From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org,
Paolo Abeni <pabeni@redhat.com>,
Stanislav Fomichev <sdf@fomichev.me>
Subject: [PATCH net-next v2 15/15] net: stmmac: use queue rather than ->queue_index
Date: Thu, 12 Mar 2026 10:10:04 +0000 [thread overview]
Message-ID: <E1w0czU-0000000CzHK-2BhC@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <abKQWloxp9_4OuJh@shell.armlinux.org.uk>
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>
---
.../net/ethernet/stmicro/stmmac/stmmac_main.c | 25 ++++++++-----------
1 file changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 55b79e9e637f..8393cbd0875e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -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.
@@ -6918,12 +6916,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);
@@ -6969,12 +6966,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);
--
2.47.3
prev parent reply other threads:[~2026-03-12 10:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 10:07 [PATCH net-next v2 00/15] net: stmmac: clean up descriptor handling part 1 Russell King (Oracle)
2026-03-12 10:08 ` [PATCH net-next v2 01/15] net: stmmac: rearrange stmmac_tx_info members to pack better Russell King (Oracle)
2026-03-12 10:08 ` [PATCH net-next v2 02/15] net: stmmac: helpers for filling tx_q->tx_skbuff_dma Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 03/15] net: stmmac: clean up stmmac_clear_rx_descriptors() Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 04/15] net: stmmac: add helper to get hardware receive descriptor Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 05/15] net: stmmac: add helper to get size of a " Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 06/15] net: stmmac: add helper to set receive tail pointer Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 07/15] net: stmmac: remove rx_tail_addr Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 08/15] net: stmmac: use consistent tests for receive buffer size Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 09/15] net: stmmac: add helper to set " Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 10/15] net: stmmac: simplify stmmac_set_queue_rx_buf_size() Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 11/15] net: stmmac: add helper to get hardware transmit descriptor Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 12/15] net: stmmac: add helper to get size of a " Russell King (Oracle)
2026-03-12 10:09 ` [PATCH net-next v2 13/15] net: stmmac: add helper to set transmit tail pointer Russell King (Oracle)
2026-03-12 12:34 ` Russell King (Oracle)
2026-03-13 19:50 ` kernel test robot
2026-03-13 20:10 ` kernel test robot
2026-03-12 10:09 ` [PATCH net-next v2 14/15] net: stmmac: remove tx_tail_addr Russell King (Oracle)
2026-03-12 10:10 ` Russell King (Oracle) [this message]
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=E1w0czU-0000000CzHK-2BhC@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=alexandre.torgue@foss.st.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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