All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/5] stmmac: Correct flow control configuration
@ 2015-04-15 16:17 Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 1/5] stmmac: Add properties for transmit and receive fifo sizes Vince Bridgers
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

This series of patches corrects flow control configuration for the Synopsys
GMAC driver.

Flow control is configured based on a configurable receive fifo size. If
less than 4Kbytes flow control is left disabled and a warning is presented. If
a receive fifo size is not specified, flow control is left disabled to
maintain current behavior. Unicast pause detection was disabled, but is now 
enabled. The pause time was modified to be maximum time per a XON/XOFF
flow control mode of operation.

This patch was tested on an Altera Cyclone 5 and an Altera Arria 10 devkit,
and verified that flow control operates as expected when enabled.

Please consider this series for inclusion so that flow control will
function as expected for the Synopsys GMAC controller. 

Vince Bridgers (5):
  stmmac: Add properties for transmit and receive fifo sizes
  stmmac: Add defines and documentation for enabling flow control
  stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree
  stmmac: Enable unicast pause frame detect in GMAC Register 6
  stmmac: Configure Flow Control to work correctly based on rxfifo size

 Documentation/devicetree/bindings/net/ethernet.txt |  6 +++
 Documentation/devicetree/bindings/net/stmmac.txt   |  4 ++
 drivers/net/ethernet/stmicro/stmmac/common.h       |  5 ++-
 drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    | 51 ++++++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  5 ++-
 .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    | 26 ++++++++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 16 ++++---
 .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  4 ++
 include/linux/stmmac.h                             |  2 +
 10 files changed, 111 insertions(+), 10 deletions(-)

-- 
1.9.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH net 1/5] stmmac: Add properties for transmit and receive fifo sizes
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
@ 2015-04-15 16:17 ` Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 2/5] stmmac: Add defines and documentation for enabling flow control Vince Bridgers
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

The Synopsys stmmac fifo sizes are configurable, and need to be known
in order to configure certain controller features. This patch adds
tx-fifo-depth and rx-fifo-depth properties to the stmmac document
file.

Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
---
 Documentation/devicetree/bindings/net/ethernet.txt | 6 ++++++
 Documentation/devicetree/bindings/net/stmmac.txt   | 4 ++++
 2 files changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt
index 3fc3605..41b3f3f 100644
--- a/Documentation/devicetree/bindings/net/ethernet.txt
+++ b/Documentation/devicetree/bindings/net/ethernet.txt
@@ -19,6 +19,12 @@ The following properties are common to the Ethernet controllers:
 - phy: the same as "phy-handle" property, not recommended for new bindings.
 - phy-device: the same as "phy-handle" property, not recommended for new
   bindings.
+- rx-fifo-depth: the size of the controller's receive fifo in bytes. This
+  is used for components that can have configurable receive fifo sizes,
+  and is useful for determining certain configuration settings such as
+  flow control thresholds.
+- tx-fifo-depth: the size of the controller's transmit fifo in bytes. This
+  is used for components that can have configurable fifo sizes.
 
 Child nodes of the Ethernet controller are typically the individual PHY devices
 connected via the MDIO bus (sometimes the MDIO bus controller is separate).
diff --git a/Documentation/devicetree/bindings/net/stmmac.txt b/Documentation/devicetree/bindings/net/stmmac.txt
index 8ca65ce..524c185 100644
--- a/Documentation/devicetree/bindings/net/stmmac.txt
+++ b/Documentation/devicetree/bindings/net/stmmac.txt
@@ -44,6 +44,8 @@ Optional properties:
   If not passed then the system clock will be used and this is fine on some
   platforms.
 - snps,burst_len: The AXI burst lenth value of the AXI BUS MODE register.
+- tx-fifo-depth: See ethernet.txt file in the same directory
+- rx-fifo-depth: See ethernet.txt file in the same directory
 
 Examples:
 
@@ -58,6 +60,8 @@ Examples:
 		phy-mode = "gmii";
 		snps,multicast-filter-bins = <256>;
 		snps,perfect-filter-entries = <128>;
+		rx-fifo-depth = <16384>;
+		tx-fifo-depth = <16384>;
 		clocks = <&clock>;
 		clock-names = "stmmaceth";
 	};
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 2/5] stmmac: Add defines and documentation for enabling flow control
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 1/5] stmmac: Add properties for transmit and receive fifo sizes Vince Bridgers
@ 2015-04-15 16:17 ` Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 3/5] stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree Vince Bridgers
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

Add defines and documentation for enabling flow control on the stmmac. Flow
control was not implemented correctly on the stmmac driver and is currently
non-functional as a result. This is the first in a series of small patches
to correctly implement this feature.

Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000.h | 51 +++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
index 64d8f56..b3fe057 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000.h
@@ -172,6 +172,7 @@ enum inter_frame_gap {
 /* GMAC FLOW CTRL defines */
 #define GMAC_FLOW_CTRL_PT_MASK	0xffff0000	/* Pause Time Mask */
 #define GMAC_FLOW_CTRL_PT_SHIFT	16
+#define GMAC_FLOW_CTRL_UP	0x00000008	/* Unicast pause frame enable */
 #define GMAC_FLOW_CTRL_RFE	0x00000004	/* Rx Flow Control Enable */
 #define GMAC_FLOW_CTRL_TFE	0x00000002	/* Tx Flow Control Enable */
 #define GMAC_FLOW_CTRL_FCB_BPA	0x00000001	/* Flow Control Busy ... */
@@ -246,6 +247,56 @@ enum ttc_control {
 #define DMA_CONTROL_FEF		0x00000080
 #define DMA_CONTROL_FUF		0x00000040
 
+/* Receive flow control activation field
+ * RFA field in DMA control register, bits 23,10:9
+ */
+#define DMA_CONTROL_RFA_MASK	0x00800600
+
+/* Receive flow control deactivation field
+ * RFD field in DMA control register, bits 22,12:11
+ */
+#define DMA_CONTROL_RFD_MASK	0x00401800
+
+/* RFD and RFA fields are encoded as follows
+ *
+ *   Bit Field
+ *   0,00 - Full minus 1KB (only valid when rxfifo >= 4KB and EFC enabled)
+ *   0,01 - Full minus 2KB (only valid when rxfifo >= 4KB and EFC enabled)
+ *   0,10 - Full minus 3KB (only valid when rxfifo >= 4KB and EFC enabled)
+ *   0,11 - Full minus 4KB (only valid when rxfifo > 4KB and EFC enabled)
+ *   1,00 - Full minus 5KB (only valid when rxfifo > 8KB and EFC enabled)
+ *   1,01 - Full minus 6KB (only valid when rxfifo > 8KB and EFC enabled)
+ *   1,10 - Full minus 7KB (only valid when rxfifo > 8KB and EFC enabled)
+ *   1,11 - Reserved
+ *
+ * RFD should always be > RFA for a given FIFO size. RFD == RFA may work,
+ * but packet throughput performance may not be as expected.
+ *
+ * Be sure that bit 3 in GMAC Register 6 is set for Unicast Pause frame
+ * detection (IEEE Specification Requirement, Annex 31B, 31B.1, Pause
+ * Description).
+ *
+ * Be sure that DZPA (bit 7 in Flow Control Register, GMAC Register 6),
+ * is set to 0. This allows pause frames with a quanta of 0 to be sent
+ * as an XOFF message to the link peer.
+ */
+
+#define RFA_FULL_MINUS_1K	0x00000000
+#define RFA_FULL_MINUS_2K	0x00000200
+#define RFA_FULL_MINUS_3K	0x00000400
+#define RFA_FULL_MINUS_4K	0x00000600
+#define RFA_FULL_MINUS_5K	0x00800000
+#define RFA_FULL_MINUS_6K	0x00800200
+#define RFA_FULL_MINUS_7K	0x00800400
+
+#define RFD_FULL_MINUS_1K	0x00000000
+#define RFD_FULL_MINUS_2K	0x00000800
+#define RFD_FULL_MINUS_3K	0x00001000
+#define RFD_FULL_MINUS_4K	0x00001800
+#define RFD_FULL_MINUS_5K	0x00400000
+#define RFD_FULL_MINUS_6K	0x00400800
+#define RFD_FULL_MINUS_7K	0x00401000
+
 enum rtc_control {
 	DMA_CONTROL_RTC_64 = 0x00000000,
 	DMA_CONTROL_RTC_32 = 0x00000008,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 3/5] stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 1/5] stmmac: Add properties for transmit and receive fifo sizes Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 2/5] stmmac: Add defines and documentation for enabling flow control Vince Bridgers
@ 2015-04-15 16:17 ` Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 4/5] stmmac: Enable unicast pause frame detect in GMAC Register 6 Vince Bridgers
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

Read the tx-fifo-depth and rx-fifo-depth from the devicetree. The Synopsys
stmmac controller fifos are configurable per product instance, and the fifo
sizes are needed to configure certain features correctly such as flow control.

Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 4 ++++
 include/linux/stmmac.h                                | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index f9b42f1..705bbdf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -181,6 +181,10 @@ static int stmmac_probe_config_dt(struct platform_device *pdev,
 				     sizeof(struct stmmac_mdio_bus_data),
 				     GFP_KERNEL);
 
+	of_property_read_u32(np, "tx-fifo-depth", &plat->tx_fifo_size);
+
+	of_property_read_u32(np, "rx-fifo-depth", &plat->rx_fifo_size);
+
 	plat->force_sf_dma_mode =
 		of_property_read_bool(np, "snps,force_sf_dma_mode");
 
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
index cd63851..7f484a2 100644
--- a/include/linux/stmmac.h
+++ b/include/linux/stmmac.h
@@ -114,6 +114,8 @@ struct plat_stmmacenet_data {
 	int maxmtu;
 	int multicast_filter_bins;
 	int unicast_filter_entries;
+	int tx_fifo_size;
+	int rx_fifo_size;
 	void (*fix_mac_speed)(void *priv, unsigned int speed);
 	void (*bus_setup)(void __iomem *ioaddr);
 	void *(*setup)(struct platform_device *pdev);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 4/5] stmmac: Enable unicast pause frame detect in GMAC Register 6
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
                   ` (2 preceding siblings ...)
  2015-04-15 16:17 ` [PATCH net 3/5] stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree Vince Bridgers
@ 2015-04-15 16:17 ` Vince Bridgers
  2015-04-15 16:17 ` [PATCH net 5/5] stmmac: Configure Flow Control to work correctly based on rxfifo size Vince Bridgers
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

Unicast pause frame detect was not being enabled for the Synopsys stmmac. This
patch sets Unicast pause frame detect in MAC register 6 so that pause frame
detection by the stmmac conforms to IEEE 802.3, Annex 31B.3.3 Receive
Operation - Specifically, a MAC shall respond to pause frames containing
either the reserved multicast address or the unique physical address
associated with this station.

Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
index 0adcf73..371a669 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c
@@ -201,7 +201,10 @@ static void dwmac1000_flow_ctrl(struct mac_device_info *hw, unsigned int duplex,
 				unsigned int fc, unsigned int pause_time)
 {
 	void __iomem *ioaddr = hw->pcsr;
-	unsigned int flow = 0;
+	/* Set flow such that DZPQ in Mac Register 6 is 0,
+	 * and unicast pause detect is enabled.
+	 */
+	unsigned int flow = GMAC_FLOW_CTRL_UP;
 
 	pr_debug("GMAC Flow-Control:\n");
 	if (fc & FLOW_RX) {
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH net 5/5] stmmac: Configure Flow Control to work correctly based on rxfifo size
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
                   ` (3 preceding siblings ...)
  2015-04-15 16:17 ` [PATCH net 4/5] stmmac: Enable unicast pause frame detect in GMAC Register 6 Vince Bridgers
@ 2015-04-15 16:17 ` Vince Bridgers
  2015-04-16  7:22 ` [PATCH net 0/5] stmmac: Correct flow control configuration Giuseppe CAVALLARO
  2015-04-16 18:09 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Vince Bridgers @ 2015-04-15 16:17 UTC (permalink / raw)
  To: peppe.cavallaro, netdev, linux-kernel; +Cc: vbridger, vbridger

Configure flow control correctly, and based on the receive fifo size read
as a property from the devicetree since the Synopsys stmmac fifo sizes are
configurable based on a particular chip's implementation. This patch maintains
the previous incorrect behavior unless the receive fifo size is found in the
devicetree.

Signed-off-by: Vince Bridgers <vbridger@opensource.altera.com>
---
 drivers/net/ethernet/stmicro/stmmac/common.h       |  5 +++--
 .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    | 26 +++++++++++++++++++++-
 drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 16 ++++++++-----
 4 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h
index cd77289..623c6ed 100644
--- a/drivers/net/ethernet/stmicro/stmmac/common.h
+++ b/drivers/net/ethernet/stmicro/stmmac/common.h
@@ -150,7 +150,7 @@ struct stmmac_extra_stats {
 #define	MAC_CSR_H_FRQ_MASK	0x20
 
 #define HASH_TABLE_SIZE 64
-#define PAUSE_TIME 0x200
+#define PAUSE_TIME 0xffff
 
 /* Flow Control defines */
 #define FLOW_OFF	0
@@ -357,7 +357,8 @@ struct stmmac_dma_ops {
 	void (*dump_regs) (void __iomem *ioaddr);
 	/* Set tx/rx threshold in the csr6 register
 	 * An invalid value enables the store-and-forward mode */
-	void (*dma_mode) (void __iomem *ioaddr, int txmode, int rxmode);
+	void (*dma_mode)(void __iomem *ioaddr, int txmode, int rxmode,
+			 int rxfifosz);
 	/* To track extra statistic (if supported) */
 	void (*dma_diagnostic_fr) (void *data, struct stmmac_extra_stats *x,
 				   void __iomem *ioaddr);
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
index 59d92e8..0e8937c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_dma.c
@@ -106,8 +106,29 @@ static int dwmac1000_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
 	return 0;
 }
 
+static u32 dwmac1000_configure_fc(u32 csr6, int rxfifosz)
+{
+	csr6 &= ~DMA_CONTROL_RFA_MASK;
+	csr6 &= ~DMA_CONTROL_RFD_MASK;
+
+	/* Leave flow control disabled if receive fifo size is less than
+	 * 4K or 0. Otherwise, send XOFF when fifo is 1K less than full,
+	 * and send XON when 2K less than full.
+	 */
+	if (rxfifosz < 4096) {
+		csr6 &= ~DMA_CONTROL_EFC;
+		pr_debug("GMAC: disabling flow control, rxfifo too small(%d)\n",
+			 rxfifosz);
+	} else {
+		csr6 |= DMA_CONTROL_EFC;
+		csr6 |= RFA_FULL_MINUS_1K;
+		csr6 |= RFD_FULL_MINUS_2K;
+	}
+	return csr6;
+}
+
 static void dwmac1000_dma_operation_mode(void __iomem *ioaddr, int txmode,
-					 int rxmode)
+					 int rxmode, int rxfifosz)
 {
 	u32 csr6 = readl(ioaddr + DMA_CONTROL);
 
@@ -153,6 +174,9 @@ static void dwmac1000_dma_operation_mode(void __iomem *ioaddr, int txmode,
 			csr6 |= DMA_CONTROL_RTC_128;
 	}
 
+	/* Configure flow control based on rx fifo size */
+	csr6 = dwmac1000_configure_fc(csr6, rxfifosz);
+
 	writel(csr6, ioaddr + DMA_CONTROL);
 }
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
index 7d1dce9..9d0971c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c
@@ -72,7 +72,7 @@ static int dwmac100_dma_init(void __iomem *ioaddr, int pbl, int fb, int mb,
  * control register.
  */
 static void dwmac100_dma_operation_mode(void __iomem *ioaddr, int txmode,
-					int rxmode)
+					int rxmode, int rxfifosz)
 {
 	u32 csr6 = readl(ioaddr + DMA_CONTROL);
 
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index a0ea84f..73d104f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1277,8 +1277,10 @@ static void free_dma_desc_resources(struct stmmac_priv *priv)
  */
 static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
 {
+	int rxfifosz = priv->plat->rx_fifo_size;
+
 	if (priv->plat->force_thresh_dma_mode)
-		priv->hw->dma->dma_mode(priv->ioaddr, tc, tc);
+		priv->hw->dma->dma_mode(priv->ioaddr, tc, tc, rxfifosz);
 	else if (priv->plat->force_sf_dma_mode || priv->plat->tx_coe) {
 		/*
 		 * In case of GMAC, SF mode can be enabled
@@ -1287,10 +1289,12 @@ static void stmmac_dma_operation_mode(struct stmmac_priv *priv)
 		 * 2) There is no bugged Jumbo frame support
 		 *    that needs to not insert csum in the TDES.
 		 */
-		priv->hw->dma->dma_mode(priv->ioaddr, SF_DMA_MODE, SF_DMA_MODE);
+		priv->hw->dma->dma_mode(priv->ioaddr, SF_DMA_MODE, SF_DMA_MODE,
+					rxfifosz);
 		priv->xstats.threshold = SF_DMA_MODE;
 	} else
-		priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE);
+		priv->hw->dma->dma_mode(priv->ioaddr, tc, SF_DMA_MODE,
+					rxfifosz);
 }
 
 /**
@@ -1442,6 +1446,7 @@ static void stmmac_tx_err(struct stmmac_priv *priv)
 static void stmmac_dma_interrupt(struct stmmac_priv *priv)
 {
 	int status;
+	int rxfifosz = priv->plat->rx_fifo_size;
 
 	status = priv->hw->dma->dma_interrupt(priv->ioaddr, &priv->xstats);
 	if (likely((status & handle_rx)) || (status & handle_tx)) {
@@ -1456,10 +1461,11 @@ static void stmmac_dma_interrupt(struct stmmac_priv *priv)
 		    (tc <= 256)) {
 			tc += 64;
 			if (priv->plat->force_thresh_dma_mode)
-				priv->hw->dma->dma_mode(priv->ioaddr, tc, tc);
+				priv->hw->dma->dma_mode(priv->ioaddr, tc, tc,
+							rxfifosz);
 			else
 				priv->hw->dma->dma_mode(priv->ioaddr, tc,
-					SF_DMA_MODE);
+							SF_DMA_MODE, rxfifosz);
 			priv->xstats.threshold = tc;
 		}
 	} else if (unlikely(status == tx_hard_error))
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH net 0/5] stmmac: Correct flow control configuration
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
                   ` (4 preceding siblings ...)
  2015-04-15 16:17 ` [PATCH net 5/5] stmmac: Configure Flow Control to work correctly based on rxfifo size Vince Bridgers
@ 2015-04-16  7:22 ` Giuseppe CAVALLARO
  2015-04-16 18:09 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: Giuseppe CAVALLARO @ 2015-04-16  7:22 UTC (permalink / raw)
  To: Vince Bridgers, netdev, linux-kernel; +Cc: vbridger

Hi Vince

On 4/15/2015 6:17 PM, Vince Bridgers wrote:
> This series of patches corrects flow control configuration for the Synopsys
> GMAC driver.

Thx for these patches

For the series

Acked-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>

peppe

>
> Flow control is configured based on a configurable receive fifo size. If
> less than 4Kbytes flow control is left disabled and a warning is presented. If
> a receive fifo size is not specified, flow control is left disabled to
> maintain current behavior. Unicast pause detection was disabled, but is now
> enabled. The pause time was modified to be maximum time per a XON/XOFF
> flow control mode of operation.
>
> This patch was tested on an Altera Cyclone 5 and an Altera Arria 10 devkit,
> and verified that flow control operates as expected when enabled.
>
> Please consider this series for inclusion so that flow control will
> function as expected for the Synopsys GMAC controller.
>
> Vince Bridgers (5):
>    stmmac: Add properties for transmit and receive fifo sizes
>    stmmac: Add defines and documentation for enabling flow control
>    stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree
>    stmmac: Enable unicast pause frame detect in GMAC Register 6
>    stmmac: Configure Flow Control to work correctly based on rxfifo size
>
>   Documentation/devicetree/bindings/net/ethernet.txt |  6 +++
>   Documentation/devicetree/bindings/net/stmmac.txt   |  4 ++
>   drivers/net/ethernet/stmicro/stmmac/common.h       |  5 ++-
>   drivers/net/ethernet/stmicro/stmmac/dwmac1000.h    | 51 ++++++++++++++++++++++
>   .../net/ethernet/stmicro/stmmac/dwmac1000_core.c   |  5 ++-
>   .../net/ethernet/stmicro/stmmac/dwmac1000_dma.c    | 26 ++++++++++-
>   drivers/net/ethernet/stmicro/stmmac/dwmac100_dma.c |  2 +-
>   drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 16 ++++---
>   .../net/ethernet/stmicro/stmmac/stmmac_platform.c  |  4 ++
>   include/linux/stmmac.h                             |  2 +
>   10 files changed, 111 insertions(+), 10 deletions(-)
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH net 0/5] stmmac: Correct flow control configuration
  2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
                   ` (5 preceding siblings ...)
  2015-04-16  7:22 ` [PATCH net 0/5] stmmac: Correct flow control configuration Giuseppe CAVALLARO
@ 2015-04-16 18:09 ` David Miller
  6 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2015-04-16 18:09 UTC (permalink / raw)
  To: vbridger; +Cc: peppe.cavallaro, netdev, linux-kernel, vbridger

From: Vince Bridgers <vbridger@opensource.altera.com>
Date: Wed, 15 Apr 2015 11:17:37 -0500

> This series of patches corrects flow control configuration for the Synopsys
> GMAC driver.
> 
> Flow control is configured based on a configurable receive fifo size. If
> less than 4Kbytes flow control is left disabled and a warning is presented. If
> a receive fifo size is not specified, flow control is left disabled to
> maintain current behavior. Unicast pause detection was disabled, but is now 
> enabled. The pause time was modified to be maximum time per a XON/XOFF
> flow control mode of operation.
> 
> This patch was tested on an Altera Cyclone 5 and an Altera Arria 10 devkit,
> and verified that flow control operates as expected when enabled.
> 
> Please consider this series for inclusion so that flow control will
> function as expected for the Synopsys GMAC controller. 

Series applied, thanks.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-16 18:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15 16:17 [PATCH net 0/5] stmmac: Correct flow control configuration Vince Bridgers
2015-04-15 16:17 ` [PATCH net 1/5] stmmac: Add properties for transmit and receive fifo sizes Vince Bridgers
2015-04-15 16:17 ` [PATCH net 2/5] stmmac: Add defines and documentation for enabling flow control Vince Bridgers
2015-04-15 16:17 ` [PATCH net 3/5] stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree Vince Bridgers
2015-04-15 16:17 ` [PATCH net 4/5] stmmac: Enable unicast pause frame detect in GMAC Register 6 Vince Bridgers
2015-04-15 16:17 ` [PATCH net 5/5] stmmac: Configure Flow Control to work correctly based on rxfifo size Vince Bridgers
2015-04-16  7:22 ` [PATCH net 0/5] stmmac: Correct flow control configuration Giuseppe CAVALLARO
2015-04-16 18:09 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.