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

From: mengyuanlou@xxxxxxxxxxxxx

Date: Thu Sep 17 2026 - 23:59:08 EST




> 2026年9月17日 17:00,Zhang Yunfei <zhangyunfei1@xxxxxxxxxx> 写道:
>
> ngbe_open() sets the WX_CFG_PORT_CTL_DRV_LOAD bit via
> wx_control_hw(wx, true) to tell the management firmware that the
> host driver has taken over the port (NCSI/OOB firmware stops using
> its management channel). Every error path of ngbe_open() returns
> without clearing it, leaving rings, IRQs and the PHY torn down
> while the firmware still believes the host owns the port, an
> inconsistent driver-firmware handshake state that persists until
> the next successful ifup.
>
> Roll the bit back on all open error paths, matching ngbe_close()
> and ngbe_dev_shutdown(), which already clear it.
>
> Fixes: e7956139a6cf ("net: ngbe: Add irqs request flow")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Zhang Yunfei <zhangyunfei1@xxxxxxxxxx>

Reviewed-by: Mengyuan Lou <mengyuanlou@xxxxxxxxxxxxx>

> ---
> 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 6d8289e2532d..88f00b72a512 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
>
>