git: 992e326cd8cc - stable/13 - neta: split fixed and in-band link status configuration

From: Marcin Wojtas <mw_at_FreeBSD.org>
Date: Tue, 29 Mar 2022 23:00:03 UTC
The branch stable/13 has been updated by mw:

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

commit 992e326cd8ccd6e1a8ec696db7902efd3021f7ae
Author:     Sebastien Bini <sebastien.bini@stormshield.eu>
AuthorDate: 2022-03-22 15:44:09 +0000
Commit:     Marcin Wojtas <mw@FreeBSD.org>
CommitDate: 2022-03-29 22:24:56 +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
    
    (cherry picked from commit 231237bbb0e803f9047c235cd6b5878f70e6c5eb)
---
 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 8b9135419736..6035609976a6 100644
--- a/sys/dev/neta/if_mvneta.c
+++ b/sys/dev/neta/if_mvneta.c
@@ -1688,7 +1688,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);
@@ -1720,7 +1720,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);
@@ -2475,7 +2475,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);
@@ -2638,7 +2638,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;
@@ -2658,7 +2658,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;