All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] TSO bug fixes
@ 2020-02-05 12:38 Harini Katakam
  2020-02-05 12:38 ` [PATCH v3 1/2] net: macb: Remove unnecessary alignment check for TSO Harini Katakam
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Harini Katakam @ 2020-02-05 12:38 UTC (permalink / raw)
  To: nicolas.ferre, davem, claudiu.beznea, kuba
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux, harini.katakam

An IP errata was recently discovered when testing TSO enabled versions
with perf test tools where a false amba error is reported by the IP.
Some ways to reproduce would be to use iperf or applications with payload
descriptor sizes very close to 16K. Once the error is observed TXERR (or
bit 6 of ISR) will be constantly triggered leading to a series of tx path
error handling and clean up. Workaround the same by limiting this size to
0x3FC0 as recommended by Cadence. There was no performance impact on 1G
system that I tested with.

Note on patch 1: The alignment code may be unused but leaving it there
in case anyone is using UFO.

Added Fixes tag to patch 1.

Harini Katakam (2):
  net: macb: Remove unnecessary alignment check for TSO
  net: macb: Limit maximum GEM TX length in TSO

 drivers/net/ethernet/cadence/macb_main.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

-- 
2.7.4


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

* [PATCH v3 1/2] net: macb: Remove unnecessary alignment check for TSO
  2020-02-05 12:38 [PATCH v3 0/2] TSO bug fixes Harini Katakam
@ 2020-02-05 12:38 ` Harini Katakam
  2020-02-05 12:38 ` [PATCH v3 2/2] net: macb: Limit maximum GEM TX length in TSO Harini Katakam
  2020-02-05 13:49 ` [PATCH v3 0/2] TSO bug fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Harini Katakam @ 2020-02-05 12:38 UTC (permalink / raw)
  To: nicolas.ferre, davem, claudiu.beznea, kuba
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux, harini.katakam

The IP TSO implementation does NOT require the length to be a
multiple of 8. That is only a requirement for UFO as per IP
documentation. Hence, exit macb_features_check function in the
beginning if the protocol is not UDP. Only when it is UDP,
proceed further to the alignment checks. Update comments to
reflect the same. Also remove dead code checking for protocol
TCP when calculating header length.

Fixes: 1629dd4f763c ("cadence: Add LSO support.")
Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
---
v3:
Update comments and commit message
Remove dead code checking for TCP
v2:
Added Fixes tag

 drivers/net/ethernet/cadence/macb_main.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 7a2fe63..1131192 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1791,16 +1791,14 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
 
 	/* Validate LSO compatibility */
 
-	/* there is only one buffer */
-	if (!skb_is_nonlinear(skb))
+	/* there is only one buffer or protocol is not UDP */
+	if (!skb_is_nonlinear(skb) || (ip_hdr(skb)->protocol != IPPROTO_UDP))
 		return features;
 
 	/* length of header */
 	hdrlen = skb_transport_offset(skb);
-	if (ip_hdr(skb)->protocol == IPPROTO_TCP)
-		hdrlen += tcp_hdrlen(skb);
 
-	/* For LSO:
+	/* For UFO only:
 	 * When software supplies two or more payload buffers all payload buffers
 	 * apart from the last must be a multiple of 8 bytes in size.
 	 */
-- 
2.7.4


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

* [PATCH v3 2/2] net: macb: Limit maximum GEM TX length in TSO
  2020-02-05 12:38 [PATCH v3 0/2] TSO bug fixes Harini Katakam
  2020-02-05 12:38 ` [PATCH v3 1/2] net: macb: Remove unnecessary alignment check for TSO Harini Katakam
@ 2020-02-05 12:38 ` Harini Katakam
  2020-02-05 13:49 ` [PATCH v3 0/2] TSO bug fixes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Harini Katakam @ 2020-02-05 12:38 UTC (permalink / raw)
  To: nicolas.ferre, davem, claudiu.beznea, kuba
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux, harini.katakam

GEM_MAX_TX_LEN currently resolves to 0x3FF8 for any IP version supporting
TSO with full 14bits of length field in payload descriptor. But an IP
errata causes false amba_error (bit 6 of ISR) when length in payload
descriptors is specified above 16387. The error occurs because the DMA
falsely concludes that there is not enough space in SRAM for incoming
payload. These errors were observed continuously under stress of large
packets using iperf on a version where SRAM was 16K for each queue. This
errata will be documented shortly and affects all versions since TSO
functionality was added. Hence limit the max length to 0x3FC0 (rounded).

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
---
v3:
Add comment
v2:
Use 0x3FC0 by default

 drivers/net/ethernet/cadence/macb_main.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1131192..4508f0d 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -73,7 +73,11 @@ struct sifive_fu540_macb_mgmt {
 /* Max length of transmit frame must be a multiple of 8 bytes */
 #define MACB_TX_LEN_ALIGN	8
 #define MACB_MAX_TX_LEN		((unsigned int)((1 << MACB_TX_FRMLEN_SIZE) - 1) & ~((unsigned int)(MACB_TX_LEN_ALIGN - 1)))
-#define GEM_MAX_TX_LEN		((unsigned int)((1 << GEM_TX_FRMLEN_SIZE) - 1) & ~((unsigned int)(MACB_TX_LEN_ALIGN - 1)))
+/* Limit maximum TX length as per Cadence TSO errata. This is to avoid a
+ * false amba_error in TX path from the DMA assuming there is not enough
+ * space in the SRAM (16KB) even when there is.
+ */
+#define GEM_MAX_TX_LEN		(unsigned int)(0x3FC0)
 
 #define GEM_MTU_MIN_SIZE	ETH_MIN_MTU
 #define MACB_NETIF_LSO		NETIF_F_TSO
-- 
2.7.4


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

* Re: [PATCH v3 0/2] TSO bug fixes
  2020-02-05 12:38 [PATCH v3 0/2] TSO bug fixes Harini Katakam
  2020-02-05 12:38 ` [PATCH v3 1/2] net: macb: Remove unnecessary alignment check for TSO Harini Katakam
  2020-02-05 12:38 ` [PATCH v3 2/2] net: macb: Limit maximum GEM TX length in TSO Harini Katakam
@ 2020-02-05 13:49 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-02-05 13:49 UTC (permalink / raw)
  To: harini.katakam
  Cc: nicolas.ferre, claudiu.beznea, kuba, netdev, linux-kernel,
	michal.simek, harinikatakamlinux

From: Harini Katakam <harini.katakam@xilinx.com>
Date: Wed,  5 Feb 2020 18:08:10 +0530

> An IP errata was recently discovered when testing TSO enabled versions
> with perf test tools where a false amba error is reported by the IP.
> Some ways to reproduce would be to use iperf or applications with payload
> descriptor sizes very close to 16K. Once the error is observed TXERR (or
> bit 6 of ISR) will be constantly triggered leading to a series of tx path
> error handling and clean up. Workaround the same by limiting this size to
> 0x3FC0 as recommended by Cadence. There was no performance impact on 1G
> system that I tested with.
> 
> Note on patch 1: The alignment code may be unused but leaving it there
> in case anyone is using UFO.
> 
> Added Fixes tag to patch 1.

Series applied and queued up for -stable, thank you.

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

end of thread, other threads:[~2020-02-05 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 12:38 [PATCH v3 0/2] TSO bug fixes Harini Katakam
2020-02-05 12:38 ` [PATCH v3 1/2] net: macb: Remove unnecessary alignment check for TSO Harini Katakam
2020-02-05 12:38 ` [PATCH v3 2/2] net: macb: Limit maximum GEM TX length in TSO Harini Katakam
2020-02-05 13:49 ` [PATCH v3 0/2] TSO bug fixes 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.