diff options
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_bce.c | 33 | ||||
-rw-r--r-- | sys/dev/pci/if_bge.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_bnx.c | 30 | ||||
-rw-r--r-- | sys/dev/pci/if_cas.c | 33 | ||||
-rw-r--r-- | sys/dev/pci/if_de.c | 36 | ||||
-rw-r--r-- | sys/dev/pci/if_em.c | 41 | ||||
-rw-r--r-- | sys/dev/pci/if_et.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_ix.c | 39 | ||||
-rw-r--r-- | sys/dev/pci/if_ixgb.c | 43 | ||||
-rw-r--r-- | sys/dev/pci/if_lge.c | 33 | ||||
-rw-r--r-- | sys/dev/pci/if_lii.c | 14 | ||||
-rw-r--r-- | sys/dev/pci/if_msk.c | 35 | ||||
-rw-r--r-- | sys/dev/pci/if_myx.c | 18 | ||||
-rw-r--r-- | sys/dev/pci/if_nfe.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_nge.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_nxe.c | 16 | ||||
-rw-r--r-- | sys/dev/pci/if_pcn.c | 36 | ||||
-rw-r--r-- | sys/dev/pci/if_sis.c | 35 | ||||
-rw-r--r-- | sys/dev/pci/if_sk.c | 33 | ||||
-rw-r--r-- | sys/dev/pci/if_ste.c | 27 | ||||
-rw-r--r-- | sys/dev/pci/if_stge.c | 34 | ||||
-rw-r--r-- | sys/dev/pci/if_tht.c | 26 | ||||
-rw-r--r-- | sys/dev/pci/if_ti.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_tl.c | 28 | ||||
-rw-r--r-- | sys/dev/pci/if_txp.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_vge.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_vic.c | 31 | ||||
-rw-r--r-- | sys/dev/pci/if_vr.c | 35 | ||||
-rw-r--r-- | sys/dev/pci/if_wb.c | 29 | ||||
-rw-r--r-- | sys/dev/pci/if_xge.c | 31 |
30 files changed, 285 insertions, 634 deletions
diff --git a/sys/dev/pci/if_bce.c b/sys/dev/pci/if_bce.c index eae61660a28..34669556d26 100644 --- a/sys/dev/pci/if_bce.c +++ b/sys/dev/pci/if_bce.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bce.c,v 1.26 2008/10/02 20:21:13 brad Exp $ */ +/* $OpenBSD: if_bce.c,v 1.27 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_bce.c,v 1.3 2003/09/29 01:53:02 mrg Exp $ */ /* @@ -434,8 +434,8 @@ int bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct bce_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -456,12 +456,7 @@ bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if(ifp->if_flags & IFF_UP) if(ifp->if_flags & IFF_RUNNING) @@ -472,30 +467,22 @@ bce_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) bce_stop(ifp, 0); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->bce_ac) : - ether_delmulti(ifr, &sc->bce_ac); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - bce_set_filter(ifp); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->bce_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->bce_ac, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bce_set_filter(ifp); + error = 0; + } + if (error == 0) { /* Try to get more packets going. */ bce_start(ifp); diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index 88a1deb0fbd..5462d27517e 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bge.c,v 1.256 2008/11/22 18:16:55 dlg Exp $ */ +/* $OpenBSD: if_bge.c,v 1.257 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems @@ -3281,8 +3281,8 @@ int bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct bge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; struct mii_data *mii; @@ -3298,12 +3298,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -3316,18 +3311,7 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->bge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - bge_iff(sc); - error = 0; - } - break; case SIOCSIFMEDIA: /* XXX Flow control is not supported for 1000BASE-SX */ if (sc->bge_flags & BGE_PHY_FIBER_TBI) { @@ -3359,10 +3343,17 @@ bge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) command); } break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bge_iff(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c index 22008bcb765..4505ad8f0dd 100644 --- a/sys/dev/pci/if_bnx.c +++ b/sys/dev/pci/if_bnx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bnx.c,v 1.70 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_bnx.c,v 1.71 2008/11/28 02:44:17 brad Exp $ */ /*- * Copyright (c) 2006 Broadcom Corporation @@ -4586,8 +4586,8 @@ int bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct bnx_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii = &sc->bnx_mii; int s, error = 0; @@ -4604,13 +4604,6 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if ((ifp->if_flags & IFF_RUNNING) && @@ -4628,19 +4621,6 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->bnx_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - bnx_set_rx_mode(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: DBPRINT(sc, BNX_VERBOSE, "bnx_phy_flags = 0x%08X\n", @@ -4653,6 +4633,12 @@ bnx_ioctl(struct ifnet *ifp, u_long command, caddr_t data) error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + bnx_set_rx_mode(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 4c42eb8bbe0..c037ab2acd3 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.23 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_cas.c,v 1.24 2008/11/28 02:44:17 brad Exp $ */ /* * @@ -1718,31 +1718,6 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) { - error = EINVAL; - } else if (ifp->if_mtu != ifr->ifr_mtu) { - ifp->if_mtu = ifr->ifr_mtu; - } - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware filter - * accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - cas_setladrf(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1752,6 +1727,12 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + cas_setladrf(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 6bc9a6b689e..13c35da05f9 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.100 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_de.c,v 1.101 2008/11/28 02:44:17 brad Exp $ */ /* $NetBSD: if_de.c,v 1.58 1998/01/12 09:39:58 thorpej Exp $ */ /*- @@ -4182,38 +4182,16 @@ tulip_ifioctl(struct ifnet * ifp, u_long cmd, caddr_t data) break; } - case SIOCADDMULTI: - case SIOCDELMULTI: { - /* - * Update multicast listeners - */ - if (cmd == SIOCADDMULTI) - error = ether_addmulti(ifr, &sc->tulip_ac); - else - error = ether_delmulti(ifr, &sc->tulip_ac); + default: + error = ether_ioctl(ifp, &sc->tulip_ac, cmd, data); + } - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { tulip_addr_filter(sc); /* reset multicast filtering */ tulip_init(sc); - } - error = 0; } - break; - } - - case SIOCSIFMTU: - /* - * Set the interface MTU. - */ - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - default: - error = ether_ioctl(ifp, &sc->tulip_ac, cmd, data); + error = 0; } splx(s); diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c index 35a96944f55..e5c701319b8 100644 --- a/sys/dev/pci/if_em.c +++ b/sys/dev/pci/if_em.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_em.c,v 1.197 2008/11/26 00:14:48 dlg Exp $ */ +/* $OpenBSD: if_em.c,v 1.198 2008/11/28 02:44:17 brad Exp $ */ /* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */ #include <dev/pci/if_em.h> @@ -555,13 +555,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->interface_data, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -584,24 +578,7 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->interface_data) - : ether_delmulti(ifr, &sc->interface_data); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - em_disable_intr(sc); - em_set_multi(sc); - if (sc->hw.mac_type == em_82542_rev2_0) - em_initialize_receive_unit(sc); - em_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: /* Check SOL/IDER usage */ if (em_check_phy_reset_block(&sc->hw)) { @@ -613,10 +590,22 @@ em_ioctl(struct ifnet *ifp, u_long command, caddr_t data) IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->interface_data, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + em_disable_intr(sc); + em_set_multi(sc); + if (sc->hw.mac_type == em_82542_rev2_0) + em_initialize_receive_unit(sc); + em_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_et.c b/sys/dev/pci/if_et.c index ef2c020da00..463e9e89e2e 100644 --- a/sys/dev/pci/if_et.c +++ b/sys/dev/pci/if_et.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_et.c,v 1.15 2008/11/04 19:20:22 chl Exp $ */ +/* $OpenBSD: if_et.c,v 1.16 2008/11/28 02:44:17 brad Exp $ */ /* * Copyright (c) 2007 The DragonFly Project. All rights reserved. * @@ -1030,8 +1030,8 @@ int et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct et_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -1046,12 +1046,7 @@ et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -1073,26 +1068,22 @@ et_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - et_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_miibus.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + et_setmulti(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c index c5626db5f80..7720a2e9f19 100644 --- a/sys/dev/pci/if_ix.c +++ b/sys/dev/pci/if_ix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ix.c,v 1.14 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ix.c,v 1.15 2008/11/28 02:44:18 brad Exp $ */ /****************************************************************************** @@ -425,10 +425,10 @@ ixgbe_start(struct ifnet *ifp) int ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) { - int s, error = 0; - struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *) data; - struct ix_softc *sc = ifp->if_softc; + struct ix_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; + int s, error = 0; s = splnet(); @@ -443,6 +443,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFMTU: IOCTL_DEBUGOUT("ioctl: SIOCSIFMTU (Set Interface MTU)"); if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) @@ -454,6 +455,7 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) ixgbe_init(sc); } break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -470,31 +472,26 @@ ixgbe_ioctl(struct ifnet * ifp, u_long command, caddr_t data) ixgbe_stop(sc); sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - ixgbe_disable_intr(sc); - ixgbe_set_multi(sc); - ixgbe_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + ixgbe_disable_intr(sc); + ixgbe_set_multi(sc); + ixgbe_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_ixgb.c b/sys/dev/pci/if_ixgb.c index baac695eca5..a2d5e58c370 100644 --- a/sys/dev/pci/if_ixgb.c +++ b/sys/dev/pci/if_ixgb.c @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. ***************************************************************************/ -/* $OpenBSD: if_ixgb.c,v 1.51 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ixgb.c,v 1.52 2008/11/28 02:44:18 brad Exp $ */ #include <dev/pci/if_ixgb.h> @@ -364,10 +364,10 @@ ixgb_start(struct ifnet *ifp) int ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { - int s, error = 0; - struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct ixgb_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; + int s, error = 0; s = splnet(); @@ -383,13 +383,7 @@ ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->interface_data, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFMTU (Set Interface MTU)"); - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCSIFFLAGS (Set Interface Flags)"); if (ifp->if_flags & IFF_UP) { @@ -412,31 +406,26 @@ ixgb_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - IOCTL_DEBUGOUT("ioctl rcv'd: SIOC(ADD|DEL)MULTI"); - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->interface_data) - : ether_delmulti(ifr, &sc->interface_data); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) { - ixgb_disable_intr(sc); - ixgb_set_multi(sc); - ixgb_enable_intr(sc); - } - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: IOCTL_DEBUGOUT("ioctl rcv'd: SIOCxIFMEDIA (Get/Set Interface Media)"); error = ifmedia_ioctl(ifp, ifr, &sc->media, command); break; + default: error = ether_ioctl(ifp, &sc->interface_data, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) { + ixgb_disable_intr(sc); + ixgb_set_multi(sc); + ixgb_enable_intr(sc); + } + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_lge.c b/sys/dev/pci/if_lge.c index 7fab43820c3..5824f8b0959 100644 --- a/sys/dev/pci/if_lge.c +++ b/sys/dev/pci/if_lge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lge.c,v 1.49 2008/10/22 00:01:59 brad Exp $ */ +/* $OpenBSD: if_lge.c,v 1.50 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -1366,8 +1366,8 @@ int lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct lge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1383,12 +1383,7 @@ lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1417,30 +1412,24 @@ lge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->lge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - lge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->lge_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: - error = ENOTTY; - break; + error = ether_ioctl(ifp, &sc->arpcom, command, data); } - splx(s); + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + lge_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_lii.c b/sys/dev/pci/if_lii.c index 216afe114ac..11a9d278d55 100644 --- a/sys/dev/pci/if_lii.c +++ b/sys/dev/pci/if_lii.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lii.c,v 1.20 2008/10/07 16:03:37 jsing Exp $ */ +/* $OpenBSD: if_lii.c,v 1.21 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation. @@ -1044,8 +1044,8 @@ int lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct lii_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; int s, error = 0; s = splnet(); @@ -1054,11 +1054,11 @@ lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSIFADDR: SET(ifp->if_flags, IFF_UP); #ifdef INET - ifa = (struct ifaddr *)addr; if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ISSET(ifp->if_flags, IFF_UP)) { if (ISSET(ifp->if_flags, IFF_RUNNING)) @@ -1071,17 +1071,11 @@ lii_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } break; - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); } diff --git a/sys/dev/pci/if_msk.c b/sys/dev/pci/if_msk.c index ad9c0958fad..f30d78874f3 100644 --- a/sys/dev/pci/if_msk.c +++ b/sys/dev/pci/if_msk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_msk.c,v 1.67 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_msk.c,v 1.68 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -727,8 +727,8 @@ int msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sk_if_softc *sc_if = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; int s, error = 0; @@ -744,12 +744,7 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc_if->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -767,31 +762,23 @@ msk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc_if->sk_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc_if->arpcom) : - ether_delmulti(ifr, &sc_if->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - msk_setmulti(sc_if); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc_if->sk_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc_if->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + msk_setmulti(sc_if); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_myx.c b/sys/dev/pci/if_myx.c index 27ff873b5c3..2645c20b5c5 100644 --- a/sys/dev/pci/if_myx.c +++ b/sys/dev/pci/if_myx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_myx.c,v 1.9 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_myx.c,v 1.10 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org> @@ -831,6 +831,7 @@ myx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -843,21 +844,6 @@ myx_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); diff --git a/sys/dev/pci/if_nfe.c b/sys/dev/pci/if_nfe.c index 133f0b7ed9d..e0c4e34edf4 100644 --- a/sys/dev/pci/if_nfe.c +++ b/sys/dev/pci/if_nfe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nfe.c,v 1.86 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_nfe.c,v 1.87 2008/11/28 02:44:18 brad Exp $ */ /*- * Copyright (c) 2006, 2007 Damien Bergamini <damien.bergamini@free.fr> @@ -522,8 +522,8 @@ int nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct nfe_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -538,12 +538,7 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -565,26 +560,22 @@ nfe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - nfe_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + nfe_setmulti(sc); + error = 0; + } + splx(s); return error; } diff --git a/sys/dev/pci/if_nge.c b/sys/dev/pci/if_nge.c index 7da2a2d5ea5..9427b44cf43 100644 --- a/sys/dev/pci/if_nge.c +++ b/sys/dev/pci/if_nge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nge.c,v 1.66 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_nge.c,v 1.67 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 Wind River Systems * Copyright (c) 1997, 1998, 1999, 2000, 2001 @@ -2061,20 +2061,14 @@ nge_ioctl(ifp, command, data) caddr_t data; { struct nge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; s = splnet(); switch(command) { - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; case SIOCSIFADDR: ifp->if_flags |= IFF_UP; switch (ifa->ifa_addr->sa_family) { @@ -2089,6 +2083,7 @@ nge_ioctl(ifp, command, data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -2116,18 +2111,7 @@ nge_ioctl(ifp, command, data) sc->nge_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->arpcom) - : ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - nge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: if (sc->nge_tbi) { @@ -2139,10 +2123,17 @@ nge_ioctl(ifp, command, data) command); } break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + nge_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index 42545077a8c..eb59c1f25a0 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.58 2008/11/23 12:51:10 dlg Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.59 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -1017,10 +1017,9 @@ int nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct nxe_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; - int error = 0; - int s; + int s, error = 0; rw_enter_write(&sc->sc_lock); s = splnet(); @@ -1031,11 +1030,11 @@ nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) case SIOCSIFADDR: SET(ifp->if_flags, IFF_UP); #ifdef INET - ifa = (struct ifaddr *)addr; if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ISSET(ifp->if_flags, IFF_UP)) { if (ISSET(ifp->if_flags, IFF_RUNNING)) @@ -1053,13 +1052,6 @@ nxe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); break; - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - default: error = ether_ioctl(ifp, &sc->sc_ac, cmd, addr); } diff --git a/sys/dev/pci/if_pcn.c b/sys/dev/pci/if_pcn.c index 58d5339d6c9..268e6f19730 100644 --- a/sys/dev/pci/if_pcn.c +++ b/sys/dev/pci/if_pcn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pcn.c,v 1.20 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_pcn.c,v 1.21 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_pcn.c,v 1.26 2005/05/07 09:15:44 is Exp $ */ /* @@ -1082,8 +1082,8 @@ int pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct pcn_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1105,13 +1105,6 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: /* * If interface is marked up and not running, then start it. @@ -1125,24 +1118,6 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) pcn_stop(ifp, 1); break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - error = pcn_init(ifp); - else - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -1152,6 +1127,13 @@ pcn_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + error = pcn_init(ifp); + else + error = 0; + } + /* Try to get more packets going. */ pcn_start(ifp); diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 284256b4174..08c2ee07e01 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.84 2008/11/10 07:23:43 cnst Exp $ */ +/* $OpenBSD: if_sis.c,v 1.85 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1887,8 +1887,8 @@ int sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sis_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1904,6 +1904,7 @@ sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1925,37 +1926,23 @@ sis_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - sis_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->sc_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + sis_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 40466aa83f7..2b53bbde494 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sk.c,v 1.149 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_sk.c,v 1.150 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999, 2000 @@ -859,8 +859,8 @@ int sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct sk_if_softc *sc_if = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; struct mii_data *mii; int s, error = 0; @@ -876,12 +876,7 @@ sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc_if->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -899,31 +894,23 @@ sk_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc_if->sk_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc_if->arpcom) : - ether_delmulti(ifr, &sc_if->arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - sk_setmulti(sc_if); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc_if->sk_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc_if->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + sk_setmulti(sc_if); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index f817717a6b5..1ffab70958c 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.42 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_ste.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -1275,8 +1275,8 @@ int ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ste_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; struct mii_data *mii; int s, error = 0; @@ -1295,6 +1295,7 @@ ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1322,31 +1323,23 @@ ste_ioctl(struct ifnet *ifp, u_long command, caddr_t data) sc->ste_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - ste_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: mii = &sc->sc_mii; error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ste_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_stge.c b/sys/dev/pci/if_stge.c index 91d27001ef2..76be8fae8c8 100644 --- a/sys/dev/pci/if_stge.c +++ b/sys/dev/pci/if_stge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stge.c,v 1.44 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_stge.c,v 1.45 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_stge.c,v 1.27 2005/05/16 21:35:32 bouyer Exp $ */ /*- @@ -700,8 +700,8 @@ int stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct stge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; s = splnet(); @@ -718,13 +718,6 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) #endif break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -742,23 +735,6 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) sc->stge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - stge_set_filter(sc); - error = 0; - } - break; - case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, cmd); @@ -768,6 +744,12 @@ stge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + stge_set_filter(sc); + error = 0; + } + /* Try to get more packets going. */ stge_start(ifp); diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c index 2e2520b37ad..1a5b168b9f7 100644 --- a/sys/dev/pci/if_tht.c +++ b/sys/dev/pci/if_tht.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tht.c,v 1.120 2008/11/23 12:48:43 dlg Exp $ */ +/* $OpenBSD: if_tht.c,v 1.121 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -863,25 +863,23 @@ int tht_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) { struct tht_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)addr; struct ifreq *ifr = (struct ifreq *)addr; - struct ifaddr *ifa; - int error = 0; - int s; + int s, error = 0; rw_enter_write(&sc->sc_lock); s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)addr; + ifp->if_flags |= IFF_UP; #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_ac, ifa); #endif - - ifp->if_flags |= IFF_UP; /* FALLTHROUGH */ + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING) @@ -894,20 +892,6 @@ tht_ioctl(struct ifnet *ifp, u_long cmd, caddr_t addr) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - error = ether_addmulti(ifr, &sc->sc_ac); - break; - case SIOCDELMULTI: - error = ether_delmulti(ifr, &sc->sc_ac); - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index c73367510cf..da5a66a8083 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.93 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_ti.c,v 1.94 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -2485,8 +2485,8 @@ int ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct ti_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; struct ifaddr *ifa = (struct ifaddr *)data; + struct ifreq *ifr = (struct ifreq *)data; int s, error = 0; struct ti_cmd_desc cmd; @@ -2502,12 +2502,7 @@ ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { /* @@ -2538,26 +2533,22 @@ ti_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->ti_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - ti_setmulti(sc); - error = 0; - } - break; case SIOCSIFMEDIA: case SIOCGIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->ifmedia, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + ti_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index ac7a9dda767..e1fadeec78b 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.45 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_tl.c,v 1.46 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1782,8 +1782,8 @@ int tl_ioctl(ifp, command, data) caddr_t data; { struct tl_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1803,6 +1803,7 @@ int tl_ioctl(ifp, command, data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1825,21 +1826,7 @@ int tl_ioctl(ifp, command, data) sc->tl_if_flags = ifp->if_flags; error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - tl_setmulti(sc); - error = 0; - } - break; + case SIOCSIFMEDIA: case SIOCGIFMEDIA: if (sc->tl_bitrate) @@ -1848,10 +1835,17 @@ int tl_ioctl(ifp, command, data) error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + tl_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 326324b426a..45491a26755 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.98 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_txp.c,v 1.99 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2001 @@ -1190,8 +1190,8 @@ int txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct txp_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa = (struct ifaddr *)data; + struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; s = splnet(); @@ -1211,6 +1211,7 @@ txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { txp_init(sc); @@ -1219,30 +1220,22 @@ txp_ioctl(struct ifnet *ifp, u_long command, caddr_t data) txp_stop(sc); } break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_arpcom) : - ether_delmulti(ifr, &sc->sc_arpcom); - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - txp_set_filter(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, command); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + txp_set_filter(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index ed280d7b627..f924e701d4d 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vge.c,v 1.42 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_vge.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* $FreeBSD: if_vge.c,v 1.3 2004/09/11 22:13:25 wpaul Exp $ */ /* * Copyright (c) 2004 @@ -1733,8 +1733,8 @@ int vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct vge_softc *sc = ifp->if_softc; - struct ifreq *ifr = (struct ifreq *) data; struct ifaddr *ifa = (struct ifaddr *) data; + struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; s = splnet(); @@ -1754,12 +1754,7 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) break; } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1782,26 +1777,22 @@ vge_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->vge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - vge_setmulti(sc); - error = 0; - } - break; case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + vge_setmulti(sc); + error = 0; + } + splx(s); return (error); } diff --git a/sys/dev/pci/if_vic.c b/sys/dev/pci/if_vic.c index e214785c663..ed0c0089435 100644 --- a/sys/dev/pci/if_vic.c +++ b/sys/dev/pci/if_vic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vic.c,v 1.63 2008/11/25 17:01:14 dlg Exp $ */ +/* $OpenBSD: if_vic.c,v 1.64 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 2006 Reyk Floeter <reyk@openbsd.org> @@ -1214,15 +1214,14 @@ int vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct vic_softc *sc = (struct vic_softc *)ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *)data; struct ifreq *ifr = (struct ifreq *)data; - struct ifaddr *ifa; int s, error = 0; s = splnet(); switch (cmd) { case SIOCSIFADDR: - ifa = (struct ifaddr *)data; ifp->if_flags |= IFF_UP; #ifdef INET if (ifa->ifa_addr->sa_family == AF_INET) @@ -1241,27 +1240,6 @@ vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - ifr = (struct ifreq *)data; - error = (cmd == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->sc_ac) : - ether_delmulti(ifr, &sc->sc_ac); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - vic_iff(sc); - error = 0; - } - break; - case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); @@ -1272,9 +1250,8 @@ vic_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } if (error == ENETRESET) { - if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) == - (IFF_UP | IFF_RUNNING)) - vic_iff(ifp->if_softc); + if (ifp->if_flags & IFF_RUNNING) + vic_iff(sc); error = 0; } diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index 90d0d884645..9e64f710c78 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.79 2008/10/14 18:01:53 naddy Exp $ */ +/* $OpenBSD: if_vr.c,v 1.80 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1326,9 +1326,9 @@ int vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) { struct vr_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; int s, error = 0; - struct ifaddr *ifa = (struct ifaddr *)data; s = splnet(); @@ -1342,6 +1342,7 @@ vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) arp_ifinit(&sc->arpcom, ifa); #endif break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1369,36 +1370,22 @@ vr_ioctl(struct ifnet *ifp, u_long command, caddr_t data) } sc->sc_if_flags = ifp->if_flags; break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else - ifp->if_mtu = ifr->ifr_mtu; - break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - vr_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + vr_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 22229c29d42..a41a7c982dc 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.42 2008/11/25 11:01:35 claudio Exp $ */ +/* $OpenBSD: if_wb.c,v 1.43 2008/11/28 02:44:18 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1572,8 +1572,8 @@ int wb_ioctl(ifp, command, data) caddr_t data; { struct wb_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -1592,6 +1592,7 @@ int wb_ioctl(ifp, command, data) wb_init(sc); } break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { wb_init(sc); @@ -1601,30 +1602,22 @@ int wb_ioctl(ifp, command, data) } error = 0; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (command == SIOCADDMULTI) ? - ether_addmulti(ifr, &sc->arpcom) : - ether_delmulti(ifr, &sc->arpcom); - - if (error == ENETRESET) { - /* - * Multicast list has changed; set the hardware - * filter accordingly. - */ - if (ifp->if_flags & IFF_RUNNING) - wb_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->sc_mii.mii_media, command); break; + default: error = ether_ioctl(ifp, &sc->arpcom, command, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + wb_setmulti(sc); + error = 0; + } + splx(s); return(error); } diff --git a/sys/dev/pci/if_xge.c b/sys/dev/pci/if_xge.c index 7bef2d3296b..513df959520 100644 --- a/sys/dev/pci/if_xge.c +++ b/sys/dev/pci/if_xge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xge.c,v 1.48 2008/11/09 15:08:26 naddy Exp $ */ +/* $OpenBSD: if_xge.c,v 1.49 2008/11/28 02:44:18 brad Exp $ */ /* $NetBSD: if_xge.c,v 1.1 2005/09/09 10:30:27 ragge Exp $ */ /* @@ -968,8 +968,8 @@ int xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct xge_softc *sc = ifp->if_softc; + struct ifaddr *ifa = (struct ifaddr *) data; struct ifreq *ifr = (struct ifreq *) data; - struct ifaddr *ifa = (struct ifaddr *)data; int s, error = 0; s = splnet(); @@ -984,12 +984,7 @@ xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) arp_ifinit(&sc->sc_arpcom, ifa); #endif /* INET */ break; - case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) - error = EINVAL; - else if (ifp->if_mtu != ifr->ifr_mtu) - ifp->if_mtu = ifr->ifr_mtu; - break; + case SIOCSIFFLAGS: if (ifp->if_flags & IFF_UP) { if (ifp->if_flags & IFF_RUNNING && @@ -1006,26 +1001,22 @@ xge_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } sc->xge_if_flags = ifp->if_flags; break; - case SIOCADDMULTI: - case SIOCDELMULTI: - error = (cmd == SIOCADDMULTI) - ? ether_addmulti(ifr, &sc->sc_arpcom) - : ether_delmulti(ifr, &sc->sc_arpcom); - - if (error == ENETRESET) { - if (ifp->if_flags & IFF_RUNNING) - xge_setmulti(sc); - error = 0; - } - break; + case SIOCGIFMEDIA: case SIOCSIFMEDIA: error = ifmedia_ioctl(ifp, ifr, &sc->xena_media, cmd); break; + default: error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data); } + if (error == ENETRESET) { + if (ifp->if_flags & IFF_RUNNING) + xge_setmulti(sc); + error = 0; + } + splx(s); return (error); } |