From 0da7809235d9cc34de71c9c5bf5028cc3034f806 Mon Sep 17 00:00:00 2001 From: "Russell King (Oracle)" Date: Sat, 14 Mar 2026 09:43:31 +0000 Subject: [PATCH] net: stmmac: remove tx_tail_addr There is only one place where tx_q->tx_tail_addr is used - the new stmmac_set_queue_tx_tail_ptr(). Make this a local variable and remove it from struct stmmac_tx_queue. This commit does not change the semantics - the hardware relies upon the descriptor ring not crossing a 4GiB boundary as the high address bits are programmed into a separate register via stmmac_init_tx_chan(). Hence, truncating the DMA address to 32-bit is fine as the register it will be programmed into is 32-bit, and the high bits are handled elsewhere. Also change the type of desc_size to size_t, as this variable is initialised from sizeof(). Signed-off-by: Russell King (Oracle) Link: https://patch.msgid.link/E1w1LWt-0000000DGT2-1oeO@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski --- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 1 - drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h index 2f24d5c584e6..b9d849a3f06e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h @@ -79,7 +79,6 @@ struct stmmac_tx_queue { unsigned int cur_tx; unsigned int dirty_tx; dma_addr_t dma_tx_phy; - dma_addr_t tx_tail_addr; u32 mss; }; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index dc7b19063564..f096d52a1672 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -389,12 +389,13 @@ static void stmmac_set_queue_tx_tail_ptr(struct stmmac_priv *priv, struct stmmac_tx_queue *tx_q, unsigned int chan, unsigned int index) { - int desc_size; + size_t desc_size; + u32 tx_tail_addr; desc_size = stmmac_get_tx_desc_size(priv, tx_q); - tx_q->tx_tail_addr = tx_q->dma_tx_phy + index * desc_size; - stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_q->tx_tail_addr, chan); + tx_tail_addr = tx_q->dma_tx_phy + index * desc_size; + stmmac_set_tx_tail_ptr(priv, priv->ioaddr, tx_tail_addr, chan); } static size_t stmmac_get_rx_desc_size(struct stmmac_priv *priv)