Index | Thread | Search

From:
Yuichiro NAITO <naito.yuichiro@gmail.com>
Subject:
iavf patch [3/4]: PCI bus error handling
To:
tech@openbsd.org
Date:
Fri, 07 Feb 2025 16:25:29 +0900

Download raw body.

Thread
This patch is the same as the following mail.

https://marc.info/?l=openbsd-tech&m=172723210819245&w=2

Now, We have support of i440fx chipset emulation on QEMU.
However, I think we need to catch up with an error case
while the iavf driver attaches.

OK?

diff --git a/sys/dev/pci/if_iavf.c b/sys/dev/pci/if_iavf.c
index 38f3cce26b6..204dbfc2637 100644
--- a/sys/dev/pci/if_iavf.c
+++ b/sys/dev/pci/if_iavf.c
@@ -616,6 +616,7 @@ struct iavf_softc {
 	uint32_t		 sc_major_ver;
 	uint32_t		 sc_minor_ver;
 
+	int			 sc_if_attached;
 	int			 sc_got_vf_resources;
 	int			 sc_got_irq_map;
 	uint32_t		 sc_vf_id;
@@ -1078,6 +1079,7 @@ iavf_attach(struct device *parent, struct device *self, void *aux)
 
 	if_attach_queues(ifp, iavf_nqueues(sc));
 	if_attach_iqueues(ifp, iavf_nqueues(sc));
+	sc->sc_if_attached++;
 
 	iavf_intr_enable(sc);
 
@@ -1627,7 +1629,8 @@ iavf_reset(void *xsc)
 	link_state = ifp->if_link_state;
 	if (ifp->if_link_state != LINK_STATE_DOWN) {
 		ifp->if_link_state = LINK_STATE_DOWN;
-		if_link_state_change(ifp);
+		if (sc->sc_if_attached)
+			if_link_state_change(ifp);
 	}
 
 	up = 0;

-- 
Yuichiro NAITO (naito.yuichiro@gmail.com)