Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19
@ 2021-02-19 21:35 Tony Nguyen
  2021-02-19 21:35 ` [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header) Tony Nguyen
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:35 UTC (permalink / raw)
  To: davem, kuba; +Cc: Tony Nguyen, netdev, sassmann

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.

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(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header)
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
@ 2021-02-19 21:35 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 2/8] i40e: Fix memory leak in i40e_probe Tony Nguyen
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:35 UTC (permalink / raw)
  To: davem, kuba
  Cc: Slawomir Laba, netdev, sassmann, anthony.l.nguyen,
	Przemyslaw Patynowski, Aleksandr Loktionov, Tony Brelinski

From: Slawomir Laba <slawomirx.laba@intel.com>

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.

Fixes: a3fd9d8876a5 ("i40e/i40evf: Handle IPv6 extension headers in checksum offload")
Signed-off-by: Slawomir Laba <slawomirx.laba@intel.com>
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 4aca637d4a23..32d97315f3f5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -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 */
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 2/8] i40e: Fix memory leak in i40e_probe
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
  2021-02-19 21:35 ` [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header) Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 3/8] i40e: Add zero-initialization of AQ command structures Tony Nguyen
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Keita Suzuki, netdev, sassmann, anthony.l.nguyen, Tony Brelinski

From: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>

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.

Signed-off-by: Keita Suzuki <keitasuzuki.park@sslab.ics.keio.ac.jp>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 1db482d310c2..84916261f5df 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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;
 		}
 	}
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 3/8] i40e: Add zero-initialization of AQ command structures
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
  2021-02-19 21:35 ` [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header) Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 2/8] i40e: Fix memory leak in i40e_probe Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 4/8] i40e: Fix overwriting flow control settings during driver loading Tony Nguyen
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mateusz Palczewski, netdev, sassmann, anthony.l.nguyen,
	Andrzej Sawuła, Arkadiusz Kubalewski, Aleksandr Loktionov,
	Tony Brelinski

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

Zero-initialize AQ command data structures to comply with
API specifications.

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Fixes: f4492db16df8 ("i40e: Add NPAR BW get and set functions")
Signed-off-by: Andrzej Sawuła <andrzej.sawula@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Arkadiusz Kubalewski <arkadiusz.kubalewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 84916261f5df..90c6c991aebc 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 4/8] i40e: Fix overwriting flow control settings during driver loading
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (2 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 3/8] i40e: Add zero-initialization of AQ command structures Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent Tony Nguyen
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mateusz Palczewski, netdev, sassmann, anthony.l.nguyen,
	Dawid Lukwinski, Aleksandr Loktionov, Tony Brelinski

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

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.

Fixes: 373149fc99a0 ("i40e: Decrease the scope of rtnl lock")
Signed-off-by: Dawid Lukwinski <dawid.lukwinski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 27 ---------------------
 1 file changed, 27 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 90c6c991aebc..53efb3a53df2 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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) {
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (3 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 4/8] i40e: Fix overwriting flow control settings during driver loading Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 6/8] i40e: Fix VFs not created Tony Nguyen
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mateusz Palczewski, netdev, sassmann, anthony.l.nguyen,
	Przemyslaw Patynowski, Sylwester Dziedziuch, Aleksandr Loktionov,
	Tony Brelinski

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

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.

Fixes: c65e78f87f81 ("i40e: Further implementation of LLDP")
Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 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(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 26ba1f3eb2d8..9e81f85ee2d8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -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;
 }
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 53efb3a53df2..3505d641660b 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 6/8] i40e: Fix VFs not created
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (4 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 7/8] i40e: Fix add TC filter for IPv6 Tony Nguyen
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Sylwester Dziedziuch, netdev, sassmann, anthony.l.nguyen,
	Konrad Jankowski

From: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>

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.

Fixes: a7542b876075 ("i40e: check __I40E_VF_DISABLE bit in i40e_sync_filters_subtask")
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Tested-by: Konrad Jankowski <konrad0.jankowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 3505d641660b..2e22ab5a0f9a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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);
 }
 
 /**
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 7/8] i40e: Fix add TC filter for IPv6
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (5 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 6/8] i40e: Fix VFs not created Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-19 21:36 ` [PATCH net v2 8/8] i40e: Fix endianness conversions Tony Nguyen
  2021-02-23  3:20 ` [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 patchwork-bot+netdevbpf
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Mateusz Palczewski, netdev, sassmann, anthony.l.nguyen,
	Grzegorz Szczurek, Jaroslaw Gawin, Tony Brelinski

From: Mateusz Palczewski <mateusz.palczewski@intel.com>

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.

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Signed-off-by: Grzegorz Szczurek <grzegorzx.szczurek@intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Reviewed-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2e22ab5a0f9a..3e4a4d6f0419 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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);
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net v2 8/8] i40e: Fix endianness conversions
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (6 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 7/8] i40e: Fix add TC filter for IPv6 Tony Nguyen
@ 2021-02-19 21:36 ` Tony Nguyen
  2021-02-23  3:20 ` [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 patchwork-bot+netdevbpf
  8 siblings, 0 replies; 10+ messages in thread
From: Tony Nguyen @ 2021-02-19 21:36 UTC (permalink / raw)
  To: davem, kuba
  Cc: Norbert Ciosek, netdev, sassmann, anthony.l.nguyen, Tony Brelinski

From: Norbert Ciosek <norbertx.ciosek@intel.com>

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

Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower")
Fixes: 2a508c64ad27 ("i40e: fix VLAN.TCI == 0 RX HW offload")
Fixes: 3106c580fb7c ("i40e: Use batched xsk Tx interfaces to increase performance")
Fixes: 8f88b3034db3 ("i40e: Add infrastructure for queue channel support")
Signed-off-by: Norbert Ciosek <norbertx.ciosek@intel.com>
Tested-by: Tony Brelinski <tonyx.brelinski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
 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(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 3e4a4d6f0419..4a2d03cada01 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -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));
 	}
 
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 32d97315f3f5..903d4e8cb0a1 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -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));
diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
index 492ce213208d..37a21fb99922 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
@@ -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);
 }
 
 /**
-- 
2.26.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19
  2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
                   ` (7 preceding siblings ...)
  2021-02-19 21:36 ` [PATCH net v2 8/8] i40e: Fix endianness conversions Tony Nguyen
@ 2021-02-23  3:20 ` patchwork-bot+netdevbpf
  8 siblings, 0 replies; 10+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-02-23  3:20 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: davem, kuba, netdev, sassmann

Hello:

This series was applied to netdev/net.git (refs/heads/master):

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, back to index

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 21:35 [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 Tony Nguyen
2021-02-19 21:35 ` [PATCH net v2 1/8] i40e: Fix flow for IPv6 next header (extension header) Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 2/8] i40e: Fix memory leak in i40e_probe Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 3/8] i40e: Add zero-initialization of AQ command structures Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 4/8] i40e: Fix overwriting flow control settings during driver loading Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 5/8] i40e: Fix addition of RX filters after enabling FW LLDP agent Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 6/8] i40e: Fix VFs not created Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 7/8] i40e: Fix add TC filter for IPv6 Tony Nguyen
2021-02-19 21:36 ` [PATCH net v2 8/8] i40e: Fix endianness conversions Tony Nguyen
2021-02-23  3:20 ` [PATCH net v2 0/8][pull request] Intel Wired LAN Driver Updates 2021-02-19 patchwork-bot+netdevbpf

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git