Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 Apr 2025 18:38:11 GMT
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: c78f603ab77f - main - e6000sw: schedule e6000sw_tick() to occur once a second
Message-ID:  <202504271838.53RIcB4C020631@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by adrian:

URL: https://cgit.FreeBSD.org/src/commit/?id=c78f603ab77ff3a2910d9b7ef190b30b611fc311

commit c78f603ab77ff3a2910d9b7ef190b30b611fc311
Author:     Adrian Chadd <adrian@FreeBSD.org>
AuthorDate: 2025-04-25 18:44:22 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2025-04-27 18:11:19 +0000

    e6000sw: schedule e6000sw_tick() to occur once a second
    
    Although all the machinery is present, the tick routine only ran once.
    It was never rescheduled.  So, reschedule it.
    
    However in practice I've discovered that the tick routine is running
    whilst a bunch of phys are actually being probe/attached on each per-port
    MII bus being created and probed off of the switch itself.
    
    Until that's debugged (and likely the whole PHY management stuff is
    cleaned up here), just add a NULL check and thus don't panic.
    
    Differential Revision:  https://reviews.freebsd.org/D50031
    Reviewed by:    imp
---
 sys/dev/etherswitch/e6000sw/e6000sw.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sys/dev/etherswitch/e6000sw/e6000sw.c b/sys/dev/etherswitch/e6000sw/e6000sw.c
index be02edb3d5e6..19d8e85decf6 100644
--- a/sys/dev/etherswitch/e6000sw/e6000sw.c
+++ b/sys/dev/etherswitch/e6000sw/e6000sw.c
@@ -1613,6 +1613,17 @@ e6000sw_tick(void *arg, int p __unused)
 		    &mii->mii_media_status, &mii->mii_media_active);
 
 		LIST_FOREACH(miisc, &mii->mii_phys, mii_list) {
+			/*
+			 * Note: this is sometimes NULL during PHY
+			 * enumeration, although that shouldn't be
+			 * happening /after/ tick runs. To work
+			 * around this whilst the problem is being
+			 * debugged, just do a NULL check here and
+			 * continue.
+			 */
+			if (mii->mii_media.ifm_cur == NULL)
+				continue;
+
 			if (IFM_INST(mii->mii_media.ifm_cur->ifm_media)
 			    != miisc->mii_inst)
 				continue;
@@ -1620,6 +1631,7 @@ e6000sw_tick(void *arg, int p __unused)
 		}
 	}
 	E6000SW_UNLOCK(sc);
+	taskqueue_enqueue_timeout(sc->sc_tq, &sc->sc_tt, hz);
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202504271838.53RIcB4C020631>