diff options
author | yar <yar@FreeBSD.org> | 2004-07-24 13:45:38 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2004-07-24 13:45:38 +0000 |
commit | da587e414b7be7fb093bf84ebb21ef6ca067d8e9 (patch) | |
tree | 54f5544ab717a1734f066b35006853ca104c848b | |
parent | 932b802dc5bb93740401d0728c8d9f367b350d82 (diff) | |
download | FreeBSD-src-da587e414b7be7fb093bf84ebb21ef6ca067d8e9.zip FreeBSD-src-da587e414b7be7fb093bf84ebb21ef6ca067d8e9.tar.gz |
Bring the advertised interface capabilities into line with the reality
(in particular, bge(4) hasn't supported rxcsum since if_bge.c#1.5)
Clean up some aspects of capabilities usage, i.e. stop using
if_hwassist to see whether we are doing offload now because if_hwassist
is for TCP/IP layer and it is subordinate to if_capenable.
Thanks to: Aled Morris for donating a nice bge(4) NIC to me
Reviewed by: -net, -hackers (silence)
-rw-r--r-- | sys/dev/bge/if_bge.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 3d082de..5468423 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -2346,7 +2346,8 @@ bge_attach(dev) ifp->if_mtu = ETHERMTU; ifp->if_snd.ifq_maxlen = BGE_TX_RING_CNT - 1; ifp->if_hwassist = BGE_CSUM_FEATURES; - ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWTAGGING | + /* NB: the code for RX csum offload is disabled for now */ + ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU; ifp->if_capenable = ifp->if_capabilities; @@ -2710,7 +2711,7 @@ bge_rxeof(sc) m->m_pkthdr.rcvif = ifp; #if 0 /* currently broken for some packets, possibly related to TCP options */ - if (ifp->if_hwassist) { + if (ifp->if_capenable & IFCAP_RXCSUM) { m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; if ((cur_rx->bge_ip_csum ^ 0xffff) == 0) m->m_pkthdr.csum_flags |= CSUM_IP_VALID; @@ -3127,6 +3128,11 @@ bge_start_locked(ifp) /* * XXX + * The code inside the if() block is never reached since we + * must mark CSUM_IP_FRAGS in our if_hwassist to start getting + * requests to checksum TCP/UDP in a fragmented packet. + * + * XXX * safety overkill. If this is a fragmented packet chain * with delayed TCP/UDP checksums, then only encapsulate * it if we have enough descriptors to handle the entire @@ -3486,11 +3492,13 @@ bge_ioctl(ifp, command, data) break; case SIOCSIFCAP: mask = ifr->ifr_reqcap ^ ifp->if_capenable; - if (mask & IFCAP_HWCSUM) { - if (IFCAP_HWCSUM & ifp->if_capenable) - ifp->if_capenable &= ~IFCAP_HWCSUM; + /* NB: the code for RX csum offload is disabled for now */ + if (mask & IFCAP_TXCSUM) { + ifp->if_capenable ^= IFCAP_TXCSUM; + if (IFCAP_TXCSUM & ifp->if_capenable) + ifp->if_hwassist = BGE_CSUM_FEATURES; else - ifp->if_capenable |= IFCAP_HWCSUM; + ifp->if_hwassist = 0; } error = 0; break; |