Thread (30 messages) 30 messages, 6 authors, 2021-11-15

Re: [PATCH v2 4/6] net: ocelot: add support for ndo_change_mtu

From: Clément Léger <clement.leger@bootlin.com>
Date: 2021-11-03 13:07:31
Also in: linux-devicetree, lkml

Le Wed, 3 Nov 2021 12:40:55 +0000,
Vladimir Oltean [off-list ref] a écrit :
quoted
+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)
quoted
+
+	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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help