Skip to contentSkip to conversation

enic: fix incorrect MTU comparison in enic_change_mtu()

PATCH Applied Alok Tiwari 3 participants 3 messages Jun 28, 2025 – Jul 2, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 enic: fix incorrect MTU comparison in enic_change_mtu()

The comparison in enic_change_mtu() incorrectly used the current netdev->mtu instead of the new new_mtu value when warning about an MTU exceeding the port MTU. This could suppress valid warnings or issue incorrect ones.

Fix the condition and log to properly reflect the new_mtu.

Fixes ab123fe071c9 ("enic: handle mtu change for vf properly")
---
 drivers/net/ethernet/cisco/enic/enic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cisco/enic/enic_main.c +2 -2
index 773f5ad972a24..6bc8dfdb3d4be 100644
@@ -1864,10 +1864,10 @@ static int enic_change_mtu(struct net_device *netdev, int new_mtu)
 	if (enic_is_dynamic(enic) || enic_is_sriov_vf(enic))
 		return -EOPNOTSUPP;
 
-	if (netdev->mtu > enic->port_mtu)
+	if (new_mtu > enic->port_mtu)
 		netdev_warn(netdev,
 			    "interface MTU (%d) set higher than port MTU (%d)\n",
-			    netdev->mtu, enic->port_mtu);
+			    new_mtu, enic->port_mtu);
 
 	return _enic_change_mtu(netdev, new_mtu);
 }
Signature · 1 line
2.46.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alok Tiwari

The comparison in enic_change_mtu() incorrectly used the current netdev->mtu instead of the new new_mtu value when warning about an MTU exceeding the port MTU. This could suppress valid warnings or issue incorrect ones.

Fix the condition and log to properly reflect the new_mtu.

Fixes ab123fe071c9 ("enic: handle mtu change for vf properly")
#2 lore raw
In reply to Alok Tiwari
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Sat, 28 Jun 2025 07:56:05 -0700 you wrote:

The comparison in enic_change_mtu() incorrectly used the current netdev->mtu instead of the new new_mtu value when warning about an MTU exceeding the port MTU. This could suppress valid warnings or issue incorrect ones.

Fix the condition and log to properly reflect the new_mtu.

[...]

Here is the summary with links:
- [net] enic: fix incorrect MTU comparison in enic_change_mtu()

    https://git.kernel.org/netdev/net/c/aaf2b2480375

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html