]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: stmmac: mmc_core: Add GMAC LPI statistics
authorMinda Chen <minda.chen@starfivetech.com>
Mon, 8 Apr 2024 01:29:42 +0000 (09:29 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Apr 2024 14:19:50 +0000 (15:19 +0100)
XGMAC MMC has already added LPI statistics. GMAC MMC lack of these
statistics. Add register definition and reading the LPI statistics
from registers.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/mmc_core.c

index 7eb477faa75a3853e7698e5a4aab3376d5d162e9..b0db5f4e8fe86f72db7856d6fbaca30817c1ee1e 100644 (file)
 #define MMC_RX_FIFO_OVERFLOW           0xd4
 #define MMC_RX_VLAN_FRAMES_GB          0xd8
 #define MMC_RX_WATCHDOG_ERROR          0xdc
+
+#define MMC_TX_LPI_USEC                        0xec
+#define MMC_TX_LPI_TRAN                        0xf0
+#define MMC_RX_LPI_USEC                        0xf4
+#define MMC_RX_LPI_TRAN                        0xf8
+
 /* IPC*/
 #define MMC_RX_IPC_INTR_MASK           0x100
 #define MMC_RX_IPC_INTR                        0x108
@@ -283,6 +289,8 @@ static void dwmac_mmc_read(void __iomem *mmcaddr, struct stmmac_counters *mmc)
        mmc->mmc_tx_excessdef += readl(mmcaddr + MMC_TX_EXCESSDEF);
        mmc->mmc_tx_pause_frame += readl(mmcaddr + MMC_TX_PAUSE_FRAME);
        mmc->mmc_tx_vlan_frame_g += readl(mmcaddr + MMC_TX_VLAN_FRAME_G);
+       mmc->mmc_tx_lpi_usec += readl(mmcaddr + MMC_TX_LPI_USEC);
+       mmc->mmc_tx_lpi_tran += readl(mmcaddr + MMC_TX_LPI_TRAN);
 
        /* MMC RX counter registers */
        mmc->mmc_rx_framecount_gb += readl(mmcaddr + MMC_RX_FRAMECOUNT_GB);
@@ -316,6 +324,9 @@ static void dwmac_mmc_read(void __iomem *mmcaddr, struct stmmac_counters *mmc)
        mmc->mmc_rx_fifo_overflow += readl(mmcaddr + MMC_RX_FIFO_OVERFLOW);
        mmc->mmc_rx_vlan_frames_gb += readl(mmcaddr + MMC_RX_VLAN_FRAMES_GB);
        mmc->mmc_rx_watchdog_error += readl(mmcaddr + MMC_RX_WATCHDOG_ERROR);
+       mmc->mmc_rx_lpi_usec += readl(mmcaddr + MMC_RX_LPI_USEC);
+       mmc->mmc_rx_lpi_tran += readl(mmcaddr + MMC_RX_LPI_TRAN);
+
        /* IPv4 */
        mmc->mmc_rx_ipv4_gd += readl(mmcaddr + MMC_RX_IPV4_GD);
        mmc->mmc_rx_ipv4_hderr += readl(mmcaddr + MMC_RX_IPV4_HDERR);