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 22:37, Anthony Mallet wrote:
On Friday, at 10:02, Roy Marples wrote:
| 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?

The results are a bit surprising to me :
 - wm(4) still starts in the 'detached' state after becoming up.
 - `ifconfig -w` consequently does not wait at all.

That is surprising.
Attached is a new patch with one extra line to ensure sc_flags is set before calling the tick function, but I'm not sure if that will help any.

Let me know!


The big difference is that mount_nfs does not report the
"rpcbind to nfs on server: RPC: Port mapper failure - RPC: Unable to send" error anymore, and merely waits a few (5 or so) seconds that the interface goes through "detached" -> "tentative" -> "". (instead of the ~30s delay without
your patch).

Well, the patch is probably causing the interface to notify the link being up just a second faster. We could also try calling the tick function a second time in wm_init to see if it just needed to be tickled.

So all in all your patch does the job, but I don't fully get why. And I'm still
a bit frustrated that ifconfig -w does nothing :)

Yes, maybe ifconfig -w *should* do something.
I was trying to avoid waiting for interfaces that really have no carrier (ie a cable plugged in), but as you point out we don't want the test to pass if it takes a few seconds for the interface to realise it has a carrier. This is doubly true for wireless and I don't know how a host AP interface would behave here.

Does anyone have any thoughts on if -w should wait for detached as well, or if we should roll that into a new flag (maybe -W)? And on how to choose which one in rc.d/network?

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	1 Dec 2015 15:58:16 -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,14 @@
 
 	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. */
+	sc->sc_if_flags = ifp->if_flags;
+	wm_tick_locked(sc);
+
  out:
 	sc->sc_if_flags = ifp->if_flags;
 	if (error)


Home | Main Index | Thread Index | Old Index