Intel Wired LAN Driver Updates 2021-11-19
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to iavf driver only.
Nitesh prevents user from changing interrupt settings when adaptive interrupt moderation is on.
Jedrzej resolves a hang that occurred when interface was closed while a reset was occurring and fixes statistics to be updated when requested to prevent stale values.
Brett adjusts driver to accommodate changes in supported VLAN features that could occur during reset and cause various errors to be reported.
The following are changes since commit 0f296e782f21dc1c55475a3c107ac68ab09cc1cf:
stmmac_pci: Fix underflow size in stmmac_rx
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
Brett Creeley (1):
iavf: Fix VLAN feature flags after VFR
Jedrzej Jagielski (2):
iavf: Fix deadlock occurrence during resetting VF interface
iavf: Fix refreshing iavf adapter stats on ethtool request
Nitesh B Venkatesh (1):
iavf: Prevent changing static ITR values if adaptive moderation is on
drivers/net/ethernet/intel/iavf/iavf.h | 3 + .../net/ethernet/intel/iavf/iavf_ethtool.c | 33 +++++++++-- drivers/net/ethernet/intel/iavf/iavf_main.c | 58 ++++++++++++------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 47 ++++++++++++++- 4 files changed, 112 insertions(+), 29 deletions(-)
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 1/4 iavf: Prevent changing static ITR values if adaptive moderation is on
From: Nitesh B Venkatesh <[email protected]>
Resolve being able to change static values on VF when adaptive interrupt moderation is enabled.
This problem is fixed by checking the interrupt settings is not a combination of change of static value while adaptive interrupt moderation is turned on.
Without this fix, the user would be able to change static values on VF with adaptive moderation enabled.
--- .../net/ethernet/intel/iavf/iavf_ethtool.c | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +26 -4
@@ -723,12 +723,31 @@ static int iavf_get_per_queue_coalesce(struct net_device *netdev, u32 queue,* * Change the ITR settings for a specific queue. **/ -static void iavf_set_itr_per_queue (struct iavf_adapter *adapter, -struct ethtool_coalesce *ec,int queue) +static int iavf_set_itr_per_queue (struct iavf_adapter *adapter, +struct ethtool_coalesce *ec,int queue) {struct iavf_ring *rx_ring = &adapter->rx_rings[queue];struct iavf_ring *tx_ring = &adapter->tx_rings[queue];struct iavf_q_vector *q_vector; +u16 itr_setting; + + itr_setting = rx_ring->itr_setting & ~IAVF_ITR_DYNAMIC ; + +if (ec->rx_coalesce_usecs != itr_setting && + ec->use_adaptive_rx_coalesce) { +netif_info (adapter, drv, adapter->netdev, +"Rx interrupt throttling cannot be changed if adaptive-rx is enabled\n" ); +return -EINVAL ; + } + + itr_setting = tx_ring->itr_setting & ~IAVF_ITR_DYNAMIC ; + +if (ec->tx_coalesce_usecs != itr_setting && + ec->use_adaptive_tx_coalesce) { +netif_info (adapter, drv, adapter->netdev, +"Tx interrupt throttling cannot be changed if adaptive-tx is enabled\n" ); +return -EINVAL ; + } rx_ring->itr_setting =ITR_REG_ALIGN (ec->rx_coalesce_usecs); tx_ring->itr_setting =ITR_REG_ALIGN (ec->tx_coalesce_usecs);
@@ -751,6 +770,7 @@ static void iavf_set_itr_per_queue(struct iavf_adapter *adapter,* the Tx and Rx ITR values based on the values we have entered * into the q_vector, no need to write the values now. */ +return 0 ; }/**
@@ -792,9 +812,11 @@ static int __iavf_set_coalesce(struct net_device *netdev,*/ if (queue <0 ) {for (i =0 ; i < adapter->num_active_queues; i++) -iavf_set_itr_per_queue (adapter, ec, i); +if (iavf_set_itr_per_queue (adapter, ec, i)) +return -EINVAL ; }else if (queue < adapter->num_active_queues) { -iavf_set_itr_per_queue (adapter, ec, queue); +if (iavf_set_itr_per_queue (adapter, ec, queue)) +return -EINVAL ; }else {netif_info (adapter, drv, netdev,"Invalid queue value, queue range is 0 - %d\n" , adapter->num_active_queues -1 );
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 2/4 iavf: Fix deadlock occurrence during resetting VF interface
In reply to Tony NguyenFrom: Jedrzej Jagielski <[email protected]>
System hangs if close the interface is called from the kernel during the interface is in resetting state.
During resetting operation the link is closing but kernel didn't know it and it tried to close this interface again what sometimes led to deadlock.
Inform kernel about current state of interface
and turn off the flag IFF_UP when interface is closing until reset is finished.
Previously it was most likely to hang the system when kernel (network manager) tried to close the interface in the same time when interface was in resetting state because of deadlock.
--- drivers/net/ethernet/intel/iavf/iavf_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/iavf/iavf_main.c +5 -2
@@ -2254,6 +2254,7 @@ static void iavf_reset_task(struct work_struct *work) (adapter->state == __IAVF_RESETTING));if (running) { + netdev->flags &= ~IFF_UP ;netif_carrier_off (netdev);netif_tx_stop_all_queues (netdev); adapter->link_up = false;
@@ -2365,7 +2366,7 @@ static void iavf_reset_task(struct work_struct *work)* to __IAVF_RUNNING */ iavf_up_complete (adapter); - + netdev->flags |=IFF_UP ;iavf_irq_enable (adapter, true); }else {iavf_change_state (adapter, __IAVF_DOWN);
@@ -2378,8 +2379,10 @@ static void iavf_reset_task(struct work_struct *work) reset_err:mutex_unlock (&adapter->client_lock);mutex_unlock (&adapter->crit_lock); -if (running) +if (running) {iavf_change_state (adapter, __IAVF_RUNNING); + netdev->flags |=IFF_UP ; + }dev_err (&adapter->pdev->dev,"failed to allocate resources during reinit\n" );iavf_close (netdev); }
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 3/4 iavf: Fix refreshing iavf adapter stats on ethtool request
In reply to Tony NguyenFrom: Jedrzej Jagielski <[email protected]>
Currently iavf adapter statistics are refreshed only in a watchdog task, triggered approximately every two seconds, which causes some ethtool requests to return outdated values.
Add explicit statistics refresh when requested by ethtool -S.
--- drivers/net/ethernet/intel/iavf/iavf.h | 2 ++ drivers/net/ethernet/intel/iavf/iavf_ethtool.c | 3 +++ drivers/net/ethernet/intel/iavf/iavf_main.c | 18 ++++++++++++++++++ .../net/ethernet/intel/iavf/iavf_virtchnl.c | 2 ++ 4 files changed, 25 insertions(+)
drivers/net/ethernet/intel/iavf/iavf.h +2 -0
@@ -305,6 +305,7 @@ struct iavf_adapter {#define IAVF_FLAG_AQ_DEL_FDIR_FILTER BIT(26)#define IAVF_FLAG_AQ_ADD_ADV_RSS_CFG BIT(27)#define IAVF_FLAG_AQ_DEL_ADV_RSS_CFG BIT(28) +#define IAVF_FLAG_AQ_REQUEST_STATS BIT(29)/* OS defined structs */ struct net_device *netdev;
@@ -444,6 +445,7 @@ int iavf_up(struct iavf_adapter *adapter);void iavf_down (struct iavf_adapter *adapter);int iavf_process_config (struct iavf_adapter *adapter);void iavf_schedule_reset (struct iavf_adapter *adapter); +void iavf_schedule_request_stats (struct iavf_adapter *adapter);void iavf_reset (struct iavf_adapter *adapter);void iavf_set_ethtool_ops (struct net_device *netdev);void iavf_update_stats (struct iavf_adapter *adapter);
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +3 -0
@@ -354,6 +354,9 @@ static void iavf_get_ethtool_stats(struct net_device *netdev,struct iavf_adapter *adapter =netdev_priv (netdev);unsigned int i; +/* Explicitly request stats refresh */ +iavf_schedule_request_stats (adapter); +iavf_add_ethtool_stats (&data, adapter, iavf_gstrings_stats);rcu_read_lock ();
drivers/net/ethernet/intel/iavf/iavf_main.c +18 -0
@@ -174,6 +174,19 @@ void iavf_schedule_reset(struct iavf_adapter *adapter) } } +/** +* iavf_schedule_request_stats - Set the flags and schedule statistics request +* @adapter: board private structure +* +* Sets IAVF_FLAG_AQ_REQUEST_STATS flag so iavf_watchdog_task() will explicitly +* request and refresh ethtool stats +**/ +void iavf_schedule_request_stats (struct iavf_adapter *adapter) +{ + adapter->aq_required |=IAVF_FLAG_AQ_REQUEST_STATS ; +mod_delayed_work (iavf_wq, &adapter->watchdog_task,0 ); +} +/** * iavf_tx_timeout - Respond to a Tx Hang * @netdev: network interface device structure
@@ -1709,6 +1722,11 @@ static int iavf_process_aq_command(struct iavf_adapter *adapter)iavf_del_adv_rss_cfg (adapter);return 0 ; } +if (adapter->aq_required &IAVF_FLAG_AQ_REQUEST_STATS ) { +iavf_request_stats (adapter); +return 0 ; + } +return -EAGAIN ; }
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +2 -0
@@ -784,6 +784,8 @@ void iavf_request_stats(struct iavf_adapter *adapter)/* no error message, this isn't crucial */ return ; } + + adapter->aq_required &= ~IAVF_FLAG_AQ_REQUEST_STATS ; adapter->current_op =VIRTCHNL_OP_GET_STATS ; vqs.vsi_id = adapter->vsi_res->vsi_id;/* queue maps are ignored for this message - only the vsi is used */
Signature · 1 line
2.31.1
Tony Nguyen
maintainerPATCH 4/4 iavf: Fix VLAN feature flags after VFR
In reply to Tony NguyenFrom: Brett Creeley <[email protected]>
When a VF goes through a reset, it's possible for the VF's feature set to change. For example it may lose the VIRTCHNL_VF_OFFLOAD_VLAN capability after VF reset. Unfortunately, the driver doesn't correctly deal with this situation and errors are seen from downing/upping the interface and/or moving the interface in/out of a network namespace.
When setting the interface down/up we see the following errors after the VIRTCHNL_VF_OFFLOAD_VLAN capability was taken away from the VF:
ice 0000:51:00.1: VF 1 failed opcode 12, retval: -64 iavf 0000:51:09.1:
Failed to add VLAN filter, error IAVF_NOT_SUPPORTED ice 0000:51:00.1: VF 1 failed opcode 13, retval: -64 iavf 0000:51:09.1: Failed to delete VLAN filter, error IAVF_NOT_SUPPORTED
These add/delete errors are happening because the VLAN filters are tracked internally to the driver and regardless of the VLAN_ALLOWED() setting the driver tries to delete/re-add them over virtchnl.
Fix the delete failure by making sure to delete any VLAN filter tracking in the driver when a removal request is made, while preventing the virtchnl request. This makes it so the driver's VLAN list is up to date and the errors are
Fix the add failure by making sure the check for VLAN_ALLOWED() during reset is done after the VF receives its capability list from the PF via VIRTCHNL_OP_GET_VF_RESOURCES. If VLAN functionality is not allowed, then prevent requesting re-adding the filters over virtchnl.
When moving the interface into a network namespace we see the following errors after the VIRTCHNL_VF_OFFLOAD_VLAN capability was taken away from the VF:
iavf 0000:51:09.1 enp81s0f1v1: NIC Link is Up Speed is 25 Gbps Full Duplex
iavf 0000:51:09.1 temp_27: renamed from enp81s0f1v1
iavf 0000:51:09.1 mgmt: renamed from temp_27
iavf 0000:51:09.1 dev27: set_features() failed (-22); wanted 0x020190001fd54833, left 0x020190001fd54bb3
These errors are happening because we aren't correctly updating the netdev capabilities and dealing with ndo_fix_features() and ndo_set_features() correctly.
Fix this by only reporting errors in the driver's ndo_set_features() callback when VIRTCHNL_VF_OFFLOAD_VLAN is not allowed and any attempt to enable the VLAN features is made. Also, make sure to disable VLAN insertion, filtering, and stripping since the VIRTCHNL_VF_OFFLOAD_VLAN flag applies to all of them and not just VLAN stripping.
Also, after we process the capabilities in the VF reset path, make sure to call netdev_update_features() in case the capabilities have changed in order to update the netdev's feature set to match the VF's actual capabilities.
Lastly, make sure to always report success on VLAN filter delete when VIRTCHNL_VF_OFFLOAD_VLAN is not supported. The changed flow in iavf_del_vlans() allows the stack to delete previosly existing VLAN filters even if VLAN filtering is not allowed. This makes it so the VLAN filter list is up to date.
--- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 33 ++++++-------- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 45 +++++++++++++++++-- 3 files changed, 56 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +1 -0
@@ -503,4 +503,5 @@ void iavf_add_adv_rss_cfg(struct iavf_adapter *adapter);void iavf_del_adv_rss_cfg (struct iavf_adapter *adapter);struct iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter,const u8 *macaddr); +int iavf_lock_timeout (struct mutex *lock,unsigned int msecs);#endif /* _IAVF_H_ */
drivers/net/ethernet/intel/iavf/iavf_main.c +13 -20
@@ -147,7 +147,7 @@ enum iavf_status iavf_free_virt_mem_d(struct iavf_hw *hw,* * Returns 0 on success, negative on failure **/ -static int iavf_lock_timeout (struct mutex *lock,unsigned int msecs) +int iavf_lock_timeout (struct mutex *lock,unsigned int msecs) {unsigned int wait, delay =10 ;
@@ -717,13 +717,11 @@ static void iavf_del_vlan(struct iavf_adapter *adapter, u16 vlan)**/ static void iavf_restore_filters (struct iavf_adapter *adapter) { -/* re-add all VLAN filters */ -if (VLAN_ALLOWED (adapter)) { -u16 vid; +u16 vid; -for_each_set_bit (vid, adapter->vsi.active_vlans,VLAN_N_VID ) -iavf_add_vlan (adapter, vid); - } +/* re-add all VLAN filters */ +for_each_set_bit (vid, adapter->vsi.active_vlans,VLAN_N_VID ) +iavf_add_vlan (adapter, vid); }/**
@@ -758,9 +756,6 @@ static int iavf_vlan_rx_kill_vid(struct net_device *netdev, {struct iavf_adapter *adapter =netdev_priv (netdev); -if (!VLAN_ALLOWED (adapter)) -return -EIO ; -iavf_del_vlan (adapter, vid);clear_bit (vid, adapter->vsi.active_vlans);
@@ -2191,7 +2186,6 @@ static void iavf_reset_task(struct work_struct *work)struct net_device *netdev = adapter->netdev;struct iavf_hw *hw = &adapter->hw;struct iavf_mac_filter *f, *ftmp; -struct iavf_vlan_filter *vlf;struct iavf_cloud_filter *cf;u32 reg_val;int i =0 , err;
@@ -2332,11 +2326,6 @@ static void iavf_reset_task(struct work_struct *work)list_for_each_entry (f, &adapter->mac_filter_list, list) { f->add = true; } -/* re-add all VLAN filters */ -list_for_each_entry (vlf, &adapter->vlan_filter_list, list) { - vlf->add = true; - } -spin_unlock_bh (&adapter->mac_vlan_list_lock);/* check if TCs are running and re-add all cloud filters */
@@ -2350,7 +2339,6 @@ static void iavf_reset_task(struct work_struct *work)spin_unlock_bh (&adapter->cloud_filter_list_lock); adapter->aq_required |=IAVF_FLAG_AQ_ADD_MAC_FILTER ; - adapter->aq_required |=IAVF_FLAG_AQ_ADD_VLAN_FILTER ; adapter->aq_required |=IAVF_FLAG_AQ_ADD_CLOUD_FILTER ;iavf_misc_irq_enable (adapter);
@@ -3462,11 +3450,16 @@ static int iavf_set_features(struct net_device *netdev, {struct iavf_adapter *adapter =netdev_priv (netdev); -/* Don't allow changing VLAN_RX flag when adapter is not capable -* of VLAN offload +/* Don't allow enabling VLAN features when adapter is not capable +* of VLAN offload/filtering */ if (!VLAN_ALLOWED (adapter)) { -if ((netdev->features ^ features) &NETIF_F_HW_VLAN_CTAG_RX ) + netdev->hw_features &= ~(NETIF_F_HW_VLAN_CTAG_RX | +NETIF_F_HW_VLAN_CTAG_TX | +NETIF_F_HW_VLAN_CTAG_FILTER ); +if (features & (NETIF_F_HW_VLAN_CTAG_RX | +NETIF_F_HW_VLAN_CTAG_TX | +NETIF_F_HW_VLAN_CTAG_FILTER ))return -EINVAL ; }else if ((netdev->features ^ features) &NETIF_F_HW_VLAN_CTAG_RX ) {if (features &NETIF_F_HW_VLAN_CTAG_RX )
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +42 -3
66 lines not on this page · raw message
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 10 lines · On Fri, 19 Nov 2021 10:12:39 -0800 you wrote:
This series contains updates to iavf driver only.
Nitesh prevents user from changing interrupt settings when adaptive interrupt moderation is on.
Jedrzej resolves a hang that occurred when interface was closed while a reset was occurring and fixes statistics to be updated when requested to prevent stale values.
[...]
Here is the summary with links:
- [net,1/4] iavf: Prevent changing static ITR values if adaptive moderation is on
https://git.kernel.org/netdev/net/c/e792779e6b63 - [net,2/4] iavf: Fix deadlock occurrence during resetting VF interface https://git.kernel.org/netdev/net/c/0cc318d2e840 - [net,3/4] iavf: Fix refreshing iavf adapter stats on ethtool request https://git.kernel.org/netdev/net/c/3b5bdd18eb76 - [net,4/4] iavf: Fix VLAN feature flags after VFR https://git.kernel.org/netdev/net/c/5951a2b9812d
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html