summaryrefslogtreecommitdiff
path: root/sys/dev/ic/lemac.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-11-28 02:44:19 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-11-28 02:44:19 +0000
commit7da313a2f65e39b86488c21555c356ca3a9100e5 (patch)
tree391b806058ca43cb3ba624dce63764bce2b9b2b1 /sys/dev/ic/lemac.c
parent37778efb0de37bd00e9269e32ac772f743cce430 (diff)
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@
Diffstat (limited to 'sys/dev/ic/lemac.c')
-rw-r--r--sys/dev/ic/lemac.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/sys/dev/ic/lemac.c b/sys/dev/ic/lemac.c
index 464ce3690c2..eec61e082cb 100644
--- a/sys/dev/ic/lemac.c
+++ b/sys/dev/ic/lemac.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lemac.c,v 1.11 2008/10/02 20:21:13 brad Exp $ */
+/* $OpenBSD: lemac.c,v 1.12 2008/11/28 02:44:17 brad Exp $ */
/* $NetBSD: lemac.c,v 1.20 2001/06/13 10:46:02 wiz Exp $ */
/*-
@@ -792,10 +792,9 @@ int
lemac_ifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct lemac_softc *const sc = LEMAC_IFP_TO_SOFTC(ifp);
- int s;
- int error = 0;
struct ifaddr *ifa = (struct ifaddr *)data;
struct ifreq *ifr = (struct ifreq *)data;
+ int s, error = 0;
s = splnet();
@@ -819,41 +818,21 @@ lemac_ifioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
lemac_init(sc);
break;
- case SIOCADDMULTI:
- case SIOCDELMULTI:
- /*
- * Update multicast listeners
- */
- error = (cmd == SIOCADDMULTI) ?
- ether_addmulti(ifr, &sc->sc_arpcom) :
- ether_delmulti(ifr, &sc->sc_arpcom);
-
- if (error == ENETRESET) {
- /* Reset multicast filtering. */
- if (ifp->if_flags & IFF_RUNNING)
- lemac_init(sc);
- error = 0;
- }
- break;
-
case SIOCSIFMEDIA:
case SIOCGIFMEDIA:
- error = ifmedia_ioctl(ifp, (struct ifreq *)data,
- &sc->sc_ifmedia, cmd);
- 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;
- }
+ error = ifmedia_ioctl(ifp, ifr, &sc->sc_ifmedia, cmd);
break;
default:
error = ether_ioctl(ifp, &sc->sc_arpcom, cmd, data);
}
+ if (error == ENETRESET) {
+ if (ifp->if_flags & IFF_RUNNING)
+ lemac_init(sc);
+ error = 0;
+ }
+
splx(s);
return (error);
}