]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
octeontx2-af: Fix CGX Receive counters
authorHariprasad Kelam <hkelam@marvell.com>
Tue, 13 May 2025 07:15:54 +0000 (12:45 +0530)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 02:29:44 +0000 (19:29 -0700)
Each CGX block supports 4 logical MACs (LMACS). Receive
counters CGX_CMR_RX_STAT0-8 are per LMAC and CGX_CMR_RX_STAT9-12
are per CGX.

Due a bug in previous patch, stale Per CGX counters values observed.

Fixes: 66208910e57a ("octeontx2-af: Support to retrieve CGX LMAC stats")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Link: https://patch.msgid.link/20250513071554.728922-1-hkelam@marvell.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/marvell/octeontx2/af/cgx.c

index 0b27a695008bdb990a3277eed50bba66b1360d7d..971993586fb49da9b6039c52518acc2f3197b618 100644 (file)
@@ -717,6 +717,11 @@ int cgx_get_rx_stats(void *cgxd, int lmac_id, int idx, u64 *rx_stat)
 
        if (!is_lmac_valid(cgx, lmac_id))
                return -ENODEV;
+
+       /* pass lmac as 0 for CGX_CMR_RX_STAT9-12 */
+       if (idx >= CGX_RX_STAT_GLOBAL_INDEX)
+               lmac_id = 0;
+
        *rx_stat =  cgx_read(cgx, lmac_id, CGXX_CMRX_RX_STAT0 + (idx * 8));
        return 0;
 }