Skip to contentSkip to conversation

net: stmmac: dwmac-imx: Time Based Scheduling support

PATCH Applied Esben Haabendal 4 participants 6 messages Jan 26, 2024 – Jan 30, 2024

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

v2 cover net: stmmac: dwmac-imx: Time Based Scheduling support

This small patch series allows using TBS support of the i.MX Ethernet QOS controller for etf qdisc offload.
It achieves this in a similar manner that it is done in dwmac-intel.c, dwmac-mediatek.c and stmmac_pci.c.

Changes since v1:

- Simplified for loop by starting at index 1.
- Fixed problem with indentation.

Esben Haabendal (2):
net: stmmac: do not clear TBS enable bit on link up/down
net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c   | 4 ++++
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 2 files changed, 7 insertions(+)
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 1/2 net: stmmac: do not clear TBS enable bit on link up/down

With the dma conf being reallocated on each call to stmmac_open(), any information in there is lost, unless we specifically handle it.

The STMMAC_TBS_EN bit is set when adding an etf qdisc, and the etf qdisc therefore would stop working when link was set down and then back up.

Fixes ba39b344e924 ("net: ethernet: stmicro: stmmac: generate stmmac dma conf before open")
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +3 -0
index b334eb16da23..25519952f754 100644
@@ -3932,6 +3932,9 @@ static int __stmmac_open(struct net_device *dev,
 	priv->rx_copybreak = STMMAC_RX_COPYBREAK;
 
 	buf_sz = dma_conf->dma_buf_sz;
+	for (int i = 0; i < MTL_MAX_TX_QUEUES; i++)
+		if (priv->dma_conf.tx_queue[i].tbs & STMMAC_TBS_EN)
+			dma_conf->tx_queue[i].tbs = priv->dma_conf.tx_queue[i].tbs;
 	memcpy(&priv->dma_conf, dma_conf, sizeof(*dma_conf));
 
 	stmmac_reset_queues_param(priv);
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/2 net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

In reply to Esben Haabendal

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use the first TX queue with TSO and the rest for TBS.

TX queues with TBS can support etf qdisc hw offload.

---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +4 -0
index 8f730ada71f9..6b65420e11b5 100644
@@ -353,6 +353,10 @@ static int imx_dwmac_probe(struct platform_device *pdev)
 	if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
 		plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;
 
+	/* Default TX Q0 to use TSO and rest TXQ for TBS */
+	for (int i = 1; i < plat_dat->tx_queues_to_use; i++)
+		plat_dat->tx_queues_cfg[i].tbs_en = 1;
+
 	plat_dat->host_dma_width = dwmac->ops->addr_width;
 	plat_dat->init = imx_dwmac_init;
 	plat_dat->exit = imx_dwmac_exit;
Signature · 1 line
2.43.0
Reviewed-by on v2 2/2
#3 lore raw

Re: [PATCH v2 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

Quoted 6 lines · Esben Haabendal

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use the first TX queue with TSO and the rest for TBS.

TX queues with TBS can support etf qdisc hw offload.

Thanks for fixing this,

Reviewed-by on v2 2/2
#4 lore raw

Re: [PATCH v2 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

In reply to Esben Haabendal
Quoted 15 lines · Esben Haabendal

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use the first TX queue with TSO and the rest for TBS.

TX queues with TBS can support etf qdisc hw offload.

---
  drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +0 -0
index 8f730ada71f9..6b65420e11b5 100644

drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c static int imx_dwmac_probe(struct platform_device *pdev) · line 362

Quoted 10 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +4 -0
@@ -353,6 +353,10 @@ static int imx_dwmac_probe(struct platform_device *pdev)
  	if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
  		plat_dat->flags |= STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY;
 
+	/* Default TX Q0 to use TSO and rest TXQ for TBS */
+	for (int i = 1; i < plat_dat->tx_queues_to_use; i++)
+		plat_dat->tx_queues_cfg[i].tbs_en = 1;
+
  	plat_dat->host_dma_width = dwmac->ops->addr_width;
  	plat_dat->init = imx_dwmac_init;
  	plat_dat->exit = imx_dwmac_exit;
#5 lore raw
In reply to Esben Haabendal
This series was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This series was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 8 lines · On Fri, 26 Jan 2024 10:10:40 +0100 you wrote:

This small patch series allows using TBS support of the i.MX Ethernet QOS controller for etf qdisc offload.
It achieves this in a similar manner that it is done in dwmac-intel.c, dwmac-mediatek.c and stmmac_pci.c.

Changes since v1:

[...]

Here is the summary with links:
- [v2,1/2] net: stmmac: do not clear TBS enable bit on link up/down

    https://git.kernel.org/netdev/net/c/4896bb7c0b31
  - [v2,2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
    https://git.kernel.org/netdev/net/c/3b12ec8f618e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html