summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2014-08-31 23:49:45 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-10-17 14:34:59 +0100
commita9f1d3b0144d7ed328d4bc84b1fbb459ee725ecc (patch)
tree96a6e8304abb3c16b55ba641646641188b9e4365
parent448ec18793c04686482f8eb9b5d43f0928595952 (diff)
net: fec: improve UDP performance
UDP performance is extremely poor. iperf reports UDP receive speeds in the range of 50Mbps with a high packet loss. The interface typically reports a few thousand overrun errors per iperf run. This is far from satisfactory. Adjust the receive FIFO thresholds to reduce the number of errors. Firstly, we decrease RAFL (receive almost full threshold) to the minimum value of 4, which gives us the maximum available space in the FIFO prior to indicating a FIFO overrun condition. Secondly, we adjust the RSEM value to send a XOFF pause frame early enough that an in-progress transmission can complete without overflowing the FIFO. Document these registers and the changes being made in the driver. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index b79d78fd6e7a..c30270168bec 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -72,12 +72,34 @@ static void set_multicast_list(struct net_device *ndev);
#define DRIVER_NAME "fec"
-/* Pause frame feild and FIFO threshold */
+/* Pause frame field and FIFO threshold */
#define FEC_ENET_FCE (1 << 5)
-#define FEC_ENET_RSEM_V 0x84
+/*
+ * RSEM: the FIFO threshold in 64-bit words (from zero bytes) at which
+ * XOFF will be sent. Minimum 0, maximum possible 255.
+ * RAFL: the number of remaining 64-bit words in the FIFO at which the
+ * frame is marked with overrun. Minimum 4, maximum possible 255.
+ *
+ * When XOFF is sent, the link partner should continue sending any
+ * packet currently in progress, and then pause transmission for the
+ * specified duration. It should not terminate transmission of the
+ * packet.
+ *
+ * The FIFO can store the full frame and the FCS value, which on standard
+ * Ethernet is 1518 bytes, or 190 FIFO entries. However, we do not know
+ * the size of the receive FIFO, so we are unable to properly calculate
+ * the thresholds.
+ *
+ * Practical tests with 1514 byte ethernet packets show that with
+ * RSEM = 132, RAFL = 8, we see a large quantity of overflowed UDP packets.
+ * Reducing RAFL to 4 has almost no effect. Reducing RSEM to 78 gives us
+ * a small number of overflow errors, and at 77 it gives only a single
+ * error per UDP iperf run.
+ */
+#define FEC_ENET_RSEM_V 77
#define FEC_ENET_RSFL_V 16
#define FEC_ENET_RAEM_V 0x8
-#define FEC_ENET_RAFL_V 0x8
+#define FEC_ENET_RAFL_V 4
#define FEC_ENET_OPD_V 0xFFF0
/* Controller is ENET-MAC */