Skip to contentSkip to conversation

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

PATCH In review Esben Haabendal 3 participants 5 messages Jan 25, 2024 – Jan 26, 2024 1 message not in the archive

Subsystems (6)
lore
Share & tools
lore
#1 lore raw

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

In reply to a message not in the archive

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 2/2 net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

In reply to a message not in the archive

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use 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 | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +6 -0
index 8f730ada71f9..c42e8f972833 100644
@@ -353,6 +353,12 @@ 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;
 
+        for (int i = 0; i < plat_dat->tx_queues_to_use; i++) {
+                /* Default TX Q0 to use TSO and rest TXQ for TBS */
+                if (i > 0)
+                        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
#3 lore raw
Quoted 15 lines · Esben Haabendal

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use 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 | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +0 -0
index 8f730ada71f9..c42e8f972833 100644

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

Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +6 -0
@@ -353,6 +353,12 @@ 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;
 
+        for (int i = 0; i < plat_dat->tx_queues_to_use; i++) {
+                /* Default TX Q0 to use TSO and rest TXQ for TBS */
+                if (i > 0)
+                        plat_dat->tx_queues_cfg[i].tbs_en = 1;
+        }
+

Just wonder why don't you start with i = 1 and remove 'if' completely? Keeping comment in place will make it understandable.

Quoted 3 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +0 -0
  	plat_dat->host_dma_width = dwmac->ops->addr_width;
  	plat_dat->init = imx_dwmac_init;
  	plat_dat->exit = imx_dwmac_exit;
#4 lore raw
Quoted 17 lines · Vadim Fedorenko
Quoted 16 lines · Esben Haabendal

TSO and TBS cannot coexist. For now we set i.MX Ethernet QOS controller to use 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 | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +0 -0
index 8f730ada71f9..c42e8f972833 100644
@@ -353,6 +353,12 @@ 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;
  +        for (int i = 0; i < plat_dat->tx_queues_to_use; i++) {
Quoted 8 lines

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

Quoted 5 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +5 -0
+                /* Default TX Q0 to use TSO and rest TXQ for TBS */
+                if (i > 0)
+                        plat_dat->tx_queues_cfg[i].tbs_en = 1;
+        }
+

Just wonder why don't you start with i = 1 and remove 'if' completely? Keeping comment in place will make it understandable.

No good reason for now. Later on, we might have some setup in the same lop that also applies to Q0. But the init value can be changed at that point.

Quoted 4 lines
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +0 -0
  	plat_dat->host_dma_width = dwmac->ops->addr_width;
  	plat_dat->init = imx_dwmac_init;
  	plat_dat->exit = imx_dwmac_exit;
maintainer
#5 lore raw
In reply to Esben Haabendal

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

Quoted 5 lines · On Thu, 25 Jan 2024 13:34:34 +0100 Esben Haabendal wrote:
drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +5 -0
+        for (int i = 0; i < plat_dat->tx_queues_to_use; i++) {
+                /* Default TX Q0 to use TSO and rest TXQ for TBS */
+                if (i > 0)
+                        plat_dat->tx_queues_cfg[i].tbs_en = 1;
+        }

checkpatch points out this code is indented with spaces. Please use tabs.