Re: [PATCH V9 net-next 05/11] net: hibmcge: Implement some .ndo functions
From: Andrew Lunn
Date: Tue Sep 10 2024 - 08:14:59 EST
> > +static void hbg_change_mtu(struct hbg_priv *priv, int new_mtu)
> > +{
> > + u32 frame_len;
> > +
> > + frame_len = new_mtu + VLAN_HLEN * priv->dev_specs.vlan_layers +
> > + ETH_HLEN + ETH_FCS_LEN;
> > + hbg_hw_set_mtu(priv, frame_len);
> > +}
> > +
> > +static int hbg_net_change_mtu(struct net_device *netdev, int new_mtu)
> > +{
> > + struct hbg_priv *priv = netdev_priv(netdev);
> > + bool is_running = netif_running(netdev);
> > +
> > + if (is_running)
> > + hbg_net_stop(netdev);
> > +
> > + hbg_change_mtu(priv, new_mtu);
> > + WRITE_ONCE(netdev->mtu, new_mtu);
> [Kalesh] IMO the setting of "netdev->mtu" should be moved to the core
> layer so that not all drivers have to do this.
> __dev_set_mtu() can be modified to incorporate this. Just a thought.
Hi Kalesh
If you look at git history, the core has left the driver to set
dev->mtu since the beginning of the code being in git, and probably
longer. It seems a bit unfair to ask a developer to go modify over 200
drivers. Please feel free to submit 200 patches yourself.
Andrew