git: 69de2b4e9679 - main - bnxt: don't set media status if link is down

From: Pouria Mousavizadeh Tehrani <pouria_at_FreeBSD.org>
Date: Mon, 26 Jan 2026 23:24:03 UTC
The branch main has been updated by pouria:

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

commit 69de2b4e96794793f04d1b323d354fcde3c480f6
Author:     Anaƫlle CAZUC <Anaelle.CAZUC@stormshield.eu>
AuthorDate: 2026-01-26 23:06:02 +0000
Commit:     Pouria Mousavizadeh Tehrani <pouria@FreeBSD.org>
CommitDate: 2026-01-26 23:21:48 +0000

    bnxt: don't set media status if link is down
    
    When the link is down don't set flags other than IFM_AVALID & IFM_ETHER
    This avoids `media: Ethernet autoselect (Unknown <full-duplex>)` on ifconfig
    
    Reviewed by:    zlei, pouria
    Approved by:    glebius (mentor)
    MFC after:      1 week
    Sponsored by:   Stormshield
    Differential Revision: https://reviews.freebsd.org/D54573
---
 sys/dev/bnxt/bnxt_en/if_bnxt.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/dev/bnxt/bnxt_en/if_bnxt.c b/sys/dev/bnxt/bnxt_en/if_bnxt.c
index fa37d04e0884..a34bd1a7e511 100644
--- a/sys/dev/bnxt/bnxt_en/if_bnxt.c
+++ b/sys/dev/bnxt/bnxt_en/if_bnxt.c
@@ -3280,11 +3280,10 @@ bnxt_media_status(if_ctx_t ctx, struct ifmediareq * ifmr)
 	ifmr->ifm_status = IFM_AVALID;
 	ifmr->ifm_active = IFM_ETHER;
 
-	if (link_info->link_up)
-		ifmr->ifm_status |= IFM_ACTIVE;
-	else
-		ifmr->ifm_status &= ~IFM_ACTIVE;
+	if (!link_info->link_up)
+		return;
 
+	ifmr->ifm_status |= IFM_ACTIVE;
 	if (link_info->duplex == HWRM_PORT_PHY_QCFG_OUTPUT_DUPLEX_CFG_FULL)
 		ifmr->ifm_active |= IFM_FDX;
 	else