All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: stmmac: do not clear TBS enable bit on link up/down
       [not found] <cover.1706184304.git.esben@geanix.com>
@ 2024-01-25 12:34   ` Esben Haabendal
  2024-01-25 12:34   ` Esben Haabendal
  1 sibling, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 12:34 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Christian Marangi
  Cc: stable, linux-stm32, linux-arm-kernel, linux-kernel

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")
Cc: stable@vger.kernel.org
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b334eb16da23..25519952f754 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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);
-- 
2.43.0


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

* [PATCH 1/2] net: stmmac: do not clear TBS enable bit on link up/down
@ 2024-01-25 12:34   ` Esben Haabendal
  0 siblings, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 12:34 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Christian Marangi
  Cc: stable, linux-stm32, linux-arm-kernel, linux-kernel

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")
Cc: stable@vger.kernel.org
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index b334eb16da23..25519952f754 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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);
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
       [not found] <cover.1706184304.git.esben@geanix.com>
@ 2024-01-25 12:34   ` Esben Haabendal
  2024-01-25 12:34   ` Esben Haabendal
  1 sibling, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 12:34 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team
  Cc: linux-arm-kernel, linux-stm32, linux-kernel

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.

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index 8f730ada71f9..c42e8f972833 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -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;
-- 
2.43.0


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

* [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
@ 2024-01-25 12:34   ` Esben Haabendal
  0 siblings, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 12:34 UTC (permalink / raw)
  To: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team
  Cc: linux-arm-kernel, linux-stm32, linux-kernel

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.

Signed-off-by: Esben Haabendal <esben@geanix.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
index 8f730ada71f9..c42e8f972833 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
@@ -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;
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
  2024-01-25 12:34   ` Esben Haabendal
@ 2024-01-25 17:11     ` Vadim Fedorenko
  -1 siblings, 0 replies; 10+ messages in thread
From: Vadim Fedorenko @ 2024-01-25 17:11 UTC (permalink / raw)
  To: Esben Haabendal, netdev, Alexandre Torgue, Jose Abreu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
  Cc: linux-arm-kernel, linux-stm32, linux-kernel

On 25/01/2024 12:34, Esben Haabendal wrote:
> 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.
> 
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> index 8f730ada71f9..c42e8f972833 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> @@ -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.

>   	plat_dat->host_dma_width = dwmac->ops->addr_width;
>   	plat_dat->init = imx_dwmac_init;
>   	plat_dat->exit = imx_dwmac_exit;


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
@ 2024-01-25 17:11     ` Vadim Fedorenko
  0 siblings, 0 replies; 10+ messages in thread
From: Vadim Fedorenko @ 2024-01-25 17:11 UTC (permalink / raw)
  To: Esben Haabendal, netdev, Alexandre Torgue, Jose Abreu,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Maxime Coquelin, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team
  Cc: linux-arm-kernel, linux-stm32, linux-kernel

On 25/01/2024 12:34, Esben Haabendal wrote:
> 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.
> 
> Signed-off-by: Esben Haabendal <esben@geanix.com>
> ---
>   drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
>   1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> index 8f730ada71f9..c42e8f972833 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
> @@ -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.

>   	plat_dat->host_dma_width = dwmac->ops->addr_width;
>   	plat_dat->init = imx_dwmac_init;
>   	plat_dat->exit = imx_dwmac_exit;


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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
  2024-01-25 17:11     ` Vadim Fedorenko
@ 2024-01-25 18:31       ` Esben Haabendal
  -1 siblings, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 18:31 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-arm-kernel, linux-stm32, linux-kernel

Vadim Fedorenko <vadim.fedorenko@linux.dev> writes:

> On 25/01/2024 12:34, Esben Haabendal wrote:
>> 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.
>> Signed-off-by: Esben Haabendal <esben@geanix.com>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> index 8f730ada71f9..c42e8f972833 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> @@ -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.

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.

>
>>   	plat_dat->host_dma_width = dwmac->ops->addr_width;
>>   	plat_dat->init = imx_dwmac_init;
>>   	plat_dat->exit = imx_dwmac_exit;

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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
@ 2024-01-25 18:31       ` Esben Haabendal
  0 siblings, 0 replies; 10+ messages in thread
From: Esben Haabendal @ 2024-01-25 18:31 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Maxime Coquelin,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-arm-kernel, linux-stm32, linux-kernel

Vadim Fedorenko <vadim.fedorenko@linux.dev> writes:

> On 25/01/2024 12:34, Esben Haabendal wrote:
>> 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.
>> Signed-off-by: Esben Haabendal <esben@geanix.com>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 6 ++++++
>>   1 file changed, 6 insertions(+)
>> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> index 8f730ada71f9..c42e8f972833 100644
>> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c
>> @@ -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.

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.

>
>>   	plat_dat->host_dma_width = dwmac->ops->addr_width;
>>   	plat_dat->init = imx_dwmac_init;
>>   	plat_dat->exit = imx_dwmac_exit;

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
  2024-01-25 12:34   ` Esben Haabendal
@ 2024-01-26  1:22     ` Jakub Kicinski
  -1 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2024-01-26  1:22 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Paolo Abeni, Maxime Coquelin, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-arm-kernel, linux-stm32, linux-kernel

On Thu, 25 Jan 2024 13:34:34 +0100 Esben Haabendal wrote:
> +        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.

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

* Re: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings
@ 2024-01-26  1:22     ` Jakub Kicinski
  0 siblings, 0 replies; 10+ messages in thread
From: Jakub Kicinski @ 2024-01-26  1:22 UTC (permalink / raw)
  To: Esben Haabendal
  Cc: netdev, Alexandre Torgue, Jose Abreu, David S. Miller,
	Eric Dumazet, Paolo Abeni, Maxime Coquelin, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-arm-kernel, linux-stm32, linux-kernel

On Thu, 25 Jan 2024 13:34:34 +0100 Esben Haabendal wrote:
> +        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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-01-26  1:23 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <cover.1706184304.git.esben@geanix.com>
2024-01-25 12:34 ` [PATCH 1/2] net: stmmac: do not clear TBS enable bit on link up/down Esben Haabendal
2024-01-25 12:34   ` Esben Haabendal
2024-01-25 12:34 ` [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings Esben Haabendal
2024-01-25 12:34   ` Esben Haabendal
2024-01-25 17:11   ` Vadim Fedorenko
2024-01-25 17:11     ` Vadim Fedorenko
2024-01-25 18:31     ` Esben Haabendal
2024-01-25 18:31       ` Esben Haabendal
2024-01-26  1:22   ` Jakub Kicinski
2024-01-26  1:22     ` Jakub Kicinski

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.