Add TSO on VLANs. Because re(4) has a TSO limitation for jumbo

frame, make sure to update VLAN capabilities whenever jumbo frame
is configured.
While I'm here rearrange interface capabilities configuration. The
controller requires VLAN hardware tagging to make TSO work on VLANs
so explicitly check this requirement.
This commit is contained in:
Pyun YongHyeon 2010-02-22 18:51:14 +00:00
parent 90a1456b12
commit ecafbbb5b9

View File

@ -1429,7 +1429,7 @@ re_attach(device_t dev)
*/
if ((sc->rl_flags & RL_FLAG_DESCV2) == 0) {
ifp->if_hwassist |= CSUM_TSO;
ifp->if_capabilities |= IFCAP_TSO4;
ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO;
}
/*
@ -1451,7 +1451,7 @@ re_attach(device_t dev)
* packets in TSO size.
*/
ifp->if_hwassist &= ~CSUM_TSO;
ifp->if_capenable &= ~IFCAP_TSO4;
ifp->if_capenable &= ~(IFCAP_TSO4 | IFCAP_VLAN_HWTSO);
#ifdef DEVICE_POLLING
ifp->if_capabilities |= IFCAP_POLLING;
#endif
@ -2789,6 +2789,7 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
(ifp->if_capenable & IFCAP_TSO4) != 0) {
ifp->if_capenable &= ~IFCAP_TSO4;
ifp->if_hwassist &= ~CSUM_TSO;
VLAN_CAPABILITIES(ifp);
}
RL_UNLOCK(sc);
break;
@ -2855,14 +2856,10 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ifp->if_hwassist &= ~RE_CSUM_FEATURES;
reinit = 1;
}
if (mask & IFCAP_VLAN_HWTAGGING) {
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
reinit = 1;
}
if (mask & IFCAP_TSO4) {
if ((mask & IFCAP_TSO4) != 0 &&
(ifp->if_capabilities & IFCAP_TSO) != 0) {
ifp->if_capenable ^= IFCAP_TSO4;
if ((IFCAP_TSO4 & ifp->if_capenable) &&
(IFCAP_TSO4 & ifp->if_capabilities))
if ((IFCAP_TSO4 & ifp->if_capenable) != 0)
ifp->if_hwassist |= CSUM_TSO;
else
ifp->if_hwassist &= ~CSUM_TSO;
@ -2872,6 +2869,17 @@ re_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
ifp->if_hwassist &= ~CSUM_TSO;
}
}
if ((mask & IFCAP_VLAN_HWTSO) != 0 &&
(ifp->if_capabilities & IFCAP_VLAN_HWTSO) != 0)
ifp->if_capenable ^= IFCAP_VLAN_HWTSO;
if ((mask & IFCAP_VLAN_HWTAGGING) != 0 &&
(ifp->if_capabilities & IFCAP_VLAN_HWTAGGING) != 0) {
ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING;
/* TSO over VLAN requires VLAN hardware tagging. */
if ((ifp->if_capenable & IFCAP_VLAN_HWTAGGING) == 0)
ifp->if_capenable &= ~IFCAP_VLAN_HWTSO;
reinit = 1;
}
if ((mask & IFCAP_WOL) != 0 &&
(ifp->if_capabilities & IFCAP_WOL) != 0) {
if ((mask & IFCAP_WOL_UCAST) != 0)