From: Jakub Raczynski <j.raczynski@samsung.com>
To: netdev@vger.kernel.org
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, k.domagalski@samsung.com,
k.tegowski@samsung.com, Jakub Raczynski <j.raczynski@samsung.com>,
Sashiko <sashiko-bot@kernel.org>
Subject: [PATCH net 2/2] net/stmmac: Apply MTL_MAX queue limit if config missing
Date: Thu, 11 Jun 2026 13:33:58 +0200 [thread overview]
Message-ID: <20260611113358.3379518-3-j.raczynski@samsung.com> (raw)
In-Reply-To: <20260611113358.3379518-1-j.raczynski@samsung.com>
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
next prev parent reply other threads:[~2026-06-11 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[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 ` Jakub Raczynski [this message]
2026-06-12 19:14 ` [PATCH net 0/2] net/stmmac: Fixes for maximum TX/RX queues to use by driver Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260611113358.3379518-3-j.raczynski@samsung.com \
--to=j.raczynski@samsung.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=k.domagalski@samsung.com \
--cc=k.tegowski@samsung.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sashiko-bot@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox