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)
This commit is contained in:
yar 2004-07-24 13:45:38 +00:00
parent 932b802dc5
commit da587e414b

View File

@ -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;
@ -3126,6 +3127,11 @@ bge_start_locked(ifp)
break;
/*
* 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
@ -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;