git: 46241b7d6647 - main - iavf: Do not publish link-up while stopped

Kevin Bowling <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a79a676.39e19.1bd4a22f__13489.7405559727$1786357492$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by kbowling:

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

commit 46241b7d6647dfc2fc557c02804d20b9f05af5c4
Author:     Kevin Bowling <[email protected]>
AuthorDate: 2026-08-10 04:00:46 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-10 10:22:31 +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.
    
    MFC after:      2 weeks
---
 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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.