Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net: stmmac: fix num tx queues in stmmac_xdp_get_tx_queue()
@ 2026-11-17 15:51 Lorenzo Bianconi
  2026-11-17 15:57 ` netdev-bot+sinfo
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2026-11-17 15:51 UTC (permalink / raw)
  To: Maxime Chevallier, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Maxime Coquelin, Alexandre Torgue,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, Stanislav Fomichev, Vladimir Oltean, Furong Xu
  Cc: netdev, linux-arm-kernel, bpf, Lorenzo Bianconi

The TX queue returned by stmmac_xdp_get_tx_queue() is passed to
netdev_get_tx_queue(), so it must be lower than dev->real_num_tx_queues.
Since mqprio offload can reduce real_num_tx_queues below
plat->tx_queues_to_use, wrapping the CPU index by plat->tx_queues_to_use
can select a TX queue that is not part of the real queue set when the
offload is active.

Use priv->xmit_qdisc.num_tx_queues instead, which is the value
stmmac_hw_setup() installs as real_num_tx_queues and is guaranteed to
never exceed plat->tx_queues_to_use.

Fixes: 195e4f409a40 ("net: stmmac: support fp parameter of tc-mqprio")
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 25894771e9e9..cf87afd27343 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -5408,13 +5408,14 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
 static int stmmac_xdp_get_tx_queue(struct stmmac_priv *priv,
 				   int cpu)
 {
+	unsigned int num_tx_queues = priv->xmit_qdisc.num_tx_queues;
 	int index = cpu;
 
 	if (unlikely(index < 0))
 		index = 0;
 
-	while (index >= priv->plat->tx_queues_to_use)
-		index -= priv->plat->tx_queues_to_use;
+	while (index >= num_tx_queues)
+		index -= num_tx_queues;
 
 	return index;
 }

---
base-commit: 5e9b2ad9b8384cd3c417cd5e2c3bc7eee4a72791
change-id: 20261117-stmmac-fix-xdp_get_tx_queue-0eda31da641f

Best regards,
-- 
Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>



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

end of thread, other threads:[~2026-11-17 20:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 15:51 [PATCH net] net: stmmac: fix num tx queues in stmmac_xdp_get_tx_queue() Lorenzo Bianconi
2026-11-17 15:57 ` netdev-bot+sinfo
2026-11-17 20:30   ` Lorenzo Bianconi

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