Re: [PATCH net-next v14 5/7] net: dsa: mv88e6xxx: rmu: Add functionality to get RMON
From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-09-21 15:57:48
I understand want you want but I can see a lot of risks and pitfalls with moving ordinary read and writes to RMU, which I wanted to avoid by first doing RMON dump and then dump ATU and at a later stage with a better architecture for write/read combining doing that, instead of forcing through read/writes with all associated testing it would require. Can we please do this in steps?
If we are going to fall back to MDIO when RMU fails, we need a
different code structure for these operations. That different code
structure should also help solve the messy _ops structure stuff.
RMU affects us in two different locations:
ATU and MIB dump: Controlled by struct mv88e6xxx_ops
register read/write: Controlled by struct mv88e6xxx_bus_ops
We could add to struct mv88e6xxx_ops:
int (*stats_rmu_get_sset_count)(struct mv88e6xxx_chip *chip);
int (*stats_rmu_get_strings)(struct mv88e6xxx_chip *chip, uint8_t *data);
int (*stats_rmu_get_stats)(struct mv88e6xxx_chip *chip, int port,
uint64_t *data);
and then mv88e6xxx_get_stats() would become something like:
static void mv88e6xxx_get_stats(struct mv88e6xxx_chip *chip, int port,
uint64_t *data)
{
int count = 0;
int err;
if (chip->info->ops->stats_rmu_get_stats && mv88e6xxx_rmu_enabled(chip)) {
err = chip->info->ops->stats_rmu_get_stats(chip, port, data)
if (!err)
return;
}
if (chip->info->ops->stats_get_stats)
count = chip->info->ops->stats_get_stats(chip, port, data);
We then get fall back to MDIO, and clean, separate implementations of
RMU and MDIO stats operations.
I hope the ATU/fdb dump can be done in a similar way.
register read/writes, we probably need to extend mv88e6xxx_smi_read()
and mv88e6xxx_smi_write(). Try RMU first, and then fall back to MDIO.
Please try something in this direction. But please, lots of small,
simple patches with good commit messages.
Andrew