* [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled
@ 2024-06-17 1:39 Xiaolei Wang
2024-06-18 9:56 ` Simon Horman
2024-06-19 1:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Xiaolei Wang @ 2024-06-17 1:39 UTC (permalink / raw)
To: horms, olteanv, linux, alexandre.torgue, andrew, joabreu, davem,
edumazet, kuba, pabeni, mcoquelin.stm32, wojciech.drewek
Cc: netdev, linux-arm-kernel, linux-kernel
commit be27b8965297 ("net: stmmac: replace priv->speed with
the portTransmitRate from the tc-cbs parameters") introduced
a problem. When deleting, it prompts "Invalid portTransmitRate
0 (idleSlope - sendSlope)" and exits. Add judgment on cbs.enable.
Only when offload is enabled, speed divider needs to be calculated.
Fixes: be27b8965297 ("net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters")
Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
---
Change log:
v1:
https://patchwork.kernel.org/project/netdevbpf/patch/20240614081916.764761-1-xiaolei.wang@windriver.com/
v2:
When offload is disabled, ptr is initialized to 0
.../net/ethernet/stmicro/stmmac/stmmac_tc.c | 40 ++++++++++---------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
index 1562fbdd0a04..996f2bcd07a2 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
@@ -358,24 +358,28 @@ static int tc_setup_cbs(struct stmmac_priv *priv,
port_transmit_rate_kbps = qopt->idleslope - qopt->sendslope;
- /* Port Transmit Rate and Speed Divider */
- switch (div_s64(port_transmit_rate_kbps, 1000)) {
- case SPEED_10000:
- case SPEED_5000:
- ptr = 32;
- break;
- case SPEED_2500:
- case SPEED_1000:
- ptr = 8;
- break;
- case SPEED_100:
- ptr = 4;
- break;
- default:
- netdev_err(priv->dev,
- "Invalid portTransmitRate %lld (idleSlope - sendSlope)\n",
- port_transmit_rate_kbps);
- return -EINVAL;
+ if (qopt->enable) {
+ /* Port Transmit Rate and Speed Divider */
+ switch (div_s64(port_transmit_rate_kbps, 1000)) {
+ case SPEED_10000:
+ case SPEED_5000:
+ ptr = 32;
+ break;
+ case SPEED_2500:
+ case SPEED_1000:
+ ptr = 8;
+ break;
+ case SPEED_100:
+ ptr = 4;
+ break;
+ default:
+ netdev_err(priv->dev,
+ "Invalid portTransmitRate %lld (idleSlope - sendSlope)\n",
+ port_transmit_rate_kbps);
+ return -EINVAL;
+ }
+ } else {
+ ptr = 0;
}
mode_to_use = priv->plat->tx_queues_cfg[queue].mode_to_use;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled
2024-06-17 1:39 [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled Xiaolei Wang
@ 2024-06-18 9:56 ` Simon Horman
2024-06-19 1:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-06-18 9:56 UTC (permalink / raw)
To: Xiaolei Wang
Cc: olteanv, linux, alexandre.torgue, andrew, joabreu, davem,
edumazet, kuba, pabeni, mcoquelin.stm32, wojciech.drewek, netdev,
linux-arm-kernel, linux-kernel
On Mon, Jun 17, 2024 at 09:39:22AM +0800, Xiaolei Wang wrote:
> commit be27b8965297 ("net: stmmac: replace priv->speed with
> the portTransmitRate from the tc-cbs parameters") introduced
> a problem. When deleting, it prompts "Invalid portTransmitRate
> 0 (idleSlope - sendSlope)" and exits. Add judgment on cbs.enable.
> Only when offload is enabled, speed divider needs to be calculated.
>
> Fixes: be27b8965297 ("net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
> ---
>
> Change log:
>
> v1:
> https://patchwork.kernel.org/project/netdevbpf/patch/20240614081916.764761-1-xiaolei.wang@windriver.com/
> v2:
> When offload is disabled, ptr is initialized to 0
Thanks for the update.
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled
2024-06-17 1:39 [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled Xiaolei Wang
2024-06-18 9:56 ` Simon Horman
@ 2024-06-19 1:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-19 1:00 UTC (permalink / raw)
To: xiaolei wang
Cc: horms, olteanv, linux, alexandre.torgue, andrew, joabreu, davem,
edumazet, kuba, pabeni, mcoquelin.stm32, wojciech.drewek, netdev,
linux-arm-kernel, linux-kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 17 Jun 2024 09:39:22 +0800 you wrote:
> commit be27b8965297 ("net: stmmac: replace priv->speed with
> the portTransmitRate from the tc-cbs parameters") introduced
> a problem. When deleting, it prompts "Invalid portTransmitRate
> 0 (idleSlope - sendSlope)" and exits. Add judgment on cbs.enable.
> Only when offload is enabled, speed divider needs to be calculated.
>
> Fixes: be27b8965297 ("net: stmmac: replace priv->speed with the portTransmitRate from the tc-cbs parameters")
> Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
>
> [...]
Here is the summary with links:
- [net,v2] net: stmmac: No need to calculate speed divider when offload is disabled
https://git.kernel.org/netdev/net/c/b8c43360f6e4
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] 3+ messages in thread
end of thread, other threads:[~2024-06-19 1:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 1:39 [net v2 PATCH] net: stmmac: No need to calculate speed divider when offload is disabled Xiaolei Wang
2024-06-18 9:56 ` Simon Horman
2024-06-19 1:00 ` 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;
as well as URLs for NNTP newsgroup(s).