Re: [PATCH net v2] net: thunderx: avoid direct MTU assignment after WRITE_ONCE()
From: Simon Horman <horms@kernel.org>
Date: 2025-06-30 11:18:41
Also in:
linux-arm-kernel, lkml
From: Simon Horman <horms@kernel.org>
Date: 2025-06-30 11:18:41
Also in:
linux-arm-kernel, lkml
On Sat, Jun 28, 2025 at 10:15:37PM -0700, Alok Tiwari wrote: ...
@@ -1589,16 +1588,18 @@ static int nicvf_change_mtu(struct net_device *netdev, int new_mtu) return -EINVAL; } - WRITE_ONCE(netdev->mtu, new_mtu); - if (!netif_running(netdev)) + if (!netif_running(netdev)) { + WRITE_ONCE(netdev->mtu, new_mtu); return 0; + } if (nicvf_update_hw_max_frs(nic, new_mtu)) { - netdev->mtu = orig_mtu; return -EINVAL; }
nit: curly brackets should be removed here, but see further comment below.
+ WRITE_ONCE(netdev->mtu, new_mtu); + return 0; }
Could this be more succinctly expressed as follows? (Completely untested!) if (netif_running(netdev) && nicvf_update_hw_max_frs(nic, new_mtu)) return -ENIVAL; WRITE_ONCE(netdev->mtu, new_mtu); return 0;