diff options
author | yar <yar@FreeBSD.org> | 2004-06-04 16:57:18 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2004-06-04 16:57:18 +0000 |
commit | d86152c1d92bb9e252ab6df1ab3ccaa534bbeead (patch) | |
tree | 0ae145bfd6b1d7cad4a9c4e82faa6595b532010c /sys/dev/em | |
parent | c4ab6e1a19c8bb05803922c155d8b27a6af693e4 (diff) | |
download | FreeBSD-src-d86152c1d92bb9e252ab6df1ab3ccaa534bbeead.zip FreeBSD-src-d86152c1d92bb9e252ab6df1ab3ccaa534bbeead.tar.gz |
Implement support for controlling VLAN_HWTAGGING through ioctl(SIOCSIFCAP).
This includes not only toggling the flag in if_capenable, but also really
reconfiguring the hardware.
Approved by: tackerman (as the em(4) maintainer)
Diffstat (limited to 'sys/dev/em')
-rw-r--r-- | sys/dev/em/if_em.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c index 4cd7686..47eb067 100644 --- a/sys/dev/em/if_em.c +++ b/sys/dev/em/if_em.c @@ -660,7 +660,7 @@ em_start(struct ifnet *ifp) static int em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - int mask, error = 0; + int mask, reinit, error = 0; struct ifreq *ifr = (struct ifreq *) data; struct adapter * adapter = ifp->if_softc; @@ -726,14 +726,20 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; case SIOCSIFCAP: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFCAP (Set Capabilities)"); + reinit = 0; mask = ifr->ifr_reqcap ^ ifp->if_capenable; if (mask & IFCAP_POLLING) ifp->if_capenable ^= IFCAP_POLLING; if (mask & IFCAP_HWCSUM) { ifp->if_capenable ^= IFCAP_HWCSUM; - if (ifp->if_flags & IFF_RUNNING) - em_init(adapter); + reinit = 1; } + if (mask & IFCAP_VLAN_HWTAGGING) { + ifp->if_capenable ^= IFCAP_VLAN_HWTAGGING; + reinit = 1; + } + if (reinit && (ifp->if_flags & IFF_RUNNING)) + em_init(adapter); break; default: IOCTL_DEBUGOUT1("ioctl received: UNKNOWN (0x%x)\n", (int)command); @@ -791,6 +797,8 @@ em_init_locked(struct adapter * adapter) { struct ifnet *ifp; + ifp = &adapter->interface_data.ac_if; + INIT_DEBUGOUT("em_init: begin"); mtx_assert(&adapter->mtx, MA_OWNED); @@ -808,7 +816,8 @@ em_init_locked(struct adapter * adapter) return; } - em_enable_vlans(adapter); + if (ifp->if_capenable & IFCAP_VLAN_HWTAGGING) + em_enable_vlans(adapter); /* Prepare transmit descriptors and buffers */ if (em_setup_transmit_structures(adapter)) { @@ -834,7 +843,6 @@ em_init_locked(struct adapter * adapter) /* Don't loose promiscuous settings */ em_set_promisc(adapter); - ifp = &adapter->interface_data.ac_if; ifp->if_flags |= IFF_RUNNING; ifp->if_flags &= ~IFF_OACTIVE; |