Intel Wired LAN Driver Updates 2021-02-19
Subsystems (3)
Tony Nguyen
maintainerThis series contains updates to i40e driver only.
Slawomir resolves an issue with the IPv6 extension headers being processed incorrectly.
Keita Suzuki fixes a memory leak on probe failure.
Mateusz initializes AQ command structures to zero to comply with spec, fixes FW flow control settings being overwritten and resolves an issue with adding VLAN filters after enabling FW LLDP. He also adds an additional check when adding TC filter as the current check doesn't properly distinguish between IPv4 and IPv6.
Sylwester removes setting disabled bit when syncing filters as this prevents VFs from completing setup.
Norbert cleans up sparse warnings.
v2:
- Fix fixes tag on patch 7
The following are changes since commit 3af409ca278d4a8d50e91f9f7c4c33b175645cf3:
net: enetc: fix destroyed phylink dereference during unbind
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 40GbE
Keita Suzuki (1):
i40e: Fix memory leak in i40e_probe
Mateusz Palczewski (4):
i40e: Add zero-initialization of AQ command structures
i40e: Fix overwriting flow control settings during driver loading
i40e: Fix addition of RX filters after enabling FW LLDP agent
i40e: Fix add TC filter for IPv6
Norbert Ciosek (1):
i40e: Fix endianness conversions
Slawomir Laba (1):
i40e: Fix flow for IPv6 next header (extension header)
Sylwester Dziedziuch (1):
i40e: Fix VFs not created
.../net/ethernet/intel/i40e/i40e_ethtool.c | 16 +++-- drivers/net/ethernet/intel/i40e/i40e_main.c | 64 +++++++------------ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 11 ++-- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +- 4 files changed, 39 insertions(+), 54 deletions(-)
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 1/8 i40e: Fix flow for IPv6 next header (extension header)
From: Slawomir Laba <[email protected]>
When a packet contains an IPv6 header with next header which is an extension header and not a protocol one, the kernel function skb_transport_header called with such sk_buff will return a pointer to the extension header and not to the TCP one.
The above explained call caused a problem with packet processing for skb with encapsulation for tunnel with I40E_TX_CTX_EXT_IP_IPV6. The extension header was not skipped at all.
The ipv6_skip_exthdr function does check if next header of the IPV6 header is an extension header and doesn't modify the l4_proto pointer if it points to a protocol header value so its safe to omit the comparison of exthdr and l4.hdr pointers. The ipv6_skip_exthdr can return value -1. This means that the skipping process failed and there is something wrong with the packet so it will be dropped.
--- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +6 -3
@@ -3113,13 +3113,16 @@ static int i40e_tx_enable_csum(struct sk_buff *skb, u32 *tx_flags, l4_proto = ip.v4->protocol; }else if (*tx_flags &I40E_TX_FLAGS_IPV6 ) { +int ret; + tunnel |=I40E_TX_CTX_EXT_IP_IPV6 ; exthdr = ip.hdr +sizeof (*ip.v6); l4_proto = ip.v6->nexthdr; -if (l4.hdr != exthdr) -ipv6_skip_exthdr (skb, exthdr - skb->data, - &l4_proto, &frag_off); + ret =ipv6_skip_exthdr (skb, exthdr - skb->data, + &l4_proto, &frag_off); +if (ret <0 ) +return -1 ; }/* define outer transport */
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 2/8 i40e: Fix memory leak in i40e_probe
In reply to Tony NguyenFrom: Keita Suzuki <[email protected]>
Struct i40e_veb is allocated in function i40e_setup_pf_switch, and stored to an array field veb inside struct i40e_pf. However when i40e_setup_misc_vector fails, this memory leaks.
Fix this by calling exit and teardown functions.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -0
@@ -15122,6 +15122,8 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (err) {dev_info (&pdev->dev,"setup of misc vector failed: %d\n" , err); +i40e_cloud_filter_exit (pf); +i40e_fdir_teardown (pf); goto err_vsis; } }
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 3/8 i40e: Add zero-initialization of AQ command structures
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
Zero-initialize AQ command data structures to comply with API specifications.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -0
@@ -7667,6 +7667,8 @@ int i40e_add_del_cloud_filter(struct i40e_vsi *vsi,if (filter->flags >=ARRAY_SIZE (flag_table))return I40E_ERR_CONFIG ; +memset (&cld_filter,0 ,sizeof (cld_filter)); +/* copy element needed to add cloud filter from filter */ i40e_set_cld_element (filter, &cld_filter);
@@ -7734,6 +7736,8 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi, !ipv6_addr_any(&filter->ip.v6.src_ip6))return -EOPNOTSUPP ; +memset (&cld_filter,0 ,sizeof (cld_filter)); +/* copy element needed to add cloud filter from filter */ i40e_set_cld_element (filter, &cld_filter.element);
@@ -11709,6 +11713,8 @@ i40e_status i40e_set_partition_bw_setting(struct i40e_pf *pf)struct i40e_aqc_configure_partition_bw_data bw_data;i40e_status status; +memset (&bw_data,0 ,sizeof (bw_data)); +/* Set the valid bit for this PF */ bw_data.pf_valid_bits =cpu_to_le16 (BIT (pf->hw.pf_id)); bw_data.max_bw[pf->hw.pf_id] = pf->max_bw &I40E_ALT_BW_VALUE_MASK ;
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 4/8 i40e: Fix overwriting flow control settings during driver loading
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
During driver loading flow control settings were written to FW using a variable which was always zero, since it was being set only by ethtool. This behavior has been corrected and driver no longer overwrites the default FW/NVM settings.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 27 --------------------- 1 file changed, 27 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -27
@@ -10005,7 +10005,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)int old_recovery_mode_bit =test_bit (__I40E_RECOVERY_MODE, pf->state);struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi];struct i40e_hw *hw = &pf->hw; -u8 set_fc_aq_fail =0 ;i40e_status ret;u32 val;int v;
@@ -10131,13 +10130,6 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)i40e_stat_str (&pf->hw, ret), i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status)); -/* make sure our flow control settings are restored */ - ret =i40e_set_fc (&pf->hw, &set_fc_aq_fail, true); -if (ret) -dev_dbg (&pf->pdev->dev,"setting flow control: ret = %s last_status = %s\n" , -i40e_stat_str (&pf->hw, ret), -i40e_aq_str (&pf->hw, pf->hw.aq.asq_last_status)); -/* Rebuild the VSIs and VEBs that existed before reset. * They are still in our local switch element arrays, so only * need to rebuild the switch model in the HW.
@@ -14720,7 +14712,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)int err;u32 val;u32 i; -u8 set_fc_aq_fail; err =pci_enable_device_mem (pdev);if (err)
@@ -15054,24 +15045,6 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }INIT_LIST_HEAD (&pf->vsi[pf->lan_vsi]->ch_list); -/* Make sure flow control is set according to current settings */ - err =i40e_set_fc (hw, &set_fc_aq_fail, true); -if (set_fc_aq_fail &I40E_SET_FC_AQ_FAIL_GET ) -dev_dbg (&pf->pdev->dev, -"Set fc with err %s aq_err %s on get_phy_cap\n" , -i40e_stat_str (hw, err), -i40e_aq_str (hw, hw->aq.asq_last_status)); -if (set_fc_aq_fail &I40E_SET_FC_AQ_FAIL_SET ) -dev_dbg (&pf->pdev->dev, -"Set fc with err %s aq_err %s on set_phy_config\n" , -i40e_stat_str (hw, err), -i40e_aq_str (hw, hw->aq.asq_last_status)); -if (set_fc_aq_fail &I40E_SET_FC_AQ_FAIL_UPDATE ) -dev_dbg (&pf->pdev->dev, -"Set fc with err %s aq_err %s on get_link_info\n" , -i40e_stat_str (hw, err), -i40e_aq_str (hw, hw->aq.asq_last_status)); -/* if FDIR VSI was set up, start it now */ for (i =0 ; i < pf->num_alloc_vsi; i++) {if (pf->vsi[i] && pf->vsi[i]->type ==I40E_VSI_FDIR ) {
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 5/8 i40e: Fix addition of RX filters after enabling FW LLDP agent
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
Fix addition of VLAN filter for PF after enabling FW LLDP agent. Changing LLDP Agent causes FW to re-initialize per NVM settings. Remove default PF filter and move "Enable/Disable" to currently used reset flag.
Without this patch PF would try to add MAC VLAN filter with default switch filter present. This causes AQ error and sets promiscuous mode on.
--- drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 16 +++++++++------- drivers/net/ethernet/intel/i40e/i40e_main.c | 9 ++++----- 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +9 -7
@@ -4878,7 +4878,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)enum i40e_admin_queue_err adq_err;struct i40e_vsi *vsi = np->vsi;struct i40e_pf *pf = vsi->back; -bool is_reset_needed; +u32 reset_needed =0 ;i40e_status status;u32 i, j;
@@ -4923,9 +4923,11 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags) flags_complete: changed_flags = orig_flags ^ new_flags; - is_reset_needed = !!(changed_flags & (I40E_FLAG_VEB_STATS_ENABLED | -I40E_FLAG_LEGACY_RX |I40E_FLAG_SOURCE_PRUNING_DISABLED | -I40E_FLAG_DISABLE_FW_LLDP )); +if (changed_flags &I40E_FLAG_DISABLE_FW_LLDP ) + reset_needed =I40E_PF_RESET_AND_REBUILD_FLAG ; +if (changed_flags & (I40E_FLAG_VEB_STATS_ENABLED | +I40E_FLAG_LEGACY_RX |I40E_FLAG_SOURCE_PRUNING_DISABLED )) + reset_needed =BIT (__I40E_PF_RESET_REQUESTED);/* Before we finalize any flag changes, we need to perform some * checks to ensure that the changes are supported and safe.
@@ -5057,7 +5059,7 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)case I40E_AQ_RC_EEXIST :dev_warn (&pf->pdev->dev,"FW LLDP agent is already running\n" ); - is_reset_needed = false; + reset_needed =0 ;break ;case I40E_AQ_RC_EPERM : dev_warn(&pf->pdev->dev,
@@ -5086,8 +5088,8 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)/* Issue reset to cause things to take effect, as additional bits * are added we will need to create a mask of bits requiring reset */ -if (is_reset_needed) -i40e_do_reset (pf,BIT (__I40E_PF_RESET_REQUESTED), true); +if (reset_needed) +i40e_do_reset (pf, reset_needed, true);return 0 ; }
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -5
@@ -8537,11 +8537,6 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired)dev_dbg (&pf->pdev->dev,"PFR requested\n" );i40e_handle_reset_warning (pf, lock_acquired); -dev_info (&pf->pdev->dev, - pf->flags &I40E_FLAG_DISABLE_FW_LLDP ? -"FW LLDP is disabled\n" : -"FW LLDP is enabled\n" ); - }else if (reset_flags &I40E_PF_RESET_AND_REBUILD_FLAG ) {/* Request a PF Reset *
@@ -8549,6 +8544,10 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags, bool lock_acquired)*/ i40e_prep_for_reset (pf, lock_acquired);i40e_reset_and_rebuild (pf, true, lock_acquired); +dev_info (&pf->pdev->dev, + pf->flags &I40E_FLAG_DISABLE_FW_LLDP ? +"FW LLDP is disabled\n" : +"FW LLDP is enabled\n" ); }else if (reset_flags &BIT_ULL (__I40E_REINIT_REQUESTED)) {int v;
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 6/8 i40e: Fix VFs not created
In reply to Tony NguyenFrom: Sylwester Dziedziuch <[email protected]>
When creating VFs they were sometimes not getting resources. It was caused by not executing i40e_reset_all_vfs due to flag __I40E_VF_DISABLE being set on PF. Because of this IAVF was never able to finish setup sequence never getting reset indication from PF.
Changed test_and_set_bit __I40E_VF_DISABLE in i40e_sync_filters_subtask to test_bit and removed clear_bit. This function should not set this bit it should only check if it hasn't been already set.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -2
@@ -2616,7 +2616,7 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf)return ;if (!test_and_clear_bit (__I40E_MACVLAN_SYNC_PENDING, pf->state))return ; -if (test_and_set_bit (__I40E_VF_DISABLE, pf->state)) { +if (test_bit (__I40E_VF_DISABLE, pf->state)) {set_bit (__I40E_MACVLAN_SYNC_PENDING, pf->state);return ; }
@@ -2634,7 +2634,6 @@ static void i40e_sync_filters_subtask(struct i40e_pf *pf) } } } -clear_bit (__I40E_VF_DISABLE, pf->state); }/**
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 7/8 i40e: Fix add TC filter for IPv6
In reply to Tony NguyenFrom: Mateusz Palczewski <[email protected]>
Fix insufficient distinction between IPv4 and IPv6 addresses when creating a filter.
IPv4 and IPv6 are kept in the same memory area. If IPv6 is added, then it's caught by IPv4 check, which leads to err -95.
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -2
@@ -7731,7 +7731,8 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,return -EOPNOTSUPP ;/* adding filter using src_port/src_ip is not supported at this stage */ -if (filter->src_port || filter->src_ipv4 || +if (filter->src_port || + (filter->src_ipv4 && filter->n_proto !=ETH_P_IPV6 ) || !ipv6_addr_any (&filter->ip.v6.src_ip6))return -EOPNOTSUPP ;
@@ -7760,7 +7761,7 @@ int i40e_add_del_cloud_filter_big_buf(struct i40e_vsi *vsi,cpu_to_le16 (I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT ); } - }else if (filter->dst_ipv4 || + }else if ((filter->dst_ipv4 && filter->n_proto !=ETH_P_IPV6 ) || !ipv6_addr_any (&filter->ip.v6.dst_ip6)) { cld_filter.element.flags =cpu_to_le16 (I40E_AQC_ADD_CLOUD_FILTER_IP_PORT );
Signature · 1 line
2.26.2
Tony Nguyen
maintainerPATCH v2 8/8 i40e: Fix endianness conversions
In reply to Tony NguyenFrom: Norbert Ciosek <[email protected]>
Fixes the following sparse warnings:
i40e_main.c:5953:32: warning: cast from restricted __le16 i40e_main.c:8008:29: warning: incorrect type in assignment (different base types)
i40e_main.c:8008:29: expected unsigned int [assigned] [usertype] ipa
i40e_main.c:8008:29: got restricted __le32 [usertype]
i40e_main.c:8008:29: warning: incorrect type in assignment (different base types)
i40e_main.c:8008:29: expected unsigned int [assigned] [usertype] ipa
i40e_main.c:8008:29: got restricted __le32 [usertype]
i40e_txrx.c:1950:59: warning: incorrect type in initializer (different base types)
i40e_txrx.c:1950:59: expected unsigned short [usertype] vlan_tag
i40e_txrx.c:1950:59: got restricted __le16 [usertype] l2tag1
i40e_txrx.c:1953:40: warning: cast to restricted __le16 i40e_xsk.c:448:38: warning: invalid assignment: |=
i40e_xsk.c:448:38: left side has type restricted __le64
i40e_xsk.c:448:38: right side has type int
--- drivers/net/ethernet/intel/i40e/i40e_main.c | 12 ++++++------ drivers/net/ethernet/intel/i40e/i40e_txrx.c | 2 +- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -6
@@ -5920,7 +5920,7 @@ static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid, ch->enabled_tc = !i40e_is_channel_macvlan (ch) && enabled_tc; ch->seid = ctxt.seid; ch->vsi_number = ctxt.vsi_number; - ch->stat_counter_idx =cpu_to_le16 (ctxt.info.stat_counter_idx); + ch->stat_counter_idx =le16_to_cpu (ctxt.info.stat_counter_idx);/* copy just the sections touched not the entire info * since not all sections are valid as returned by
@@ -7599,8 +7599,8 @@ static inline void i40e_set_cld_element(struct i40e_cloud_filter *filter, struct i40e_aqc_cloud_filters_element_data *cld) { - int i, j; u32 ipa; +int i;memset (cld,0 ,sizeof (*cld));ether_addr_copy (cld->outer_mac, filter->dst_mac);
@@ -7611,14 +7611,14 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter,if (filter->n_proto ==ETH_P_IPV6 ) {#define IPV6_MAX_INDEX (ARRAY_SIZE(filter->dst_ipv6) - 1) -for (i =0 , j =0 ; i <ARRAY_SIZE (filter->dst_ipv6); - i++, j +=2 ) { +for (i =0 ; i <ARRAY_SIZE (filter->dst_ipv6); i++) { ipa =be32_to_cpu (filter->dst_ipv6[IPV6_MAX_INDEX - i]); - ipa =cpu_to_le32 (ipa); -memcpy (&cld->ipaddr.raw_v6.data[j], &ipa,sizeof (ipa)); + + *(__le32 *)&cld->ipaddr.raw_v6.data[i *2 ] =cpu_to_le32 (ipa); } }else { ipa =be32_to_cpu (filter->dst_ipv4); +memcpy (&cld->ipaddr.v4.data, &ipa,sizeof (ipa)); }
drivers/net/ethernet/intel/i40e/i40e_txrx.c +1 -1
@@ -1793,7 +1793,7 @@ void i40e_process_skb_fields(struct i40e_ring *rx_ring,skb_record_rx_queue (skb, rx_ring->queue_index);if (qword &BIT (I40E_RX_DESC_STATUS_L2TAG1P_SHIFT )) { -u16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1; +__le16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;__vlan_hwaccel_put_tag (skb,htons (ETH_P_8021Q ),le16_to_cpu (vlan_tag));
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -1
@@ -444,7 +444,7 @@ static void i40e_set_rs_bit(struct i40e_ring *xdp_ring)struct i40e_tx_desc *tx_desc; tx_desc =I40E_TX_DESC (xdp_ring, ntu); - tx_desc->cmd_type_offset_bsz |= (I40E_TX_DESC_CMD_RS <<I40E_TXD_QW1_CMD_SHIFT ); + tx_desc->cmd_type_offset_bsz |=cpu_to_le64 (I40E_TX_DESC_CMD_RS <<I40E_TXD_QW1_CMD_SHIFT ); }/**
Signature · 1 line
2.26.2
This series was applied to netdev/net.git (refs/heads/master):
Hello:
This series was applied to netdev/net.git (refs/heads/master):
Quoted 8 lines · On Fri, 19 Feb 2021 13:35:58 -0800 you wrote:
This series contains updates to i40e driver only.
Slawomir resolves an issue with the IPv6 extension headers being processed incorrectly.
Keita Suzuki fixes a memory leak on probe failure.
[...]
Here is the summary with links:
- [net,v2,1/8] i40e: Fix flow for IPv6 next header (extension header)
https://git.kernel.org/netdev/net/c/92c6058024e8 - [net,v2,2/8] i40e: Fix memory leak in i40e_probe https://git.kernel.org/netdev/net/c/58cab46c622d - [net,v2,3/8] i40e: Add zero-initialization of AQ command structures https://git.kernel.org/netdev/net/c/d2c788f739b6 - [net,v2,4/8] i40e: Fix overwriting flow control settings during driver loading https://git.kernel.org/netdev/net/c/4cdb9f80dcd4 - [net,v2,5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent https://git.kernel.org/netdev/net/c/28b1208e7a7f - [net,v2,6/8] i40e: Fix VFs not created https://git.kernel.org/netdev/net/c/dc8812626440 - [net,v2,7/8] i40e: Fix add TC filter for IPv6 https://git.kernel.org/netdev/net/c/61c1e0eb8375 - [net,v2,8/8] i40e: Fix endianness conversions https://git.kernel.org/netdev/net/c/b32cddd2247c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html