Re: [net-next RFC PATCH 3/4] net: dsa: qca8k: rework mib autocast handling

Vladimir Oltean
2022-07-18T17:27:21Z

On Sat, Jul 16, 2022 at 07:49:57PM +0200, Christian Marangi wrote:
> In preparation for code split, move the autocast mib function used to
> receive mib data from eth packet in priv struct and use that in
> get_ethtool_stats instead of referencing the function directly. This is
> needed as the get_ethtool_stats function will be moved to a common file.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---

Can this change be deferred until there actually appears a second
implementation of (*autocast_mib)?

> diff --git a/drivers/net/dsa/qca/qca8k.h b/drivers/net/dsa/qca/qca8k.h
> index 22ece14e06dc..a306638a7100 100644
> --- a/drivers/net/dsa/qca/qca8k.h
> +++ b/drivers/net/dsa/qca/qca8k.h
> @@ -403,6 +403,7 @@ struct qca8k_priv {
> struct qca8k_mdio_cache mdio_cache;
> struct qca8k_pcs pcs_port_0;
> struct qca8k_pcs pcs_port_6;
> + int (*autocast_mib)(struct dsa_switch *ds, int port, u64 *data);

Typically we hold function pointers in separate read-only structures rather
than in the stateful private structure of the driver, see struct sja1105_info,
struct felix_info, struct mv88e6xxx_info and mv88e6xxx_ops, struct b53_io_ops,
etc etc.

> };
>
> struct qca8k_mib_desc {
> --
> 2.36.1
>