]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net/stmmac: Apply TBS config only to used queues
authorJakub Raczynski <j.raczynski@samsung.com>
Thu, 11 Jun 2026 11:33:57 +0000 (13:33 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sat, 13 Jun 2026 23:00:21 +0000 (16:00 -0700)
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.

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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260611113358.3379518-2-j.raczynski@samsung.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 35da51c26248448c4ff8feff70a7516959c3ad83..2a0d7eff88d3ff1ffa57e224c25f9e77bc28ed10 100644 (file)
@@ -4142,7 +4142,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));