[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yxkc6Zav7XoKRLBt@lunn.ch>
Date: Thu, 8 Sep 2022 00:36:25 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Mattias Forsblad <mattias.forsblad@...il.com>
Cc: netdev@...r.kernel.org, Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next v5 5/6] net: dsa: mv88e6xxx: rmon: Use RMU for
reading RMON data
> @@ -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
Powered by blists - more mailing lists