From edeaeac8e8580a76e5adcaaae420cd0f24191443 Mon Sep 17 00:00:00 2001
From: Thomas Scheiblauer <tom@sharkbay.at>
Date: Thu, 17 Oct 2013 13:14:43 -0500
Subject: [PATCH] imx6q: work around fec tx-queue timeouts when SATA/SD +
 ethernet is active with high throughput

When data is transferred from SATA or is SD-card tx-queue timeouts occur
on the ethernet leading to network bandwidth drops to zero every few
seconds lasting for about 2-3 seconds (NETDEV WATCHDOG timeout?).
This issue gets more apparent the higher the throughput on on all of the
mentioned data channels becomes.
To reproduce it ethernet throughput should be beyond 40MB/s and SATA or
SD at least 35MB/s. Below these values the problem may not be
experienced.
According to Duan Fugang-B38611 <B38611 <at> freescale.com> it is an SMP
related problem that does not appear to happen when running on only one
CPU. His proposed work around (fix?) was to increase TX_RING_SIZE in
drivers/net/ethernet/freescale/fec.h to 64.
In my tests this helped a lot though it didn't completely remedy the
issue. I was now able to run at least a couple of minutes with high
throughput not having tx-queue timeouts but they still happened now and
then.
I'm submitting this patch based on Duan Fugang's findings for review and
possible further improvement since it doesn't seem like this issue will
be explored further by the Freescale(?) people judging by Duan Fugang's
most recent email he sent to me and I'm not sure which further
consequences the TX_RING_SIZE change will have (increased network
latency?).

Signed-off-by: Thomas Scheiblauer <tom@sharkbay.at>
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
 drivers/net/ethernet/freescale/fec.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 0120217..ee9a1da 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -246,7 +246,7 @@ struct bufdesc_ex {
 #define RX_RING_SIZE		(FEC_ENET_RX_FRPPG * FEC_ENET_RX_PAGES)
 #define FEC_ENET_TX_FRSIZE	2048
 #define FEC_ENET_TX_FRPPG	(PAGE_SIZE / FEC_ENET_TX_FRSIZE)
-#define TX_RING_SIZE		16	/* Must be power of two */
+#define TX_RING_SIZE		64	/* Must be power of two */
 #define TX_RING_MOD_MASK	15	/*   for this to work */
 
 #define BD_ENET_RX_INT          0x00800000
-- 
1.8.4.rc3