Skip to content

Commit e738451

Browse files
jjagielskanguy11
authored andcommitted
i40e: Fix incorrect netdev's real number of RX/TX queues
There was a wrong queues representation in sysfs during driver's reinitialization in case of online cpus number is less than combined queues. It was caused by stopped NetworkManager, which is responsible for calling vsi_open function during driver's initialization. In specific situation (ex. 12 cpus online) there were 16 queues in /sys/class/net/<iface>/queues. In case of modifying queues with value higher, than number of online cpus, then it caused write errors and other errors. Add updating of sysfs's queues representation during driver initialization. Fixes: 41c445f ("i40e: main driver core") Signed-off-by: Lukasz Cieplicki <[email protected]> Signed-off-by: Jedrzej Jagielski <[email protected]> Tested-by: Gurucharan G <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 40feded commit e738451

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8740,6 +8740,27 @@ int i40e_open(struct net_device *netdev)
87408740
return 0;
87418741
}
87428742

8743+
/**
8744+
* i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
8745+
* @vsi: vsi structure
8746+
*
8747+
* This updates netdev's number of tx/rx queues
8748+
*
8749+
* Returns status of setting tx/rx queues
8750+
**/
8751+
static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
8752+
{
8753+
int ret;
8754+
8755+
ret = netif_set_real_num_rx_queues(vsi->netdev,
8756+
vsi->num_queue_pairs);
8757+
if (ret)
8758+
return ret;
8759+
8760+
return netif_set_real_num_tx_queues(vsi->netdev,
8761+
vsi->num_queue_pairs);
8762+
}
8763+
87438764
/**
87448765
* i40e_vsi_open -
87458766
* @vsi: the VSI to open
@@ -8776,13 +8797,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
87768797
goto err_setup_rx;
87778798

87788799
/* Notify the stack of the actual queue counts. */
8779-
err = netif_set_real_num_tx_queues(vsi->netdev,
8780-
vsi->num_queue_pairs);
8781-
if (err)
8782-
goto err_set_queues;
8783-
8784-
err = netif_set_real_num_rx_queues(vsi->netdev,
8785-
vsi->num_queue_pairs);
8800+
err = i40e_netif_set_realnum_tx_rx_queues(vsi);
87868801
if (err)
87878802
goto err_set_queues;
87888803

@@ -14173,6 +14188,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
1417314188
case I40E_VSI_MAIN:
1417414189
case I40E_VSI_VMDQ2:
1417514190
ret = i40e_config_netdev(vsi);
14191+
if (ret)
14192+
goto err_netdev;
14193+
ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
1417614194
if (ret)
1417714195
goto err_netdev;
1417814196
ret = register_netdev(vsi->netdev);

0 commit comments

Comments
 (0)