Skip to content

Commit c859c4d

Browse files
jjagielskgregkh
authored andcommitted
i40e: Fix incorrect netdev's real number of RX/TX queues
commit e738451 upstream. 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 <lukaszx.cieplicki@intel.com> Signed-off-by: Jedrzej Jagielski <jedrzej.jagielski@intel.com> Tested-by: Gurucharan G <gurucharanx.g@intel.com> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d0ad644 commit c859c4d

1 file changed

Lines changed: 25 additions & 7 deletions

File tree

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

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8381,6 +8381,27 @@ int i40e_open(struct net_device *netdev)
83818381
return 0;
83828382
}
83838383

8384+
/**
8385+
* i40e_netif_set_realnum_tx_rx_queues - Update number of tx/rx queues
8386+
* @vsi: vsi structure
8387+
*
8388+
* This updates netdev's number of tx/rx queues
8389+
*
8390+
* Returns status of setting tx/rx queues
8391+
**/
8392+
static int i40e_netif_set_realnum_tx_rx_queues(struct i40e_vsi *vsi)
8393+
{
8394+
int ret;
8395+
8396+
ret = netif_set_real_num_rx_queues(vsi->netdev,
8397+
vsi->num_queue_pairs);
8398+
if (ret)
8399+
return ret;
8400+
8401+
return netif_set_real_num_tx_queues(vsi->netdev,
8402+
vsi->num_queue_pairs);
8403+
}
8404+
83848405
/**
83858406
* i40e_vsi_open -
83868407
* @vsi: the VSI to open
@@ -8417,13 +8438,7 @@ int i40e_vsi_open(struct i40e_vsi *vsi)
84178438
goto err_setup_rx;
84188439

84198440
/* Notify the stack of the actual queue counts. */
8420-
err = netif_set_real_num_tx_queues(vsi->netdev,
8421-
vsi->num_queue_pairs);
8422-
if (err)
8423-
goto err_set_queues;
8424-
8425-
err = netif_set_real_num_rx_queues(vsi->netdev,
8426-
vsi->num_queue_pairs);
8441+
err = i40e_netif_set_realnum_tx_rx_queues(vsi);
84278442
if (err)
84288443
goto err_set_queues;
84298444

@@ -13710,6 +13725,9 @@ struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf, u8 type,
1371013725
case I40E_VSI_MAIN:
1371113726
case I40E_VSI_VMDQ2:
1371213727
ret = i40e_config_netdev(vsi);
13728+
if (ret)
13729+
goto err_netdev;
13730+
ret = i40e_netif_set_realnum_tx_rx_queues(vsi);
1371313731
if (ret)
1371413732
goto err_netdev;
1371513733
ret = register_netdev(vsi->netdev);

0 commit comments

Comments
 (0)