aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiahao LI <jiahali@blackberry.com>2022-09-08 15:50:37 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2022-09-16 17:41:54 +0000
commitc1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6 (patch)
tree8c1fe14f217375d2106ded15772958a74426d303
parent8716f1553800fda8cf06ce97c1b2a7a55856fc73 (diff)
downloadsrc-c1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6.tar.gz
src-c1cec62c0db0cb15d2d09aa5dfc5bd3727bbf3f6.zip
if_dwc: fix reinitialization with changed MAC
It was observed that on RockPro64 hardware, the dwc interface is unable to receive packets after being assigned a new MAC address. The fix is simply to call mii_mediachg() before touching any device registers in dwc_init_locked(). This is consistent with what the OpenBSD driver does. PR: 263820 MFC after: 1 week (cherry picked from commit 6501fcdc0a97faa3c59f6ece314bf7754303db6f)
-rw-r--r--sys/dev/dwc/if_dwc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c
index 06eb6bb47649..6d280bd3b86c 100644
--- a/sys/dev/dwc/if_dwc.c
+++ b/sys/dev/dwc/if_dwc.c
@@ -1026,6 +1026,12 @@ dwc_init_locked(struct dwc_softc *sc)
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING)
return;
+ /*
+ * Call mii_mediachg() which will call back into dwc_miibus_statchg()
+ * to set up the remaining config registers based on current media.
+ */
+ mii_mediachg(sc->mii_softc);
+
dwc_setup_rxfilter(sc);
dwc_setup_core(sc);
dwc_enable_mac(sc, true);
@@ -1033,11 +1039,6 @@ dwc_init_locked(struct dwc_softc *sc)
if_setdrvflagbits(ifp, IFF_DRV_RUNNING, IFF_DRV_OACTIVE);
- /*
- * Call mii_mediachg() which will call back into dwc_miibus_statchg()
- * to set up the remaining config registers based on current media.
- */
- mii_mediachg(sc->mii_softc);
callout_reset(&sc->dwc_callout, hz, dwc_tick, sc);
}