* [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver
[not found] <CGME20260611113403eucas1p1f4b61896c875f1f6833d6ca136472af8@eucas1p1.samsung.com>
@ 2026-06-11 11:33 ` Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 1/2] net/stmmac: Apply TBS config only to used queues Jakub Raczynski
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Jakub Raczynski @ 2026-06-11 11:33 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
alexandre.torgue, linux-kernel, linux-arm-kernel, k.domagalski,
k.tegowski, Jakub Raczynski
When contributing other changes preparing functions for new XGMAC hardware
https://lore.kernel.org/netdev/20260601162537.553512-1-j.raczynski@samsung.com/
there have been reports by Sashiko AI review about pre-existing issues
in the code. These problems are non-insignificant and are 'net' material fixes,
rather than net-next features.
One issue in this patchset was reported by Sashiko AI, while other
technically part of new patchset, but is reasonable related fix.
All of issues are wrong DTS configuration, but kernel needs to handle it.
Jakub Raczynski (2):
net/stmmac: Apply TBS config only to used queues
net/stmmac: Apply MTL_MAX queue limit if config missing
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net 1/2] net/stmmac: Apply TBS config only to used queues
2026-06-11 11:33 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Jakub Raczynski
@ 2026-06-11 11:33 ` Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 2/2] net/stmmac: Apply MTL_MAX queue limit if config missing Jakub Raczynski
2026-06-12 19:14 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Raczynski @ 2026-06-11 11:33 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
alexandre.torgue, linux-kernel, linux-arm-kernel, k.domagalski,
k.tegowski, Jakub Raczynski, Chang-Sub Lee
While opening stmmac driver, there is enabling of TBS (Time-Based Scheduling)
option in dma config. Currently this is executed for all possible TX queues via
MTL_MAX_TX_QUEUES macro, but actual number of queues used might differ.
While setting this is generally harmless, since memory for MTL_MAX_TX_QUEUES
is allocated, it is incorrect, because it prepares config for unused queues.
Change this to apply tbs config only to tx_queues_to_use.
Fixes: 4896bb7c0b31a ("net: stmmac: do not clear TBS enable bit on link up/down")
Co-developed-by: Chang-Sub Lee <cs0617.lee@samsung.com>
Signed-off-by: Chang-Sub Lee <cs0617.lee@samsung.com>
Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 3591755ea30b..5917bf47c7de 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4140,7 +4140,7 @@ static int __stmmac_open(struct net_device *dev,
u8 chan;
int ret;
- for (int i = 0; i < MTL_MAX_TX_QUEUES; i++)
+ for (int i = 0; i < priv->plat->tx_queues_to_use; 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));
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] net/stmmac: Apply MTL_MAX queue limit if config missing
2026-06-11 11:33 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 1/2] net/stmmac: Apply TBS config only to used queues Jakub Raczynski
@ 2026-06-11 11:33 ` Jakub Raczynski
2026-06-12 19:14 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Jakub Raczynski @ 2026-06-11 11:33 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, mcoquelin.stm32,
alexandre.torgue, linux-kernel, linux-arm-kernel, k.domagalski,
k.tegowski, Jakub Raczynski, Sashiko
When "snps,rx-queues-to-use" or "tx-queues-to-use" config in DTS is provided
current code will apply U8_MAX value for queues_to_use if there is input of
higher value. But actual maximum number of supported queues is set via
macro MTL_MAX_RX_QUEUES and MTL_MAX_TX_QUEUES, which currently have value of 8.
This value of U8_MAX will be capped to value provided by core in DMA
capabilities (dma_conf), but it does so only if core provides it.
This is true for XGMAC (dwxgmac2) and some GMAC (dwmac4),
but not for (dwmac1000). This capping is at later stage in stmmac_hw_init(),
and during stmmac_mtl_setup() we might parse fields outside allocated memory
if queues_to_use is over defines MTL_MAX_ values,
for example following rx_queues_cfg is array of size of MTL_MAX_RX_QUEUES.
Fix this by capping value to MTL_MAX during config parsing.
Fixes: 94808793fed71 ("net: stmmac: use u8 for ?x_queues_to_use and number_?x_queues")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 5cae2aa72906..dc5f951a311d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -156,8 +156,8 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
/* Processing RX queues common config */
if (!of_property_read_u32(rx_node, "snps,rx-queues-to-use", &value)) {
- if (value > U8_MAX)
- value = U8_MAX;
+ if (value > MTL_MAX_RX_QUEUES)
+ value = MTL_MAX_RX_QUEUES;
plat->rx_queues_to_use = value;
}
@@ -210,8 +210,8 @@ static int stmmac_mtl_setup(struct platform_device *pdev,
/* Processing TX queues common config */
if (!of_property_read_u32(tx_node, "snps,tx-queues-to-use", &value)) {
- if (value > U8_MAX)
- value = U8_MAX;
+ if (value > MTL_MAX_TX_QUEUES)
+ value = MTL_MAX_TX_QUEUES;
plat->tx_queues_to_use = value;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver
2026-06-11 11:33 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 1/2] net/stmmac: Apply TBS config only to used queues Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 2/2] net/stmmac: Apply MTL_MAX queue limit if config missing Jakub Raczynski
@ 2026-06-12 19:14 ` Simon Horman
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2026-06-12 19:14 UTC (permalink / raw)
To: Jakub Raczynski
Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni,
mcoquelin.stm32, alexandre.torgue, linux-kernel, linux-arm-kernel,
k.domagalski, k.tegowski
On Thu, Jun 11, 2026 at 01:33:56PM +0200, Jakub Raczynski wrote:
> When contributing other changes preparing functions for new XGMAC hardware
> https://lore.kernel.org/netdev/20260601162537.553512-1-j.raczynski@samsung.com/
> there have been reports by Sashiko AI review about pre-existing issues
> in the code. These problems are non-insignificant and are 'net' material fixes,
> rather than net-next features.
> One issue in this patchset was reported by Sashiko AI, while other
> technically part of new patchset, but is reasonable related fix.
> All of issues are wrong DTS configuration, but kernel needs to handle it.
>
> Jakub Raczynski (2):
> net/stmmac: Apply TBS config only to used queues
> net/stmmac: Apply MTL_MAX queue limit if config missing
For the series;
Reviewed-by: Simon Horman <horms@kernel.org>
FTR, there is AI-generated review of this patch-set available on sashiko.dev
However I believe that feedback can be viewed in the context of possible
follow-up and should not impede the progress of this patchset.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-12 19:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20260611113403eucas1p1f4b61896c875f1f6833d6ca136472af8@eucas1p1.samsung.com>
2026-06-11 11:33 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 1/2] net/stmmac: Apply TBS config only to used queues Jakub Raczynski
2026-06-11 11:33 ` [PATCH net 2/2] net/stmmac: Apply MTL_MAX queue limit if config missing Jakub Raczynski
2026-06-12 19:14 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox