diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2013-05-21 20:08:46 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2013-05-21 20:08:46 +0000 |
commit | 8dcf9e10a870b3ac9a31c403c8b2d1f7c0c4982a (patch) | |
tree | 7cb4f0c6eb8b35afc9ebb3a1dfaf6826f5ecb46a /sys/dev/ic | |
parent | 1223d06696f7e28ea88bca80018594fdcd57b172 (diff) |
Rewrite ioctl handling bits.
ok sthen@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/am7990.c | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/sys/dev/ic/am7990.c b/sys/dev/ic/am7990.c index b98061af829..cf8bfc9f0f2 100644 --- a/sys/dev/ic/am7990.c +++ b/sys/dev/ic/am7990.c @@ -1,4 +1,4 @@ -/* $OpenBSD: am7990.c,v 1.44 2009/08/10 20:29:54 deraadt Exp $ */ +/* $OpenBSD: am7990.c,v 1.45 2013/05/21 20:08:45 brad Exp $ */ /* $NetBSD: am7990.c,v 1.22 1996/10/13 01:37:19 christos Exp $ */ /*- @@ -840,44 +840,27 @@ am7990_ioctl(ifp, cmd, data) switch (cmd) { case SIOCSIFADDR: ifp->if_flags |= IFF_UP; - - switch (ifa->ifa_addr->sa_family) { -#ifdef INET - case AF_INET: + if (!(ifp->if_flags & IFF_RUNNING)) am7990_init(sc); +#ifdef INET + if (ifa->ifa_addr->sa_family == AF_INET) arp_ifinit(&sc->sc_arpcom, ifa); - break; #endif - default: - am7990_init(sc); - break; - } break; case SIOCSIFFLAGS: - if ((ifp->if_flags & IFF_UP) == 0 && - (ifp->if_flags & IFF_RUNNING) != 0) { - /* - * If interface is marked down and it is running, then - * stop it. - */ - am7990_stop(sc); - ifp->if_flags &= ~IFF_RUNNING; - } else if ((ifp->if_flags & IFF_UP) != 0 && - (ifp->if_flags & IFF_RUNNING) == 0) { - /* - * If interface is marked up and it is stopped, then - * start it. - */ - am7990_init(sc); + if (ifp->if_flags & IFF_UP) { + if (ifp->if_flags & IFF_RUNNING) + error = ENETRESET; + else + am7990_init(sc); } else { - /* - * Reset the interface to pick up changes in any other - * flags that affect hardware registers. - */ - /*am7990_stop(sc);*/ - am7990_init(sc); + if (ifp->if_flags & IFF_RUNNING) { + am7990_stop(sc); + ifp->if_flags &= ~IFF_RUNNING; + } } + #ifdef LEDEBUG if (ifp->if_flags & IFF_DEBUG) sc->sc_debug = 1; |