git: 231237bbb0e8 - main - neta: split fixed and in-band link status configuration

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Tue, 22 Mar 2022 16:06:33 UTC
The branch main has been updated by mw:

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

commit 231237bbb0e803f9047c235cd6b5878f70e6c5eb
Author:     Sebastien Bini <sebastien.bini@stormshield.eu>
AuthorDate: 2022-03-22 15:44:09 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-03-22 15:52:31 +0000

    neta: split fixed and in-band link status configuration
    
    Fixed-link mode requires different handling than the in-band
    managed connection. Update interrupt, link-up/down and
    autonegotiation settings for the former.
    
    Reviewed by: mw
    MFC after: 1 week
    Obtained from: Stormshield
    Differential Revision: https://reviews.freebsd.org/D34394
---
 sys/dev/neta/if_mvneta.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/neta/if_mvneta.c b/sys/dev/neta/if_mvneta.c
index f4a5c9b52c0d..17bc7cab7115 100644
--- a/sys/dev/neta/if_mvneta.c
+++ b/sys/dev/neta/if_mvneta.c
@@ -1679,7 +1679,7 @@ mvneta_enable_intr(struct mvneta_softc *sc)
 	reg |= MVNETA_PRXTXTI_PMISCICSUMMARY;
 	MVNETA_WRITE(sc, MVNETA_PRXTXTIM, reg);
 
-	if (sc->use_inband_status) {
+	if (!sc->phy_attached || sc->use_inband_status) {
 		/* Enable Port MISC Intr. (via RXTX_TH_Summary bit) */
 		MVNETA_WRITE(sc, MVNETA_PMIM, MVNETA_PMI_PHYSTATUSCHNG |
 		    MVNETA_PMI_LINKCHANGE | MVNETA_PMI_PSCSYNCCHANGE);
@@ -1711,7 +1711,7 @@ mvneta_rxtxth_intr(void *arg)
 
 	/* Ack maintance interrupt first */
 	if (__predict_false((ic & MVNETA_PRXTXTI_PMISCICSUMMARY) &&
-	    sc->use_inband_status)) {
+	    (!sc->phy_attached || sc->use_inband_status))) {
 		mvneta_sc_lock(sc);
 		mvneta_misc_intr(sc);
 		mvneta_sc_unlock(sc);
@@ -2466,7 +2466,7 @@ mvneta_update_media(struct mvneta_softc *sc, int media)
 
 	sc->autoneg = (IFM_SUBTYPE(media) == IFM_AUTO);
 
-	if (sc->use_inband_status)
+	if (!sc->phy_attached || sc->use_inband_status)
 		mvneta_update_autoneg(sc, IFM_SUBTYPE(media) == IFM_AUTO);
 
 	mvneta_update_eee(sc);
@@ -2629,7 +2629,7 @@ mvneta_linkup(struct mvneta_softc *sc)
 
 	KASSERT_SC_MTX(sc);
 
-	if (!sc->use_inband_status) {
+	if (!sc->phy_attached || !sc->use_inband_status) {
 		reg  = MVNETA_READ(sc, MVNETA_PANC);
 		reg |= MVNETA_PANC_FORCELINKPASS;
 		reg &= ~MVNETA_PANC_FORCELINKFAIL;
@@ -2649,7 +2649,7 @@ mvneta_linkdown(struct mvneta_softc *sc)
 
 	KASSERT_SC_MTX(sc);
 
-	if (!sc->use_inband_status) {
+	if (!sc->phy_attached || !sc->use_inband_status) {
 		reg  = MVNETA_READ(sc, MVNETA_PANC);
 		reg &= ~MVNETA_PANC_FORCELINKPASS;
 		reg |= MVNETA_PANC_FORCELINKFAIL;