git: 44f656641c23 - main - Hyper-V: hn: just call vf's ioctl when changing mtu

From: Wei Hu <whu_at_FreeBSD.org>
Date: Tue, 23 Dec 2025 05:51:41 UTC
The branch main has been updated by whu:

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

commit 44f656641c238cb3db31026f3e3bef36cd5231a8
Author:     Wei Hu <whu@FreeBSD.org>
AuthorDate: 2025-12-23 04:23:39 +0000
Commit:     Wei Hu <whu@FreeBSD.org>
CommitDate: 2025-12-23 05:38:40 +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
---
 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 2ae9e710978e..79fdea371fbb 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -3750,14 +3750,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;
 		}
 
 		/*