summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2009-06-24 07:42:04 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2009-06-24 07:42:04 +0000
commitf0dcbf5188940326e08b0a6ff96ea309745b0a06 (patch)
tree2415baff6f43b0d14cf398159f31478beff2e040 /sys/arch/sparc
parentcba6d57a1146fc04bc00b39ce3137e3ee5d23601 (diff)
Simplify the ioctl handling code. From Brad.
Tested by nick@
Diffstat (limited to 'sys/arch/sparc')
-rw-r--r--sys/arch/sparc/dev/hme.c59
-rw-r--r--sys/arch/sparc/dev/hmevar.h4
2 files changed, 13 insertions, 50 deletions
diff --git a/sys/arch/sparc/dev/hme.c b/sys/arch/sparc/dev/hme.c
index 75985ff9724..d13a95455a8 100644
--- a/sys/arch/sparc/dev/hme.c
+++ b/sys/arch/sparc/dev/hme.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hme.c,v 1.59 2009/06/20 09:40:29 sthen Exp $ */
+/* $OpenBSD: hme.c,v 1.60 2009/06/24 07:42:03 sthen Exp $ */
/*
* Copyright (c) 1998 Jason L. Wright (jason@thought.net)
@@ -248,7 +248,6 @@ hmeattach(parent, self, aux)
ifp->if_watchdog = hmewatchdog;
ifp->if_flags =
IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;
- sc->sc_if_flags = ifp->if_flags;
ifp->if_capabilities = IFCAP_VLAN_MTU;
IFQ_SET_MAXLEN(&ifp->if_snd, HME_TX_RING_SIZE);
IFQ_SET_READY(&ifp->if_snd);
@@ -394,55 +393,24 @@ hmeioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFADDR:
- switch (ifa->ifa_addr->sa_family) {
+ ifp->if_flags |= IFF_UP;
+ if (!(ifp->if_flags & IFF_RUNNING))
+ hmeinit(sc);
#ifdef INET
- case AF_INET:
- if (ifp->if_flags & IFF_UP)
- hme_mcreset(sc);
- else {
- ifp->if_flags |= IFF_UP;
- hmeinit(sc);
- }
+ if (ifa->ifa_addr->sa_family == AF_INET)
arp_ifinit(&sc->sc_arpcom, ifa);
- break;
-#endif /* INET */
- default:
- ifp->if_flags |= IFF_UP;
- hmeinit(sc);
- break;
- }
+#endif
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.
- */
- hmestop(sc);
- } 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.
- */
- hmeinit(sc);
- } else {
- /*
- * If setting debug or promiscuous mode, do not reset
- * the chip; for everything else, call hmeinit()
- * which will trigger a reset.
- */
-#define RESETIGN (IFF_CANTCHANGE | IFF_DEBUG)
- if (ifp->if_flags == sc->sc_if_flags)
- break;
- if ((ifp->if_flags & (~RESETIGN))
- == (sc->sc_if_flags & (~RESETIGN)))
- hme_mcreset(sc);
+ if (ifp->if_flags & IFF_UP) {
+ if (ifp->if_flags & IFF_RUNNING)
+ error = ENETRESET;
else
hmeinit(sc);
-#undef RESETIGN
+ } else {
+ if (ifp->if_flags & IFF_RUNNING)
+ hmestop(sc);
}
break;
@@ -461,7 +429,6 @@ hmeioctl(ifp, cmd, data)
error = 0;
}
- sc->sc_if_flags = ifp->if_flags;
splx(s);
return (error);
}
@@ -605,7 +572,6 @@ hmeinit(sc)
ifp->if_flags |= IFF_RUNNING;
ifp->if_flags &= ~IFF_OACTIVE;
- sc->sc_if_flags = ifp->if_flags;
}
void
@@ -1230,5 +1196,4 @@ hme_mii_statchg(self)
cr->tx_cfg &= ~CR_TXCFG_FULLDPLX;
sc->sc_arpcom.ac_if.if_flags &= ~IFF_SIMPLEX;
}
- sc->sc_if_flags = sc->sc_arpcom.ac_if.if_flags;
}
diff --git a/sys/arch/sparc/dev/hmevar.h b/sys/arch/sparc/dev/hmevar.h
index 8dfbfe4ea26..3672e2c9a93 100644
--- a/sys/arch/sparc/dev/hmevar.h
+++ b/sys/arch/sparc/dev/hmevar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hmevar.h,v 1.12 2006/06/02 20:00:54 miod Exp $ */
+/* $OpenBSD: hmevar.h,v 1.13 2009/06/24 07:42:03 sthen Exp $ */
/*
* Copyright (c) 1998 Jason L. Wright (jason@thought.net)
@@ -49,8 +49,6 @@ struct hme_softc {
u_int32_t sc_flags; /* status flags */
- short sc_if_flags;
-
/*
* RX/TX ring buffers, descriptors, and counters
*/