Thread (11 messages) 11 messages, 2 authors, 2022-09-07

Re: [PATCH net-next v5 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for reading RMON data

From: Andrew Lunn <andrew@lunn.ch>
Date: 2022-09-07 22:36:31

quoted hunk ↗ jump to hunk
@@ -430,6 +431,7 @@ struct mv88e6xxx_bus_ops {
 	int (*read)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 *val);
 	int (*write)(struct mv88e6xxx_chip *chip, int addr, int reg, u16 val);
 	int (*init)(struct mv88e6xxx_chip *chip);
+	int (*get_rmon)(struct mv88e6xxx_chip *chip, int port, uint64_t *data);
 };
I think you can make this a lot cleaner. You are adding this get_rmon
op here. Add it to mv88e6xxx_smi_indirect_ops,
mv88e6xxx_smi_direct_ops, and mv88e6xxx_smi_dual_direct_ops, calling
the MDIO version.

Then the top level mv88e6xxx_get_ethtool_stats() just calls the
get_rmon() method in mv88e6xxx_bus_ops.

Notice how mv88e6xxx_smi_init() sets chip->smi_ops depending on the
chip type. What you can do is when RMU is successfully enabled,
replace chip->smi_ops with a version which goes via RMU. You can keep
.read and .write pointing to the MDIO versions for the moment, until
they also use RMU.

Doing it like this removes all the checking is RMU setup or not.

      Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help