Skip to content

Commit 83576e3

Browse files
committed
Merge branch 'macb-TSO-bug-fixes'
Harini Katakam says: ==================== macb: TSO bug fixes 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. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 38f88c4 + f822e9c commit 83576e3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ struct sifive_fu540_macb_mgmt {
7373
/* Max length of transmit frame must be a multiple of 8 bytes */
7474
#define MACB_TX_LEN_ALIGN 8
7575
#define MACB_MAX_TX_LEN ((unsigned int)((1 << MACB_TX_FRMLEN_SIZE) - 1) & ~((unsigned int)(MACB_TX_LEN_ALIGN - 1)))
76-
#define GEM_MAX_TX_LEN ((unsigned int)((1 << GEM_TX_FRMLEN_SIZE) - 1) & ~((unsigned int)(MACB_TX_LEN_ALIGN - 1)))
76+
/* Limit maximum TX length as per Cadence TSO errata. This is to avoid a
77+
* false amba_error in TX path from the DMA assuming there is not enough
78+
* space in the SRAM (16KB) even when there is.
79+
*/
80+
#define GEM_MAX_TX_LEN (unsigned int)(0x3FC0)
7781

7882
#define GEM_MTU_MIN_SIZE ETH_MIN_MTU
7983
#define MACB_NETIF_LSO NETIF_F_TSO
@@ -1791,16 +1795,14 @@ static netdev_features_t macb_features_check(struct sk_buff *skb,
17911795

17921796
/* Validate LSO compatibility */
17931797

1794-
/* there is only one buffer */
1795-
if (!skb_is_nonlinear(skb))
1798+
/* there is only one buffer or protocol is not UDP */
1799+
if (!skb_is_nonlinear(skb) || (ip_hdr(skb)->protocol != IPPROTO_UDP))
17961800
return features;
17971801

17981802
/* length of header */
17991803
hdrlen = skb_transport_offset(skb);
1800-
if (ip_hdr(skb)->protocol == IPPROTO_TCP)
1801-
hdrlen += tcp_hdrlen(skb);
18021804

1803-
/* For LSO:
1805+
/* For UFO only:
18041806
* When software supplies two or more payload buffers all payload buffers
18051807
* apart from the last must be a multiple of 8 bytes in size.
18061808
*/

0 commit comments

Comments
 (0)