Re: [PATCH net-next v7 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for reading RMON data
From: Mattias Forsblad <hidden>
Date: 2022-09-09 07:41:20
On 2022-09-09 03:49, Andrew Lunn wrote:
quoted
diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index bbdf229c9e71..bd16afa2e1a5 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c@@ -1234,16 +1234,30 @@ static int mv88e6xxx_stats_get_stats(struct mv88e6xxx_chip *chip, int port, u16 bank1_select, u16 histogram) { struct mv88e6xxx_hw_stat *stat; + int offset = 0; + u64 high; int i, j; for (i = 0, j = 0; i < ARRAY_SIZE(mv88e6xxx_hw_stats); i++) { stat = &mv88e6xxx_hw_stats[i]; if (stat->type & types) { - mv88e6xxx_reg_lock(chip); - data[j] = _mv88e6xxx_get_ethtool_stat(chip, stat, port, - bank1_select, - histogram); - mv88e6xxx_reg_unlock(chip); + if (mv88e6xxx_rmu_available(chip) &&I was trying to avoid code like this, by the use of the ops.
The call path with this patch is:
dsa_slave_get_ethtool_stats->
get_ethtool_stats(ops)->
mv88e6xxx_get_ethtool_stats->
get_rmon(ops)-> (1)
mv88e6xxx_rmu_stats_get->
stats_get_stats(ops)->
(per chip implementation:mv88e6095/6250/6320/6390_stats_get_stats->
mv88e6xxx_stats_get_stats(with different parameters)
Here we want to decode the raw RMU data according to specific chip.
This function is not an ops and furthermore some RMON data is still
fetched through MDIO, i.e. !(stat->type & STATS_TYPE_PORT).
I'm not sure what you want me to do? The ops I've changed is at (1)
/Mattias