summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_xl.c
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2001-10-22 06:45:42 +0000
committeralc <alc@FreeBSD.org>2001-10-22 06:45:42 +0000
commit2b32fcf0b550c8a2f85ed0af0cc1a453e7cd8be0 (patch)
tree34589108aa0dc2ef1cfc4ad19f412d9b879f69bb /sys/pci/if_xl.c
parentea86fcc2992ec8dd50d1f93b62c7eea3fd1e245e (diff)
downloadFreeBSD-src-2b32fcf0b550c8a2f85ed0af0cc1a453e7cd8be0.zip
FreeBSD-src-2b32fcf0b550c8a2f85ed0af0cc1a453e7cd8be0.tar.gz
Implement TCP/IP checksum off-loading on send for the 3c905B and later
generation cards.
Diffstat (limited to 'sys/pci/if_xl.c')
-rw-r--r--sys/pci/if_xl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c
index 82c6cbe..3c0b28d 100644
--- a/sys/pci/if_xl.c
+++ b/sys/pci/if_xl.c
@@ -155,6 +155,8 @@ static const char rcsid[] =
"$FreeBSD$";
#endif
+#define XL905B_CSUM_FEATURES (CSUM_IP | CSUM_TCP | CSUM_UDP)
+
/*
* Various supported device vendors/types and their names.
*/
@@ -1464,7 +1466,8 @@ static int xl_attach(dev)
ifp->if_output = ether_output;
if (sc->xl_type == XL_TYPE_905B) {
ifp->if_start = xl_start_90xB;
- ifp->if_capabilities = IFCAP_RXCSUM;
+ ifp->if_hwassist = XL905B_CSUM_FEATURES;
+ ifp->if_capabilities = IFCAP_HWCSUM;
} else
ifp->if_start = xl_start;
ifp->if_watchdog = xl_watchdog;
@@ -2446,6 +2449,14 @@ static int xl_encap_90xB(sc, c, m_head)
c->xl_ptr->xl_frag[frag - 1].xl_len |= XL_LAST_FRAG;
c->xl_ptr->xl_status = XL_TXSTAT_RND_DEFEAT;
+ if (m_head->m_pkthdr.csum_flags) {
+ if (m_head->m_pkthdr.csum_flags & CSUM_IP)
+ c->xl_ptr->xl_status |= XL_TXSTAT_IPCKSUM;
+ if (m_head->m_pkthdr.csum_flags & CSUM_TCP)
+ c->xl_ptr->xl_status |= XL_TXSTAT_TCPCKSUM;
+ if (m_head->m_pkthdr.csum_flags & CSUM_UDP)
+ c->xl_ptr->xl_status |= XL_TXSTAT_UDPCKSUM;
+ }
return(0);
}
OpenPOWER on IntegriCloud