[PATCH net] net: stmmac: fix num tx queues in stmmac_xdp_get_tx_queue()
Lorenzo Bianconi
lorenzo.bianconi at oss.qualcomm.com
Tue Nov 17 07:51:53 PST 2026
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 at 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 at oss.qualcomm.com>
More information about the linux-arm-kernel
mailing list