Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
patch: avoid wm(4) resets when adding/deleting vlan(4)
After a wm(4) is reset, it takes about 30 seconds for the NIC to get
back "on net." It's really painful.
I've attached a patch for -current that stops wm(4) from needlessly
resetting when you add or delete a vlan(4):
ifconfig vlan0 create vlan 2 vlanif wm0
ifconfig vlan0 destroy
Please give it a look or give it a try. I will commit it next week.
A patch for netbsd-5 is on the way.
Dave
--
David Young OJC Technologies
dyoung%ojctech.com@localhost Urbana, IL * (217) 278-3933
Index: if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.215
diff -u -p -r1.215 if_wm.c
--- if_wm.c 16 Oct 2010 06:31:49 -0000 1.215
+++ if_wm.c 3 Dec 2010 21:14:01 -0000
@@ -516,6 +516,7 @@ static int wm_read_mac_addr(struct wm_so
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 *);
@@ -2738,14 +2739,17 @@ wm_ifflags_cb(struct ethercom *ec)
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);
+ if ((change & (IFF_PROMISC | IFF_ALLMULTI)) != 0)
+ wm_set_filter(sc);
+
+ wm_set_vlan(sc);
- sc->sc_if_flags = ifp->if_flags;
return 0;
}
@@ -3704,6 +3708,19 @@ wm_reset(struct wm_softc *sc)
/* 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]
*
@@ -3921,14 +3938,8 @@ wm_init(struct ifnet *ifp)
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