2024-01-25 13:04:20

by Esben Haabendal

[permalink] [raw]
Subject: [PATCH 2/2] net: stmmac: dwmac-imx: set TSO/TBS TX queues default settings

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 <[email protected]>
---
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



2024-01-25 17:16:31

by Vadim Fedorenko

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

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 <[email protected]>
> ---
> 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;


2024-01-25 18:34:30

by Esben Haabendal

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

Vadim Fedorenko <[email protected]> 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 <[email protected]>
>> ---
>> 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;

2024-01-26 01:23:20

by Jakub Kicinski

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

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.