Re: [PATCH net-next 2/4] net: dsa: motorcomm: Split MIB buffers

From: Andrew Lunn

Date: Thu Sep 03 2026 - 12:57:20 EST


On Thu, Sep 03, 2026 at 10:35:07PM +0800, David Yang wrote:
> With MIB improvement introduced later, struct yt921x_priv will be over
> 20k which is not very good for a single kmalloc(). Dynamically allocate
> the MIB structures to reduce the size of struct yt921x_priv, and do not
> waste memory on dummy ports.

When you read this....

>
> -struct yt921x_mib {
> - u64 rx_broadcast;
> - u64 rx_pause;
> - u64 rx_multicast;
> - u64 rx_crc_errors;
> -
>
> +struct yt921x_mib_stats {
> + u64 rx_broadcast;
> + u64 rx_pause;
> + u64 rx_multicast;
> + u64 rx_crc_errors;

It does not explain "Why?" this structure got renamed.

> +struct yt921x_mib {
> + struct yt921x_port *port;
> +
> + struct delayed_work work;
> + struct yt921x_mib_stats stats;
> + u64 rx_frames;
> + u64 tx_frames;
> +};

And the old structure gets new contents.

I find this confusing, and not easy to review.

Maybe avoid the rename, and call this new structure something else?

Maybe break this up into a number of patches, do things one step at a
time, making it easier to review, lots of small changes which are
obviously correct?

Andrew