git: de698a13ccca - stable/15 - Hyper-V: hn: just call vf's ioctl when changing mtu

From: Wei Hu <whu_at_FreeBSD.org>
Date: Tue, 12 May 2026 17:02:53 UTC
The branch stable/15 has been updated by whu:

URL: https://cgit.FreeBSD.org/src/commit/?id=de698a13cccaf831b1812c577594429421b028c5

commit de698a13cccaf831b1812c577594429421b028c5
Author:     Wei Hu <whu@FreeBSD.org>
AuthorDate: 2025-12-23 04:23:39 +0000
Commit:     Wei Hu <whu@FreeBSD.org>
CommitDate: 2026-05-12 17:02:00 +0000

    Hyper-V: hn: just call vf's ioctl when changing mtu
    
    When changing mtu, if a vf is attached to the netvsc interface, just
    calling its ioctl to change vf's mtu is good enough.
    
    Tested by:      whu
    MFC after:      3 days
    Sponsored by:   Microsoft
    
    (cherry picked from commit 44f656641c238cb3db31026f3e3bef36cd5231a8)
---
 sys/dev/hyperv/netvsc/if_hn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index b23c0d76115d..8c79ae7b003b 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -3763,14 +3763,16 @@ hn_ioctl(if_t ifp, u_long cmd, caddr_t data)
 			ifr_vf = *ifr;
 			strlcpy(ifr_vf.ifr_name, if_name(vf_ifp),
 			    sizeof(ifr_vf.ifr_name));
-			error = ifhwioctl(SIOCSIFMTU,vf_ifp, 
+			error = ifhwioctl(SIOCSIFMTU, vf_ifp,
 			    (caddr_t)&ifr_vf, curthread);
+			HN_UNLOCK(sc);
 			if (error) {
-				HN_UNLOCK(sc);
 				if_printf(ifp, "%s SIOCSIFMTU %d failed: %d\n",
 				    if_name(vf_ifp), ifr->ifr_mtu, error);
-				break;
+			} else {
+				if_setmtu(ifp, ifr->ifr_mtu);
 			}
+			break;
 		}
 
 		/*