summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2001-12-11 02:47:53 +0000
committerluigi <luigi@FreeBSD.org>2001-12-11 02:47:53 +0000
commit41dffde8bb5add69956df30104e9689d68cd5a46 (patch)
tree23cc761de87f4050d3a67dcbeb7107879c75feb2
parentc7282b9212c327c3a40b40d948d29eaed42c3f27 (diff)
downloadFreeBSD-src-41dffde8bb5add69956df30104e9689d68cd5a46.zip
FreeBSD-src-41dffde8bb5add69956df30104e9689d68cd5a46.tar.gz
Avoid an unnecessary copy of a packet if it is already in a single mbuf.
Introduce an additional device flag for those NICs which require the transmit buffers to be aligned to 32-bit boundaries. (the equivalen fix for STABLE is slightly simpler because there are no supported chips which require this alignment there.)
-rw-r--r--sys/dev/dc/if_dc.c8
-rw-r--r--sys/dev/dc/if_dcreg.h1
-rw-r--r--sys/pci/if_dc.c8
-rw-r--r--sys/pci/if_dcreg.h1
4 files changed, 14 insertions, 4 deletions
diff --git a/sys/dev/dc/if_dc.c b/sys/dev/dc/if_dc.c
index 7a0c54d..139983b 100644
--- a/sys/dev/dc/if_dc.c
+++ b/sys/dev/dc/if_dc.c
@@ -1942,10 +1942,12 @@ static int dc_attach(dev)
break;
case DC_DEVICEID_X3201:
sc->dc_type = DC_TYPE_XIRCOM;
- sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE;
+ sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE |
+ DC_TX_ALIGN ;
/*
* We don't actually need to coalesce, but we're doing
* it to obtain a double word aligned buffer.
+ * The DC_TX_COALESCE flag is required.
*/
break;
case DC_DEVICEID_RS7112:
@@ -2996,7 +2998,9 @@ static void dc_start(ifp)
if (m_head == NULL)
break;
- if (sc->dc_flags & DC_TX_COALESCE) {
+ if (sc->dc_flags & DC_TX_COALESCE &&
+ (m_head->m_next != NULL ||
+ sc->dc_flags & DC_TX_ALIGN) ) {
if (dc_coal(sc, &m_head)) {
IF_PREPEND(&ifp->if_snd, m_head);
ifp->if_flags |= IFF_OACTIVE;
diff --git a/sys/dev/dc/if_dcreg.h b/sys/dev/dc/if_dcreg.h
index 9336728..0052d33 100644
--- a/sys/dev/dc/if_dcreg.h
+++ b/sys/dev/dc/if_dcreg.h
@@ -739,6 +739,7 @@ struct dc_softc {
#define DC_64BIT_HASH 0x00002000
#define DC_TULIP_LEDS 0x00004000
#define DC_TX_ONE 0x00008000
+#define DC_TX_ALIGN 0x00010000 /* align mbuf on tx */
/*
* register space access macros
diff --git a/sys/pci/if_dc.c b/sys/pci/if_dc.c
index 7a0c54d..139983b 100644
--- a/sys/pci/if_dc.c
+++ b/sys/pci/if_dc.c
@@ -1942,10 +1942,12 @@ static int dc_attach(dev)
break;
case DC_DEVICEID_X3201:
sc->dc_type = DC_TYPE_XIRCOM;
- sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE;
+ sc->dc_flags |= DC_TX_INTR_ALWAYS | DC_TX_COALESCE |
+ DC_TX_ALIGN ;
/*
* We don't actually need to coalesce, but we're doing
* it to obtain a double word aligned buffer.
+ * The DC_TX_COALESCE flag is required.
*/
break;
case DC_DEVICEID_RS7112:
@@ -2996,7 +2998,9 @@ static void dc_start(ifp)
if (m_head == NULL)
break;
- if (sc->dc_flags & DC_TX_COALESCE) {
+ if (sc->dc_flags & DC_TX_COALESCE &&
+ (m_head->m_next != NULL ||
+ sc->dc_flags & DC_TX_ALIGN) ) {
if (dc_coal(sc, &m_head)) {
IF_PREPEND(&ifp->if_snd, m_head);
ifp->if_flags |= IFF_OACTIVE;
diff --git a/sys/pci/if_dcreg.h b/sys/pci/if_dcreg.h
index 9336728..0052d33 100644
--- a/sys/pci/if_dcreg.h
+++ b/sys/pci/if_dcreg.h
@@ -739,6 +739,7 @@ struct dc_softc {
#define DC_64BIT_HASH 0x00002000
#define DC_TULIP_LEDS 0x00004000
#define DC_TX_ONE 0x00008000
+#define DC_TX_ALIGN 0x00010000 /* align mbuf on tx */
/*
* register space access macros
OpenPOWER on IntegriCloud