Skip to content

Commit 46d08f5

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: extend RTNL to VF check in devlink driver_reinit
The fixes the race condition between configuring SR-IOV and devlink reload. The SR-IOV configure logic already takes the RTNL lock, setting sriov_cfg under the lock while changes are underway. Extend the lock scope in devlink driver_reinit to cover the VF check and don't run concurrently with SR-IOV configure. Reported-by: Leon Romanovsky <[email protected]> Fixes: 228ea8c ("bnxt_en: implement devlink dev reload driver_reinit") Cc: Leon Romanovsky <[email protected]> Reviewed-by: Somnath Kotur <[email protected]> Reviewed-by: Pavan Chebbi <[email protected]> Reviewed-by: Andy Gospodarek <[email protected]> Signed-off-by: Edwin Peer <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e97b21e commit 46d08f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,13 @@ static int bnxt_dl_reload_down(struct devlink *dl, bool netns_change,
441441

442442
switch (action) {
443443
case DEVLINK_RELOAD_ACTION_DRIVER_REINIT: {
444-
if (BNXT_PF(bp) && bp->pf.active_vfs) {
444+
rtnl_lock();
445+
if (BNXT_PF(bp) && (bp->pf.active_vfs || bp->sriov_cfg)) {
445446
NL_SET_ERR_MSG_MOD(extack,
446-
"reload is unsupported when VFs are allocated");
447+
"reload is unsupported while VFs are allocated or being configured");
448+
rtnl_unlock();
447449
return -EOPNOTSUPP;
448450
}
449-
rtnl_lock();
450451
if (bp->dev->reg_state == NETREG_UNREGISTERED) {
451452
rtnl_unlock();
452453
return -ENODEV;

0 commit comments

Comments
 (0)