Commit 0f0d15100a8ac875bdd408324c473e16d73d3557

Authored by Michael Chan
Committed by David S. Miller
1 parent 44f3b503c1

tg3: Fix data corruption on 5725 with TSO

The 5725 family of devices (asic rev 5762), corrupts TSO packets where
the buffer is within MSS bytes of a 4G boundary (4G, 8G etc.). Detect
this condition and trigger the workaround path.

Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 17 additions and 0 deletions Side-by-side Diff

drivers/net/ethernet/broadcom/tg3.c
... ... @@ -7448,6 +7448,20 @@
7448 7448 return (base > 0xffffdcc0) && (base + len + 8 < base);
7449 7449 }
7450 7450  
  7451 +/* Test for TSO DMA buffers that cross into regions which are within MSS bytes
  7452 + * of any 4GB boundaries: 4G, 8G, etc
  7453 + */
  7454 +static inline int tg3_4g_tso_overflow_test(struct tg3 *tp, dma_addr_t mapping,
  7455 + u32 len, u32 mss)
  7456 +{
  7457 + if (tg3_asic_rev(tp) == ASIC_REV_5762 && mss) {
  7458 + u32 base = (u32) mapping & 0xffffffff;
  7459 +
  7460 + return ((base + len + (mss & 0x3fff)) < base);
  7461 + }
  7462 + return 0;
  7463 +}
  7464 +
7451 7465 /* Test for DMA addresses > 40-bit */
7452 7466 static inline int tg3_40bit_overflow_test(struct tg3 *tp, dma_addr_t mapping,
7453 7467 int len)
... ... @@ -7482,6 +7496,9 @@
7482 7496 hwbug = true;
7483 7497  
7484 7498 if (tg3_4g_overflow_test(map, len))
  7499 + hwbug = true;
  7500 +
  7501 + if (tg3_4g_tso_overflow_test(tp, map, len, mss))
7485 7502 hwbug = true;
7486 7503  
7487 7504 if (tg3_40bit_overflow_test(tp, map, len))