Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Bimmy Pujari 4 participants 20 messages Jul 25, 2016 – Jul 26, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover i40e/i40evf updates

Akeem G Abodunrin adds code to increase minimum number of allocated VSI.

Anjali Singhai Jain fixes a bug where a client close can be called before an open is complete.

Avinash Dayanand adds code to force register writes to mitigate sync issues with iwarp VF driver & adds code to not notify client of VF reset during VF creation.

Alan Brady fixes lookup table when RSS disabled/enabled.

Carolyn Wyborny adds code to allow RSS Hash set with less than four parameters.

Catherine Sullivan adds code to reset vlan filter count when resetting and adds code to reset RX csum error stat with other pf stats.

Dave Ertman fixes static analysis tool warning.

Jacob Keller adds code for missing rtnl_lock() around i40evf_set_interrupt_ capability and adds code to not allow reduction of channels below active FD rules.

Mitch Williams fixes memory leak.

 drivers/net/ethernet/intel/i40e/i40e.h             |   5 +-
 drivers/net/ethernet/intel/i40e/i40e_client.c      |   5 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     | 232 ++++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  33 ++-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |   9 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |   4 +-
 6 files changed, 199 insertions(+), 89 deletions(-)
Signature · 1 line
2.4.11
#1 lore raw

PATCH 1/13 i40e: Fix a bug where a client close can be called before an open is complete

From: Anjali Singhai Jain <[email protected]>

The client->open call in this path was not protected with the client instance mutex. And hence the client->close can get initiated before the open completes.

Change-Id I0ed60c38868dd3f44966b6ed49a063d0e5b7edf5
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_client.c +2 -0
index a3d6bb4..e8d9e47 100644
@@ -561,6 +561,7 @@ void i40e_client_subtask(struct i40e_pf *pf)
 				 pf->hw.bus.device, pf->hw.bus.func);
 		}
 
+		mutex_lock(&i40e_client_instance_mutex);
 		/* Send an Open request to the client */
 		atomic_inc(&cdev->ref_cnt);
 		if (client->ops && client->ops->open)
@@ -574,6 +575,7 @@ void i40e_client_subtask(struct i40e_pf *pf)
 			atomic_dec(&client->ref_cnt);
 			continue;
 		}
+		mutex_unlock(&i40e_client_instance_mutex);
 	}
 	mutex_unlock(&i40e_client_mutex);
 }
Signature · 1 line
2.4.11
#2 lore raw

PATCH 1/13 i40e: Fix a bug where a client close can be called before an open is complete

Quoted 11 lines · Bimmy Pujari

From: Anjali Singhai Jain <[email protected]>

The client->open call in this path was not protected with the client instance mutex. And hence the client->close can get initiated before the open completes.

Change-Id I0ed60c38868dd3f44966b6ed49a063d0e5b7edf5

---
?drivers/net/ethernet/intel/i40e/i40e_client.c | 2 ++ ?1 file changed, 2 insertions(+)

This does not apply cleanly to the current net-next tree. ?It appears that
this series was based on an old/stale version of my next-queue branch. ?So
I am dropping the series, please update/rebase your series to my current
next-queue branch and resubmit.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160726/dab9ffb0/attachment.asc>

#3 lore raw

PATCH 2/13 i40e/i40evf: Reset vlan filter count when resetting

In reply to Bimmy Pujari

From: Catherine Sullivan <[email protected]>

When we do a reset, all the vlan filters get added again. Therefore we also want to reset the vlan count to 0 or we quickly run out of filters.

Change-ID I459f26851e22204dc8b8999928ad87cde8170119

---
Testing Hints: Make sure that you don't run out of filters when doing multiple resets.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -0
index 6fcbf76..0fa050a 100644
@@ -992,6 +992,7 @@ complete_reset:
 		set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
 		clear_bit(I40E_VF_STAT_DISABLED, &vf->vf_states);
 		i40e_notify_client_of_vf_reset(pf, abs_vf_id);
+		vf->num_vlan = 0;
 	}
 	/* tell the VF the reset is done */
 	wr32(hw, I40E_VFGEN_RSTAT1(vf->vf_id), I40E_VFR_VFACTIVE);
Signature · 1 line
2.4.11
#4 lore raw

PATCH 3/13 i40e: reset RX csum error stat with other pf stats

In reply to Bimmy Pujari

From: Catherine Sullivan <[email protected]>

When we are resetting the pf stats we should also reset the RX csum error stat.

Change-ID I7af5ee0ec81a10f6deee1a7b8c2082ea068ef620

---
Testing Hints: Make sure the port.rx_csum_bad stat resets in ethtool after a pfr.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
index faebadf..b6f9b11 100644
@@ -527,6 +527,7 @@ void i40e_pf_reset_stats(struct i40e_pf *pf)
 			pf->veb[i]->stat_offsets_loaded = false;
 		}
 	}
+	pf->hw_csum_rx_error = 0;
 }
 
 /**
Signature · 1 line
2.4.11
#5 lore raw

PATCH 4/13 i40evf: add missing rtnl_lock() around i40evf_set_interrupt_capability

In reply to Bimmy Pujari

From: Jacob Keller <[email protected]>

The function calls netif_set_real_num_(tx|rx)_queues, both of which should be done only under rntl lock. Unfortunately the i40evf_init_task did not hold the rtnl_lock as necessary. This patch adds the locking needed.

Change-ID Ib72a21c3ce22b71a226b16f9bbe0f5f8cc3e849b
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +2 -0
index 9aa3342..eaadeef 100644
@@ -1420,7 +1420,9 @@ int i40evf_init_interrupt_scheme(struct i40evf_adapter *adapter)
 {
 	int err;
 
+	rtnl_lock();
 	err = i40evf_set_interrupt_capability(adapter);
+	rtnl_unlock();
 	if (err) {
 		dev_err(&adapter->pdev->dev,
 			"Unable to setup interrupt capabilities\n");
Signature · 1 line
2.4.11
#6 lore raw

PATCH 5/13 i40e: Increase minimum number of allocated VSI

In reply to Bimmy Pujari

From: Akeem G Abodunrin <[email protected]>

This patch increases minimum number of allocated VSIs, so as to resolve failure adding VSI for VF when 64-VFs assigned to a PF. The driver supports up to 128 VFs per device, users can decide to enable up to 64-VFs on a single PF, especially 2 X 40 devices. In that scenario, with VMDq co-existence, there would be starvation of VSIs - with this patch, supported features would have enough VSIs for configuration now.

Change-ID If084f4cd823667af8fe7fdc11489c705b32039d5
---
 drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
index 2a88291..06e1835 100644
@@ -74,7 +74,7 @@
 #define I40E_MIN_NUM_DESCRIPTORS      64
 #define I40E_MIN_MSIX                 2
 #define I40E_DEFAULT_NUM_VMDQ_VSI     8 /* max 256 VSIs */
-#define I40E_MIN_VSI_ALLOC            51 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ */
+#define I40E_MIN_VSI_ALLOC            83 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ */
 /* max 16 qps */
 #define i40e_default_queues_per_vmdq(pf) \
 		(((pf)->flags & I40E_FLAG_RSS_AQ_CAPABLE) ? 4 : 1)
Signature · 1 line
2.4.11
#7 lore raw

PATCH 5/13 i40e: Increase minimum number of allocated VSI

Quoted 20 lines · Bimmy Pujari

From: Akeem G Abodunrin <[email protected]>

This patch increases minimum number of allocated VSIs, so as to resolve failure adding VSI for VF when 64-VFs assigned to a PF. The driver supports up to 128 VFs per device, users can decide to enable up to 64-VFs on a single PF, especially 2 X 40 devices. In that scenario, with VMDq co-existence, there would be starvation of VSIs - with this patch, supported features would have enough VSIs for configuration now.

Change-ID If084f4cd823667af8fe7fdc11489c705b32039d5
---
  drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -0
index 2a88291..06e1835 100644

drivers/net/ethernet/intel/i40e/i40e.h line 77

Quoted 5 lines
drivers/net/ethernet/intel/i40e/i40e.h +1 -1
@@ -74,7 +74,7 @@
  #define I40E_MIN_NUM_DESCRIPTORS      64
  #define I40E_MIN_MSIX                 2
  #define I40E_DEFAULT_NUM_VMDQ_VSI     8 /* max 256 VSIs */
-#define I40E_MIN_VSI_ALLOC            51 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ */
+#define I40E_MIN_VSI_ALLOC            83 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ */

You should update the comment here to reflect 64 VFs.

Since VMDq is not really supported, perhaps you can remove those 16 from this calculation?

sln

Quoted 3 lines
drivers/net/ethernet/intel/i40e/i40e.h +0 -0
  /* max 16 qps */
  #define i40e_default_queues_per_vmdq(pf) \
  		(((pf)->flags & I40E_FLAG_RSS_AQ_CAPABLE) ? 4 : 1)
#8 lore raw

PATCH 5/13 i40e: Increase minimum number of allocated VSI

Thanks Shannon!

Sure, we might not need to mention VMDq for upstream, Linux patch - since VMDq is not supported. Yes, original patch contains comment about 64 VFs, not sure how it got lost on the way here...

Regards,
~Akeem

Quoted 51 lines

-----Original Message-----
From: Shannon Nelson [mailto:sln at onemain.com]
Sent: Monday, July 25, 2016 4:47 PM
To: Pujari, Bimmy <[email protected]>; intel-wired-lan at lists.osuosl.org
Cc: Abodunrin, Akeem G <[email protected]>
Subject: Re: [Intel-wired-lan] [next PATCH S40 05/13] i40e: Increase minimum number of allocated VSI

Quoted 8 lines · Bimmy Pujari

From: Akeem G Abodunrin <[email protected]>

This patch increases minimum number of allocated VSIs, so as to resolve failure adding VSI for VF when 64-VFs assigned to a PF. The driver supports up to 128 VFs per device, users can decide to enable up to 64-VFs on a single PF, especially 2 X 40 devices. In that scenario, with VMDq co-existence, there would be starvation of VSIs - with this patch, supported features would have enough VSIs for configuration

now.

Quoted 13 lines
Change-ID If084f4cd823667af8fe7fdc11489c705b32039d5
---
  drivers/net/ethernet/intel/i40e/i40e.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -0
index 2a88291..06e1835 100644

drivers/net/ethernet/intel/i40e/i40e.h line 77

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e.h +0 -1
@@ -74,7 +74,7 @@
  #define I40E_MIN_NUM_DESCRIPTORS      64
  #define I40E_MIN_MSIX                 2
  #define I40E_DEFAULT_NUM_VMDQ_VSI     8 /* max 256 VSIs */
-#define I40E_MIN_VSI_ALLOC            51 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ

*/

drivers/net/ethernet/intel/i40e/i40e.h line 77

Quoted 1 line
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
+#define I40E_MIN_VSI_ALLOC            83 /* LAN, ATR, FCOE, 32 VF, 16 VMDQ

*/

You should update the comment here to reflect 64 VFs.

Since VMDq is not really supported, perhaps you can remove those 16 from this calculation?

sln

Quoted 3 lines
drivers/net/ethernet/intel/i40e/i40e.h +0 -0
  /* max 16 qps */
  #define i40e_default_queues_per_vmdq(pf) \
  		(((pf)->flags & I40E_FLAG_RSS_AQ_CAPABLE) ? 4 : 1)
#9 lore raw

PATCH 6/13 i40e: Fix static analysis tool warning

In reply to Bimmy Pujari

From: Dave Ertman <[email protected]>

This patch fixes a problem where a static analysis tool generates a warning for "INVARIANT_CONDITION: Expression 'enabled_tc' used in the condition always yields the same result."

Without this patch, the driver will not pass the static analysis tool checks without generating warnings.

This patch fixes the problem by eliminating the irrelevant check and redundant assignment for the value of enabled_tc.

Change-ID Ia7d44cb050f507df7de333e96369d322e08bf408
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -2
index b6f9b11..c130149 100644
@@ -4608,8 +4608,6 @@ static u8 i40e_pf_get_num_tc(struct i40e_pf *pf)
 	else
 		return 1; /* Only TC0 */
 
-	/* At least have TC0 */
-	enabled_tc = (enabled_tc ? enabled_tc : 0x1);
 	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
 		if (enabled_tc & BIT(i))
 			num_tc++;
Signature · 1 line
2.4.11
#10 lore raw

PATCH 6/13 i40e: Fix static analysis tool warning

Quoted 8 lines · Bimmy Pujari

From: Dave Ertman <[email protected]>

This patch fixes a problem where a static analysis tool generates a warning for "INVARIANT_CONDITION: Expression 'enabled_tc' used in the condition always yields the same result."

Without this patch, the driver will not pass the static analysis tool checks without generating warnings.

That checker is obviously seeing that i40e_get_iscsi_tc_map() is defaulting the map to 0x1 which I believe wasn't the case when this was first written. If that is ever changed it could now cause a bug here. You might default enabled_tc here in i40e_pf_get_num_tc() just to be sure there's no problem in the future.

sln

Quoted 23 lines

This patch fixes the problem by eliminating the irrelevant check and redundant assignment for the value of enabled_tc.

Change-ID Ia7d44cb050f507df7de333e96369d322e08bf408
---
  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 --
  1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -2
index b6f9b11..c130149 100644
@@ -4608,8 +4608,6 @@ static u8 i40e_pf_get_num_tc(struct i40e_pf *pf)
  	else
  		return 1; /* Only TC0 */
 
-	/* At least have TC0 */
-	enabled_tc = (enabled_tc ? enabled_tc : 0x1);
  	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) {
  		if (enabled_tc & BIT(i))
  			num_tc++;
#11 lore raw

PATCH 7/13 i40e: don't allow reduction of channels below active FD rules

In reply to Bimmy Pujari

From: Jacob Keller <[email protected]>

If a driver is unable to maintain all current user supplied settings from ethtool (or other sources), it is not ok for a user request to succeed and silently trample over previous configuration.

To that end, if you change the number of channels, it must not be allowed to reduce the number of channels (queues) below the current flow director filter rules targets. In this case, return -EINVAL when a request to reduce the number of channels would do so. In addition log a warning to the kernel buffer explaining why we failed, and report the rules which prevent us from lowering the number of channels.

Change-ID If41464d63d7aab11cedf09e4f3aa1a69e21ffd88
---
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +24 -0
index c912e04..a49552f 100644
@@ -2744,11 +2744,15 @@ static void i40e_get_channels(struct net_device *dev,
 static int i40e_set_channels(struct net_device *dev,
 			      struct ethtool_channels *ch)
 {
+	const u8 drop = I40E_FILTER_PROGRAM_DESC_DEST_DROP_PACKET;
 	struct i40e_netdev_priv *np = netdev_priv(dev);
 	unsigned int count = ch->combined_count;
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
+	struct i40e_fdir_filter *rule;
+	struct hlist_node *node2;
 	int new_count;
+	int err = 0;
 
 	/* We do not support setting channels for any other VSI at present */
 	if (vsi->type != I40E_VSI_MAIN)
@@ -2766,6 +2770,26 @@ static int i40e_set_channels(struct net_device *dev,
 	if (count > i40e_max_channels(vsi))
 		return -EINVAL;
 
+	/* verify that the number of channels does not invalidate any current
+	 * flow director rules
+	 */
+	hlist_for_each_entry_safe(rule, node2,
+				  &pf->fdir_filter_list, fdir_node) {
+		if (rule->dest_ctl != drop && count <= rule->q_index) {
+			dev_warn(&pf->pdev->dev,
+				 "Existing user defined filter %d assigns flow to queue %d\n",
+				 rule->fd_id, rule->q_index);
+			err = -EINVAL;
+		}
+	}
+
+	if (err) {
+		dev_err(&pf->pdev->dev,
+			"Existing filter rules must be deleted to reduce combined channel count to %d\n",
+			count);
+		return err;
+	}
+
 	/* update feature limits from largest to smallest supported values */
 	/* TODO: Flow director limit, DCB etc */
 
Signature · 1 line
2.4.11
#12 lore raw

PATCH 8/13 i40e: Force register writes to mitigate sync issues with iwarp VF driver

In reply to Bimmy Pujari

From: Avinash Dayanand <[email protected]>

This patch is a fix for the bug i.e. unable to create iwarp device in VF. This is a sync issue and the iwarp device open is called even before the PCI register writes are done.

Forcing the PCI register writes to happen just before it exits the function.

Change-ID I60c6a2c709da89e845f2764cc50ce8b7373c8c44
---
 drivers/net/ethernet/intel/i40e/i40e_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_client.c +2 -1
index e8d9e47..cc7403a 100644
@@ -815,7 +815,8 @@ static int i40e_client_setup_qvlist(struct i40e_info *ldev,
 			wr32(hw, I40E_PFINT_AEQCTL, reg);
 		}
 	}
-
+	/* Mitigate sync problems with iwarp VF driver */
+	i40e_flush(hw);
 	return 0;
 err:
 	kfree(ldev->qvlist_info);
Signature · 1 line
2.4.11
#13 lore raw

PATCH 9/13 i40e: Don't notify client of VF reset during VF creation

In reply to Bimmy Pujari

From: Avinash Dayanand <[email protected]>

VF goes through reset path during VF creation which happens to also have notification of VF reset to client. Adding conditional check to avoid wrongly notifying VF reset during VF creation.

Also changing the call order of VF enable, calling it after VF creation rather than before.

Change-ID I96eabd99deae746a2f0fc465194c886f196178ce
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +5 -2
index 0fa050a..5ea659c 100644
@@ -991,7 +991,9 @@ complete_reset:
 		i40e_enable_vf_mappings(vf);
 		set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
 		clear_bit(I40E_VF_STAT_DISABLED, &vf->vf_states);
-		i40e_notify_client_of_vf_reset(pf, abs_vf_id);
+		/* Do not notify the client during VF init */
+		if (vf->pf->num_alloc_vfs)
+			i40e_notify_client_of_vf_reset(pf, abs_vf_id);
 		vf->num_vlan = 0;
 	}
 	/* tell the VF the reset is done */
@@ -1090,7 +1092,6 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 			goto err_iov;
 		}
 	}
-	i40e_notify_client_of_vf_enable(pf, num_alloc_vfs);
 	/* allocate memory */
 	vfs = kcalloc(num_alloc_vfs, sizeof(struct i40e_vf), GFP_KERNEL);
 	if (!vfs) {
@@ -1114,6 +1115,8 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)
 	}
 	pf->num_alloc_vfs = num_alloc_vfs;
 
+	i40e_notify_client_of_vf_enable(pf, num_alloc_vfs);
+
 err_alloc:
 	if (ret)
 		i40e_free_vfs(pf);
Signature · 1 line
2.4.11
#14 lore raw

PATCH 10/13 i40e: fix lookup table when RSS disabled/enabled

In reply to Bimmy Pujari

From: "Alan, Brady" <[email protected]>

This patch fixes the bug which causes RSS to continue to work after being disabled. After disabling RSS, traffic would continue to be assigned to different queues instead of falling back to a single queue. Without this patch, attempting to disable RSS would not work as expected. This patch fixes the bug by clearing the lookup table used by RSS such that all traffic is assigned to a single queue. This patch also addresses the issue of reinstating
the lookup table should RSS then be re-enabled.

Change-ID Ib20c7c6a7e9f1f772bb787370f8a8c664796b141
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +28 -0
index c130149..a33e902 100644
@@ -8658,6 +8658,28 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)
 }
 
 /**
+ * i40e_clear_rss_lut - clear the rx hash lookup table
+ * @vsi: the VSI being configured
+ **/
+static void i40e_clear_rss_lut(struct i40e_vsi *vsi)
+{
+	struct i40e_pf *pf = vsi->back;
+	struct i40e_hw *hw = &pf->hw;
+	u16 vf_id = vsi->vf_id;
+	u8 i;
+
+	if (vsi->type == I40E_VSI_MAIN) {
+		for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++)
+			wr32(hw, I40E_PFQF_HLUT(i), 0);
+	} else if (vsi->type == I40E_VSI_SRIOV) {
+		for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++)
+			i40e_write_rx_ctl(hw, I40E_VFQF_HLUT1(i, vf_id), 0);
+	} else {
+		dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n");
+	}
+}
+
+/**
  * i40e_set_features - set the netdev feature flags
  * @netdev: ptr to the netdev being adjusted
  * @features: the feature set that the stack is suggesting
@@ -8670,6 +8692,12 @@ static int i40e_set_features(struct net_device *netdev,
 	struct i40e_pf *pf = vsi->back;
 	bool need_reset;
 
+	if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH))
+		i40e_pf_config_rss(pf);
+	else if (!(features & NETIF_F_RXHASH) &&
+		 netdev->features & NETIF_F_RXHASH)
+		i40e_clear_rss_lut(vsi);
+
 	if (features & NETIF_F_HW_VLAN_CTAG_RX)
 		i40e_vlan_stripping_enable(vsi);
 	else
Signature · 1 line
2.4.11
#15 lore raw

PATCH 10/13 i40e: fix lookup table when RSS disabled/enabled

ACK

-----Original Message-----
From: Pujari, Bimmy
Sent: Monday, July 25, 2016 4:16 PM
To: [email protected]
Cc: Brady, Alan <[email protected]>
Subject: [next PATCH S40 10/13] i40e: fix lookup table when RSS disabled/enabled

From: "Alan, Brady" <[email protected]>

This patch fixes the bug which causes RSS to continue to work after being disabled. After disabling RSS, traffic would continue to be assigned to different queues instead of falling back to a single queue. Without this patch, attempting to disable RSS would not work as expected. This patch fixes the bug by clearing the lookup table used by RSS such that all traffic is assigned to a single queue. This patch also addresses the issue of reinstating the lookup table should RSS then be re-enabled.

Change-ID Ib20c7c6a7e9f1f772bb787370f8a8c664796b141
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +21 -0
index c130149..a33e902 100644
@@ -8658,6 +8658,28 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)  }
 
 /**
+ * i40e_clear_rss_lut - clear the rx hash lookup table
+ * @vsi: the VSI being configured
+ **/
+static void i40e_clear_rss_lut(struct i40e_vsi *vsi) {
+	struct i40e_pf *pf = vsi->back;
+	struct i40e_hw *hw = &pf->hw;
+	u16 vf_id = vsi->vf_id;
+	u8 i;
+
+	if (vsi->type == I40E_VSI_MAIN) {
+		for (i = 0; i <= I40E_PFQF_HLUT_MAX_INDEX; i++)
+			wr32(hw, I40E_PFQF_HLUT(i), 0);
+	} else if (vsi->type == I40E_VSI_SRIOV) {
+		for (i = 0; i <= I40E_VFQF_HLUT_MAX_INDEX; i++)
+			i40e_write_rx_ctl(hw, I40E_VFQF_HLUT1(i, vf_id), 0);
+	} else {
+		dev_err(&pf->pdev->dev, "Cannot set RSS LUT - invalid VSI type\n");
+	}
+}
+
+/**
  * i40e_set_features - set the netdev feature flags
  * @netdev: ptr to the netdev being adjusted
  * @features: the feature set that the stack is suggesting @@ -8670,6 +8692,12 @@ static int i40e_set_features(struct net_device *netdev,
 	struct i40e_pf *pf = vsi->back;

bool need_reset;

+ if (features & NETIF_F_RXHASH && !(netdev->features & NETIF_F_RXHASH))
+ i40e_pf_config_rss(pf);
+ else if (!(features & NETIF_F_RXHASH) &&
+ netdev->features & NETIF_F_RXHASH)
+ i40e_clear_rss_lut(vsi);
+
if (features & NETIF_F_HW_VLAN_CTAG_RX)
i40e_vlan_stripping_enable(vsi);
else
--
2.4.11

#16 lore raw

PATCH 10/13 i40e: fix lookup table when RSS disabled/enabled

Quoted 20 lines · Alan

ACK

-----Original Message-----
From: Pujari, Bimmy?
Sent: Monday, July 25, 2016 4:16 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [next PATCH S40 10/13] i40e: fix lookup table when RSS disabled/enabled

From: "Alan, Brady" <[email protected]>

This patch fixes the bug which causes RSS to continue to work after being disabled.? After disabling RSS, traffic would continue to be assigned to different queues instead of falling back to a single queue. Without this patch, attempting to disable RSS would not work as expected. This patch fixes the bug by clearing the lookup table used by RSS such that all traffic is assigned to a single queue.? This patch also addresses the issue of reinstating? the lookup table should RSS then be re-enabled.

Quoted 6 lines
Change-ID Ib20c7c6a7e9f1f772bb787370f8a8c664796b141

---
?drivers/net/ethernet/intel/i40e/i40e_main.c | 28
++++++++++++++++++++++++++++
?1 file changed, 28 insertions(+)

First why are you ACK'ing your own patch, which you already Signed-off-by
on? ?Second, never top post.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160726/0a26257e/attachment.asc>

#17 lore raw

PATCH 11/13 i40e: fix memory leak

In reply to Bimmy Pujari

From: Mitch Williams <[email protected]>

When we allocate memory, we must free it. It's simple courtesy.

Change-ID Id007294096fb53344f1a8b9a0f78eddf9853c5d6

---
Testing Hints : Found by inspection. The VF driver doesn't currently call this function, so not testable.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -0
index 5ea659c..68e3482 100644
@@ -2318,6 +2318,7 @@ err:
 	/* send the response back to the VF */
 	aq_ret = i40e_vc_send_msg_to_vf(vf, I40E_VIRTCHNL_OP_GET_RSS_HENA_CAPS,
 					aq_ret, (u8 *)vrh, len);
+	kfree(vrh);
 	return aq_ret;
 }
 
Signature · 1 line
2.4.11
#18 lore raw

PATCH 12/13 i40e: Allow RSS Hash set with less than four parameters

In reply to Bimmy Pujari

From: Carolyn Wyborny <[email protected]>

This patch implements a feature change which allows using ethtool to set rss hash opts using less than four parameters if desired.

Change-ID I0fbb91255d81e997c456697c21ac39cc9754821b
---
 drivers/net/ethernet/intel/i40e/i40e.h         |   3 -
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 208 +++++++++++++++----------
 2 files changed, 130 insertions(+), 81 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +0 -3
index 06e1835..6329233 100644
@@ -586,9 +586,6 @@ struct i40e_vsi {
 
 	/* VSI specific handlers */
 	irqreturn_t (*irq_handler)(int irq, void *data);
-
-	/* current rxnfc data */
-	struct ethtool_rxnfc rxnfc; /* current rss hash opts */
 } ____cacheline_internodealigned_in_smp;
 
 struct i40e_netdev_priv {
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +130 -78

271 lines not on this page · raw message

Signature · 1 line
2.4.11
#19 lore raw

PATCH 13/13 i40e/i40evf-Bump version from 1.6.11 to 1.6.12

In reply to Bimmy Pujari
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index a33e902..d90ad77 100644
@@ -41,7 +41,7 @@ static const char i40e_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 6
-#define DRV_VERSION_BUILD 11
+#define DRV_VERSION_BUILD 12
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
index eaadeef..24f88ec 100644
@@ -38,7 +38,7 @@ static const char i40evf_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 6
-#define DRV_VERSION_BUILD 11
+#define DRV_VERSION_BUILD 12
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD) \
Signature · 1 line
2.4.11