public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive
@ 2024-12-20  7:56 Siddharth Vadapalli
  2024-12-20 10:41 ` Przemek Kitszel
  2024-12-23 18:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Siddharth Vadapalli @ 2024-12-20  7:56 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni, rogerq, horms,
	dan.carpenter, c-vankar, jpanis, npitre
  Cc: stable, netdev, linux-kernel, linux-arm-kernel, vigneshr, srk,
	s-vadapalli

The Host Port (i.e. CPU facing port) of CPSW receives traffic from Linux
via TX DMA Channels which are Hardware Queues consisting of traffic
categorized according to their priority. The Host Port is configured to
dequeue traffic from these Hardware Queues on the basis of priority i.e.
as long as traffic exists on a Hardware Queue of a higher priority, the
traffic on Hardware Queues of lower priority isn't dequeued. An alternate
operation is also supported wherein traffic can be dequeued by the Host
Port in a Round-Robin manner.

Until [0], the am65-cpsw driver enabled a single TX DMA Channel, due to
which, unless modified by user via "ethtool", all traffic from Linux is
transmitted on DMA Channel 0. Therefore, configuring the Host Port for
priority based dequeuing or Round-Robin operation is identical since
there is a single DMA Channel.

Since [0], all 8 TX DMA Channels are enabled by default. Additionally,
the default "tc mapping" doesn't take into account the possibility of
different traffic profiles which various users might have. This results
in traffic starvation at the Host Port due to the priority based dequeuing
which has been enabled by default since the inception of the driver. The
traffic starvation triggers NETDEV WATCHDOG timeout for all TX DMA Channels
that haven't been serviced due to the presence of traffic on the higher
priority TX DMA Channels.

Fix this by defaulting to Round-Robin dequeuing at the Host Port, which
shall ensure that traffic is dequeued from all TX DMA Channels irrespective
of the traffic profile. This will address the NETDEV WATCHDOG timeouts.
At the same time, users can still switch from Round-Robin to Priority
based dequeuing at the Host Port with the help of the "p0-rx-ptype-rrobin"
private flag of "ethtool". Users are expected to setup an appropriate
"tc mapping" that suits their traffic profile when switching to priority
based dequeuing at the Host Port.

[0] commit be397ea3473d ("net: ethernet: am65-cpsw: Set default TX channels to maximum")
Fixes: be397ea3473d ("net: ethernet: am65-cpsw: Set default TX channels to maximum")
Cc: <stable@vger.kernel.org>
Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
---

Hello,

This patch is based on commit
8faabc041a00 Merge tag 'net-6.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
of Mainline Linux.

Regards,
Siddharth.

 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index 14e1df721f2e..5465bf872734 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -3551,7 +3551,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
 	init_completion(&common->tdown_complete);
 	common->tx_ch_num = AM65_CPSW_DEFAULT_TX_CHNS;
 	common->rx_ch_num_flows = AM65_CPSW_DEFAULT_RX_CHN_FLOWS;
-	common->pf_p0_rx_ptype_rrobin = false;
+	common->pf_p0_rx_ptype_rrobin = true;
 	common->default_vlan = 1;
 
 	common->ports = devm_kcalloc(dev, common->port_num,
-- 
2.43.0


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

* Re: [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive
  2024-12-20  7:56 [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive Siddharth Vadapalli
@ 2024-12-20 10:41 ` Przemek Kitszel
  2024-12-20 16:17   ` Siddharth Vadapalli
  2024-12-23 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Przemek Kitszel @ 2024-12-20 10:41 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: stable, netdev, linux-kernel, andrew+netdev, davem, edumazet,
	kuba, pabeni, rogerq, horms, dan.carpenter, c-vankar, jpanis,
	npitre, linux-arm-kernel, vigneshr, srk

On 12/20/24 08:56, Siddharth Vadapalli wrote:
> The Host Port (i.e. CPU facing port) of CPSW receives traffic from Linux
> via TX DMA Channels which are Hardware Queues consisting of traffic
> categorized according to their priority. The Host Port is configured to
> dequeue traffic from these Hardware Queues on the basis of priority i.e.
> as long as traffic exists on a Hardware Queue of a higher priority, the
> traffic on Hardware Queues of lower priority isn't dequeued. An alternate
> operation is also supported wherein traffic can be dequeued by the Host
> Port in a Round-Robin manner.
> 
> Until [0], the am65-cpsw driver enabled a single TX DMA Channel, due to
> which, unless modified by user via "ethtool", all traffic from Linux is
> transmitted on DMA Channel 0. Therefore, configuring the Host Port for
> priority based dequeuing or Round-Robin operation is identical since
> there is a single DMA Channel.
> 
> Since [0], all 8 TX DMA Channels are enabled by default. Additionally,
> the default "tc mapping" doesn't take into account the possibility of
> different traffic profiles which various users might have. This results
> in traffic starvation at the Host Port due to the priority based dequeuing
> which has been enabled by default since the inception of the driver. The
> traffic starvation triggers NETDEV WATCHDOG timeout for all TX DMA Channels
> that haven't been serviced due to the presence of traffic on the higher
> priority TX DMA Channels.

I get it right that the starving is caused by HW/DMA (not SW)

> 
> Fix this by defaulting to Round-Robin dequeuing at the Host Port, which
> shall ensure that traffic is dequeued from all TX DMA Channels irrespective
> of the traffic profile. This will address the NETDEV WATCHDOG timeouts.
> At the same time, users can still switch from Round-Robin to Priority
> based dequeuing at the Host Port with the help of the "p0-rx-ptype-rrobin"

why the flag has rx in the name?

> private flag of "ethtool". Users are expected to setup an appropriate
> "tc mapping" that suits their traffic profile when switching to priority
> based dequeuing at the Host Port.
> 
> [0] commit be397ea3473d ("net: ethernet: am65-cpsw: Set default TX channels to maximum")
> Fixes: be397ea3473d ("net: ethernet: am65-cpsw: Set default TX channels to maximum")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
> 
> Hello,
> 
> This patch is based on commit
> 8faabc041a00 Merge tag 'net-6.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
> of Mainline Linux.
> 
> Regards,
> Siddharth.
> 
>   drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index 14e1df721f2e..5465bf872734 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -3551,7 +3551,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
>   	init_completion(&common->tdown_complete);
>   	common->tx_ch_num = AM65_CPSW_DEFAULT_TX_CHNS;
>   	common->rx_ch_num_flows = AM65_CPSW_DEFAULT_RX_CHN_FLOWS;
> -	common->pf_p0_rx_ptype_rrobin = false;
> +	common->pf_p0_rx_ptype_rrobin = true;
>   	common->default_vlan = 1;
>   
>   	common->ports = devm_kcalloc(dev, common->port_num,


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

* Re: [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive
  2024-12-20 10:41 ` Przemek Kitszel
@ 2024-12-20 16:17   ` Siddharth Vadapalli
  0 siblings, 0 replies; 4+ messages in thread
From: Siddharth Vadapalli @ 2024-12-20 16:17 UTC (permalink / raw)
  To: Przemek Kitszel
  Cc: Siddharth Vadapalli, stable, netdev, linux-kernel, andrew+netdev,
	davem, edumazet, kuba, pabeni, rogerq, horms, dan.carpenter,
	c-vankar, jpanis, npitre, linux-arm-kernel, vigneshr, srk

On Fri, Dec 20, 2024 at 11:41:26AM +0100, Przemek Kitszel wrote:
> On 12/20/24 08:56, Siddharth Vadapalli wrote:
> > The Host Port (i.e. CPU facing port) of CPSW receives traffic from Linux
> > via TX DMA Channels which are Hardware Queues consisting of traffic
> > categorized according to their priority. The Host Port is configured to
> > dequeue traffic from these Hardware Queues on the basis of priority i.e.
> > as long as traffic exists on a Hardware Queue of a higher priority, the
> > traffic on Hardware Queues of lower priority isn't dequeued. An alternate
> > operation is also supported wherein traffic can be dequeued by the Host
> > Port in a Round-Robin manner.
> > 
> > Until [0], the am65-cpsw driver enabled a single TX DMA Channel, due to
> > which, unless modified by user via "ethtool", all traffic from Linux is
> > transmitted on DMA Channel 0. Therefore, configuring the Host Port for
> > priority based dequeuing or Round-Robin operation is identical since
> > there is a single DMA Channel.
> > 
> > Since [0], all 8 TX DMA Channels are enabled by default. Additionally,
> > the default "tc mapping" doesn't take into account the possibility of
> > different traffic profiles which various users might have. This results
> > in traffic starvation at the Host Port due to the priority based dequeuing
> > which has been enabled by default since the inception of the driver. The
> > traffic starvation triggers NETDEV WATCHDOG timeout for all TX DMA Channels
> > that haven't been serviced due to the presence of traffic on the higher
> > priority TX DMA Channels.
> 
> I get it right that the starving is caused by HW/DMA (not SW)

Yes. The CPSW Host Port in Hardware can be configured to dequeue packets
queued onto the DMA Channels by Linux in either a Priority-based manner
or Round-Robin manner. Linux is submitting the packets onto the TX DMA
Channels to be received by CPSW, with CPSW's Host Port dequeuing them
in one of the two modes (fixed priority or round-robin) that has been
programmed.

> 
> > 
> > Fix this by defaulting to Round-Robin dequeuing at the Host Port, which
> > shall ensure that traffic is dequeued from all TX DMA Channels irrespective
> > of the traffic profile. This will address the NETDEV WATCHDOG timeouts.
> > At the same time, users can still switch from Round-Robin to Priority
> > based dequeuing at the Host Port with the help of the "p0-rx-ptype-rrobin"
> 
> why the flag has rx in the name?

The "rx" corresponds to "receive" w.r.t. the Host Port (P0). As indicated
in the $subject of this patch, we are defaulting to "Round-Robin" (rrobin)
mode of operation of Host Port dequeuing i.e. packets received by the Host
Port from Linux are to be dequeued in a Round-Robin manner from each of the
TX DMA Channels (TX from Linux's perspective). As for the naming convention
being followed, it is based on the Techincal Reference Manual.

[...]

Regards,
Siddharth.

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

* Re: [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive
  2024-12-20  7:56 [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive Siddharth Vadapalli
  2024-12-20 10:41 ` Przemek Kitszel
@ 2024-12-23 18:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-12-23 18:50 UTC (permalink / raw)
  To: Siddharth Vadapalli
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, rogerq, horms,
	dan.carpenter, c-vankar, jpanis, npitre, stable, netdev,
	linux-kernel, linux-arm-kernel, vigneshr, srk

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 20 Dec 2024 13:26:14 +0530 you wrote:
> The Host Port (i.e. CPU facing port) of CPSW receives traffic from Linux
> via TX DMA Channels which are Hardware Queues consisting of traffic
> categorized according to their priority. The Host Port is configured to
> dequeue traffic from these Hardware Queues on the basis of priority i.e.
> as long as traffic exists on a Hardware Queue of a higher priority, the
> traffic on Hardware Queues of lower priority isn't dequeued. An alternate
> operation is also supported wherein traffic can be dequeued by the Host
> Port in a Round-Robin manner.
> 
> [...]

Here is the summary with links:
  - [net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive
    https://git.kernel.org/netdev/net/c/4a4d38ace1fb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-12-23 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20  7:56 [PATCH net] net: ethernet: ti: am65-cpsw: default to round-robin for host port receive Siddharth Vadapalli
2024-12-20 10:41 ` Przemek Kitszel
2024-12-20 16:17   ` Siddharth Vadapalli
2024-12-23 18:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox