summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authordyoung <dyoung@NetBSD.org>2009-04-03 00:14:42 +0000
committerdyoung <dyoung@NetBSD.org>2009-04-03 00:14:42 +0000
commit8f20e30696112e79ef12429ec3ff3630b35dc790 (patch)
treeb2eb8f00ac07e8c14232121cfb637d4433eda5bf /sys/dev
parentd28e46bb7b034a1874f3d709e9e51372479c9ad6 (diff)
Fix SIOCSIFFLAGS. Mark as safe to detach at shutdown.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_bnx.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/sys/dev/pci/if_bnx.c b/sys/dev/pci/if_bnx.c
index a82f2af7f88..48fbbe396d3 100644
--- a/sys/dev/pci/if_bnx.c
+++ b/sys/dev/pci/if_bnx.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bnx.c,v 1.23 2009/03/18 16:00:19 cegger Exp $ */
+/* $NetBSD: if_bnx.c,v 1.24 2009/04/03 00:14:42 dyoung Exp $ */
/* $OpenBSD: if_bnx.c,v 1.43 2007/01/30 03:21:10 krw Exp $ */
/*-
@@ -35,7 +35,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.23 2009/03/18 16:00:19 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.24 2009/04/03 00:14:42 dyoung Exp $");
/*
* The following controllers are supported by this driver:
@@ -348,8 +348,8 @@ void bnx_tick(void *);
/****************************************************************************/
/* OpenBSD device dispatch table. */
/****************************************************************************/
-CFATTACH_DECL_NEW(bnx, sizeof(struct bnx_softc),
- bnx_probe, bnx_attach, bnx_detach, NULL);
+CFATTACH_DECL3_NEW(bnx, sizeof(struct bnx_softc),
+ bnx_probe, bnx_attach, bnx_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
/****************************************************************************/
/* Device probe function. */
@@ -4332,16 +4332,26 @@ bnx_ioctl(struct ifnet *ifp, u_long command, void *data)
switch (command) {
case SIOCSIFFLAGS:
- if (ifp->if_flags & IFF_UP) {
- if ((ifp->if_flags & IFF_RUNNING) &&
- ((ifp->if_flags ^ sc->bnx_if_flags) &
- (IFF_ALLMULTI | IFF_PROMISC)) != 0) {
+ if ((error = ifioctl_common(ifp, command, data)) != 0)
+ break;
+ /* XXX set an ifflags callback and let ether_ioctl
+ * handle all of this.
+ */
+ switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
+ case IFF_UP|IFF_RUNNING:
+ if (((ifp->if_flags ^ sc->bnx_if_flags) &
+ (IFF_ALLMULTI | IFF_PROMISC)) != 0)
bnx_set_rx_mode(sc);
- } else if (!(ifp->if_flags & IFF_RUNNING))
- bnx_init(ifp);
-
- } else if (ifp->if_flags & IFF_RUNNING)
+ break;
+ case IFF_UP:
+ bnx_init(ifp);
+ break;
+ case IFF_RUNNING:
bnx_stop(ifp, 1);
+ break;
+ case 0:
+ break;
+ }
sc->bnx_if_flags = ifp->if_flags;
break;