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

net: stmmac: mmc_core: Drop interrupt registers from stats

The MMC IPC interrupt status and interrupt mask registers are
of little use as Ethernet statistics, but incrementing counters
based on the current interrupt and interrupt mask registers
makes them actively misleading.

For example, if the interrupt mask is set to 0x08420842,
the current code will increment by that amount each iteration,
leading to the following sequence of nonsense:

mmc_rx_ipc_intr_mask: 969816526
mmc_rx_ipc_intr_mask: 1108361744

These registers have been included in the Ethernet statistics
since the first version of MMC back in 2011 (commit 1c901a46d57).
That commit also mentions the MMC interrupts as
"something to add later (if actually useful)".

If the registers are actually useful, they should probably
be part of the Ethernet register dump instead of statistics,
but for now, drop the counters for mmc_rx_ipc_intr and
mmc_rx_ipc_intr_mask completely.

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20240223-stmmac_stats-v3-1-5d483c2a071a@axis.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

authored by

Jesper Nilsson and committed by
Paolo Abeni
d0dc1e42 2322467a

-9
-4
drivers/net/ethernet/stmicro/stmmac/mmc.h
··· 86 86 unsigned int mmc_rx_discard_octets_gb; 87 87 unsigned int mmc_rx_align_err_frames; 88 88 89 - /* IPC */ 90 - unsigned int mmc_rx_ipc_intr_mask; 91 - unsigned int mmc_rx_ipc_intr; 92 - 93 89 /* IPv4 */ 94 90 unsigned int mmc_rx_ipv4_gd; 95 91 unsigned int mmc_rx_ipv4_hderr;
-3
drivers/net/ethernet/stmicro/stmmac/mmc_core.c
··· 316 316 mmc->mmc_rx_fifo_overflow += readl(mmcaddr + MMC_RX_FIFO_OVERFLOW); 317 317 mmc->mmc_rx_vlan_frames_gb += readl(mmcaddr + MMC_RX_VLAN_FRAMES_GB); 318 318 mmc->mmc_rx_watchdog_error += readl(mmcaddr + MMC_RX_WATCHDOG_ERROR); 319 - /* IPC */ 320 - mmc->mmc_rx_ipc_intr_mask += readl(mmcaddr + MMC_RX_IPC_INTR_MASK); 321 - mmc->mmc_rx_ipc_intr += readl(mmcaddr + MMC_RX_IPC_INTR); 322 319 /* IPv4 */ 323 320 mmc->mmc_rx_ipv4_gd += readl(mmcaddr + MMC_RX_IPV4_GD); 324 321 mmc->mmc_rx_ipv4_hderr += readl(mmcaddr + MMC_RX_IPV4_HDERR);
-2
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
··· 243 243 STMMAC_MMC_STAT(mmc_rx_discard_frames_gb), 244 244 STMMAC_MMC_STAT(mmc_rx_discard_octets_gb), 245 245 STMMAC_MMC_STAT(mmc_rx_align_err_frames), 246 - STMMAC_MMC_STAT(mmc_rx_ipc_intr_mask), 247 - STMMAC_MMC_STAT(mmc_rx_ipc_intr), 248 246 STMMAC_MMC_STAT(mmc_rx_ipv4_gd), 249 247 STMMAC_MMC_STAT(mmc_rx_ipv4_hderr), 250 248 STMMAC_MMC_STAT(mmc_rx_ipv4_nopay),