[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231206002225.nehk4htc4mozcq5b@skbuf>
Date: Wed, 6 Dec 2023 02:22:25 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: Tobias Waldekranz <tobias@...dekranz.com>
Cc: davem@...emloft.net, kuba@...nel.org, andrew@...n.ch,
f.fainelli@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH v2 net-next 6/6] net: dsa: mv88e6xxx: Add "rmon" counter
group support
On Tue, Dec 05, 2023 at 05:04:18PM +0100, Tobias Waldekranz wrote:
> +static void mv88e6xxx_get_rmon_stats(struct dsa_switch *ds, int port,
> + struct ethtool_rmon_stats *rmon_stats,
> + const struct ethtool_rmon_hist_range **ranges)
> +{
> + static const struct ethtool_rmon_hist_range rmon_ranges[] = {
> + { 64, 64 },
> + { 65, 127 },
> + { 128, 255 },
> + { 256, 511 },
> + { 512, 1023 },
> + { 1024, 65535 },
> + {}
> + };
> + struct mv88e6xxx_chip *chip = ds->priv;
> + int ret;
> +
> + ret = mv88e6xxx_stats_snapshot(chip, port);
> + if (ret < 0)
> + return;
> +
> +#define MV88E6XXX_RMON_STAT_MAP(_id, _member) \
> + mv88e6xxx_stats_get_stat(chip, port, \
> + &mv88e6xxx_hw_stats[MV88E6XXX_HW_STAT_ID_ ## _id], \
> + &rmon_stats->stats._member)
> +
> + MV88E6XXX_RMON_STAT_MAP(in_undersize, undersize_pkts);
> + MV88E6XXX_RMON_STAT_MAP(in_oversize, oversize_pkts);
> + MV88E6XXX_RMON_STAT_MAP(in_fragments, fragments);
> + MV88E6XXX_RMON_STAT_MAP(in_jabber, jabbers);
> + MV88E6XXX_RMON_STAT_MAP(hist_64bytes, hist[0]);
> + MV88E6XXX_RMON_STAT_MAP(hist_65_127bytes, hist[1]);
> + MV88E6XXX_RMON_STAT_MAP(hist_128_255bytes, hist[2]);
> + MV88E6XXX_RMON_STAT_MAP(hist_256_511bytes, hist[3]);
> + MV88E6XXX_RMON_STAT_MAP(hist_512_1023bytes, hist[4]);
> + MV88E6XXX_RMON_STAT_MAP(hist_1024_max_bytes, hist[5]);
> +
> +#undef MV88E6XXX_RMON_STAT_MAP
> +
> + *ranges = rmon_ranges;
> +}
I just noticed that this doesn't populate the TX counters, just RX.
I haven't tried it, but I think the Histogram Mode bits (11:10) of the
Stats Operation Register might be able to control what gets reported for
the Set 4 of counters. Currently AFAICS, the driver always sets it to
MV88E6XXX_G1_STATS_OP_HIST_RX_TX, aka what gets reported to
"rx-rmon-etherStatsPkts64to64Octets" is actually an RX+TX counter.
What's the story behind this?
Powered by blists - more mailing lists