Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: stmmac: Correct usage of maximum queue number macros

The maximum numbers of each Rx and Tx queues are defined by
MTL_MAX_RX_QUEUES and MTL_MAX_TX_QUEUES respectively.

There are some places where Rx and Tx are used in reverse. There is no
issue when the Tx and Rx macros have the same value, but should correct
usage of macros for maximum queue number to keep consistency and prevent
unexpected mistakes.

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Link: https://patch.msgid.link/20250221051818.4163678-1-hayashi.kunihiko@socionext.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Kunihiko Hayashi and committed by
Jakub Kicinski
352bc451 75bc3dab

+5 -6
+2 -2
drivers/net/ethernet/stmicro/stmmac/common.h
··· 101 101 /* Updates on each CPU protected by not allowing nested irqs. */ 102 102 struct stmmac_pcpu_stats { 103 103 struct u64_stats_sync syncp; 104 - u64_stats_t rx_normal_irq_n[MTL_MAX_TX_QUEUES]; 105 - u64_stats_t tx_normal_irq_n[MTL_MAX_RX_QUEUES]; 104 + u64_stats_t rx_normal_irq_n[MTL_MAX_RX_QUEUES]; 105 + u64_stats_t tx_normal_irq_n[MTL_MAX_TX_QUEUES]; 106 106 }; 107 107 108 108 /* Extra statistic and debug information exposed by ethtool */
+3 -4
drivers/net/ethernet/stmicro/stmmac/stmmac.h
··· 259 259 /* Frequently used values are kept adjacent for cache effect */ 260 260 u32 tx_coal_frames[MTL_MAX_TX_QUEUES]; 261 261 u32 tx_coal_timer[MTL_MAX_TX_QUEUES]; 262 - u32 rx_coal_frames[MTL_MAX_TX_QUEUES]; 262 + u32 rx_coal_frames[MTL_MAX_RX_QUEUES]; 263 263 264 264 int hwts_tx_en; 265 265 bool tx_path_in_lpi_mode; ··· 267 267 int sph; 268 268 int sph_cap; 269 269 u32 sarc_type; 270 - 271 - u32 rx_riwt[MTL_MAX_TX_QUEUES]; 270 + u32 rx_riwt[MTL_MAX_RX_QUEUES]; 272 271 int hwts_rx_en; 273 272 274 273 void __iomem *ioaddr; ··· 343 344 char int_name_sfty[IFNAMSIZ + 10]; 344 345 char int_name_sfty_ce[IFNAMSIZ + 10]; 345 346 char int_name_sfty_ue[IFNAMSIZ + 10]; 346 - char int_name_rx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 14]; 347 + char int_name_rx_irq[MTL_MAX_RX_QUEUES][IFNAMSIZ + 14]; 347 348 char int_name_tx_irq[MTL_MAX_TX_QUEUES][IFNAMSIZ + 18]; 348 349 349 350 #ifdef CONFIG_DEBUG_FS