diff options
author | yongari <yongari@FreeBSD.org> | 2010-02-26 20:39:07 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2010-02-26 20:39:07 +0000 |
commit | a4df49e099e329f7f0930f2000baf75b5e4e69bb (patch) | |
tree | b3dec8ce4ea70f837969dcaed353ef7f26361701 /sys | |
parent | c08d71acc77a9b5828d94d12fcd7145a33c2f2ac (diff) | |
download | FreeBSD-src-a4df49e099e329f7f0930f2000baf75b5e4e69bb.zip FreeBSD-src-a4df49e099e329f7f0930f2000baf75b5e4e69bb.tar.gz |
Make toggling TSO, VLAN hardware checksum offloading work. Also fix
TX/RX checksum handler to set/clear relavant assist bits which was
used to cause unexpected results.
With this change, bce(4) can be bridged with other interfaces that
lack TSO, VLAN checksum offloading.
Reviewed by: davidch
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/bce/if_bce.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c index d5013d1..d9158f1 100644 --- a/sys/dev/bce/if_bce.c +++ b/sys/dev/bce/if_bce.c @@ -7102,33 +7102,35 @@ bce_ioctl(struct ifnet *ifp, u_long command, caddr_t data) mask = ifr->ifr_reqcap ^ ifp->if_capenable; DBPRINT(sc, BCE_INFO_MISC, "Received SIOCSIFCAP = 0x%08X\n", (u32) mask); - /* Toggle the TX checksum capabilites enable flag. */ - if (mask & IFCAP_TXCSUM) { + /* Toggle the TX checksum capabilities enable flag. */ + if (mask & IFCAP_TXCSUM && + ifp->if_capabilities & IFCAP_TXCSUM) { ifp->if_capenable ^= IFCAP_TXCSUM; if (IFCAP_TXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; + ifp->if_hwassist |= BCE_IF_HWASSIST; else - ifp->if_hwassist = 0; + ifp->if_hwassist &= ~BCE_IF_HWASSIST; } /* Toggle the RX checksum capabilities enable flag. */ - if (mask & IFCAP_RXCSUM) { + if (mask & IFCAP_RXCSUM && + ifp->if_capabilities & IFCAP_RXCSUM) ifp->if_capenable ^= IFCAP_RXCSUM; - if (IFCAP_RXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; - else - ifp->if_hwassist = 0; - } /* Toggle the TSO capabilities enable flag. */ - if (bce_tso_enable && (mask & IFCAP_TSO4)) { + if (bce_tso_enable && (mask & IFCAP_TSO4) && + ifp->if_capabilities & IFCAP_TSO4) { ifp->if_capenable ^= IFCAP_TSO4; - if (IFCAP_RXCSUM & ifp->if_capenable) - ifp->if_hwassist = BCE_IF_HWASSIST; + if (IFCAP_TSO4 & ifp->if_capenable) + ifp->if_hwassist |= CSUM_TSO; else - ifp->if_hwassist = 0; + ifp->if_hwassist &= ~CSUM_TSO; } + if (mask & IFCAP_VLAN_HWCSUM && + ifp->if_capabilities & IFCAP_VLAN_HWCSUM) + ifp->if_capenable ^= IFCAP_VLAN_HWCSUM; + /* * Don't actually disable VLAN tag stripping as * management firmware (ASF/IPMI/UMP) requires the |