git: d79c9a8675f1 - stable/14 - iavf: Do not publish link-up while stopped

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Mon, 24 Aug 2026 09:14:19 UTC
The branch stable/14 has been updated by kbowling:

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

commit d79c9a8675f15dee6a0cd2b8c0a37e6c7d014d55
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-08-10 04:00:46 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-24 09:12:22 +0000

    iavf: Do not publish link-up while stopped
    
    A PF link event remains cached while a VF is administratively down.
    Media status queries called iavf_update_link_status() and published
    that cached state as link-up, while the stopped admin path immediately
    published link-down.  Consumers reacting to link events could turn
    this into an unbounded notification loop and prevent interface detach
    from draining its link-state task.
    
    Keep the cached PF state, but only publish link-up after iflib has
    marked the VF running.  A subsequent admin pass publishes the cached
    state after a successful initialization.
    
    (cherry picked from commit 46241b7d6647dfc2fc557c02804d20b9f05af5c4)
---
 sys/dev/iavf/if_iavf_iflib.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c
index 77c85f4212af..82ba7a92b008 100644
--- a/sys/dev/iavf/if_iavf_iflib.c
+++ b/sys/dev/iavf/if_iavf_iflib.c
@@ -2065,8 +2065,18 @@ void
 iavf_update_link_status(struct iavf_sc *sc)
 {
 	struct iavf_vsi *vsi = &sc->vsi;
+	if_t ifp;
 	u64 baudrate;
 
+	ifp = iflib_get_ifp(vsi->ctx);
+	if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0) {
+		if (vsi->link_active) {
+			vsi->link_active = false;
+			iflib_link_state_change(vsi->ctx, LINK_STATE_DOWN, 0);
+		}
+		return;
+	}
+
 	if (sc->link_up){
 		if (vsi->link_active == FALSE) {
 			vsi->link_active = TRUE;