From 7da313a2f65e39b86488c21555c356ca3a9100e5 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 28 Nov 2008 02:44:19 +0000 Subject: Eliminate the redundant bits of code for MTU and multicast handling from the individual drivers now that ether_ioctl() handles this. Shrinks the i386 kernels by.. RAMDISK - 2176 bytes RAMDISKB - 1504 bytes RAMDISKC - 736 bytes Tested by naddy@/okan@/sthen@/brad@/todd@/jmc@ and lots of users. Build tested on almost all archs by todd@/brad@ ok naddy@ --- sys/dev/pci/if_bge.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'sys/dev/pci/if_bge.c') 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); } -- cgit v1.2.3