Skip to contentSkip to conversation

net: stmmac: 10GbE using XGMAC

PATCH In review Jose Abreu 3 participants 17 messages Jun 28, 2019 – Jul 1, 2019

Subsystems (4)
lore
Share & tools
lore

Jose Abreu

author
#0 lore raw

v2 cover net: stmmac: 10GbE using XGMAC

Support for 10Gb Link using XGMAC core plus some performance tweaks.

Tested in a PCI based setup.

iperf3 TCP results:

	TSO ON, MTU=1500, TX Queues = 1, RX Queues = 1, Flow Control ON
	Pinned CPU (-A), Zero-Copy (-Z)
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec   643 GBytes  9.21 Gbits/sec    1             sender
[  5]   0.00-600.00 sec   643 GBytes  9.21 Gbits/sec                  receiver
Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>

Jose Abreu (10):
net: stmmac: dwxgmac: Enable EDMA by default
net: stmmac: Do not try to enable PHY EEE if MAC does not support it
net: stmmac: Decrease default RX Watchdog value
net: stmmac: dwxgmac: Fix the undefined burst setting
net: stmmac: Add the missing speeds that XGMAC supports
net: stmmac: Do not disable interrupts when cleaning TX
net: stmmac: Enable support for > 32 Bits addressing in XGMAC
net: stmmac: Update RX Tail Pointer to last free entry
net: stmmac: Only disable interrupts if NAPI is scheduled
net: stmmac: Update Kconfig entry

 drivers/net/ethernet/stmicro/stmmac/Kconfig        |   2 +-
 drivers/net/ethernet/stmicro/stmmac/common.h       |   9 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     |  16 ++-
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c    |  14 +-
 .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c   |   4 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c |  27 +++-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 160 ++++++++++++++++-----
 7 files changed, 176 insertions(+), 56 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/10 net: stmmac: dwxgmac: Enable EDMA by default

Enable the EDMA feature by default which gives higher performance.

Changes from v1:
- Do not use magic values (David)

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     | 4 ++++
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 2 ++
 2 files changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +4 -0
index b8296eb41011..c9e802faabb5 100644
@@ -177,6 +177,10 @@
 #define XGMAC_BLEN8			BIT(2)
 #define XGMAC_BLEN4			BIT(1)
 #define XGMAC_UNDEF			BIT(0)
+#define XGMAC_TX_EDMA_CTRL		0x00003040
+#define XGMAC_TDPS			GENMASK(29, 0)
+#define XGMAC_RX_EDMA_CTRL		0x00003044
+#define XGMAC_RDPS			GENMASK(29, 0)
 #define XGMAC_DMA_CH_CONTROL(x)		(0x00003100 + (0x80 * (x)))
 #define XGMAC_PBLx8			BIT(16)
 #define XGMAC_DMA_CH_TX_CONTROL(x)	(0x00003104 + (0x80 * (x)))
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +2 -0
index 7861a938420a..42448973c36e 100644
@@ -122,6 +122,8 @@ static void dwxgmac2_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
 	}
 
 	writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE);
+	writel(XGMAC_TDPS, ioaddr + XGMAC_TX_EDMA_CTRL);
+	writel(XGMAC_RDPS, ioaddr + XGMAC_RX_EDMA_CTRL);
 }
 
 static void dwxgmac2_dma_rx_mode(void __iomem *ioaddr, int mode,
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/10 net: stmmac: Do not try to enable PHY EEE if MAC does not support it

In reply to Jose Abreu

Do not enable EEE feature in the PHY if MAC does not support 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/stmmac_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -1
index 91f24b63ea16..0b1900bf4e9e 100644
@@ -896,7 +896,7 @@ static void stmmac_mac_link_up(struct phylink_config *config,
 	struct stmmac_priv *priv = netdev_priv(to_net_dev(config->dev));
 
 	stmmac_mac_set(priv, priv->ioaddr, true);
-	if (phy) {
+	if (phy && priv->dma_cap.eee) {
 		priv->eee_active = phy_init_eee(phy, 1) >= 0;
 		priv->eee_enabled = stmmac_eee_init(priv);
 		stmmac_set_eee_pls(priv, priv->hw, true);
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/10 net: stmmac: Decrease default RX Watchdog value

In reply to Jose Abreu

For performance reasons decrease the default RX Watchdog value for the minimum allowed.

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/common.h      | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -1
index ad9e9368535d..14d8f6d7cb9a 100644
@@ -246,7 +246,7 @@ struct stmmac_safety_stats {
 
 /* Max/Min RI Watchdog Timer count value */
 #define MAX_DMA_RIWT		0xff
-#define MIN_DMA_RIWT		0x20
+#define MIN_DMA_RIWT		0x10
 /* Tx coalesce parameters */
 #define STMMAC_COAL_TX_TIMER	1000
 #define STMMAC_MAX_COAL_TX_TICK	100000
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
index 0b1900bf4e9e..40408a067400 100644
@@ -2516,9 +2516,9 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
 	priv->tx_lpi_timer = STMMAC_DEFAULT_TWT_LS;
 
 	if (priv->use_riwt) {
-		ret = stmmac_rx_watchdog(priv, priv->ioaddr, MAX_DMA_RIWT, rx_cnt);
+		ret = stmmac_rx_watchdog(priv, priv->ioaddr, MIN_DMA_RIWT, rx_cnt);
 		if (!ret)
-			priv->rx_riwt = MAX_DMA_RIWT;
+			priv->rx_riwt = MIN_DMA_RIWT;
 	}
 
 	if (priv->hw->pcs)
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 4/10 net: stmmac: dwxgmac: Fix the undefined burst setting

In reply to Jose Abreu

Undefined burst shall only be set if pdata asks to.

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_dma.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +3 -3
index 42448973c36e..b739673f8842 100644
@@ -91,11 +91,11 @@ static void dwxgmac2_dma_axi(void __iomem *ioaddr, struct stmmac_axi *axi)
 	value |= (axi->axi_rd_osr_lmt << XGMAC_RD_OSR_LMT_SHIFT) &
 		XGMAC_RD_OSR_LMT;
 
+	if (!axi->axi_fb)
+		value |= XGMAC_UNDEF;
+
 	value &= ~XGMAC_BLEN;
 	for (i = 0; i < AXI_BLEN; i++) {
-		if (axi->axi_blen[i])
-			value &= ~XGMAC_UNDEF;
-
 		switch (axi->axi_blen[i]) {
 		case 256:
 			value |= XGMAC_BLEN256;
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v2 5/10 net: stmmac: Add the missing speeds that XGMAC supports

In reply to Jose Abreu

XGMAC supports following speeds:
- 10G XGMII
- 5G XGMII
- 2.5G XGMII
- 2.5G GMII
- 1G GMII
- 100M MII
- 10M MII

Add them to the stmmac driver.

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/common.h       |  6 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     | 10 ++-
 .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c    | 14 ++--
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 79 ++++++++++++++++++----
 4 files changed, 86 insertions(+), 23 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +5 -1
index 14d8f6d7cb9a..9e8f4dbdcc22 100644
@@ -392,8 +392,12 @@ struct mac_link {
 	u32 speed100;
 	u32 speed1000;
 	u32 speed2500;
-	u32 speed10000;
 	u32 duplex;
+	struct {
+		u32 speed2500;
+		u32 speed5000;
+		u32 speed10000;
+	} xgmii;
 };
 
 struct mii_regs {
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +7 -3
index c9e802faabb5..29db9b538874 100644
@@ -15,10 +15,14 @@
 /* MAC Registers */
 #define XGMAC_TX_CONFIG			0x00000000
 #define XGMAC_CONFIG_SS_OFF		29
-#define XGMAC_CONFIG_SS_MASK		GENMASK(30, 29)
+#define XGMAC_CONFIG_SS_MASK		GENMASK(31, 29)
 #define XGMAC_CONFIG_SS_10000		(0x0 << XGMAC_CONFIG_SS_OFF)
-#define XGMAC_CONFIG_SS_2500		(0x2 << XGMAC_CONFIG_SS_OFF)
-#define XGMAC_CONFIG_SS_1000		(0x3 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_2500_GMII	(0x2 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_1000_GMII	(0x3 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_100_MII		(0x4 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_5000		(0x5 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_2500		(0x6 << XGMAC_CONFIG_SS_OFF)
+#define XGMAC_CONFIG_SS_10_MII		(0x7 << XGMAC_CONFIG_SS_OFF)
 #define XGMAC_CONFIG_SARC		GENMASK(22, 20)
 #define XGMAC_CONFIG_SARC_SHIFT		20
 #define XGMAC_CONFIG_JD			BIT(16)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +8 -6
index bfa7d6913fd4..0a32c96a7854 100644
@@ -36,7 +36,7 @@ static void dwxgmac2_core_init(struct mac_device_info *hw,
 
 		switch (hw->ps) {
 		case SPEED_10000:
-			tx |= hw->link.speed10000;
+			tx |= hw->link.xgmii.speed10000;
 			break;
 		case SPEED_2500:
 			tx |= hw->link.speed2500;
@@ -381,11 +381,13 @@ int dwxgmac2_setup(struct stmmac_priv *priv)
 		mac->mcast_bits_log2 = ilog2(mac->multicast_filter_bins);
 
 	mac->link.duplex = 0;
-	mac->link.speed10 = 0;
-	mac->link.speed100 = 0;
-	mac->link.speed1000 = XGMAC_CONFIG_SS_1000;
-	mac->link.speed2500 = XGMAC_CONFIG_SS_2500;
-	mac->link.speed10000 = XGMAC_CONFIG_SS_10000;
+	mac->link.speed10 = XGMAC_CONFIG_SS_10_MII;
+	mac->link.speed100 = XGMAC_CONFIG_SS_100_MII;
+	mac->link.speed1000 = XGMAC_CONFIG_SS_1000_GMII;
+	mac->link.speed2500 = XGMAC_CONFIG_SS_2500_GMII;
+	mac->link.xgmii.speed2500 = XGMAC_CONFIG_SS_2500;
+	mac->link.xgmii.speed5000 = XGMAC_CONFIG_SS_5000;
+	mac->link.xgmii.speed10000 = XGMAC_CONFIG_SS_10000;
 	mac->link.speed_mask = XGMAC_CONFIG_SS_MASK;
 
 	mac->mii.addr = XGMAC_MDIO_ADDR;
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +66 -13

105 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 6/10 net: stmmac: Do not disable interrupts when cleaning TX

In reply to Jose Abreu

This is a performance killer and anyways the interrupts are being disabled by RX NAPI so no need to disable them again.

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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -5
index 4a5941caaadc..e8f3e76889c8 100644
@@ -2061,10 +2061,8 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 		napi_schedule_irqoff(&ch->rx_napi);
 	}
 
-	if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use)) {
-		stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
+	if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use))
 		napi_schedule_irqoff(&ch->tx_napi);
-	}
 
 	return status;
 }
@@ -3570,8 +3568,8 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget)
 	work_done = stmmac_tx_clean(priv, DMA_TX_SIZE, chan);
 	work_done = min(work_done, budget);
 
-	if (work_done < budget && napi_complete_done(napi, work_done))
-		stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
+	if (work_done < budget)
+		napi_complete_done(napi, work_done);
 
 	/* Force transmission restart */
 	tx_q = &priv->tx_queue[chan];
Signature · 1 line
2.7.4
#7 lore raw

Re: [PATCH net-next v2 06/10] net: stmmac: Do not disable interrupts when cleaning TX

Quoted 3 lines · Jose Abreu

This is a performance killer and anyways the interrupts are being disabled by RX NAPI so no need to disable them again.

By the

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {
                stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
                napi_schedule_irqoff(&ch->rx_napi);
        }

branch directly above? If so, is it possible to have fewer rx than tx queues and miss this?

this logic seems more complex than needed?

        if (status)
                status |= handle_rx | handle_tx;

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {

        }

        if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use)) {

        }

status & handle_rx implies status & handle_tx and vice versa.

Quoted 27 lines
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 | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +1 -3
index 4a5941caaadc..e8f3e76889c8 100644
@@ -2061,10 +2061,8 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
                napi_schedule_irqoff(&ch->rx_napi);
        }
 
-       if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use)) {
-               stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
+       if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use))
                napi_schedule_irqoff(&ch->tx_napi);
-       }
 
        return status;
 }

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) · line 3572

Quoted 7 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
@@ -3570,8 +3568,8 @@ static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget)
        work_done = stmmac_tx_clean(priv, DMA_TX_SIZE, chan);
        work_done = min(work_done, budget);
 
-       if (work_done < budget && napi_complete_done(napi, work_done))
-               stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
+       if (work_done < budget)
+               napi_complete_done(napi, work_done);

It does seem odd that stmmac_napi_poll_rx and stmmac_napi_poll_tx both call stmmac_enable_dma_irq(..) independent of the other. Shouldn't the IRQ remain masked while either is active or scheduled? That is almost what this patch does, though not exactly.

author
#8 lore raw

RE: [PATCH net-next v2 06/10] net: stmmac: Do not disable interrupts when cleaning TX

From: Willem de Bruijn <[email protected]>

Quoted 9 lines

By the

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {
                stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
                napi_schedule_irqoff(&ch->rx_napi);
        }

branch directly above? If so, is it possible to have fewer rx than tx queues and miss this?

Yes, it is possible.

Quoted 13 lines

this logic seems more complex than needed?

        if (status)
                status |= handle_rx | handle_tx;

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {

        }

        if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use)) {

        }
Quoted 1 line

status & handle_rx implies status & handle_tx and vice versa.

This is removed in patch 09/10.

Quoted 9 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) · line 3572

Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
-       if (work_done < budget && napi_complete_done(napi, work_done))
-               stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
+       if (work_done < budget)
+               napi_complete_done(napi, work_done);

It does seem odd that stmmac_napi_poll_rx and stmmac_napi_poll_tx both call stmmac_enable_dma_irq(..) independent of the other. Shouldn't the IRQ remain masked while either is active or scheduled? That is almost what this patch does, though not exactly.

After patch 09/10 the interrupts will only be disabled by RX NAPI and re-enabled by it again. I can do some tests on whether disabling interrupts independently gives more performance but I wouldn't expect so because the real bottleneck when I do iperf3 tests is the RX path ...

#9 lore raw

Re: [PATCH net-next v2 06/10] net: stmmac: Do not disable interrupts when cleaning TX

Quoted 10 lines · Jose Abreu

From: Willem de Bruijn <[email protected]>

Quoted 7 lines

By the

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {
                stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
                napi_schedule_irqoff(&ch->rx_napi);
        }
Quoted 4 lines
Quoted 2 lines

branch directly above? If so, is it possible to have fewer rx than tx queues and miss this?

Yes, it is possible.

And that is not a problem?

Quoted 28 lines
Quoted 14 lines

this logic seems more complex than needed?

        if (status)
                status |= handle_rx | handle_tx;

        if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {

        }

        if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use)) {

        }
Quoted 1 line

status & handle_rx implies status & handle_tx and vice versa.

This is removed in patch 09/10.

Quoted 9 lines

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c static int stmmac_napi_poll_tx(struct napi_struct *napi, int budget) · line 3572

Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -2
-       if (work_done < budget && napi_complete_done(napi, work_done))
-               stmmac_enable_dma_irq(priv, priv->ioaddr, chan);
+       if (work_done < budget)
+               napi_complete_done(napi, work_done);

It does seem odd that stmmac_napi_poll_rx and stmmac_napi_poll_tx both call stmmac_enable_dma_irq(..) independent of the other. Shouldn't the IRQ remain masked while either is active or scheduled? That is almost what this patch does, though not exactly.

Quoted 4 lines

After patch 09/10 the interrupts will only be disabled by RX NAPI and re-enabled by it again. I can do some tests on whether disabling interrupts independently gives more performance but I wouldn't expect so because the real bottleneck when I do iperf3 tests is the RX path ...

Sharing the IRQ sounds fine. My only concern was TX-only IRQs in case more TX than RX queues are configured. If that is possible with this driver.

author
#10 lore raw

PATCH v2 7/10 net: stmmac: Enable support for > 32 Bits addressing in XGMAC

In reply to Jose Abreu

Currently, stmmac only supports 32 bits addressing for SKB. Enable the support for upto 48 bits addressing in XGMAC core.

This avoids the use of bounce buffers and increases performance.

Changes from v1:
- Fallback to 32 bits in failure (Andrew)

Cc Joao Pinto <[email protected]>
Cc David S. Miller <[email protected]>
Cc Giuseppe Cavallaro <[email protected]>
Cc Alexandre Torgue <[email protected]>
Cc Andrew Lunn <[email protected]>
---
 drivers/net/ethernet/stmicro/stmmac/common.h       |  1 +
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h     |  2 +
 .../net/ethernet/stmicro/stmmac/dwxgmac2_descs.c   |  4 +-
 drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 19 +++++++-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c  | 55 +++++++++++++++++-----
 5 files changed, 66 insertions(+), 15 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
index 9e8f4dbdcc22..2403a65167b2 100644
@@ -351,6 +351,7 @@ struct dma_features {
 	unsigned int frpsel;
 	unsigned int frpbs;
 	unsigned int frpes;
+	unsigned int addr64;
 };
 
 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +2 -0
index 29db9b538874..9a9792527530 100644
@@ -87,6 +87,7 @@
 #define XGMAC_HWFEAT_GMIISEL		BIT(1)
 #define XGMAC_HW_FEATURE1		0x00000120
 #define XGMAC_HWFEAT_TSOEN		BIT(18)
+#define XGMAC_HWFEAT_ADDR64		GENMASK(15, 14)
 #define XGMAC_HWFEAT_TXFIFOSIZE		GENMASK(10, 6)
 #define XGMAC_HWFEAT_RXFIFOSIZE		GENMASK(4, 0)
 #define XGMAC_HW_FEATURE2		0x00000124
@@ -172,6 +173,7 @@
 #define XGMAC_EN_LPI			BIT(15)
 #define XGMAC_LPI_XIT_PKT		BIT(14)
 #define XGMAC_AAL			BIT(12)
+#define XGMAC_EAME			BIT(11)
 #define XGMAC_BLEN			GENMASK(7, 1)
 #define XGMAC_BLEN256			BIT(7)
 #define XGMAC_BLEN128			BIT(6)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_descs.c +2 -2
index 98fa471da7c0..c4c45402b8f8 100644
@@ -242,8 +242,8 @@ static void dwxgmac2_get_addr(struct dma_desc *p, unsigned int *addr)
 
 static void dwxgmac2_set_addr(struct dma_desc *p, dma_addr_t addr)
 {
-	p->des0 = cpu_to_le32(addr);
-	p->des1 = 0;
+	p->des0 = cpu_to_le32(lower_32_bits(addr));
+	p->des1 = cpu_to_le32(upper_32_bits(addr));
 }
 
 static void dwxgmac2_clear(struct dma_desc *p)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +18 -1
index b739673f8842..229c58758cbd 100644
@@ -27,7 +27,7 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr,
 	if (dma_cfg->aal)
 		value |= XGMAC_AAL;
 
-	writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE);
+	writel(value | XGMAC_EAME, ioaddr + XGMAC_DMA_SYSBUS_MODE);
 }
 
 static void dwxgmac2_dma_init_chan(void __iomem *ioaddr,
@@ -361,6 +361,23 @@ static void dwxgmac2_get_hw_feature(void __iomem *ioaddr,
 	/* MAC HW feature 1 */
 	hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1);
 	dma_cap->tsoen = (hw_cap & XGMAC_HWFEAT_TSOEN) >> 18;
+
+	dma_cap->addr64 = (hw_cap & XGMAC_HWFEAT_ADDR64) >> 14;
+	switch (dma_cap->addr64) {
+	case 0:
+		dma_cap->addr64 = 32;
+		break;
+	case 1:
+		dma_cap->addr64 = 40;
+		break;
+	case 2:
+		dma_cap->addr64 = 48;
+		break;
+	default:
+		dma_cap->addr64 = 32;
+		break;
+	}
+
 	dma_cap->tx_fifo_size =
 		128 << ((hw_cap & XGMAC_HWFEAT_TXFIFOSIZE) >> 6);
 	dma_cap->rx_fifo_size =
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +43 -12

104 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#11 lore raw

PATCH v2 8/10 net: stmmac: Update RX Tail Pointer to last free entry

In reply to Jose Abreu

Update the RX Tail Pointer to the last available SKB entry.

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, 2 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +2 -0
index 620dd387e3b1..a629b3144a0d 100644
@@ -3347,6 +3347,8 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
 		entry = STMMAC_GET_ENTRY(entry, DMA_RX_SIZE);
 	}
 	rx_q->dirty_rx = entry;
+	rx_q->rx_tail_addr = rx_q->dma_rx_phy +
+			    (rx_q->dirty_rx * sizeof(struct dma_desc));
 	stmmac_set_rx_tail_ptr(priv, priv->ioaddr, rx_q->rx_tail_addr, queue);
 }
 
Signature · 1 line
2.7.4
author
#12 lore raw

PATCH v2 9/10 net: stmmac: Only disable interrupts if NAPI is scheduled

In reply to Jose Abreu

Only disable the interrupts if RX NAPI gets to be scheduled. Also, schedule the TX NAPI only when the interrupts are disabled.

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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +5 -5
index a629b3144a0d..3425d4dda03d 100644
@@ -2053,12 +2053,12 @@ static int stmmac_napi_check(struct stmmac_priv *priv, u32 chan)
 						 &priv->xstats, chan);
 	struct stmmac_channel *ch = &priv->channel[chan];
 
-	if (status)
-		status |= handle_rx | handle_tx;
-
 	if ((status & handle_rx) && (chan < priv->plat->rx_queues_to_use)) {
-		stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
-		napi_schedule_irqoff(&ch->rx_napi);
+		if (napi_schedule_prep(&ch->rx_napi)) {
+			stmmac_disable_dma_irq(priv, priv->ioaddr, chan);
+			__napi_schedule_irqoff(&ch->rx_napi);
+			status |= handle_tx;
+		}
 	}
 
 	if ((status & handle_tx) && (chan < priv->plat->tx_queues_to_use))
Signature · 1 line
2.7.4
author
#13 lore raw

PATCH v2 10/10 net: stmmac: Update Kconfig entry

In reply to Jose Abreu

We support more speeds now. Update the Kconfig entry.

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/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/Kconfig +1 -1
index c43e2da4e7e3..2acb999b7f63 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config STMMAC_ETH
-	tristate "STMicroelectronics 10/100/1000/EQOS Ethernet driver"
+	tristate "STMicroelectronics 10/100/1000/EQOS/2500/5000/10000 Ethernet driver"
 	depends on HAS_IOMEM && HAS_DMA
 	select MII
 	select PHYLINK
Signature · 1 line
2.7.4
maintainer
#14 lore raw
In reply to Jose Abreu

From: Jose Abreu <[email protected]>
Date: Fri, 28 Jun 2019 09:29:11 +0200

Quoted 11 lines

Support for 10Gb Link using XGMAC core plus some performance tweaks.

Tested in a PCI based setup.

iperf3 TCP results:

	TSO ON, MTU=1500, TX Queues = 1, RX Queues = 1, Flow Control ON
	Pinned CPU (-A), Zero-Copy (-Z)
[ ID] Interval           Transfer     Bitrate         Retr
[  5]   0.00-600.00 sec   643 GBytes  9.21 Gbits/sec    1             sender
[  5]   0.00-600.00 sec   643 GBytes  9.21 Gbits/sec                  receiver

Series applied, thanks Jose.

About the Kconfig change, maybe it just doesn't make sense to list all of the various speeds the chip supports... just a thought.

author
#15 lore raw

From: David Miller <[email protected]>

Quoted 2 lines

About the Kconfig change, maybe it just doesn't make sense to list all of the various speeds the chip supports... just a thought.

What about: "STMicroelectronics Multi-Gigabit Ethernet driver" ?

Or, just "STMicroelectronics Ethernet driver" ?

maintainer
#16 lore raw

From: Jose Abreu <[email protected]>
Date: Mon, 1 Jul 2019 10:19:55 +0000

Quoted 8 lines

From: David Miller <[email protected]>

Quoted 2 lines

About the Kconfig change, maybe it just doesn't make sense to list all of the various speeds the chip supports... just a thought.

What about: "STMicroelectronics Multi-Gigabit Ethernet driver" ?

Or, just "STMicroelectronics Ethernet driver" ?

Maybe the first one is better, I don't know. What are the chances of there being more STMicroelectronics ethernet NICs? :-)