tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ifconfig not waiting for DAD completion



On 2015-11-27 08:48, Roy Marples wrote:
On 27/11/2015 00:29, Anthony Mallet wrote:
When my wm(4) interface goes from down to up, it first enters a 'detached' state for 1s or so, then the carrier is detected and the interface goes to the
ipv6 'tentative' state.

I believe this behaviour is true for all interfaces, it's not specific
to wm(4).

The best way of fixing this is to reduce this window to zero because
it's a small lie - kernel is telling userland the link is down when it's
really up.
I don't know how to start doing that though .... I suspect each driver
would need to be touched somewhere.

The attached patch should fix it for wm(4), but I won't have a chance to actually test it fully until the weekend.

Can you test it to see if it fixes your issue?

Thanks

Roy
Index: sys/dev/pci/if_wm.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/if_wm.c,v
retrieving revision 1.381
diff -u -r1.381 if_wm.c
--- sys/dev/pci/if_wm.c	30 Oct 2015 19:22:01 -0000	1.381
+++ sys/dev/pci/if_wm.c	27 Nov 2015 09:56:52 -0000
@@ -542,6 +542,7 @@
 static bool	wm_resume(device_t, const pmf_qual_t *);
 static void	wm_watchdog(struct ifnet *);
 static void	wm_tick(void *);
+static void	wm_tick_locked(struct wm_softc *);
 static int	wm_ifflags_cb(struct ethercom *);
 static int	wm_ioctl(struct ifnet *, u_long, void *);
 /* MAC address related */
@@ -2693,6 +2694,15 @@
 wm_tick(void *arg)
 {
 	struct wm_softc *sc = arg;
+
+	WM_CORE_LOCK(sc);
+	wm_tick_locked(sc);
+	WM_CORE_UNLOCK(sc);
+}
+
+static void
+wm_tick_locked(struct wm_softc *sc)
+{
 	struct ifnet *ifp = &sc->sc_ethercom.ec_if;
 #ifndef WM_MPSAFE
 	int s;
@@ -2700,8 +2710,6 @@
 	s = splnet();
 #endif
 
-	WM_CORE_LOCK(sc);
-
 	if (sc->sc_stopping)
 		goto out;
 
@@ -2733,7 +2741,6 @@
 		wm_tbi_tick(sc);
 
 out:
-	WM_CORE_UNLOCK(sc);
 #ifndef WM_MPSAFE
 	splx(s);
 #endif
@@ -4946,13 +4953,13 @@
 
 	sc->sc_stopping = false;
 
-	/* Start the one second link check clock. */
-	callout_reset(&sc->sc_tick_ch, hz, wm_tick, sc);
-
 	/* ...all done! */
 	ifp->if_flags |= IFF_RUNNING;
 	ifp->if_flags &= ~IFF_OACTIVE;
 
+	/* Start the one second link check clock. */
+	wm_tick_locked(sc);
+
  out:
 	sc->sc_if_flags = ifp->if_flags;
 	if (error)


Home | Main Index | Thread Index | Old Index