Skip to content

Commit 110eff1

Browse files
Stanislav Fomichevkuba-moo
authored andcommitted
eth: bnxt: switch to netif_close
All (error) paths that call dev_close are already holding instance lock, so switch to netif_close to avoid the deadlock. v2: - add missing EXPORT_MODULE for netif_close Fixes: 004b500 ("eth: bnxt: remove most dependencies on RTNL") Reported-by: Jakub Kicinski <[email protected]> Signed-off-by: Stanislav Fomichev <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0a13c1e commit 110eff1

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12802,7 +12802,7 @@ int bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
1280212802
rc = __bnxt_open_nic(bp, irq_re_init, link_re_init);
1280312803
if (rc) {
1280412804
netdev_err(bp->dev, "nic open fail (rc: %x)\n", rc);
12805-
dev_close(bp->dev);
12805+
netif_close(bp->dev);
1280612806
}
1280712807
return rc;
1280812808
}
@@ -12840,7 +12840,7 @@ int bnxt_half_open_nic(struct bnxt *bp)
1284012840
half_open_err:
1284112841
bnxt_free_skbs(bp);
1284212842
bnxt_free_mem(bp, true);
12843-
dev_close(bp->dev);
12843+
netif_close(bp->dev);
1284412844
return rc;
1284512845
}
1284612846

@@ -14195,7 +14195,7 @@ void bnxt_fw_reset(struct bnxt *bp)
1419514195
netdev_err(bp->dev, "Firmware reset aborted, rc = %d\n",
1419614196
n);
1419714197
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
14198-
dev_close(bp->dev);
14198+
netif_close(bp->dev);
1419914199
goto fw_reset_exit;
1420014200
} else if (n > 0) {
1420114201
u16 vf_tmo_dsecs = n * 10;
@@ -14810,7 +14810,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
1481014810
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
1481114811
bnxt_dl_health_fw_status_update(bp, false);
1481214812
bp->fw_reset_state = 0;
14813-
dev_close(bp->dev);
14813+
netif_close(bp->dev);
1481414814
}
1481514815

1481614816
static void bnxt_fw_reset_task(struct work_struct *work)
@@ -16276,7 +16276,7 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)
1627616276

1627716277
if (netif_running(bp->dev)) {
1627816278
if (rc)
16279-
dev_close(bp->dev);
16279+
netif_close(bp->dev);
1628016280
else
1628116281
rc = bnxt_open_nic(bp, true, false);
1628216282
}
@@ -16669,7 +16669,7 @@ static void bnxt_shutdown(struct pci_dev *pdev)
1666916669
goto shutdown_exit;
1667016670

1667116671
if (netif_running(dev))
16672-
dev_close(dev);
16672+
netif_close(dev);
1667316673

1667416674
bnxt_ptp_clear(bp);
1667516675
bnxt_clear_int_mode(bp);

drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,
461461
if (rc) {
462462
NL_SET_ERR_MSG_MOD(extack, "Failed to deregister");
463463
if (netif_running(bp->dev))
464-
dev_close(bp->dev);
464+
netif_close(bp->dev);
465465
netdev_unlock(bp->dev);
466466
rtnl_unlock();
467467
break;
@@ -576,7 +576,7 @@ static int bnxt_dl_reload_up(struct devlink *dl, enum devlink_reload_action acti
576576
*actions_performed |= BIT(action);
577577
} else if (netif_running(bp->dev)) {
578578
netdev_lock(bp->dev);
579-
dev_close(bp->dev);
579+
netif_close(bp->dev);
580580
netdev_unlock(bp->dev);
581581
}
582582
rtnl_unlock();

net/core/dev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1760,6 +1760,7 @@ void netif_close(struct net_device *dev)
17601760
list_del(&single);
17611761
}
17621762
}
1763+
EXPORT_SYMBOL(netif_close);
17631764

17641765
void netif_disable_lro(struct net_device *dev)
17651766
{

0 commit comments

Comments
 (0)