Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Bimmy Pujari 2 participants 22 messages Sep 7, 2016 – Sep 9, 2016

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

cover i40e/i40evf updates

Alexander Duyck adds code to limit TX descriptor count in cases where frag size is greater than 16K.

Bimmy Pujari removes unnecessary error checking against i40evf_up_complete.

Alan Brady adds code to fix deleting mac filters.

Harshitha Ramamurthy removes 100 Mbps SGMII support for X722.

Henry Tieman removes unreachable code.

Jacob Keller adds code to cleanup ATR auto_disable_flags use & checks conflicting ntuple/sideband rules when re-enabling ATR.

Lihong Yang removes unnecessary error checking against i40e_shutdown_adminq.

Preethi Banala adds encap csum VF offload flag.

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c    |  3 ++
 drivers/net/ethernet/intel/i40e/i40e_main.c       | 43 ++++++++++-------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c       | 21 +++++------
 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h   |  1 +
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c     |  7 ++--
 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h |  1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c   | 16 +++------
 7 files changed, 39 insertions(+), 53 deletions(-)
Signature · 1 line
2.4.11
#1 lore raw

PATCH 1/10 i40evf: remove unnecessary error checking against i40evf_up_complete

Function i40evf_up_complete() always returns success. Changed this to a void type and removed the code that checks the return status and prints an error message.

Change-ID I8c400f174786b9c855f679e470f35af292fb50ad
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +3 -8
index f751f7b..2074a8f 100644
@@ -1007,7 +1007,7 @@ static void i40evf_configure(struct i40evf_adapter *adapter)
  * i40evf_up_complete - Finish the last steps of bringing up a connection
  * @adapter: board private structure
  **/
-static int i40evf_up_complete(struct i40evf_adapter *adapter)
+static void i40evf_up_complete(struct i40evf_adapter *adapter)
 {
 	adapter->state = __I40EVF_RUNNING;
 	clear_bit(__I40E_DOWN, &adapter->vsi.state);
@@ -1016,7 +1016,6 @@ static int i40evf_up_complete(struct i40evf_adapter *adapter)
 
 	adapter->aq_required |= I40EVF_FLAG_AQ_ENABLE_QUEUES;
 	mod_timer_pending(&adapter->watchdog_timer, jiffies + 1);
-	return 0;
 }
 
 /**
@@ -1824,9 +1823,7 @@ continue_reset:
 
 		i40evf_configure(adapter);
 
-		err = i40evf_up_complete(adapter);
-		if (err)
-			goto reset_err;
+		i40evf_up_complete(adapter);
 
 		i40evf_irq_enable(adapter, true);
 	} else {
@@ -2056,9 +2053,7 @@ static int i40evf_open(struct net_device *netdev)
 	i40evf_add_filter(adapter, adapter->hw.mac.addr);
 	i40evf_configure(adapter);
 
-	err = i40evf_up_complete(adapter);
-	if (err)
-		goto err_req_irq;
+	i40evf_up_complete(adapter);
 
 	i40evf_irq_enable(adapter, true);
 
Signature · 1 line
2.4.11
#2 lore raw

PATCH 1/10 i40evf: remove unnecessary error checking against i40evf_up_complete

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 01/10] i40evf: remove unnecessary error checking against i40evf_up_complete

Function i40evf_up_complete() always returns success. Changed this to a void type and removed the code that checks the return status and prints an error message.

Quoted 5 lines
Change-ID I8c400f174786b9c855f679e470f35af292fb50ad
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
#3 lore raw

PATCH 2/10 i40e: Limit TX descriptor count in cases where frag size is greater than 16K

In reply to Bimmy Pujari

From: Alexander Duyck <[email protected]>

The i40e driver was incorrectly assuming that we would always be pulling no more than 1 descriptor from each fragment. It is in fact possible for us to end up with the case where 2 descriptors worth of data may be pulled when a frame is larger than one of the pieces generated when aligning the payload to either 4K or pieces smaller than 16K.

To adjust for this we just need to make certain to test all the way to the end of the fragments as it is possible for us to span 2 descriptors in the block before us so we need to guarantee that even the last 6 descriptors have enough data to fill a full frame.

Change-ID Ic2ecb4d6b745f447d334e66c14002152f50e2f99

---
Testing Hints:
This is hard to reproduce. Patch submitted to customer for testing. Best effort would be to try testing TSO, if possible TSO with iSCSI to verify nothing there is broken.

HSD-number: 10021204

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 7 ++-----
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_txrx.c +2 -5
index f8d6623..bf7bb7c 100644
@@ -2621,9 +2621,7 @@ bool __i40e_chk_linearize(struct sk_buff *skb)
 		return false;
 
 	/* We need to walk through the list and validate that each group
-	 * of 6 fragments totals at least gso_size.  However we don't need
-	 * to perform such validation on the last 6 since the last 6 cannot
-	 * inherit any data from a descriptor after them.
+	 * of 6 fragments totals at least gso_size.
 	 */
 	nr_frags -= I40E_MAX_BUFFER_TXD - 2;
 	frag = &skb_shinfo(skb)->frags[0];
@@ -2654,8 +2652,7 @@ bool __i40e_chk_linearize(struct sk_buff *skb)
 		if (sum < 0)
 			return true;
 
-		/* use pre-decrement to avoid processing last fragment */
-		if (!--nr_frags)
+		if (!nr_frags--)
 			break;
 
 		sum -= skb_frag_size(stale++);
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +2 -5
index 0130458..e3427eb 100644
@@ -1832,9 +1832,7 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)
 		return false;
 
 	/* We need to walk through the list and validate that each group
-	 * of 6 fragments totals at least gso_size.  However we don't need
-	 * to perform such validation on the last 6 since the last 6 cannot
-	 * inherit any data from a descriptor after them.
+	 * of 6 fragments totals@least gso_size.
 	 */
 	nr_frags -= I40E_MAX_BUFFER_TXD - 2;
 	frag = &skb_shinfo(skb)->frags[0];
@@ -1865,8 +1863,7 @@ bool __i40evf_chk_linearize(struct sk_buff *skb)
 		if (sum < 0)
 			return true;
 
-		/* use pre-decrement to avoid processing last fragment */
-		if (!--nr_frags)
+		if (!nr_frags--)
 			break;
 
 		sum -= skb_frag_size(stale++);
Signature · 1 line
2.4.11
#4 lore raw

PATCH 2/10 i40e: Limit TX descriptor count in cases where frag size is greater than 16K

Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 02/10] i40e: Limit TX descriptor count in cases where frag size is greater than 16K

From: Alexander Duyck <[email protected]>

The i40e driver was incorrectly assuming that we would always be pulling no more than 1 descriptor from each fragment. It is in fact possible for us to end up with the case where 2 descriptors worth of data may be pulled when a frame is larger than one of the pieces generated when aligning the payload to either 4K or pieces smaller than 16K.

To adjust for this we just need to make certain to test all the way to the end of the fragments as it is possible for us to span 2 descriptors in the block before us so we need to guarantee that even the last 6 descriptors have enough data to fill a full frame.

Change-ID Ic2ecb4d6b745f447d334e66c14002152f50e2f99

---
Testing Hints:
This is hard to reproduce. Patch submitted to customer for testing. Best effort would be to try testing TSO, if possible TSO with iSCSI to verify nothing there is broken.

Quoted 5 lines

HSD-number: 10021204

 drivers/net/ethernet/intel/i40e/i40e_txrx.c   | 7 ++-----
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)
#5 lore raw

PATCH 3/10 i40evf: remove unnecessary error checking against i40e_shutdown_adminq

In reply to Bimmy Pujari

From: Lihong Yang <[email protected]>

The i40e_shutdown_adminq function never returns failure. There is no need to check the non-0 return value. Clean up the unnecessary error checking and warning against it.

Change-ID Ibb616f09cfb93bd1a872ebf3241a15fb8354b31b

---
Testing Hints:
Found by static code analysis. Check by code inspection.

 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -2
index 2074a8f..f2111d2 100644
@@ -1782,8 +1782,7 @@ continue_reset:
 	i40evf_free_all_tx_resources(adapter);
 
 	/* kill and reinit the admin queue */
-	if (i40evf_shutdown_adminq(hw))
-		dev_warn(&adapter->pdev->dev, "Failed to shut down adminq\n");
+	i40evf_shutdown_adminq(hw);
 	adapter->current_op = I40E_VIRTCHNL_OP_UNKNOWN;
 	err = i40evf_init_adminq(hw);
 	if (err)
Signature · 1 line
2.4.11
#6 lore raw

PATCH 3/10 i40evf: remove unnecessary error checking against i40e_shutdown_adminq

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 03/10] i40evf: remove unnecessary error checking against i40e_shutdown_adminq

From: Lihong Yang <[email protected]>

The i40e_shutdown_adminq function never returns failure. There is no need to check the non-0 return value. Clean up the unnecessary error checking and warning against it.

Quoted 8 lines
Change-ID Ibb616f09cfb93bd1a872ebf3241a15fb8354b31b

---
Testing Hints:
Found by static code analysis. Check by code inspection.

 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
#7 lore raw

PATCH 4/10 i40e: Remove 100 Mbps SGMII support for X722

In reply to Bimmy Pujari

From: Harshitha Ramamurthy <[email protected]>

This patch fixes the problem where driver shows 100 Mbps as a supported speed, and allows it to be configured for advertising on X722 devices. This patch fixes the problem by not setting the 100 Mbps SGMII flag for X722 devices.

Without this patch, the user incorrectly thinks that 100 Mbps is supported and hence might try to advertise it on X722 devices when it is actually not a supported speed.

Change-ID I8c3d7c4251a9402d98994ed29749b7b895a0f205

---
Testing Hints: Test on Copperpeak that 100 Mbps is not listed as supported or advertised on ethtool. Also ensure we are not able to configure the speed to 100 Mbps.

HSD-number: 10021180

 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
index 68c1253..e83b317 100644
@@ -8591,7 +8591,6 @@ static int i40e_sw_init(struct i40e_pf *pf)
 			     I40E_FLAG_WB_ON_ITR_CAPABLE |
 			     I40E_FLAG_MULTIPLE_TCP_UDP_RSS_PCTYPE |
 			     I40E_FLAG_NO_PCI_LINK_CHECK |
-			     I40E_FLAG_100M_SGMII_CAPABLE |
 			     I40E_FLAG_USE_SET_LLDP_MIB |
 			     I40E_FLAG_GENEVE_OFFLOAD_CAPABLE;
 	} else if ((pf->hw.aq.api_maj_ver > 1) ||
Signature · 1 line
2.4.11
#8 lore raw

PATCH 4/10 i40e: Remove 100 Mbps SGMII support for X722

Quoted 26 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 04/10] i40e: Remove 100 Mbps SGMII support for X722

From: Harshitha Ramamurthy <[email protected]>

This patch fixes the problem where driver shows 100 Mbps as a supported speed, and allows it to be configured for advertising on X722 devices. This patch fixes the problem by not setting the 100 Mbps SGMII flag for X722 devices.

Without this patch, the user incorrectly thinks that 100 Mbps is supported and hence might try to advertise it on X722 devices when it is actually not a supported speed.

Change-ID I8c3d7c4251a9402d98994ed29749b7b895a0f205

---
Testing Hints: Test on Copperpeak that 100 Mbps is not listed as supported or advertised on ethtool. Also ensure we are not able to configure the speed to 100 Mbps.

Quoted 4 lines

HSD-number: 10021180

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

Driver no longer reports 100Base/T nor allows advertise to be set to 100Base/T

#9 lore raw

PATCH 5/10 i40e: fix deleting mac filters

In reply to Bimmy Pujari

From: Alan Brady <[email protected]>

There exists a bug in which deleting a mac filter does not actually occur. The driver reports that the filter has been deleted with no error. The problem occurs because the wrong cmd_flag is passed to the firmware when deleting the filter. The firmware reports an error back to the driver but it is expressly ignored.

This fixes the bug by using the correct flag when deleting a filter. Without this patch, deleted filters remain in firmware and function as if they had not been deleted.

Change-ID I5f22b874f3b83f457702f18f0d5602ca21ac40c3

---
Testing-hints:
I used 'tcpdump -npi <iface>' to watch traffic.

1. Pass traffic with mac header 00:aa:00:aa:02:01 - no traffic
2. Add mac filter - ip maddr add 00:aa:00:aa:02:01 dev enp5s0f0
3. Pass traffic with mac header 00:aa:00:aa:02:01 - traffic
4. Delete mac filter - ip maddr del 00:aa:00:aa:02:01 dev enp5s0f0
5. Pass traffic with mac header 00:aa:00:aa:02:01 Expected - no traffic
Actual - traffic

 drivers/net/ethernet/intel/i40e/i40e_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -2
index e83b317..4c3c6ce 100644
@@ -1315,7 +1315,7 @@ static void i40e_rm_default_mac_filter(struct i40e_vsi *vsi, u8 *macaddr)
 	element.vlan_tag = 0;
 	/* ...and some firmware does it this way. */
 	element.flags = I40E_AQC_MACVLAN_DEL_PERFECT_MATCH |
-			I40E_AQC_MACVLAN_ADD_IGNORE_VLAN;
+			I40E_AQC_MACVLAN_DEL_IGNORE_VLAN;
 	i40e_aq_remove_macvlan(&pf->hw, vsi->seid, &element, 1, NULL);
 }
 
@@ -1908,7 +1908,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 			ether_addr_copy(del_list[num_del].mac_addr, f->macaddr);
 			if (f->vlan == I40E_VLAN_ANY) {
 				del_list[num_del].vlan_tag = 0;
-				cmd_flags |= I40E_AQC_MACVLAN_ADD_IGNORE_VLAN;
+				cmd_flags |= I40E_AQC_MACVLAN_DEL_IGNORE_VLAN;
 			} else {
 				del_list[num_del].vlan_tag =
 					cpu_to_le16((u16)(f->vlan));
Signature · 1 line
2.4.11
#10 lore raw

PATCH 5/10 i40e: fix deleting mac filters

Quoted 34 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Brady, Alan <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S45 05/10] i40e: fix deleting mac filters

From: Alan Brady <[email protected]>

There exists a bug in which deleting a mac filter does not actually occur. The driver reports that the filter has been deleted with no error. The problem occurs because the wrong cmd_flag is passed to the firmware when deleting the filter. The firmware reports an error back to the driver but it is expressly ignored.

This fixes the bug by using the correct flag when deleting a filter. Without this patch, deleted filters remain in firmware and function as if they had not been deleted.

Change-ID I5f22b874f3b83f457702f18f0d5602ca21ac40c3

---
Testing-hints:
I used 'tcpdump -npi <iface>' to watch traffic.

1. Pass traffic with mac header 00:aa:00:aa:02:01 - no traffic
2. Add mac filter - ip maddr add 00:aa:00:aa:02:01 dev enp5s0f0
3. Pass traffic with mac header 00:aa:00:aa:02:01 - traffic
4. Delete mac filter - ip maddr del 00:aa:00:aa:02:01 dev enp5s0f0
5. Pass traffic with mac header 00:aa:00:aa:02:01 Expected - no traffic
Actual - traffic

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

Bug/behavior no longer present, mac filters work as designed

#11 lore raw

PATCH 6/10 i40e: add encap csum VF offload flag

In reply to Bimmy Pujari

From: Preethi Banala <[email protected]>

Add ENCAP_CSUM offload negotiation flag. Currently VF assumes checksum offload for encapsulated packets is supported by default. Going forward, this feature needs to be negotiated with PF before advertising to the stack. Hence, we need a flag to control it.
This is in regards to prepping up for VF base mode functionality support.

Change-ID Iaab1f25cc0abda5f2fbe3309092640f0e77d163e
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h   | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 1 +
 2 files changed, 2 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl.h +1 -0
index c92a3bd..f861d31 100644
@@ -163,6 +163,7 @@ struct i40e_virtchnl_vsi_resource {
 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING	0x00020000
 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF		0X00080000
+#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM	0X00100000
 
 struct i40e_virtchnl_vf_resource {
 	u16 num_vsis;
drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h +1 -0
index f04ce6c..bd691ad 100644
@@ -160,6 +160,7 @@ struct i40e_virtchnl_vsi_resource {
 #define I40E_VIRTCHNL_VF_OFFLOAD_RX_POLLING	0x00020000
 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PCTYPE_V2	0x00040000
 #define I40E_VIRTCHNL_VF_OFFLOAD_RSS_PF		0X00080000
+#define I40E_VIRTCHNL_VF_OFFLOAD_ENCAP_CSUM	0X00100000
 
 struct i40e_virtchnl_vf_resource {
 	u16 num_vsis;
Signature · 1 line
2.4.11
#12 lore raw

PATCH 6/10 i40e: add encap csum VF offload flag

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 06/10] i40e: add encap csum VF offload flag

From: Preethi Banala <[email protected]>

Add ENCAP_CSUM offload negotiation flag. Currently VF assumes checksum offload for encapsulated packets is supported by default. Going forward, this feature needs to be negotiated with PF before advertising to the stack. Hence, we need a flag to control it.
This is in regards to prepping up for VF base mode functionality support.

Quoted 6 lines
Change-ID Iaab1f25cc0abda5f2fbe3309092640f0e77d163e
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl.h   | 1 +
 drivers/net/ethernet/intel/i40evf/i40e_virtchnl.h | 1 +
 2 files changed, 2 insertions(+)
#13 lore raw

PATCH 7/10 i40e: cleanup ATR auto_disable_flags use

In reply to Bimmy Pujari

From: Jacob Keller <[email protected]>

Some locations that disable ATR accidentally used the "full" disable by disabling the flag in the standard flags field. This incorrectly forces ATR off permanently instead of temporarily disabling it. In addition, some code locations accidentally set the ATR flag enabled when they only meant to clear the auto_disable_flags. This results in ignoring the user's ethtool private flag settings.

Additionally, when disabling ATR via ethtool, we did not perform a flush of the FD table. This results in the previously assigned ATR rules still functioning which was not expected.

Cleanup all these areas so that automatic disable uses only the auto_disable_flag. Fix the flush code so that we can trigger a flush even when we've disabled ATR and SB support, as otherwise the flush doesn't work. Fix ethtool setting to actually request a flush. Fix NETIF_F_NTUPLE flag to only clear the auto_disable setting and not enable the full feature.

Change-ID Ib2486111f8031bd16943e9308757b276305c03b5

---
Testing-hints:
See the marked HSDs for details

HSD-number: 5645176, 5645175

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  3 +++
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 20 +++++++-------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 14 +++++++-------
 3 files changed, 17 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +3 -0
index 2b2b55e..e842628 100644
@@ -3021,6 +3021,9 @@ static int i40e_set_priv_flags(struct net_device *dev, u32 flags)
 	} else {
 		pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 		pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
+
+		/* flush current ATR settings */
+		set_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
 	}
 
 	if ((flags & I40E_PRIV_FLAGS_VEB_STATS) &&
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -13
index 4c3c6ce..9ab15e2d 100644
@@ -5226,7 +5226,7 @@ static int i40e_up_complete(struct i40e_vsi *vsi)
 		/* reset fd counters */
 		pf->fd_add_err = pf->fd_atr_cnt = 0;
 		if (pf->fd_tcp_rule > 0) {
-			pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
+			pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
 			if (I40E_DEBUG_FD & pf->hw.debug_mask)
 				dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 exist\n");
 			pf->fd_tcp_rule = 0;
@@ -5960,9 +5960,6 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 	int fd_room;
 	int reg;
 
-	if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED)))
-		return;
-
 	if (!time_after(jiffies, pf->fd_flush_timestamp +
 				 (I40E_MIN_FD_FLUSH_INTERVAL * HZ)))
 		return;
@@ -5982,7 +5979,7 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 	}
 
 	pf->fd_flush_timestamp = jiffies;
-	pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
+	pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
 	/* flush all filters */
 	wr32(&pf->hw, I40E_PFQF_CTL_1,
 	     I40E_PFQF_CTL_1_CLEARFDTABLE_MASK);
@@ -6002,7 +5999,7 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 		/* replay sideband filters */
 		i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]);
 		if (!disable_atr)
-			pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
+			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 		clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
 		if (I40E_DEBUG_FD & pf->hw.debug_mask)
 			dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n");
@@ -6036,9 +6033,6 @@ static void i40e_fdir_reinit_subtask(struct i40e_pf *pf)
 	if (test_bit(__I40E_DOWN, &pf->state))
 		return;
 
-	if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED)))
-		return;
-
 	if (test_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state))
 		i40e_fdir_flush_and_replay(pf);
 
@@ -8665,13 +8659,13 @@ bool i40e_set_ntuple(struct i40e_pf *pf, netdev_features_t features)
 		/* reset fd counters */
 		pf->fd_add_err = pf->fd_atr_cnt = pf->fd_tcp_rule = 0;
 		pf->fdir_pf_active_filters = 0;
-		pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
-		if (I40E_DEBUG_FD & pf->hw.debug_mask)
-			dev_info(&pf->pdev->dev, "ATR re-enabled.\n");
 		/* if ATR was auto disabled it can be re-enabled. */
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
-		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED))
+		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) {
 			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
+			if (I40E_DEBUG_FD & pf->hw.debug_mask)
+				dev_info(&pf->pdev->dev, "ATR re-enabled.\n");
+		}
 	}
 	return need_reset;
 }
drivers/net/ethernet/intel/i40e/i40e_txrx.c +7 -7
index bf7bb7c..7ada05e 100644
@@ -282,18 +282,18 @@ static int i40e_add_del_fdir_tcpv4(struct i40e_vsi *vsi,
 
 	if (add) {
 		pf->fd_tcp_rule++;
-		if (pf->flags & I40E_FLAG_FD_ATR_ENABLED) {
-			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 flow being applied\n");
-			pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
-		}
+		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
+		    I40E_DEBUG_FD & pf->hw.debug_mask)
+			dev_info(&pf->pdev->dev, "Forcing ATR off, sideband rules for TCP/IPv4 flow being applied\n");
+		pf->auto_disable_flags |= I40E_FLAG_FD_ATR_ENABLED;
 	} else {
 		pf->fd_tcp_rule = (pf->fd_tcp_rule > 0) ?
 				  (pf->fd_tcp_rule - 1) : 0;
 		if (pf->fd_tcp_rule == 0) {
-			pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
-			if (I40E_DEBUG_FD & pf->hw.debug_mask)
+			if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
+			    I40E_DEBUG_FD & pf->hw.debug_mask)
 				dev_info(&pf->pdev->dev, "ATR re-enabled due to no sideband TCP/IPv4 rules\n");
+			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 		}
 	}
 
Signature · 1 line
2.4.11
#14 lore raw

PATCH 7/10 i40e: cleanup ATR auto_disable_flags use

Quoted 33 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 07/10] i40e: cleanup ATR auto_disable_flags use

From: Jacob Keller <[email protected]>

Some locations that disable ATR accidentally used the "full" disable by disabling the flag in the standard flags field. This incorrectly forces ATR off permanently instead of temporarily disabling it. In addition, some code locations accidentally set the ATR flag enabled when they only meant to clear the auto_disable_flags. This results in ignoring the user's ethtool private flag settings.

Additionally, when disabling ATR via ethtool, we did not perform a flush of the FD table. This results in the previously assigned ATR rules still functioning which was not expected.

Cleanup all these areas so that automatic disable uses only the auto_disable_flag. Fix the flush code so that we can trigger a flush even when we've disabled ATR and SB support, as otherwise the flush doesn't work. Fix ethtool setting to actually request a flush. Fix NETIF_F_NTUPLE flag to only clear the auto_disable setting and not enable the full feature.

Change-ID Ib2486111f8031bd16943e9308757b276305c03b5

---
Testing-hints:
See the marked HSDs for details

Quoted 6 lines

HSD-number: 5645176, 5645175

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c |  3 +++
 drivers/net/ethernet/intel/i40e/i40e_main.c    | 20 +++++++-------------
 drivers/net/ethernet/intel/i40e/i40e_txrx.c    | 14 +++++++-------
 3 files changed, 17 insertions(+), 20 deletions(-)

Bugs no longer present

#15 lore raw

PATCH 8/10 i40e: check conflicting ntuple/sideband rules when re-enabling ATR

In reply to Bimmy Pujari

From: Jacob Keller <[email protected]>

In i40e_fdir_check_and_reenable(), the driver performs some checks to determine whether it is safe to re-enable FD Sideband and FD ATR support. The current check will only determine if there is available space in the flow director table. However, this ignores the fact that ATR should be disabled when there are TCP/IPv4 sideband rules in effect. Add the missing check, and update the info message printed when I40E_DEBUG_FD is enabled.

Change-ID Ibb9c63e5be95d63c53a498fdd5dbf69f54a00e08
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +7 -3
index 9ab15e2d..3be9675 100644
@@ -5923,13 +5923,17 @@ void i40e_fdir_check_and_reenable(struct i40e_pf *pf)
 				dev_info(&pf->pdev->dev, "FD Sideband/ntuple is being enabled since we have space in the table now\n");
 		}
 	}
-	/* Wait for some more space to be available to turn on ATR */
+
+	/* Wait for some more space to be available to turn on ATR. We also
+	 * must check that no existing ntuple rules for TCP are in effect
+	 */
 	if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM * 2)) {
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
-		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)) {
+		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED) &&
+		    (pf->fd_tcp_rule == 0)) {
 			pf->auto_disable_flags &= ~I40E_FLAG_FD_ATR_ENABLED;
 			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "ATR is being enabled since we have space in the table now\n");
+				dev_info(&pf->pdev->dev, "ATR is being enabled since we have space in the table and there are no conflicting ntuple rules\n");
 		}
 	}
 
Signature · 1 line
2.4.11
#16 lore raw

PATCH 8/10 i40e: check conflicting ntuple/sideband rules when re-enabling ATR

ACK

Quoted 61 lines

-----Original Message-----
From: Pujari, Bimmy
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Keller, Jacob E <[email protected]>
Subject: [next PATCH S45 08/10] i40e: check conflicting ntuple/sideband rules when re-enabling ATR

From: Jacob Keller <[email protected]>

In i40e_fdir_check_and_reenable(), the driver performs some checks to determine whether it is safe to re-enable FD Sideband and FD ATR support. The current check will only determine if there is available space in the flow director table. However, this ignores the fact that ATR should be disabled when there are TCP/IPv4 sideband rules in effect. Add the missing check, and update the info message printed when I40E_DEBUG_FD is enabled.

Change-ID Ibb9c63e5be95d63c53a498fdd5dbf69f54a00e08
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +2 -1
index 9ab15e2d..3be9675 100644
@@ -5923,13 +5923,17 @@ void i40e_fdir_check_and_reenable(struct
 i40e_pf *pf)
 				dev_info(&pf->pdev->dev, "FD
 Sideband/ntuple is being enabled since we have space in the table now\n");
 		}
 	}
-	/* Wait for some more space to be available to turn on ATR */
+
+	/* Wait for some more space to be available to turn on ATR. We

also

drivers/net/ethernet/intel/i40e/i40e_main.c +2 -1
+	 * must check that no existing ntuple rules for TCP are in effect
+	 */
 	if (fcnt_prog < (fcnt_avail - I40E_FDIR_BUFFER_HEAD_ROOM * 2)) {
 		if ((pf->flags & I40E_FLAG_FD_ATR_ENABLED) &&
-		    (pf->auto_disable_flags &

I40E_FLAG_FD_ATR_ENABLED)) {

drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
+		    (pf->auto_disable_flags & I40E_FLAG_FD_ATR_ENABLED)

&&

drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
+		    (pf->fd_tcp_rule == 0)) {
 			pf->auto_disable_flags &=

~I40E_FLAG_FD_ATR_ENABLED;

drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
 			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "ATR is being

enabled since we have space in the table now\n");

drivers/net/ethernet/intel/i40e/i40e_main.c +1 -0
+				dev_info(&pf->pdev->dev, "ATR is being

enabled since we have space in the table and there are no conflicting ntuple rules\n");

drivers/net/ethernet/intel/i40e/i40e_main.c +0 -1
 		}
 	}
 
--

2.4.11

#17 lore raw

PATCH 8/10 i40e: check conflicting ntuple/sideband rules when re-enabling ATR

In reply to Bimmy Pujari
Quoted 18 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 08/10] i40e: check conflicting ntuple/sideband rules when re-enabling ATR

From: Jacob Keller <[email protected]>

In i40e_fdir_check_and_reenable(), the driver performs some checks to determine whether it is safe to re-enable FD Sideband and FD ATR support. The current check will only determine if there is available space in the flow director table. However, this ignores the fact that ATR should be disabled when there are TCP/IPv4 sideband rules in effect.
Add the missing check, and update the info message printed when I40E_DEBUG_FD is enabled.

Quoted 5 lines
Change-ID Ibb9c63e5be95d63c53a498fdd5dbf69f54a00e08
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Bugs no longer present

#18 lore raw

PATCH 9/10 i40e: removing unreachable code

In reply to Bimmy Pujari

From: Henry Tieman <[email protected]>

The return value from i40e_shutdown_adminq() is always 0 (I40E_SUCCESS). So, the test for non-0 will never be true. Cleanup by removing the test and debug print statement.

Change-ID Ie51e8e37515c3e3a6a9ff26fa951d0e5e24343c1

---
Testing Hints:
Found by static code analysis. Test by code inspection.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -5
index 3be9675..f741649 100644
@@ -11405,11 +11405,7 @@ static void i40e_remove(struct pci_dev *pdev)
 	}
 
 	/* shutdown the adminq */
-	ret_code = i40e_shutdown_adminq(hw);
-	if (ret_code)
-		dev_warn(&pdev->dev,
-			 "Failed to destroy the Admin Queue resources: %d\n",
-			 ret_code);
+	i40e_shutdown_adminq(hw);
 
 	/* destroy the locks only once, here */
 	mutex_destroy(&hw->aq.arq_mutex);
Signature · 1 line
2.4.11
#19 lore raw

PATCH 9/10 i40e: removing unreachable code

Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Tieman, Henry W <[email protected]>
Subject: [Intel-wired-lan] [next PATCH S45 09/10] i40e: removing unreachable code

From: Henry Tieman <[email protected]>

The return value from i40e_shutdown_adminq() is always 0 (I40E_SUCCESS). So, the test for non-0 will never be true. Cleanup by removing the test and debug print statement.

Quoted 8 lines
Change-ID Ie51e8e37515c3e3a6a9ff26fa951d0e5e24343c1

---
Testing Hints:
Found by static code analysis. Test by code inspection.

 drivers/net/ethernet/intel/i40e/i40e_main.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
#20 lore raw

PATCH 10/10 i40e/i40evf: Changed version to 1.6.16

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 f741649..995dc44 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 12
+#define DRV_VERSION_BUILD 16
 #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 f2111d2..39268e2 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 12
+#define DRV_VERSION_BUILD 16
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD) \
Signature · 1 line
2.4.11
#21 lore raw

PATCH 10/10 i40e/i40evf: Changed version to 1.6.16

Quoted 8 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Bimmy Pujari
Sent: Tuesday, September 06, 2016 6:05 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S45 10/10] i40e/i40evf: Changed version to 1.6.16

Quoted 5 lines
---
 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(-)