lkml.org 
[lkml]   [2021]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 4/6] net: ocelot: add support for ndo_change_mtu
Le Wed, 3 Nov 2021 12:40:55 +0000,
Vladimir Oltean <vladimir.oltean@nxp.com> a écrit :

> > +static int ocelot_change_mtu(struct net_device *dev, int new_mtu)
> > +{
> > + struct ocelot_port_private *priv = netdev_priv(dev);
> > + struct ocelot_port *ocelot_port = &priv->port;
> > + struct ocelot *ocelot = ocelot_port->ocelot;
> > +
> > + ocelot_port_set_maxlen(ocelot, priv->chip_port, new_mtu);
> > + WRITE_ONCE(dev->mtu, new_mtu);
>
> The WRITE_ONCE seems absolutely gratuitous to me.

I applied what is recommended in netdevice.h for the mtu field of the
netdev.
(https://elixir.bootlin.com/linux/v5.15/source/include/linux/netdevice.h#L1989)
And used in __dev_set_mtu
(https://elixir.bootlin.com/linux/v5.15/source/net/core/dev.c#L8849)

>
> > +
> > + return 0;
> > +}
> > +
> > enum ocelot_action_type {
> > OCELOT_MACT_LEARN,
> > OCELOT_MACT_FORGET,


--
Clément Léger,
Embedded Linux and Kernel engineer at Bootlin
https://bootlin.com

\
 
 \ /
  Last update: 2021-11-03 14:08    [W:0.671 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site