Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Catherine Sullivan 2 participants 25 messages Oct 21, 2015 – Oct 29, 2015

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

cover i40e/i40evf updates

Anjali adds a workaround fix for mss < 256 issue and adds a stat to track how many times we have to do a force WB.

Catherine moves the saving of old link info from handle_link_event to link_event.

Helin properly cast type for arithmetic, adds a comment to #endif, returns the number of enabled queues for ETHTOOL_GRXRINGS, reworks the functions to configure RSS with similar parameters, and creates a generic configure rss function.

Mitch cleans up error messages, and adds support to handle many MAC filters correctly.

Shannon removes an unused tunnel parameter, changes BUG_ON to WARN_ON in service event complete, removes BUG_ON from feature string building, and removes BUG_ON from fcoe setup

 drivers/net/ethernet/intel/i40e/i40e.h             |   4 +
 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h  |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |  76 +++---
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   2 -
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 255 ++++++++++++++++-----
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         |   2 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |  15 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  21 +-
 .../net/ethernet/intel/i40evf/i40e_adminq_cmd.h    |   2 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |  12 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   1 +
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    |  58 ++++-
 13 files changed, 311 insertions(+), 140 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/15 i40e/i40evf: remove unused tunnel parameter

From: Shannon Nelson <[email protected]>

Code was moved into a separate function some time ago.

Change-ID Icabbe71ce05cf5d716d3e1152cdd9cd41d11bcb5

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 11 ++++-------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c |  8 +++-----
 2 files changed, 7 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +4 -7
index 6cd0918..626c567 100644
@@ -2187,14 +2187,12 @@ out:
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @hdr_len:  ptr to the size of the packet header
- * @cd_type_cmd_tso_mss: ptr to u64 object
- * @cd_tunneling: ptr to context descriptor bits
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no TSO can happen, 1 if tso is going, or error
  **/
 static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
-		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss,
-		    u32 *cd_tunneling)
+		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 {
 	u32 cd_cmd, cd_tso_len, cd_mss;
 	struct ipv6hdr *ipv6h;
@@ -2247,7 +2245,7 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @tx_flags: the collected send information
- * @cd_type_cmd_tso_mss: ptr to u64 object
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no Tx timestamp can happen and 1 if the timestamp will happen
  **/
@@ -2826,8 +2824,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	else if (protocol == htons(ETH_P_IPV6))
 		tx_flags |= I40E_TX_FLAGS_IPV6;
 
-	tso = i40e_tso(tx_ring, skb, &hdr_len,
-		       &cd_type_cmd_tso_mss, &cd_tunneling);
+	tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss);
 
 	if (tso < 0)
 		goto out_drop;
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -5
index 0fe2625..521803e 100644
@@ -1437,13 +1437,12 @@ out:
  * @tx_ring:  ptr to the ring to send
  * @skb:      ptr to the skb we're sending
  * @hdr_len:  ptr to the size of the packet header
- * @cd_tunneling: ptr to context descriptor bits
+ * @cd_type_cmd_tso_mss: Quad Word 1
  *
  * Returns 0 if no TSO can happen, 1 if tso is going, or error
  **/
 static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
-		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss,
-		    u32 *cd_tunneling)
+		    u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 {
 	u32 cd_cmd, cd_tso_len, cd_mss;
 	struct ipv6hdr *ipv6h;
@@ -1980,8 +1979,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	else if (protocol == htons(ETH_P_IPV6))
 		tx_flags |= I40E_TX_FLAGS_IPV6;
 
-	tso = i40e_tso(tx_ring, skb, &hdr_len,
-		       &cd_type_cmd_tso_mss, &cd_tunneling);
+	tso = i40e_tso(tx_ring, skb, &hdr_len, &cd_type_cmd_tso_mss);
 
 	if (tso < 0)
 		goto out_drop;
Signature · 1 line
1.9.3
#2 lore raw

PATCH 1/15 i40e/i40evf: remove unused tunnel parameter

Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 01/15] i40e/i40evf: remove unused tunnel parameter

From: Shannon Nelson <[email protected]>

Code was moved into a separate function some time ago.

Change-ID Icabbe71ce05cf5d716d3e1152cdd9cd41d11bcb5
Quoted 6 lines

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 11 ++++-------
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c |  8 +++-----
 2 files changed, 7 insertions(+), 12 deletions(-)

Patch code changes correctly applied

#3 lore raw

PATCH 2/15 i40e: Change BUG_ON to WARN_ON in service event complete

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

There's no need to kill the thread and eventually the kernel in this case. In fact, the remainder of the code won't hurt anything anyway, so just complain that we're here and move along.

Prompted by a recent Linus diatribe.

Change-ID Iec020d8bcfedffc1cd2553cc6905fd915bb3e670

---
Testing-hints: Internal code change only, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index 62d58de..d2e4ea8 100644
@@ -5758,7 +5758,7 @@ static void i40e_handle_lan_overflow_event(struct i40e_pf *pf,
  **/
 static void i40e_service_event_complete(struct i40e_pf *pf)
 {
-	BUG_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state));
+	WARN_ON(!test_bit(__I40E_SERVICE_SCHED, &pf->state));
 
 	/* flush memory to make sure state is correct before next watchog */
 	smp_mb__before_atomic();
Signature · 1 line
1.9.3
#4 lore raw

PATCH 2/15 i40e: Change BUG_ON to WARN_ON in service event complete

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 02/15] i40e: Change BUG_ON to WARN_ON in service event complete

From: Shannon Nelson <[email protected]>

There's no need to kill the thread and eventually the kernel in this case. In fact, the remainder of the code won't hurt anything anyway, so just complain that we're here and move along.

Prompted by a recent Linus diatribe.

Quoted 8 lines
Change-ID Iec020d8bcfedffc1cd2553cc6905fd915bb3e670

---
Testing-hints: Internal code change only, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch code changes correctly applied

#5 lore raw

PATCH 3/15 i40e: remove BUG_ON from feature string building

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

There's really no reason to kill the kernel thread just because of a little info string. This reworks the code to use snprintf's limiting to assure that the string is never too long, and WARN_ON to still put out a warning that we might want to look at the feature list length.

Prompted by a recent Linus diatribe.

Change-ID If52ba5ca1c2344d8bf454a31bbb805eb5d2c5802

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 34 +++++++++++++++--------------
 1 file changed, 18 insertions(+), 16 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +18 -16
index d2e4ea8..a8fd031 100644
@@ -10128,10 +10128,12 @@ static int i40e_setup_pf_filter_control(struct i40e_pf *pf)
 }
 
 #define INFO_STRING_LEN 255
+#define REMAIN(__x) (INFO_STRING_LEN - (__x))
 static void i40e_print_features(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = &pf->hw;
 	char *buf, *string;
+	int i = 0;
 
 	string = kzalloc(INFO_STRING_LEN, GFP_KERNEL);
 	if (!string) {
@@ -10141,42 +10143,42 @@ static void i40e_print_features(struct i40e_pf *pf)
 
 	buf = string;
 
-	buf += sprintf(string, "Features: PF-id[%d] ", hw->pf_id);
+	i += snprintf(&buf[i], REMAIN(i), "Features: PF-id[%d] ", hw->pf_id);
 #ifdef CONFIG_PCI_IOV
-	buf += sprintf(buf, "VFs: %d ", pf->num_req_vfs);
+	i += snprintf(&buf[i], REMAIN(i), "VFs: %d ", pf->num_req_vfs);
 #endif
-	buf += sprintf(buf, "VSIs: %d QP: %d RX: %s ",
-		       pf->hw.func_caps.num_vsis,
-		       pf->vsi[pf->lan_vsi]->num_queue_pairs,
-		       pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
+	i += snprintf(&buf[i], REMAIN(i), "VSIs: %d QP: %d RX: %s ",
+		      pf->hw.func_caps.num_vsis,
+		      pf->vsi[pf->lan_vsi]->num_queue_pairs,
+		      pf->flags & I40E_FLAG_RX_PS_ENABLED ? "PS" : "1BUF");
 
 	if (pf->flags & I40E_FLAG_RSS_ENABLED)
-		buf += sprintf(buf, "RSS ");
+		i += snprintf(&buf[i], REMAIN(i), "RSS ");
 	if (pf->flags & I40E_FLAG_FD_ATR_ENABLED)
-		buf += sprintf(buf, "FD_ATR ");
+		i += snprintf(&buf[i], REMAIN(i), "FD_ATR ");
 	if (pf->flags & I40E_FLAG_FD_SB_ENABLED) {
-		buf += sprintf(buf, "FD_SB ");
-		buf += sprintf(buf, "NTUPLE ");
+		i += snprintf(&buf[i], REMAIN(i), "FD_SB ");
+		i += snprintf(&buf[i], REMAIN(i), "NTUPLE ");
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
-		buf += sprintf(buf, "DCB ");
+		i += snprintf(&buf[i], REMAIN(i), "DCB ");
 #if IS_ENABLED(CONFIG_VXLAN)
-	buf += sprintf(buf, "VxLAN ");
+	i += snprintf(&buf[i], REMAIN(i), "VxLAN ");
 #endif
 	if (pf->flags & I40E_FLAG_PTP)
-		buf += sprintf(buf, "PTP ");
+		i += snprintf(&buf[i], REMAIN(i), "PTP ");
 #ifdef I40E_FCOE
 	if (pf->flags & I40E_FLAG_FCOE_ENABLED)
-		buf += sprintf(buf, "FCOE ");
+		i += snprintf(&buf[i], REMAIN(i), "FCOE ");
 #endif
 	if (pf->flags & I40E_FLAG_VEB_MODE_ENABLED)
-		buf += sprintf(buf, "VEB ");
+		i += snprintf(&buf[i], REMAIN(i), "VEPA ");
 	else
 		buf += sprintf(buf, "VEPA ");
 
-	BUG_ON(buf > (string + INFO_STRING_LEN));
 	dev_info(&pf->pdev->dev, "%s\n", string);
 	kfree(string);
+	WARN_ON(i > INFO_STRING_LEN);
 }
 
 /**
Signature · 1 line
1.9.3
#6 lore raw

PATCH 3/15 i40e: remove BUG_ON from feature string building

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 03/15] i40e: remove BUG_ON from feature string building

From: Shannon Nelson <[email protected]>

There's really no reason to kill the kernel thread just because of a little info string. This reworks the code to use snprintf's limiting to assure that the string is never too long, and WARN_ON to still put out a warning that we might want to look at the feature list length.

Prompted by a recent Linus diatribe.

Change-ID If52ba5ca1c2344d8bf454a31bbb805eb5d2c5802
Quoted 6 lines

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 34 +++++++++++++++--------
------
 1 file changed, 18 insertions(+), 16 deletions(-)

Patch code changes correctly applied

#7 lore raw

PATCH 4/15 i40e: remove BUG_ON from fcoe setup

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

There's no need to kill the kernel thread here. If this condition was true, the probe() would have died long before we got here. In any case, we'll get the same result when this code tries to use the vsi pointer being checked.

Prompted by a recent Linus diatribe.

Change-ID I62f531cac34d4fc28ff9657d5b2d9523ae5e33a4

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_fcoe.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_fcoe.c +0 -2
index fe5d9bf..579a46c 100644
@@ -1544,8 +1544,6 @@ void i40e_fcoe_vsi_setup(struct i40e_pf *pf)
 	if (!(pf->flags & I40E_FLAG_FCOE_ENABLED))
 		return;
 
-	BUG_ON(!pf->vsi[pf->lan_vsi]);
-
 	for (i = 0; i < pf->num_alloc_vsi; i++) {
 		vsi = pf->vsi[i];
 		if (vsi && vsi->type == I40E_VSI_FCOE) {
Signature · 1 line
1.9.3
#8 lore raw

PATCH 4/15 i40e: remove BUG_ON from fcoe setup

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 04/15] i40e: remove BUG_ON from fcoe setup

From: Shannon Nelson <[email protected]>

There's no need to kill the kernel thread here. If this condition was true, the probe() would have died long before we got here. In any case, we'll get the same result when this code tries to use the vsi pointer being checked.

Prompted by a recent Linus diatribe.

Quoted 8 lines
Change-ID I62f531cac34d4fc28ff9657d5b2d9523ae5e33a4

---
Testing-hints: Internal code change, check that the patch was applied and compiled correctly.

 drivers/net/ethernet/intel/i40e/i40e_fcoe.c | 2 --
 1 file changed, 2 deletions(-)

Patch code changes correctly applied

#9 lore raw

PATCH 5/15 i40e: Properly cast type for arithmetic

In reply to Catherine Sullivan

From: Helin Zhang <[email protected]>

Pointer of type void * shouldn't be used in arithmetic, which may result in compilation error. Casting of (u8 *) can be added to fix that.

Change-ID I273aa57cdef7cacac5c552c348d585cd09d7e06b

---
Testing-hints: Patch just avoids a compile warning with cast to u8 *, so verify with gcc option:
-Wpointer-arith like make -C /lib/modules/uname -r/build \
M=driver/net/ethernet/intel EXTRA_CFLAGS=-Wpointer-arith
Before this patch, there will be a warning on this line (among many others) - search for buff.va, and after it will be gone.

 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +1 -1
index 6100cdd..29d6785 100644
@@ -1246,7 +1246,7 @@ static i40e_status i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
 		remainder -= len;
 		buff = hw->nvm_buff.va;
 	} else {
-		buff = hw->nvm_buff.va + (cmd->offset - aq_desc_len);
+		buff = (u8 *)hw->nvm_buff.va + (cmd->offset - aq_desc_len);
 	}
 
 	if (remainder > 0) {
Signature · 1 line
1.9.3
#10 lore raw

PATCH 5/15 i40e: Properly cast type for arithmetic

Quoted 24 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Helin
Subject: [Intel-wired-lan] [next PATCH S19 05/15] i40e: Properly cast type for arithmetic

From: Helin Zhang <[email protected]>

Pointer of type void * shouldn't be used in arithmetic, which may result in compilation error. Casting of (u8 *) can be added to fix that.

Change-ID I273aa57cdef7cacac5c552c348d585cd09d7e06b

---
Testing-hints: Patch just avoids a compile warning with cast to u8 *, so verify with gcc option:
-Wpointer-arith like make -C /lib/modules/uname -r/build \
M=driver/net/ethernet/intel EXTRA_CFLAGS=-Wpointer-arith Before this patch, there will be a warning on this line (among many
others) - search for buff.va, and after it will be gone.

Quoted 2 lines
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch code changes correctly applied, no compiler warning on afected code with -Wpointer-arith option

#11 lore raw

PATCH 6/15 i40e: Workaround fix for mss < 256 issue

In reply to Catherine Sullivan

From: Anjali Singhai Jain <[email protected]>

HW/NVM sets a limit of no less than 256 bytes for MSS. Stack can send as low as 76 bytes MSS. This patch lowers the HW limit to 64 bytes to avoid MDDs from firing and causing a reset when the MSS is lower than 256.

Change-ID I36b500a6bb227d283c3e321a7718e0672b11fab0

---
Testing-hints: 5644586
Set the mss to as low as 76 bytes using iperf3:
iperf3 -c 192.168.2.109 -B 192.168.2.108 -M 76
Check to see there are not resets and that the MSS for outbound packets is as was set by the test.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +27 -0
index a8fd031..c8727b8 100644
@@ -6705,6 +6705,7 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
 	struct i40e_hw *hw = &pf->hw;
 	u8 set_fc_aq_fail = 0;
 	i40e_status ret;
+	u32 val;
 	u32 v;
 
 	/* Now we wait for GRST to settle out.
@@ -6843,6 +6844,20 @@ static void i40e_reset_and_rebuild(struct i40e_pf *pf, bool reinit)
 		}
 	}
 
+	/* Reconfigure hardware for allowing smaller MSS in the case
+	 * of TSO, so that we avoid the MDD being fired and causing
+	 * a reset in the case of small MSS+TSO.
+	 */
+#define I40E_REG_MSS          0x000E64DC
+#define I40E_REG_MSS_MIN_MASK 0x3FF0000
+#define I40E_64BYTE_MSS       0x400000
+	val = rd32(hw, I40E_REG_MSS);
+	if ((val & I40E_REG_MSS_MIN_MASK) > I40E_64BYTE_MSS) {
+		val &= ~I40E_REG_MSS_MIN_MASK;
+		val |= I40E_64BYTE_MSS;
+		wr32(hw, I40E_REG_MSS, val);
+	}
+
 	if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
 	    (pf->hw.aq.fw_maj_ver < 4)) {
 		msleep(75);
@@ -10202,6 +10217,7 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	u16 link_status;
 	int err;
 	u32 len;
+	u32 val;
 	u32 i;
 	u8 set_fc_aq_fail;
 
@@ -10506,6 +10522,17 @@ static int i40e_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 			 i40e_stat_str(&pf->hw, err),
 			 i40e_aq_str(&pf->hw, pf->hw.aq.asq_last_status));
 
+	/* Reconfigure hardware for allowing smaller MSS in the case
+	 * of TSO, so that we avoid the MDD being fired and causing
+	 * a reset in the case of small MSS+TSO.
+	 */
+	val = rd32(hw, I40E_REG_MSS);
+	if ((val & I40E_REG_MSS_MIN_MASK) > I40E_64BYTE_MSS) {
+		val &= ~I40E_REG_MSS_MIN_MASK;
+		val |= I40E_64BYTE_MSS;
+		wr32(hw, I40E_REG_MSS, val);
+	}
+
 	if (((pf->hw.aq.fw_maj_ver == 4) && (pf->hw.aq.fw_min_ver < 33)) ||
 	    (pf->hw.aq.fw_maj_ver < 4)) {
 		msleep(75);
Signature · 1 line
1.9.3
#12 lore raw

PATCH 6/15 i40e: Workaround fix for mss < 256 issue

Quoted 17 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 06/15] i40e: Workaround fix for mss < 256 issue

From: Anjali Singhai Jain <[email protected]>

HW/NVM sets a limit of no less than 256 bytes for MSS. Stack can send as low as 76 bytes MSS. This patch lowers the HW limit to 64 bytes to avoid MDDs from firing and causing a reset when the MSS is lower than 256.

Change-ID I36b500a6bb227d283c3e321a7718e0672b11fab0
Quoted 8 lines

---
Testing-hints: 5644586
Set the mss to as low as 76 bytes using iperf3:
iperf3 -c 192.168.2.109 -B 192.168.2.108 -M 76 Check to see there are not resets and that the MSS for outbound packets is as was set by the test.

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

Patch code changes correctly applied, using iperf3 to pass traffic with MSS < 255 does not cause resets, MSS correctly set according to TShark capture, however attempting to set the MSS <88 causes an "Unable to set TCP MSS: invalid argument" error from iperf3 on the client side, and an "unable to set TCP/SCTP MSS: Bad file descriptor" on the server side.

#13 lore raw

PATCH 7/15 i40e/i40evf: Add a stat to track how many times we have to do a force WB

In reply to Catherine Sullivan

From: Anjali Singhai Jain <[email protected]>

When in NAPI with interrupts disabled, the HW needs to be forced to do a write back on TX if the number of descriptors pending are less than a cache line.

This stat helps keep track of how many times we get into this situation.

Change-ID I76c1bcc7ebccd6bffcc5aa33bfe05f2fa1c9a984

---
Testing-hints: We are forcing WB only once a second with the changes to move force WB in the timer task. You should not see this ethtool stat "tx_force_wb" go up more often than that on X[L]710. On TLVF you will see this stat more ofetn since we have a different strategy for force WB since the HW provides a less expensive way of doing a force WB.

 drivers/net/ethernet/intel/i40e/i40e.h         | 1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 5 ++++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h    | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c  | 4 +++-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h  | 1 +
 7 files changed, 14 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
index 4dd3e26..ca07a7b 100644
@@ -487,6 +487,7 @@ struct i40e_vsi {
 	u32 tx_restart;
 	u32 tx_busy;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 	u32 rx_buf_failed;
 	u32 rx_page_failed;
 
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -0
index f956cd0..1a39d4d 100644
@@ -88,6 +88,7 @@ static const struct i40e_stats i40e_gstrings_misc_stats[] = {
 	I40E_VSI_STAT("tx_broadcast", eth_stats.tx_broadcast),
 	I40E_VSI_STAT("rx_unknown_protocol", eth_stats.rx_unknown_protocol),
 	I40E_VSI_STAT("tx_linearize", tx_linearize),
+	I40E_VSI_STAT("tx_force_wb", tx_force_wb),
 };
 
 /* These PF_STATs might look like duplicates of some NETDEV_STATs,
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -1
index c8727b8..ae63539 100644
@@ -881,6 +881,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	u64 bytes, packets;
 	unsigned int start;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 	u64 rx_p, rx_b;
 	u64 tx_p, tx_b;
 	u16 q;
@@ -899,7 +900,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	 */
 	rx_b = rx_p = 0;
 	tx_b = tx_p = 0;
-	tx_restart = tx_busy = tx_linearize = 0;
+	tx_restart = tx_busy = tx_linearize = tx_force_wb = 0;
 	rx_page = 0;
 	rx_buf = 0;
 	rcu_read_lock();
@@ -917,6 +918,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 		tx_restart += p->tx_stats.restart_queue;
 		tx_busy += p->tx_stats.tx_busy;
 		tx_linearize += p->tx_stats.tx_linearize;
+		tx_force_wb += p->tx_stats.tx_force_wb;
 
 		/* Rx queue is part of the same block as Tx queue */
 		p = &p[1];
@@ -934,6 +936,7 @@ static void i40e_update_vsi_stats(struct i40e_vsi *vsi)
 	vsi->tx_restart = tx_restart;
 	vsi->tx_busy = tx_busy;
 	vsi->tx_linearize = tx_linearize;
+	vsi->tx_force_wb = tx_force_wb;
 	vsi->rx_page_failed = rx_page;
 	vsi->rx_buf_failed = rx_buf;
 
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -1
index 626c567..718c0f0 100644
@@ -1926,8 +1926,10 @@ int i40e_napi_poll(struct napi_struct *napi, int budget)
 	/* If work not completed, return budget and polling will return */
 	if (!clean_complete) {
 tx_only:
-		if (arm_wb)
+		if (arm_wb) {
+			q_vector->tx.ring[0].tx_stats.tx_force_wb++;
 			i40e_force_wb(vsi, q_vector);
+		}
 		return budget;
 	}
 
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
index 6779fb7..dccc1eb 100644
@@ -202,6 +202,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_busy;
 	u64 tx_done_old;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 };
 
 struct i40e_rx_queue_stats {
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -1
index 521803e..e4f97f8 100644
@@ -1364,8 +1364,10 @@ int i40evf_napi_poll(struct napi_struct *napi, int budget)
 	/* If work not completed, return budget and polling will return */
 	if (!clean_complete) {
 tx_only:
-		if (arm_wb)
+		if (arm_wb) {
+			q_vector->tx.ring[0].tx_stats.tx_force_wb++;
 			i40evf_force_wb(vsi, q_vector);
+		}
 		return budget;
 	}
 
drivers/net/ethernet/intel/i40evf/i40e_txrx.h +1 -0
index ebc1bf7..997b374 100644
@@ -201,6 +201,7 @@ struct i40e_tx_queue_stats {
 	u64 tx_busy;
 	u64 tx_done_old;
 	u64 tx_linearize;
+	u64 tx_force_wb;
 };
 
 struct i40e_rx_queue_stats {
Signature · 1 line
1.9.3
#14 lore raw

PATCH 7/15 i40e/i40evf: Add a stat to track how many times we have to do a force WB

Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 07/15] i40e/i40evf: Add a stat to track how many times we have to do a force WB

From: Anjali Singhai Jain <[email protected]>

When in NAPI with interrupts disabled, the HW needs to be forced to do a write back on TX if the number of descriptors pending are less than a cache line.

This stat helps keep track of how many times we get into this situation.

Change-ID I76c1bcc7ebccd6bffcc5aa33bfe05f2fa1c9a984

---
Testing-hints: We are forcing WB only once a second with the changes to move force WB in the timer task. You should not see this ethtool stat "tx_force_wb" go up more often than that on X[L]710. On TLVF you will see this stat more ofetn since we have a different strategy for force WB since the HW provides a less expensive way of doing a force WB.

Quoted 8 lines
 drivers/net/ethernet/intel/i40e/i40e.h         | 1 +
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 1 +
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 5 ++++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 4 +++-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h    | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c  | 4 +++-
drivers/net/ethernet/intel/i40evf/i40e_txrx.h  | 1 +
 7 files changed, 14 insertions(+), 3 deletions(-)

Patch code changes correctly applied, stats correctly show up in Ethtool -S

#15 lore raw

PATCH 8/15 i40e: Move the saving of old link info from handle_link_event to link_event

In reply to Catherine Sullivan

The watchdog only calls link_event not handle_link_event which means that we need to save the old information in link_event.

Previously when polling we were comparing current data to the old data saved the last time we actually received a link event. This means that the polling would only fix link status changes in one direction depending on what the last old data saved off was.

Change-ID Ie590f30fdbcb133d0ddad4e07e3eb1aad58255b3

---
Testing-hints: Play with link a bit (forcing it up and down and such) and make sure htat it is reporting the expected state in ethtool <dev>.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -4
index ae63539..26e5ed0 100644
@@ -6036,6 +6036,9 @@ static void i40e_link_event(struct i40e_pf *pf)
 	i40e_status status;
 	bool new_link, old_link;
 
+	/* save off old link status information */
+	pf->hw.phy.link_info_old = pf->hw.phy.link_info;
+
 	/* set this to force the get_link_status call to refresh state */
 	pf->hw.phy.get_link_info = true;
 
@@ -6170,13 +6173,9 @@ unlock:
 static void i40e_handle_link_event(struct i40e_pf *pf,
 				   struct i40e_arq_event_info *e)
 {
-	struct i40e_hw *hw = &pf->hw;
 	struct i40e_aqc_get_link_status *status =
 		(struct i40e_aqc_get_link_status *)&e->desc.params.raw;
 
-	/* save off old link status information */
-	hw->phy.link_info_old = hw->phy.link_info;
-
 	/* Do a new status request to re-enable LSE reporting
 	 * and load new status information into the hw struct
 	 * This completely ignores any state information
Signature · 1 line
1.9.3
#16 lore raw

PATCH 8/15 i40e: Move the saving of old link info from handle_link_event to link_event

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 08/15] i40e: Move the saving of old link info from handle_link_event to link_event

The watchdog only calls link_event not handle_link_event which means that we need to save the old information in link_event.

Previously when polling we were comparing current data to the old data saved the last time we actually received a link event. This means that the polling would only fix link status changes in one direction depending on what the last old data saved off was.

Quoted 8 lines
Change-ID Ie590f30fdbcb133d0ddad4e07e3eb1aad58255b3

---
Testing-hints: Play with link a bit (forcing it up and down and such) and make sure htat it is reporting the expected state in ethtool <dev>.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Patch code changes correctly applied, ethtool shows correct link state

#17 lore raw

PATCH 9/15 i40e/i40evf: Add comment to #endif

In reply to Catherine Sullivan

From: Helin Zhang <[email protected]>

Add a comment to the #endif to more easily match it with its #if.

Change-ID I47eb0a60a17dc6d2f01a930e45006d2dc82e044f

---
Testing-hints: Verify code change is present, no functional change.

 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h   | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h +1 -1
index 6584b6c..61a4979 100644
@@ -2403,4 +2403,4 @@ struct i40e_aqc_debug_modify_internals {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
 
-#endif
+#endif /* _I40E_ADMINQ_CMD_H_ */
drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h +1 -1
index fcb9ef3..1c76389 100644
@@ -2311,4 +2311,4 @@ struct i40e_aqc_debug_modify_internals {
 
 I40E_CHECK_CMD_LENGTH(i40e_aqc_debug_modify_internals);
 
-#endif
+#endif /* _I40E_ADMINQ_CMD_H_ */
Signature · 1 line
1.9.3
#18 lore raw

PATCH 9/15 i40e/i40evf: Add comment to #endif

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Helin
Subject: [Intel-wired-lan] [next PATCH S19 09/15] i40e/i40evf: Add comment to #endif

From: Helin Zhang <[email protected]>

Add a comment to the #endif to more easily match it with its #if.

Quoted 8 lines
Change-ID I47eb0a60a17dc6d2f01a930e45006d2dc82e044f

---
Testing-hints: Verify code change is present, no functional change.

 drivers/net/ethernet/intel/i40e/i40e_adminq_cmd.h   | 2 +-
 drivers/net/ethernet/intel/i40evf/i40e_adminq_cmd.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch code changes correctly applied

#19 lore raw

PATCH 10/15 i40e/i40evf: clean up error messages

In reply to Catherine Sullivan

From: Mitch Williams <[email protected]>

Clean up and enhance error messages related to VF MAC/VLAN filters. Indicate which VF is having issues, and if possible indicate the MAC address or VLAN involved.

Also, when an error is returned from the PF driver, print useful information about what went wrong, for the most likely cases.

Change-ID Ib3d15eef9e3369a78fd142948671e5fa26d921b8

---
Testing-hints: Add 1000 VLANS to a VF and add 1000 multicast filters to a VF should show most of the errors, make sure the new errors are what is getting printed.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++--------
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 26 +++++++++++++++++++---
 2 files changed, 35 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +12 -9
index 44462b4..9c54ca2 100644
@@ -1623,7 +1623,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (!f) {
 			dev_err(&pf->pdev->dev,
-				"Unable to add VF MAC filter\n");
+				"Unable to add MAC filter %pM for VF %d\n",
+				 al->list[i].addr, vf->vf_id);
 			ret = I40E_ERR_PARAM;
 			spin_unlock_bh(&vsi->mac_filter_list_lock);
 			goto error_param;
@@ -1633,7 +1634,8 @@ static int i40e_vc_add_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi, false))
-		dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
+		dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters\n",
+			vf->vf_id);
 
 error_param:
 	/* send the response to the VF */
@@ -1669,8 +1671,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 	for (i = 0; i < al->num_elements; i++) {
 		if (is_broadcast_ether_addr(al->list[i].addr) ||
 		    is_zero_ether_addr(al->list[i].addr)) {
-			dev_err(&pf->pdev->dev, "invalid VF MAC addr %pM\n",
-				al->list[i].addr);
+			dev_err(&pf->pdev->dev, "Invalid MAC addr %pM for VF %d\n",
+				al->list[i].addr, vf->vf_id);
 			ret = I40E_ERR_INVALID_MAC_ADDR;
 			goto error_param;
 		}
@@ -1686,7 +1688,8 @@ static int i40e_vc_del_mac_addr_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 	/* program the updated filter list */
 	if (i40e_sync_vsi_filters(vsi, false))
-		dev_err(&pf->pdev->dev, "Unable to program VF MAC filters\n");
+		dev_err(&pf->pdev->dev, "Unable to program VF %d MAC filters\n",
+			vf->vf_id);
 
 error_param:
 	/* send the response to the VF */
@@ -1740,8 +1743,8 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (ret)
 			dev_err(&pf->pdev->dev,
-				"Unable to add VF vlan filter %d, error %d\n",
-				vfl->vlan_id[i], ret);
+				"Unable to add VLAN filter %d for VF %d, error %d\n",
+				vfl->vlan_id[i], vf->vf_id, ret);
 	}
 
 error_param:
@@ -1792,8 +1795,8 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 		if (ret)
 			dev_err(&pf->pdev->dev,
-				"Unable to delete VF vlan filter %d, error %d\n",
-				vfl->vlan_id[i], ret);
+				"Unable to delete VLAN filter %d for VF %d, error %d\n",
+				vfl->vlan_id[i], vf->vf_id, ret);
 	}
 
 error_param:
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +23 -3
index 32e620e..091ef6a 100644
@@ -724,9 +724,29 @@ void i40evf_virtchnl_completion(struct i40evf_adapter *adapter,
 		return;
 	}
 	if (v_retval) {
-		dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
-			v_retval, i40evf_stat_str(&adapter->hw, v_retval),
-			v_opcode);
+		switch (v_opcode) {
+		case I40E_VIRTCHNL_OP_ADD_VLAN:
+			dev_err(&adapter->pdev->dev, "Failed to add VLAN filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS:
+			dev_err(&adapter->pdev->dev, "Failed to add MAC filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_DEL_VLAN:
+			dev_err(&adapter->pdev->dev, "Failed to delete VLAN filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		case I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS:
+			dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n",
+				i40evf_stat_str(&adapter->hw, v_retval));
+			break;
+		default:
+			dev_err(&adapter->pdev->dev, "PF returned error %d (%s) to our request %d\n",
+				v_retval,
+				i40evf_stat_str(&adapter->hw, v_retval),
+				v_opcode);
+		}
 	}
 	switch (v_opcode) {
 	case I40E_VIRTCHNL_OP_GET_STATS: {
Signature · 1 line
1.9.3
#20 lore raw

PATCH 10/15 i40e/i40evf: clean up error messages

Quoted 20 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 10/15] i40e/i40evf: clean up error messages

From: Mitch Williams <[email protected]>

Clean up and enhance error messages related to VF MAC/VLAN filters. Indicate which VF is having issues, and if possible indicate the MAC address or VLAN involved.

Also, when an error is returned from the PF driver, print useful information about what went wrong, for the most likely cases.

Change-ID Ib3d15eef9e3369a78fd142948671e5fa26d921b8
Quoted 8 lines

---
Testing-hints: Add 1000 VLANS to a VF and add 1000 multicast filters to a VF should show most of the errors, make sure the new errors are what is getting printed.

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 21 +++++++++--------
 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 26
+++++++++++++++++++---
 2 files changed, 35 insertions(+), 12 deletions(-)

Patch code changes correctly applied, dmesg shows updated error messages correctly.

#21 lore raw

PATCH 11/15 i40evf: handle many MAC filters correctly

In reply to Catherine Sullivan

From: Mitch Williams <[email protected]>

When a lot (many hundreds) of MAC or VLAN filters are added at one time, we can overflow the Admin Queue buffer size with all the requests. Unfortunately, the driver would then calculate the message size incorrectly, causing it to be rejected by the PF. Furthermore, there was no mechanism to trigger another request to allow for configuring the rest of the filters that didn't fit into the first request.

To fix this, recalculate the correct buffer size when we detect the overflow condition instead of just assuming the max buffer size. Also, don't clear the request bit in adapter->aq_required when we have an overflow, so that the rest of the filters can be processed later.

Change-ID Idd7cbbc5af31315e0dcb1b10e6a02ad9817ce65c

---
Testing-hints: 5645131, 5645133
Bring up a VF and add 2000 IPv6 addresses to it. Before this patch, it will crash. After this patch, it will crash less horribly.

 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 32 ++++++++++++++++------
 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_virtchnl.c +24 -8
index 091ef6a..46b0516 100644
@@ -391,6 +391,7 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_ether_addr_list *veal;
 	int len, i = 0, count = 0;
 	struct i40evf_mac_filter *f;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -415,7 +416,9 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_ether_addr_list)) /
 			sizeof(struct i40e_virtchnl_ether_addr);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_ether_addr_list) +
+		      (count * sizeof(struct i40e_virtchnl_ether_addr));
+		more = true;
 	}
 
 	veal = kzalloc(len, GFP_ATOMIC);
@@ -431,7 +434,8 @@ void i40evf_add_ether_addrs(struct i40evf_adapter *adapter)
 			f->add = false;
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_MAC_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_ETHER_ADDRESS,
 			   (u8 *)veal, len);
 	kfree(veal);
@@ -450,6 +454,7 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_ether_addr_list *veal;
 	struct i40evf_mac_filter *f, *ftmp;
 	int len, i = 0, count = 0;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -474,7 +479,9 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_ether_addr_list)) /
 			sizeof(struct i40e_virtchnl_ether_addr);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_ether_addr_list) +
+		      (count * sizeof(struct i40e_virtchnl_ether_addr));
+		more = true;
 	}
 	veal = kzalloc(len, GFP_ATOMIC);
 	if (!veal)
@@ -490,7 +497,8 @@ void i40evf_del_ether_addrs(struct i40evf_adapter *adapter)
 			kfree(f);
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_MAC_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_ETHER_ADDRESS,
 			   (u8 *)veal, len);
 	kfree(veal);
@@ -509,6 +517,7 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_vlan_filter_list *vvfl;
 	int len, i = 0, count = 0;
 	struct i40evf_vlan_filter *f;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -534,7 +543,9 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_vlan_filter_list)) /
 			sizeof(u16);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
+		      (count * sizeof(u16));
+		more = true;
 	}
 	vvfl = kzalloc(len, GFP_ATOMIC);
 	if (!vvfl)
@@ -549,7 +560,8 @@ void i40evf_add_vlans(struct i40evf_adapter *adapter)
 			f->add = false;
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_ADD_VLAN_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_ADD_VLAN, (u8 *)vvfl, len);
 	kfree(vvfl);
 }
@@ -567,6 +579,7 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 	struct i40e_virtchnl_vlan_filter_list *vvfl;
 	struct i40evf_vlan_filter *f, *ftmp;
 	int len, i = 0, count = 0;
+	bool more = false;
 
 	if (adapter->current_op != I40E_VIRTCHNL_OP_UNKNOWN) {
 		/* bail because we already have a command pending */
@@ -592,7 +605,9 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 		count = (I40EVF_MAX_AQ_BUF_SIZE -
 			 sizeof(struct i40e_virtchnl_vlan_filter_list)) /
 			sizeof(u16);
-		len = I40EVF_MAX_AQ_BUF_SIZE;
+		len = sizeof(struct i40e_virtchnl_vlan_filter_list) +
+		      (count * sizeof(u16));
+		more = true;
 	}
 	vvfl = kzalloc(len, GFP_ATOMIC);
 	if (!vvfl)
@@ -608,7 +623,8 @@ void i40evf_del_vlans(struct i40evf_adapter *adapter)
 			kfree(f);
 		}
 	}
-	adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
+	if (!more)
+		adapter->aq_required &= ~I40EVF_FLAG_AQ_DEL_VLAN_FILTER;
 	i40evf_send_pf_msg(adapter, I40E_VIRTCHNL_OP_DEL_VLAN, (u8 *)vvfl, len);
 	kfree(vvfl);
 }
Signature · 1 line
1.9.3
#22 lore raw

PATCH 11/15 i40evf: handle many MAC filters correctly

Quoted 25 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S19 11/15] i40evf: handle many MAC filters correctly

From: Mitch Williams <[email protected]>

When a lot (many hundreds) of MAC or VLAN filters are added at one time, we can overflow the Admin Queue buffer size with all the requests. Unfortunately, the driver would then calculate the message size incorrectly, causing it to be rejected by the PF. Furthermore, there was no mechanism to trigger another request to allow for configuring the rest of the filters that didn't fit into the first request.

To fix this, recalculate the correct buffer size when we detect the overflow condition instead of just assuming the max buffer size. Also, don't clear the request bit in adapter->aq_required when we have an overflow, so that the rest of the filters can be processed later.

Change-ID Idd7cbbc5af31315e0dcb1b10e6a02ad9817ce65c
Quoted 7 lines

---
Testing-hints: 5645131, 5645133
Bring up a VF and add 2000 IPv6 addresses to it. Before this patch, it will crash. After this patch, it will crash less horribly.

 .../net/ethernet/intel/i40evf/i40evf_virtchnl.c    | 32 ++++++++++++++++---
---
 1 file changed, 24 insertions(+), 8 deletions(-)

Patch code changes correctly applied, system still crashes but does not lock up system. Still have to reboot, however.

#23 lore raw

PATCH 12/15 i40e: return the number of enabled queues for ETHTOOL_GRXRINGS

In reply to Catherine Sullivan

From: Helin Zhang <[email protected]>

This patch fixes a problem where using ethtool rxnfc command could let RX flow hash be set on disabled queues. This patch fixes the problem by returning the number of enabled queues before setting rxnfc.

Change-ID Idbac86b0b47ddacc8deee7cd257e41de01cbe5c0

---
Testing-hints: 5535691
Verify that ethtool set rxnfc cannot set the flow hash on queues that are not active, on a system that has a non power of two number of cpus.

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +1 -1
index 1a39d4d..9c243aa 100644
@@ -2105,7 +2105,7 @@ static int i40e_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
 
 	switch (cmd->cmd) {
 	case ETHTOOL_GRXRINGS:
-		cmd->data = vsi->alloc_queue_pairs;
+		cmd->data = vsi->num_queue_pairs;
 		ret = 0;
 		break;
 	case ETHTOOL_GRXFH:
Signature · 1 line
1.9.3
#24 lore raw

PATCH 12/15 i40e: return the number of enabled queues for ETHTOOL_GRXRINGS

Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Wednesday, October 21, 2015 4:47 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Zhang, Helin
Subject: [Intel-wired-lan] [next PATCH S19 12/15] i40e: return the number of enabled queues for ETHTOOL_GRXRINGS

From: Helin Zhang <[email protected]>

This patch fixes a problem where using ethtool rxnfc command could let RX flow hash be set on disabled queues. This patch fixes the problem by returning the number of enabled queues before setting rxnfc.

Change-ID Idbac86b0b47ddacc8deee7cd257e41de01cbe5c0
Quoted 6 lines

---
Testing-hints: 5535691
Verify that ethtool set rxnfc cannot set the flow hash on queues that are not active, on a system that has a non power of two number of cpus.

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch code changes correctly applied, cannot set number of queues to greater than number of processors.