]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: use queue rather than ->queue_index
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Sat, 14 Mar 2026 09:43:36 +0000 (09:43 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 Mar 2026 03:32:09 +0000 (20:32 -0700)
We use a lot of ->queue_index where we already have the queue / channel
index (which are actually the same index), which has been used to get
the queue struct. Since queue and queue_index are identical in
priv->(tx|rx)_queue[queue]->queue_index there is no point using the
queue_index where we already have queue.

Use queue rather than queue_index.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1w1LWy-0000000DGT8-2Hoc@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index f096d52a16726605dc159b851780509e9dcc9f26..0a933aac3f0344176b6ab7e3d66553c023a029f8 100644 (file)
@@ -440,7 +440,7 @@ static void stmmac_set_queue_rx_buf_size(struct stmmac_priv *priv,
        else
                buf_size = priv->dma_conf.dma_buf_sz;
 
-       stmmac_set_dma_bfsize(priv, priv->ioaddr, buf_size, rx_q->queue_index);
+       stmmac_set_dma_bfsize(priv, priv->ioaddr, buf_size, chan);
 }
 
 /**
@@ -1902,7 +1902,7 @@ static int __init_dma_rx_desc_rings(struct stmmac_priv *priv,
                                                   NULL));
                netdev_info(priv->dev,
                            "Register MEM_TYPE_XSK_BUFF_POOL RxQ-%d\n",
-                           rx_q->queue_index);
+                           queue);
                xsk_pool_set_rxq_info(rx_q->xsk_pool, &rx_q->xdp_rxq);
        } else {
                WARN_ON(xdp_rxq_info_reg_mem_model(&rx_q->xdp_rxq,
@@ -1910,7 +1910,7 @@ static int __init_dma_rx_desc_rings(struct stmmac_priv *priv,
                                                   rx_q->page_pool));
                netdev_info(priv->dev,
                            "Register MEM_TYPE_PAGE_POOL RxQ-%d\n",
-                           rx_q->queue_index);
+                           queue);
        }
 
        if (rx_q->xsk_pool) {
@@ -2310,9 +2310,7 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv,
        else
                napi_id = ch->rx_napi.napi_id;
 
-       ret = xdp_rxq_info_reg(&rx_q->xdp_rxq, priv->dev,
-                              rx_q->queue_index,
-                              napi_id);
+       ret = xdp_rxq_info_reg(&rx_q->xdp_rxq, priv->dev, queue, napi_id);
        if (ret) {
                netdev_err(priv->dev, "Failed to register xdp rxq info\n");
                return -EINVAL;
@@ -3340,7 +3338,7 @@ static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
        if (!tx_coal_timer)
                return;
 
-       ch = &priv->channel[tx_q->queue_index];
+       ch = &priv->channel[queue];
        napi = tx_q->xsk_pool ? &ch->rxtx_napi : &ch->tx_napi;
 
        /* Arm timer only if napi is not already scheduled.
@@ -6942,12 +6940,11 @@ void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue)
        stmmac_clear_rx_descriptors(priv, &priv->dma_conf, queue);
 
        stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
-                           rx_q->dma_rx_phy, rx_q->queue_index);
+                           rx_q->dma_rx_phy, queue);
 
-       stmmac_set_queue_rx_tail_ptr(priv, rx_q, rx_q->queue_index,
-                                    rx_q->buf_alloc_num);
+       stmmac_set_queue_rx_tail_ptr(priv, rx_q, queue, rx_q->buf_alloc_num);
 
-       stmmac_set_queue_rx_buf_size(priv, rx_q, rx_q->queue_index);
+       stmmac_set_queue_rx_buf_size(priv, rx_q, queue);
 
        stmmac_start_rx_dma(priv, queue);
 
@@ -6993,12 +6990,12 @@ void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue)
        stmmac_clear_tx_descriptors(priv, &priv->dma_conf, queue);
 
        stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
-                           tx_q->dma_tx_phy, tx_q->queue_index);
+                           tx_q->dma_tx_phy, queue);
 
        if (tx_q->tbs & STMMAC_TBS_AVAIL)
-               stmmac_enable_tbs(priv, priv->ioaddr, 1, tx_q->queue_index);
+               stmmac_enable_tbs(priv, priv->ioaddr, 1, queue);
 
-       stmmac_set_queue_tx_tail_ptr(priv, tx_q, tx_q->queue_index, 0);
+       stmmac_set_queue_tx_tail_ptr(priv, tx_q, queue, 0);
 
        stmmac_start_tx_dma(priv, queue);