All of lore.kernel.org
 help / color / mirror / Atom feed
* [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06
@ 2015-01-06  8:44 Jeff Kirsher
  2015-01-06  8:44 ` [net 1/3] i40e: fix un-necessary Tx hangs Jeff Kirsher
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jeff Kirsher @ 2015-01-06  8:44 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene

This series contains fixes to i40e only.

Jesse provides a fix for when the driver was polling with interrupts
disabled the hardware would occasionally not write back descriptors.
His fix causes the driver to detect this situation and force an interrupt
to fire which will flush the stuck descriptor.

Anjali provides a couple of fixes, the first corrects an issue where
the receive port checksum error counter was incrementing incorrectly with
UDP encapsulated tunneled traffic.  The second fix resolves an issue where
the driver was examining the outer protocol layer to set the inner protocol
layer checksum offload.  In the case of TCP over IPv6 over an IPv4 based
VXLAN, the inner checksum offloads would be set to look for IPv4/UDP
instead of IPv6/TCP, so fixed the issue so that the driver will look at
the proper layer for encapsulation offload settings.

The following are changes since commit 7ce67a38f799d1fb332f672b117efbadedaa5352:
  net: ethernet: cpsw: fix hangs with interrupts
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net master

Anjali Singhai (2):
  i40e: Fix Rx checksum error counter
  i40e: Fix bug with TCP over IPv6 over VXLAN

Jesse Brandeburg (1):
  i40e: fix un-necessary Tx hangs

 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 83 ++++++++++++++++++-----------
 1 file changed, 53 insertions(+), 30 deletions(-)

-- 
1.9.3

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

* [net 1/3] i40e: fix un-necessary Tx hangs
  2015-01-06  8:44 [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 Jeff Kirsher
@ 2015-01-06  8:44 ` Jeff Kirsher
  2015-01-06 17:04   ` Jesse Brandeburg
  2015-01-06  8:44 ` [net 2/3] i40e: Fix Rx checksum error counter Jeff Kirsher
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jeff Kirsher @ 2015-01-06  8:44 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

When the driver was polling with interrupts disabled the hardware
will occasionally not write back descriptors.  This patch causes
the driver to detect this situation and force an interrupt to
fire which will flush the stuck descriptor.  Does not conflict
with NAPI because if we are already polling the napi_schedule is
ignored.  Additionally the extra interrupts are rate limited, so
don't cause a burden to the CPU.

Change-ID: Iba4616d2a71288672a5f08e4512e2704b97335e8
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 35 ++++++++++++++++++++++++-----
 1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 04b4414..9995598 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -658,6 +658,8 @@ static inline u32 i40e_get_head(struct i40e_ring *tx_ring)
 	return le32_to_cpu(*(volatile __le32 *)head);
 }
 
+#define WB_STRIDE 0x3
+
 /**
  * i40e_clean_tx_irq - Reclaim resources after transmit completes
  * @tx_ring:  tx ring to clean
@@ -759,6 +761,25 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 	tx_ring->q_vector->tx.total_bytes += total_bytes;
 	tx_ring->q_vector->tx.total_packets += total_packets;
 
+	/* check to see if there are any non-cache aligned descriptors
+	 * waiting to be written back, and kick the hardware to force
+	 * them to be written back in case of napi polling
+	 */
+	if (budget &&
+	    !((i & WB_STRIDE) == WB_STRIDE) &&
+	    !test_bit(__I40E_DOWN, &tx_ring->vsi->state) &&
+	    (I40E_DESC_UNUSED(tx_ring) != tx_ring->count)) {
+		u32 val = I40E_PFINT_DYN_CTLN_INTENA_MASK |
+			  I40E_PFINT_DYN_CTLN_SWINT_TRIG_MASK |
+			  I40E_PFINT_DYN_CTLN_SW_ITR_INDX_ENA_MASK;
+			  /* allow 00 to be written to the index */
+
+		wr32(&tx_ring->vsi->back->hw,
+		     I40E_PFINT_DYN_CTLN(tx_ring->q_vector->v_idx +
+					 tx_ring->vsi->base_vector - 1),
+		     val);
+	}
+
 	if (check_for_tx_hang(tx_ring) && i40e_check_tx_hang(tx_ring)) {
 		/* schedule immediate reset if we believe we hung */
 		dev_info(tx_ring->dev, "Detected Tx Unit Hang\n"
@@ -777,13 +798,16 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 		netif_stop_subqueue(tx_ring->netdev, tx_ring->queue_index);
 
 		dev_info(tx_ring->dev,
-			 "tx hang detected on queue %d, resetting adapter\n",
+			 "tx hang detected on queue %d, reset requested\n",
 			 tx_ring->queue_index);
 
-		tx_ring->netdev->netdev_ops->ndo_tx_timeout(tx_ring->netdev);
+		/* do not fire the reset immediately, wait for the stack to
+		 * decide we are truly stuck, also prevents every queue from
+		 * simultaneously requesting a reset
+		 */
 
-		/* the adapter is about to reset, no point in enabling stuff */
-		return true;
+		/* the adapter is about to reset, no point in enabling polling */
+		budget = 1;
 	}
 
 	netdev_tx_completed_queue(netdev_get_tx_queue(tx_ring->netdev,
@@ -806,7 +830,7 @@ static bool i40e_clean_tx_irq(struct i40e_ring *tx_ring, int budget)
 		}
 	}
 
-	return budget > 0;
+	return !!budget;
 }
 
 /**
@@ -2198,7 +2222,6 @@ static void i40e_tx_map(struct i40e_ring *tx_ring, struct sk_buff *skb,
 	/* Place RS bit on last descriptor of any packet that spans across the
 	 * 4th descriptor (WB_STRIDE aka 0x3) in a 64B cacheline.
 	 */
-#define WB_STRIDE 0x3
 	if (((i & WB_STRIDE) != WB_STRIDE) &&
 	    (first <= &tx_ring->tx_bi[i]) &&
 	    (first >= &tx_ring->tx_bi[i & ~WB_STRIDE])) {
-- 
1.9.3

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

* [net 2/3] i40e: Fix Rx checksum error counter
  2015-01-06  8:44 [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 Jeff Kirsher
  2015-01-06  8:44 ` [net 1/3] i40e: fix un-necessary Tx hangs Jeff Kirsher
@ 2015-01-06  8:44 ` Jeff Kirsher
  2015-01-06  8:44 ` [net 3/3] i40e: Fix bug with TCP over IPv6 over VXLAN Jeff Kirsher
  2015-01-06 18:31 ` [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2015-01-06  8:44 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai, netdev, nhorman, sassmann, jogreene, Greg Rose,
	Jeff Kirsher

From: Anjali Singhai <anjali.singhai@intel.com>

The Rx port checksum error counter was incrementing incorrectly with
UDP encapsulated tunneled traffic.  This patch fixes the problem so that
the port_rx_csum counter will show accurate statistics.

Signed-off-by: Anjali Singhai <anjali.singhai@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Jim Young <james.m.young@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 9995598..2f19ea5 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1314,9 +1314,7 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
 	 * so the total length of IPv4 header is IHL*4 bytes
 	 * The UDP_0 bit *may* bet set if the *inner* header is UDP
 	 */
-	if (ipv4_tunnel &&
-	    (decoded.inner_prot != I40E_RX_PTYPE_INNER_PROT_UDP) &&
-	    !(rx_status & (1 << I40E_RX_DESC_STATUS_UDP_0_SHIFT))) {
+	if (ipv4_tunnel) {
 		skb->transport_header = skb->mac_header +
 					sizeof(struct ethhdr) +
 					(ip_hdr(skb)->ihl * 4);
@@ -1326,15 +1324,19 @@ static inline void i40e_rx_checksum(struct i40e_vsi *vsi,
 					  skb->protocol == htons(ETH_P_8021AD))
 					  ? VLAN_HLEN : 0;
 
-		rx_udp_csum = udp_csum(skb);
-		iph = ip_hdr(skb);
-		csum = csum_tcpudp_magic(
-				iph->saddr, iph->daddr,
-				(skb->len - skb_transport_offset(skb)),
-				IPPROTO_UDP, rx_udp_csum);
+		if ((ip_hdr(skb)->protocol == IPPROTO_UDP) &&
+		    (udp_hdr(skb)->check != 0)) {
+			rx_udp_csum = udp_csum(skb);
+			iph = ip_hdr(skb);
+			csum = csum_tcpudp_magic(
+					iph->saddr, iph->daddr,
+					(skb->len - skb_transport_offset(skb)),
+					IPPROTO_UDP, rx_udp_csum);
 
-		if (udp_hdr(skb)->check != csum)
-			goto checksum_fail;
+			if (udp_hdr(skb)->check != csum)
+				goto checksum_fail;
+
+		} /* else its GRE and so no outer UDP header */
 	}
 
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
-- 
1.9.3

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

* [net 3/3] i40e: Fix bug with TCP over IPv6 over VXLAN
  2015-01-06  8:44 [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 Jeff Kirsher
  2015-01-06  8:44 ` [net 1/3] i40e: fix un-necessary Tx hangs Jeff Kirsher
  2015-01-06  8:44 ` [net 2/3] i40e: Fix Rx checksum error counter Jeff Kirsher
@ 2015-01-06  8:44 ` Jeff Kirsher
  2015-01-06 18:31 ` [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: Jeff Kirsher @ 2015-01-06  8:44 UTC (permalink / raw)
  To: davem
  Cc: Anjali Singhai, netdev, nhorman, sassmann, jogreene, Greg Rose,
	Jeff Kirsher

From: Anjali Singhai <anjali.singhai@intel.com>

The driver was examining the outer protocol layer to set the inner protocol
layer checksum offload.  In the case of TCP over IPV6 over an IPv4 based
VXLAN the inner checksum offloads would be set to look for IPv4/UDP instead
of IPv6/TCP.  This code fixes that so that the driver will look at the
proper layer for encapsulation offload settings.

Signed-off-by: Anjali Singhai <anjali.singhai@intel.com>
Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_txrx.c | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 2f19ea5..35696ab 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1866,17 +1866,16 @@ static int i40e_tso(struct i40e_ring *tx_ring, struct sk_buff *skb,
 	if (err < 0)
 		return err;
 
-	if (protocol == htons(ETH_P_IP)) {
-		iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);
+	iph = skb->encapsulation ? inner_ip_hdr(skb) : ip_hdr(skb);
+	ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb) : ipv6_hdr(skb);
+
+	if (iph->version == 4) {
 		tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);
 		iph->tot_len = 0;
 		iph->check = 0;
 		tcph->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
 						 0, IPPROTO_TCP, 0);
-	} else if (skb_is_gso_v6(skb)) {
-
-		ipv6h = skb->encapsulation ? inner_ipv6_hdr(skb)
-					   : ipv6_hdr(skb);
+	} else if (ipv6h->version == 6) {
 		tcph = skb->encapsulation ? inner_tcp_hdr(skb) : tcp_hdr(skb);
 		ipv6h->payload_len = 0;
 		tcph->check = ~csum_ipv6_magic(&ipv6h->saddr, &ipv6h->daddr,
@@ -1972,13 +1971,9 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags,
 					 I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM;
 			}
 		} else if (tx_flags & I40E_TX_FLAGS_IPV6) {
-			if (tx_flags & I40E_TX_FLAGS_TSO) {
-				*cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6;
+			*cd_tunneling |= I40E_TX_CTX_EXT_IP_IPV6;
+			if (tx_flags & I40E_TX_FLAGS_TSO)
 				ip_hdr(skb)->check = 0;
-			} else {
-				*cd_tunneling |=
-					 I40E_TX_CTX_EXT_IP_IPV4_NO_CSUM;
-			}
 		}
 
 		/* Now set the ctx descriptor fields */
@@ -1988,7 +1983,10 @@ static void i40e_tx_enable_csum(struct sk_buff *skb, u32 tx_flags,
 				   ((skb_inner_network_offset(skb) -
 					skb_transport_offset(skb)) >> 1) <<
 				   I40E_TXD_CTX_QW0_NATLEN_SHIFT;
-
+		if (this_ip_hdr->version == 6) {
+			tx_flags &= ~I40E_TX_FLAGS_IPV4;
+			tx_flags |= I40E_TX_FLAGS_IPV6;
+		}
 	} else {
 		network_hdr_len = skb_network_header_len(skb);
 		this_ip_hdr = ip_hdr(skb);
-- 
1.9.3

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

* Re: [net 1/3] i40e: fix un-necessary Tx hangs
  2015-01-06  8:44 ` [net 1/3] i40e: fix un-necessary Tx hangs Jeff Kirsher
@ 2015-01-06 17:04   ` Jesse Brandeburg
  2015-01-06 18:31     ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Jesse Brandeburg @ 2015-01-06 17:04 UTC (permalink / raw)
  To: Jeff Kirsher, davem; +Cc: netdev, nhorman, sassmann, jogreene

On Tue, 6 Jan 2015 00:44:22 -0800
Jeff Kirsher <jeffrey.t.kirsher@intel.com> wrote:

> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> 
> When the driver was polling with interrupts disabled the hardware
> will occasionally not write back descriptors.  This patch causes
> the driver to detect this situation and force an interrupt to
> fire which will flush the stuck descriptor.  Does not conflict
> with NAPI because if we are already polling the napi_schedule is
> ignored.  Additionally the extra interrupts are rate limited, so
> don't cause a burden to the CPU.

Dave, sorry to do this but we discovered a bug in this patch (where
this patch impacts performance) and didn't interrupt Jeff before he sent
it (my mistake) I will prep a v2 for Jeff.

Please do not apply.

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

* Re: [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06
  2015-01-06  8:44 [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2015-01-06  8:44 ` [net 3/3] i40e: Fix bug with TCP over IPv6 over VXLAN Jeff Kirsher
@ 2015-01-06 18:31 ` David Miller
  3 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-01-06 18:31 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue,  6 Jan 2015 00:44:21 -0800

> This series contains fixes to i40e only.
> 
> Jesse provides a fix for when the driver was polling with interrupts
> disabled the hardware would occasionally not write back descriptors.
> His fix causes the driver to detect this situation and force an interrupt
> to fire which will flush the stuck descriptor.
> 
> Anjali provides a couple of fixes, the first corrects an issue where
> the receive port checksum error counter was incrementing incorrectly with
> UDP encapsulated tunneled traffic.  The second fix resolves an issue where
> the driver was examining the outer protocol layer to set the inner protocol
> layer checksum offload.  In the case of TCP over IPv6 over an IPv4 based
> VXLAN, the inner checksum offloads would be set to look for IPv4/UDP
> instead of IPv6/TCP, so fixed the issue so that the driver will look at
> the proper layer for encapsulation offload settings.

Not pulled, waiting for a respin with the fix for patch #1, thanks.

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

* Re: [net 1/3] i40e: fix un-necessary Tx hangs
  2015-01-06 17:04   ` Jesse Brandeburg
@ 2015-01-06 18:31     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2015-01-06 18:31 UTC (permalink / raw)
  To: jesse.brandeburg; +Cc: jeffrey.t.kirsher, netdev, nhorman, sassmann, jogreene

From: Jesse Brandeburg <jesse.brandeburg@intel.com>
Date: Tue, 6 Jan 2015 09:04:40 -0800

> Dave, sorry to do this but we discovered a bug in this patch (where
> this patch impacts performance) and didn't interrupt Jeff before he sent
> it (my mistake) I will prep a v2 for Jeff.
> 
> Please do not apply.

Ok.

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

end of thread, other threads:[~2015-01-06 18:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-06  8:44 [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 Jeff Kirsher
2015-01-06  8:44 ` [net 1/3] i40e: fix un-necessary Tx hangs Jeff Kirsher
2015-01-06 17:04   ` Jesse Brandeburg
2015-01-06 18:31     ` David Miller
2015-01-06  8:44 ` [net 2/3] i40e: Fix Rx checksum error counter Jeff Kirsher
2015-01-06  8:44 ` [net 3/3] i40e: Fix bug with TCP over IPv6 over VXLAN Jeff Kirsher
2015-01-06 18:31 ` [net 0/3][pull request] Intel Wired LAN Driver Updates 2015-01-06 David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.