Skip to contentSkip to conversation

net: stmmac: Enable Flow Control

PATCH In review Jose Abreu 3 participants 5 messages Apr 17, 2019

Subsystems (4)
lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

cover net: stmmac: Enable Flow Control

I don't know of any specific reason why Flow Control is off by default but do let me know if there is any.

Tested in B2B between XGMAC2 and GMAC5.

Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>

Jose Abreu (2):
net: stmmac: dwxgmac: Finish the Flow Control implementation
net: stmmac: Set Flow Control to automatic mode in the driver

 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     |  5 +++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 46 ++++++++++++++++++++++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  |  2 +-
 3 files changed, 52 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/2 net: stmmac: dwxgmac: Finish the Flow Control implementation

Finish the implementation of Flow Control feature. In order for it to work correctly we need to set EHFC bit and the correct threshold values for activating and deactivating it.

Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>
---
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     |  5 +++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 46 ++++++++++++++++++++++
 2 files changed, 51 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +5 -0
index 37d5e6fe7473..085b700a4994 100644
@@ -143,6 +143,11 @@
 #define XGMAC_RSF			BIT(5)
 #define XGMAC_RTC			GENMASK(1, 0)
 #define XGMAC_RTC_SHIFT			0
+#define XGMAC_MTL_RXQ_FLOW_CONTROL(x)	(0x00001150 + (0x80 * (x)))
+#define XGMAC_RFD			GENMASK(31, 17)
+#define XGMAC_RFD_SHIFT			17
+#define XGMAC_RFA			GENMASK(15, 1)
+#define XGMAC_RFA_SHIFT			1
 #define XGMAC_MTL_QINTEN(x)		(0x00001170 + (0x80 * (x)))
 #define XGMAC_RXOIE			BIT(16)
 #define XGMAC_MTL_QINT_STATUS(x)	(0x00001174 + (0x80 * (x)))
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +46 -0

52 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#2 lore raw

PATCH 2/2 net: stmmac: Set Flow Control to automatic mode in the driver

In reply to Jose Abreu

By default Flow Control feature is not being enabled in stmmac.

This is a useful feature that can prevent loss of packets and now that XGMAC already supports it (along with GMAC and QoS) it makes sense to activate it.

Switch the module parameter to FLOW_AUTO so that Flow Control is activated.

Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
index a26e36dbb5df..7a895a2889e3 100644
@@ -74,7 +74,7 @@ MODULE_PARM_DESC(phyaddr, "Physical device address");
 #define STMMAC_TX_THRESH	(DMA_TX_SIZE / 4)
 #define STMMAC_RX_THRESH	(DMA_RX_SIZE / 4)
 
-static int flow_ctrl = FLOW_OFF;
+static int flow_ctrl = FLOW_AUTO;
 module_param(flow_ctrl, int, 0644);
 MODULE_PARM_DESC(flow_ctrl, "Flow control ability [on/off]");
 
Signature · 1 line
2.7.4
maintainer
#3 lore raw
In reply to Jose Abreu

From: Jose Abreu <[email protected]>
Date: Wed, 17 Apr 2019 09:33:03 +0200

Quoted 9 lines

I don't know of any specific reason why Flow Control is off by default but do let me know if there is any.

Tested in B2B between XGMAC2 and GMAC5.

Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>

I'm just going to apply this series now, it's easy to revert if necessary.

Thanks.

#4 lore raw
In reply to Jose Abreu

Hi,

Quoted 2 lines · Jose Abreu

I don't know of any specific reason why Flow Control is off by default but do let me know if there is any.

It seems dwmac1000 assumes 4K FIFO size when configuring threshold values. This could be non-optimal for 8K/16K FIFOs, but that can be fixed later on with incremental patches.

A.