Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Stop wm(4) from needlessly resetting when you ad...
details: https://anonhg.NetBSD.org/src/rev/d2f9a58b5dac
branches: trunk
changeset: 759634:d2f9a58b5dac
user: dyoung <dyoung%NetBSD.org@localhost>
date: Tue Dec 14 02:51:46 2010 +0000
description:
Stop wm(4) from needlessly resetting when you add or delete a vlan(4):
ifconfig vlan0 create vlan 2 vlanif wm0
ifconfig vlan0 destroy
It pays to avoid a reset because after a reset it can take about 30
seconds before wm0 is back on the net.
The patch garnered no objections on tech-net@.
Sponsored by CoyotePoint Systems Inc.
diffstat:
sys/dev/pci/if_wm.c | 43 +++++++++++++++++++++++++++----------------
1 files changed, 27 insertions(+), 16 deletions(-)
diffs (87 lines):
diff -r d20de1ae48be -r d2f9a58b5dac sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c Tue Dec 14 02:28:57 2010 +0000
+++ b/sys/dev/pci/if_wm.c Tue Dec 14 02:51:46 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_wm.c,v 1.216 2010/11/13 13:52:07 uebayasi Exp $ */
+/* $NetBSD: if_wm.c,v 1.217 2010/12/14 02:51:46 dyoung Exp $ */
/*
* Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.216 2010/11/13 13:52:07 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.217 2010/12/14 02:51:46 dyoung Exp $");
#include "rnd.h"
@@ -514,6 +514,7 @@
static void wm_tick(void *);
static void wm_set_filter(struct wm_softc *);
+static void wm_set_vlan(struct wm_softc *);
static int wm_intr(void *);
static void wm_txintr(struct wm_softc *);
@@ -2736,14 +2737,17 @@
struct wm_softc *sc = ifp->if_softc;
int change = ifp->if_flags ^ sc->sc_if_flags;
+ if (change != 0)
+ sc->sc_if_flags = ifp->if_flags;
+
if ((change & ~(IFF_CANTCHANGE|IFF_DEBUG)) != 0)
return ENETRESET;
- else if ((change & (IFF_PROMISC | IFF_ALLMULTI)) == 0)
- return 0;
-
- wm_set_filter(sc);
-
- sc->sc_if_flags = ifp->if_flags;
+
+ if ((change & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
+ wm_set_filter(sc);
+
+ wm_set_vlan(sc);
+
return 0;
}
@@ -3702,6 +3706,19 @@
/* XXX need special handling for 82580 */
}
+static void
+wm_set_vlan(struct wm_softc *sc)
+{
+ /* Deal with VLAN enables. */
+ if (VLAN_ATTACHED(&sc->sc_ethercom))
+ sc->sc_ctrl |= CTRL_VME;
+ else
+ sc->sc_ctrl &= ~CTRL_VME;
+
+ /* Write the control registers. */
+ CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+}
+
/*
* wm_init: [ifnet interface function]
*
@@ -3919,14 +3936,8 @@
else
CSR_WRITE(sc, WMREG_FCTTV, FCTTV_DFLT);
- /* Deal with VLAN enables. */
- if (VLAN_ATTACHED(&sc->sc_ethercom))
- sc->sc_ctrl |= CTRL_VME;
- else
- sc->sc_ctrl &= ~CTRL_VME;
-
- /* Write the control register. */
- CSR_WRITE(sc, WMREG_CTRL, sc->sc_ctrl);
+ /* Writes the control register. */
+ wm_set_vlan(sc);
if (sc->sc_flags & WM_F_HAS_MII) {
int val;
Home |
Main Index |
Thread Index |
Old Index