Re: [PATCH net-next 1/2] net: dsa: mxl862xx: add ethtool statistics support

From: Andrew Lunn

Date: Sat Apr 11 2026 - 18:41:54 EST


> +static int mxl862xx_read_rmon(struct dsa_switch *ds, int port,
> + struct mxl862xx_rmon_port_cnt *cnt)
> +{
> + memset(cnt, 0, sizeof(*cnt));
> + cnt->port_type = cpu_to_le32(MXL862XX_CTP_PORT);
> + cnt->port_id = cpu_to_le16(port);
> +
> + return MXL862XX_API_READ(ds->priv, MXL862XX_RMON_PORT_GET, *cnt);
> +}
> +
> +static void mxl862xx_get_ethtool_stats(struct dsa_switch *ds, int port,
> + u64 *data)
> +{
> + const struct mxl862xx_mib_desc *mib;
> + struct mxl862xx_rmon_port_cnt cnt;
> + int ret, i;
> + void *field;
> +
> + ret = mxl862xx_read_rmon(ds, port, &cnt);
> + if (ret) {
> + dev_err(ds->dev, "failed to read RMON stats on port %d\n", port);
> + return;
> + }

RMON statistics should be returned via the .get_rmon_stats in
dsa_switch_ops. Please only return statistics here which don't fit any
of the other statistics functions in dsa_switch_ops.

Andrew

---
pw-bot: cr