Intel Wired LAN Driver Updates 2021-12-06
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to iavf and i40e drivers.
Mitch adds restoration of MSI state during reset for iavf.
Michal fixes checking and reporting of descriptor count changes to communicate changes and/or issues for iavf.
Karen resolves an issue with failed handling of VF requests while a VF reset is occurring for i40e.
Mateusz removes clearing of VF requested queue count when configuring VF ADQ for i40e.
Norbert fixes a NULL pointer dereference that can occur when getting VSI descriptors for i40e.
---
v2:
- Change successful descriptor change from info to debug.
- Drop patch 5; awaiting changes from author
The following are changes since commit 2be6d4d16a0849455a5c22490e3c5983495fed00:
net: cdc_ncm: Allow for dwNtbOutMaxSize to be unset or zero
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
Karen Sornek (1):
i40e: Fix failed opcode appearing if handling messages from VF
Mateusz Palczewski (1):
i40e: Fix pre-set max number of queues for VF
Michal Maloszewski (1):
iavf: Fix reporting when setting descriptor count
Mitch Williams (1):
iavf: restore MSI state on reset
Norbert Zulinski (1):
i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc
.../net/ethernet/intel/i40e/i40e_debugfs.c | 8 ++ .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 75 ++++++++++++------- .../ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + .../net/ethernet/intel/iavf/iavf_ethtool.c | 43 ++++++++--- drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + 5 files changed, 91 insertions(+), 38 deletions(-)
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH v2 1/5 iavf: restore MSI state on reset
From: Mitch Williams <[email protected]>
If the PF experiences an FLR, the VF's MSI and MSI-X configuration will be conveniently and silently removed in the process. When this happens, reset recovery will appear to complete normally but no traffic will pass. The netdev watchdog will helpfully notify everyone of this issue.
To prevent such public embarrassment, restore MSI configuration at every reset. For normal resets, this will do no harm, but for VF resets resulting from a PF FLR, this will keep the VF working.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/iavf/iavf_main.c +1 -0
@@ -2248,6 +2248,7 @@ static void iavf_reset_task(struct work_struct *work) }pci_set_master (adapter->pdev); +pci_restore_msi_state (adapter->pdev);if (i ==IAVF_RESET_WAIT_COMPLETE_COUNT ) { dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n",
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH v2 2/5 iavf: Fix reporting when setting descriptor count
In reply to Tony NguyenFrom: Michal Maloszewski <[email protected]>
iavf_set_ringparams doesn't communicate to the user that
1. The user requested descriptor count is out of range. Instead it just quietly sets descriptors to the "clamped" value and calls it done. This makes it look an invalid value was successfully set as the descriptor count when this isn't actually true.
2. The user provided descriptor count needs to be inflated for alignment reasons.
This behavior is confusing. The ice driver has already addressed this by rejecting invalid values for descriptor count and messaging for alignment adjustments.
Do the same thing here by adding the error and info messages.
--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +32 -11
@@ -615,23 +615,44 @@ static int iavf_set_ringparam(struct net_device *netdev,if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))return -EINVAL ; - new_tx_count =clamp_t (u32, ring->tx_pending, -IAVF_MIN_TXD , -IAVF_MAX_TXD ); - new_tx_count =ALIGN (new_tx_count,IAVF_REQ_DESCRIPTOR_MULTIPLE ); +if (ring->tx_pending >IAVF_MAX_TXD || + ring->tx_pending <IAVF_MIN_TXD || + ring->rx_pending >IAVF_MAX_RXD || + ring->rx_pending <IAVF_MIN_RXD ) { +netdev_err (netdev,"Descriptors requested (Tx: %d / Rx: %d) out of range [%d-%d] (increment %d)\n" , + ring->tx_pending, ring->rx_pending,IAVF_MIN_TXD , +IAVF_MAX_RXD ,IAVF_REQ_DESCRIPTOR_MULTIPLE ); +return -EINVAL ; + } - new_rx_count =clamp_t (u32, ring->rx_pending, -IAVF_MIN_RXD , -IAVF_MAX_RXD ); - new_rx_count =ALIGN (new_rx_count,IAVF_REQ_DESCRIPTOR_MULTIPLE ); + new_tx_count =ALIGN (ring->tx_pending,IAVF_REQ_DESCRIPTOR_MULTIPLE ); +if (new_tx_count != ring->tx_pending) +netdev_info (netdev,"Requested Tx descriptor count rounded up to %d\n" , + new_tx_count); + + new_rx_count =ALIGN (ring->rx_pending,IAVF_REQ_DESCRIPTOR_MULTIPLE ); +if (new_rx_count != ring->rx_pending) +netdev_info (netdev,"Requested Rx descriptor count rounded up to %d\n" , + new_rx_count);/* if nothing to do return success */ if ((new_tx_count == adapter->tx_desc_count) && - (new_rx_count == adapter->rx_desc_count)) + (new_rx_count == adapter->rx_desc_count)) { +netdev_dbg (netdev,"Nothing to change, descriptor count is same as requested\n" );return 0 ; + } - adapter->tx_desc_count = new_tx_count; - adapter->rx_desc_count = new_rx_count; +if (new_tx_count != adapter->tx_desc_count) { +netdev_dbg (netdev,"Changing Tx descriptor count from %d to %d\n" , + adapter->tx_desc_count, new_tx_count); + adapter->tx_desc_count = new_tx_count; + } + +if (new_rx_count != adapter->rx_desc_count) { +netdev_dbg (netdev,"Changing Rx descriptor count from %d to %d\n" , + adapter->rx_desc_count, new_rx_count); + adapter->rx_desc_count = new_rx_count; + }if (netif_running (netdev)) { adapter->flags |=IAVF_FLAG_RESET_NEEDED ;
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH v2 3/5 i40e: Fix failed opcode appearing if handling messages from VF
In reply to Tony NguyenFrom: Karen Sornek <[email protected]>
Fix failed operation code appearing if handling messages from VF. Implemented by waiting for VF appropriate state if request starts handle while VF reset.
Without this patch the message handling request while VF is in a reset state ends with error -5 (I40E_ERR_PARAM).
--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 70 +++++++++++++------ .../ethernet/intel/i40e/i40e_virtchnl_pf.h | 2 + 2 files changed, 50 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +48 -22
@@ -1948,6 +1948,32 @@ static int i40e_vc_send_resp_to_vf(struct i40e_vf *vf,return i40e_vc_send_msg_to_vf (vf, opcode, retval,NULL ,0 ); } +/** +* i40e_sync_vf_state +* @vf: pointer to the VF info +* @state: VF state +* +* Called from a VF message to synchronize the service with a potential +* VF reset state +**/ +static bool i40e_sync_vf_state (struct i40e_vf *vf,enum i40e_vf_states state) +{ +int i; + +/* When handling some messages, it needs VF state to be set. +* It is possible that this flag is cleared during VF reset, +* so there is a need to wait until the end of the reset to +* handle the request message correctly. +*/ +for (i =0 ; i <I40E_VF_STATE_WAIT_COUNT ; i++) { +if (test_bit (state, &vf->vf_states)) +return true; +usleep_range (10000 ,20000 ); + } + +return test_bit (state, &vf->vf_states); +} +/** * i40e_vc_get_version_msg * @vf: pointer to the VF info
@@ -2008,7 +2034,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)size_t len =0 ;int ret; -if (!test_bit (I40E_VF_STATE_INIT , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_INIT )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -2131,7 +2157,7 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf, u8 *msg)bool allmulti = false;bool alluni = false; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err_out; }
@@ -2219,7 +2245,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *vf, u8 *msg)struct i40e_vsi *vsi;u16 num_qps_all =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
@@ -2368,7 +2394,7 @@ static int i40e_vc_config_irq_map_msg(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;int i; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
@@ -2540,7 +2566,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg)struct i40e_pf *pf = vf->pf;i40e_status aq_ret =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
@@ -2590,7 +2616,7 @@ static int i40e_vc_request_queues_msg(struct i40e_vf *vf, u8 *msg)u8 cur_pairs = vf->num_queue_pairs;struct i40e_pf *pf = vf->pf; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ))return -EINVAL ;if (req_pairs >I40E_MAX_VF_QUEUES ) {
@@ -2635,7 +2661,7 @@ static int i40e_vc_get_stats_msg(struct i40e_vf *vf, u8 *msg)memset (&stats,0 ,sizeof (struct i40e_eth_stats )); -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
@@ -2752,7 +2778,7 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg)i40e_status ret =0 ;int i; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states) || +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ) || !i40e_vc_isvalid_vsi_id (vf, al->vsi_id)) { ret =I40E_ERR_PARAM ; goto error_param;
@@ -2824,7 +2850,7 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg)i40e_status ret =0 ;int i; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states) || +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ) || !i40e_vc_isvalid_vsi_id (vf, al->vsi_id)) { ret =I40E_ERR_PARAM ; goto error_param;
@@ -2968,7 +2994,7 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;int i; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states) || +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ) || !i40e_vc_isvalid_vsi_id (vf, vfl->vsi_id)) { aq_ret =I40E_ERR_PARAM ; goto error_param;
@@ -3088,9 +3114,9 @@ static int i40e_vc_config_rss_key(struct i40e_vf *vf, u8 *msg)struct i40e_vsi *vsi =NULL ;i40e_status aq_ret =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states) || +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ) || !i40e_vc_isvalid_vsi_id (vf, vrk->vsi_id) || - (vrk->key_len !=I40E_HKEY_ARRAY_SIZE )) { + vrk->key_len !=I40E_HKEY_ARRAY_SIZE ) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3119,9 +3145,9 @@ static int i40e_vc_config_rss_lut(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;u16 i; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states) || +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE ) || !i40e_vc_isvalid_vsi_id (vf, vrl->vsi_id) || - (vrl->lut_entries !=I40E_VF_HLUT_ARRAY_SIZE )) { + vrl->lut_entries !=I40E_VF_HLUT_ARRAY_SIZE ) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3154,7 +3180,7 @@ static int i40e_vc_get_rss_hena(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;int len =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3190,7 +3216,7 @@ static int i40e_vc_set_rss_hena(struct i40e_vf *vf, u8 *msg)struct i40e_hw *hw = &pf->hw;i40e_status aq_ret =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3215,7 +3241,7 @@ static int i40e_vc_enable_vlan_stripping(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;struct i40e_vsi *vsi; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3241,7 +3267,7 @@ static int i40e_vc_disable_vlan_stripping(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;struct i40e_vsi *vsi; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3468,7 +3494,7 @@ static int i40e_vc_del_cloud_filter(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;int i, ret; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3599,7 +3625,7 @@ static int i40e_vc_add_cloud_filter(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;int i, ret; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err_out; }
@@ -3708,7 +3734,7 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)i40e_status aq_ret =0 ;u64 speed =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
@@ -3824,7 +3850,7 @@ static int i40e_vc_del_qch_msg(struct i40e_vf *vf, u8 *msg)struct i40e_pf *pf = vf->pf;i40e_status aq_ret =0 ; -if (!test_bit (I40E_VF_STATE_ACTIVE , &vf->vf_states)) { +if (!i40e_sync_vf_state (vf,I40E_VF_STATE_ACTIVE )) { aq_ret =I40E_ERR_PARAM ; goto err; }
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +2 -0
@@ -18,6 +18,8 @@#define I40E_MAX_VF_PROMISC_FLAGS 3 +#define I40E_VF_STATE_WAIT_COUNT 20 +/* Various queue ctrls */ enum i40e_queue_ctrl {I40E_QUEUE_CTRL_UNKNOWN =0 ,
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH v2 4/5 i40e: Fix pre-set max number of queues for VF
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
After setting pre-set combined to 16 queues and reserving 16 queues by tc qdisc, pre-set maximum combined queues returned to default value after VF reset being 4 and this generated errors during removing tc. Fixed by removing clear num_req_queues before reset VF.
--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +0 -5
@@ -3823,11 +3823,6 @@ static int i40e_vc_add_qch_msg(struct i40e_vf *vf, u8 *msg)/* set this flag only after making sure all inputs are sane */ vf->adq_enabled = true; -/* num_req_queues is set when user changes number of queues via ethtool -* and this causes issue for default VSI(which depends on this variable) -* when ADq is enabled, hence reset it. -*/ - vf->num_req_queues =0 ;/* reset the VF in order to allocate resources */ i40e_vc_reset_vf (vf, true);
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH v2 5/5 i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc
In reply to Tony NguyenFrom: Norbert Zulinski <[email protected]>
When trying to dump VFs VSI RX/TX descriptors using debugfs there was a crash
due to NULL pointer dereference in i40e_dbg_dump_desc. Added a check to i40e_dbg_dump_desc that checks if VSI type is correct for dumping RX/TX descriptors.
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +8 -0
@@ -553,6 +553,14 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,dev_info (&pf->pdev->dev,"vsi %d not found\n" , vsi_seid);return ; } +if (vsi->type !=I40E_VSI_MAIN && + vsi->type !=I40E_VSI_FDIR && + vsi->type !=I40E_VSI_VMDQ2 ) { +dev_info (&pf->pdev->dev, +"vsi %d type %d descriptor rings not available\n" , + vsi_seid, vsi->type); +return ; + }if (type ==RING_TYPE_XDP && !i40e_enabled_xdp_vsi (vsi)) {dev_info (&pf->pdev->dev,"XDP not enabled on VSI %d\n" , vsi_seid);return ;
Signature · 1 line
2.31.1
This series was applied to netdev/net.git (master) by Tony Nguyen <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by Tony Nguyen <[email protected]>:
Quoted 8 lines · On Mon, 6 Dec 2021 10:35:14 -0800 you wrote:
This series contains updates to iavf and i40e drivers.
Mitch adds restoration of MSI state during reset for iavf.
Michal fixes checking and reporting of descriptor count changes to communicate changes and/or issues for iavf.
[...]
Here is the summary with links:
- [net,v2,1/5] iavf: restore MSI state on reset
https://git.kernel.org/netdev/net/c/7e4dcc13965c - [net,v2,2/5] iavf: Fix reporting when setting descriptor count https://git.kernel.org/netdev/net/c/1a1aa356ddf3 - [net,v2,3/5] i40e: Fix failed opcode appearing if handling messages from VF https://git.kernel.org/netdev/net/c/61125b8be85d - [net,v2,4/5] i40e: Fix pre-set max number of queues for VF https://git.kernel.org/netdev/net/c/8aa55ab422d9 - [net,v2,5/5] i40e: Fix NULL pointer dereference in i40e_dbg_dump_desc https://git.kernel.org/netdev/net/c/23ec111bf354
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html