mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-10 05:39:42 -04:00
net: enetc: separate 64-bit counters from enetc_port_counters
Some counters in enetc_port_counters are 32-bit registers, and some are 64-bit registers. But in the current driver, they are all read through enetc_port_rd(), which can only read a 32-bit value. Therefore, separate 64-bit counters (enetc_pm_counters) from enetc_port_counters and use enetc_port_rd64() to read the 64-bit statistics. Signed-off-by: Wei Fang <wei.fang@nxp.com> Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250627021108.3359642-3-wei.fang@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -142,7 +142,7 @@ static const struct {
|
||||
static const struct {
|
||||
int reg;
|
||||
char name[ETH_GSTRING_LEN] __nonstring;
|
||||
} enetc_port_counters[] = {
|
||||
} enetc_pm_counters[] = {
|
||||
{ ENETC_PM_REOCT(0), "MAC rx ethernet octets" },
|
||||
{ ENETC_PM_RALN(0), "MAC rx alignment errors" },
|
||||
{ ENETC_PM_RXPF(0), "MAC rx valid pause frames" },
|
||||
@@ -194,6 +194,12 @@ static const struct {
|
||||
{ ENETC_PM_TSCOL(0), "MAC tx single collisions" },
|
||||
{ ENETC_PM_TLCOL(0), "MAC tx late collisions" },
|
||||
{ ENETC_PM_TECOL(0), "MAC tx excessive collisions" },
|
||||
};
|
||||
|
||||
static const struct {
|
||||
int reg;
|
||||
char name[ETH_GSTRING_LEN] __nonstring;
|
||||
} enetc_port_counters[] = {
|
||||
{ ENETC_UFDMF, "SI MAC nomatch u-cast discards" },
|
||||
{ ENETC_MFDMF, "SI MAC nomatch m-cast discards" },
|
||||
{ ENETC_PBFDSIR, "SI MAC nomatch b-cast discards" },
|
||||
@@ -240,6 +246,7 @@ static int enetc_get_sset_count(struct net_device *ndev, int sset)
|
||||
return len;
|
||||
|
||||
len += ARRAY_SIZE(enetc_port_counters);
|
||||
len += ARRAY_SIZE(enetc_pm_counters);
|
||||
|
||||
return len;
|
||||
}
|
||||
@@ -266,6 +273,9 @@ static void enetc_get_strings(struct net_device *ndev, u32 stringset, u8 *data)
|
||||
for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++)
|
||||
ethtool_cpy(&data, enetc_port_counters[i].name);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++)
|
||||
ethtool_cpy(&data, enetc_pm_counters[i].name);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -302,6 +312,9 @@ static void enetc_get_ethtool_stats(struct net_device *ndev,
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(enetc_port_counters); i++)
|
||||
data[o++] = enetc_port_rd(hw, enetc_port_counters[i].reg);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(enetc_pm_counters); i++)
|
||||
data[o++] = enetc_port_rd64(hw, enetc_pm_counters[i].reg);
|
||||
}
|
||||
|
||||
static void enetc_pause_stats(struct enetc_hw *hw, int mac,
|
||||
|
||||
@@ -536,6 +536,7 @@ static inline u64 _enetc_rd_reg64_wa(void __iomem *reg)
|
||||
/* port register accessors - PF only */
|
||||
#define enetc_port_rd(hw, off) enetc_rd_reg((hw)->port + (off))
|
||||
#define enetc_port_wr(hw, off, val) enetc_wr_reg((hw)->port + (off), val)
|
||||
#define enetc_port_rd64(hw, off) _enetc_rd_reg64_wa((hw)->port + (off))
|
||||
#define enetc_port_rd_mdio(hw, off) _enetc_rd_mdio_reg_wa((hw)->port + (off))
|
||||
#define enetc_port_wr_mdio(hw, off, val) _enetc_wr_mdio_reg_wa(\
|
||||
(hw)->port + (off), val)
|
||||
|
||||
Reference in New Issue
Block a user