[PATCH net v3 2/2] net: ngbe: clear DRV_LOAD bit when ngbe_open() fails

From: Zhang Yunfei

Date: Wed Sep 30 2026 - 05:52:36 EST


On NCSI-managed systems, a failed ifup - for example when IRQ or
ring allocation fails under memory pressure - leaves the port
without either host or firmware driving it: the firmware already
handed the port over on open, so out-of-band management of the NIC
through that port stops until the next successful ifup.

ngbe_open() sets the WX_CFG_PORT_CTL_DRV_LOAD bit to tell the
management firmware the host has taken over the port, but every
error path returns without clearing it, leaving rings, IRQs and the
PHY torn down while the firmware still believes the host owns the
port.

Roll the bit back on all open error paths, matching ngbe_close()
and ngbe_dev_shutdown(), so a failed ifup leaves the same
firmware-visible state as if the interface had never been opened.

Found by manual code inspection of the open error paths. The
deterministic reproduction uses a loadable test module injecting a
wx_setup_resources() failure: in a QEMU VM the unfixed driver
leaves DRV_LOAD set after a failed open, and with the fix the bit
is cleared. No physical ngbe device is involved.

Fixes: a1cf597b99a7 ("net: ngbe: Add ngbe mdio bus driver.")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Zhang Yunfei <zhangyunfei1@xxxxxxxxxx>
---
Changes in v3:
- correct the Fixes tag to a1cf597b99a7, the commit that introduced
the bug (the first ngbe_open() failure path after the DRV_LOAD bit
is set; v2 pointed at e7956139a6cf, which added more failing returns
but not the first one); no code change.

drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
index 8247f6c14be0..0aea5a99a1e2 100644
--- a/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
+++ b/drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
@@ -494,7 +494,7 @@ static int ngbe_open(struct net_device *netdev)

err = wx_setup_resources(wx);
if (err)
- return err;
+ goto err_control_hw;

wx_configure(wx);

@@ -526,6 +526,8 @@ static int ngbe_open(struct net_device *netdev)
err_free_resources:
wx_free_isb_resources(wx);
wx_free_resources(wx);
+err_control_hw:
+ wx_control_hw(wx, false);
return err;
}

--
2.25.1