]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: stmmac: rename "mode" to "descriptor_mode"
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 18 Mar 2026 18:26:33 +0000 (18:26 +0000)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Mar 2026 00:18:51 +0000 (17:18 -0700)
priv->mode doesn't describe what it refers to, it is whether we operate
the DMA descriptors as a ring or chain. It is also difficult to grep for
as there are several "mode" struct members. Add "descriptor_" prefix.

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

index 71dac8c1a3ca03edacc6e91dc95aa72d604b7a13..511b0fd5e8343f90c4d5a9892d3ed7797d7ae424 100644 (file)
@@ -57,11 +57,11 @@ static void stmmac_dwmac_mode_quirk(struct stmmac_priv *priv)
 
        if (priv->chain_mode) {
                dev_info(priv->device, "Chain mode enabled\n");
-               priv->mode = STMMAC_CHAIN_MODE;
+               priv->descriptor_mode = STMMAC_CHAIN_MODE;
                mac->mode = &chain_mode_ops;
        } else {
                dev_info(priv->device, "Ring mode enabled\n");
-               priv->mode = STMMAC_RING_MODE;
+               priv->descriptor_mode = STMMAC_RING_MODE;
                mac->mode = &ring_mode_ops;
        }
 }
index b9d849a3f06ecfba1c48182a97737a60027a9dc5..919a93a5239039431cdb48230788c3e81eb13abc 100644 (file)
@@ -323,7 +323,10 @@ struct stmmac_priv {
        bool extend_desc;
        /* chain_mode: requested descriptor mode */
        bool chain_mode;
-       unsigned int mode;
+       /* descriptor_mode: actual descriptor mode,
+        * see STMMAC_CHAIN_MODE or STMMAC_RING_MODE
+        */
+       u8 descriptor_mode;
        struct kernel_hwtstamp_config tstamp_config;
        struct ptp_clock *ptp_clock;
        struct ptp_clock_info ptp_clock_ops;
index 0a933aac3f0344176b6ab7e3d66553c023a029f8..567499e74917bc592dfb30a1937cfe2126b02f87 100644 (file)
@@ -1589,7 +1589,8 @@ static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv,
        for (i = 0; i < dma_conf->dma_rx_size; i++) {
                desc = stmmac_get_rx_desc(priv, rx_q, i);
 
-               stmmac_init_rx_desc(priv, desc, priv->use_riwt, priv->mode,
+               stmmac_init_rx_desc(priv, desc, priv->use_riwt,
+                                   priv->descriptor_mode,
                                    (i == dma_conf->dma_rx_size - 1),
                                    dma_conf->dma_buf_sz);
        }
@@ -1616,7 +1617,7 @@ static void stmmac_clear_tx_descriptors(struct stmmac_priv *priv,
                struct dma_desc *p;
 
                p = stmmac_get_tx_desc(priv, tx_q, i);
-               stmmac_init_tx_desc(priv, p, priv->mode, last);
+               stmmac_init_tx_desc(priv, p, priv->descriptor_mode, last);
        }
 }
 
@@ -1925,7 +1926,7 @@ static int __init_dma_rx_desc_rings(struct stmmac_priv *priv,
        }
 
        /* Setup the chained descriptor addresses */
-       if (priv->mode == STMMAC_CHAIN_MODE) {
+       if (priv->descriptor_mode == STMMAC_CHAIN_MODE) {
                if (priv->extend_desc)
                        stmmac_mode_init(priv, rx_q->dma_erx,
                                         rx_q->dma_rx_phy,
@@ -2027,7 +2028,7 @@ static int __init_dma_tx_desc_rings(struct stmmac_priv *priv,
                  (u32)tx_q->dma_tx_phy);
 
        /* Setup the chained descriptor addresses */
-       if (priv->mode == STMMAC_CHAIN_MODE) {
+       if (priv->descriptor_mode == STMMAC_CHAIN_MODE) {
                if (priv->extend_desc)
                        stmmac_mode_init(priv, tx_q->dma_etx,
                                         tx_q->dma_tx_phy,
@@ -2774,7 +2775,7 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
                }
 
                stmmac_prepare_tx_desc(priv, tx_desc, 1, xdp_desc.len,
-                                      csum, priv->mode, true, true,
+                                      csum, priv->descriptor_mode, true, true,
                                       xdp_desc.len);
 
                stmmac_enable_dma_transmission(priv, priv->ioaddr, queue);
@@ -2948,7 +2949,7 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue,
                        }
                }
 
-               stmmac_release_tx_desc(priv, p, priv->mode);
+               stmmac_release_tx_desc(priv, p, priv->descriptor_mode);
 
                entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
        }
@@ -4794,7 +4795,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 
                /* Prepare the descriptor and set the own bit too */
                stmmac_prepare_tx_desc(priv, desc, 0, len, csum_insertion,
-                               priv->mode, 1, last_segment, skb->len);
+                                      priv->descriptor_mode, 1, last_segment,
+                                      skb->len);
        }
 
        stmmac_set_tx_dma_last_segment(tx_q, entry);
@@ -4890,8 +4892,8 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
 
                /* Prepare the first descriptor setting the OWN bit too */
                stmmac_prepare_tx_desc(priv, first, 1, nopaged_len,
-                               csum_insertion, priv->mode, 0, last_segment,
-                               skb->len);
+                                      csum_insertion, priv->descriptor_mode,
+                                      0, last_segment, skb->len);
        }
 
        if (tx_q->tbs & STMMAC_TBS_EN) {
@@ -5119,7 +5121,7 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
        stmmac_set_desc_addr(priv, tx_desc, dma_addr);
 
        stmmac_prepare_tx_desc(priv, tx_desc, 1, xdpf->len,
-                              csum, priv->mode, true, true,
+                              csum, priv->descriptor_mode, true, true,
                               xdpf->len);
 
        tx_q->tx_count_frames++;
@@ -7432,7 +7434,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
         * is not expected to change this.
         */
        priv->plat->dma_cfg->atds = priv->extend_desc &&
-                                   priv->mode == STMMAC_RING_MODE;
+                                   priv->descriptor_mode == STMMAC_RING_MODE;
 
        /* Rx Watchdog is available in the COREs newer than the 3.40.
         * In some case, for example on bugged HW this feature