Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue

Tony Nguyen says:

====================
Intel Wired LAN Driver Updates 2022-09-02 (i40e, iavf)

This series contains updates to i40e and iavf drivers.

Przemyslaw adds reset to ADQ configuration to allow for setting of rate
limit beyond TC0 for i40e.

Ivan Vecera does not free client on failure to open which could cause
NULL pointer dereference to occur on i40e. He also detaches device
during reset to prevent NDO calls with could cause races for iavf.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2022-09-03 10:46:24 +01:00
commit d9c0103b9c
4 changed files with 20 additions and 5 deletions

View File

@ -177,6 +177,10 @@ void i40e_notify_client_of_netdev_close(struct i40e_vsi *vsi, bool reset)
"Cannot locate client instance close routine\n"); "Cannot locate client instance close routine\n");
return; return;
} }
if (!test_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state)) {
dev_dbg(&pf->pdev->dev, "Client is not open, abort close\n");
return;
}
cdev->client->ops->close(&cdev->lan_info, cdev->client, reset); cdev->client->ops->close(&cdev->lan_info, cdev->client, reset);
clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state); clear_bit(__I40E_CLIENT_INSTANCE_OPENED, &cdev->state);
i40e_client_release_qvlist(&cdev->lan_info); i40e_client_release_qvlist(&cdev->lan_info);
@ -429,7 +433,6 @@ void i40e_client_subtask(struct i40e_pf *pf)
/* Remove failed client instance */ /* Remove failed client instance */
clear_bit(__I40E_CLIENT_INSTANCE_OPENED, clear_bit(__I40E_CLIENT_INSTANCE_OPENED,
&cdev->state); &cdev->state);
i40e_client_del_instance(pf);
return; return;
} }
} }

View File

@ -6659,6 +6659,9 @@ static int i40e_configure_queue_channels(struct i40e_vsi *vsi)
vsi->tc_seid_map[i] = ch->seid; vsi->tc_seid_map[i] = ch->seid;
} }
} }
/* reset to reconfigure TX queue contexts */
i40e_do_reset(vsi->back, I40E_PF_RESET_FLAG, true);
return ret; return ret;
err_free: err_free:

View File

@ -3688,7 +3688,8 @@ u16 i40e_lan_select_queue(struct net_device *netdev,
u8 prio; u8 prio;
/* is DCB enabled at all? */ /* is DCB enabled at all? */
if (vsi->tc_config.numtc == 1) if (vsi->tc_config.numtc == 1 ||
i40e_is_tc_mqprio_enabled(vsi->back))
return netdev_pick_tx(netdev, skb, sb_dev); return netdev_pick_tx(netdev, skb, sb_dev);
prio = skb->priority; prio = skb->priority;

View File

@ -2877,6 +2877,11 @@ static void iavf_reset_task(struct work_struct *work)
int i = 0, err; int i = 0, err;
bool running; bool running;
/* Detach interface to avoid subsequent NDO callbacks */
rtnl_lock();
netif_device_detach(netdev);
rtnl_unlock();
/* When device is being removed it doesn't make sense to run the reset /* When device is being removed it doesn't make sense to run the reset
* task, just return in such a case. * task, just return in such a case.
*/ */
@ -2884,7 +2889,7 @@ static void iavf_reset_task(struct work_struct *work)
if (adapter->state != __IAVF_REMOVE) if (adapter->state != __IAVF_REMOVE)
queue_work(iavf_wq, &adapter->reset_task); queue_work(iavf_wq, &adapter->reset_task);
return; goto reset_finish;
} }
while (!mutex_trylock(&adapter->client_lock)) while (!mutex_trylock(&adapter->client_lock))
@ -2954,7 +2959,6 @@ continue_reset:
if (running) { if (running) {
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_stop_all_queues(netdev);
adapter->link_up = false; adapter->link_up = false;
iavf_napi_disable_all(adapter); iavf_napi_disable_all(adapter);
} }
@ -3084,7 +3088,7 @@ continue_reset:
mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->client_lock);
mutex_unlock(&adapter->crit_lock); mutex_unlock(&adapter->crit_lock);
return; goto reset_finish;
reset_err: reset_err:
if (running) { if (running) {
set_bit(__IAVF_VSI_DOWN, adapter->vsi.state); set_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
@ -3095,6 +3099,10 @@ reset_err:
mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->client_lock);
mutex_unlock(&adapter->crit_lock); mutex_unlock(&adapter->crit_lock);
dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n"); dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
reset_finish:
rtnl_lock();
netif_device_attach(netdev);
rtnl_unlock();
} }
/** /**