git: d3b1d2fbe926 - stable/15 - hn: Refresh VF offloads after bringing it up

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Thu, 29 Oct 2026 05:00:56 UTC
The branch stable/15 has been updated by kbowling:

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

commit d3b1d2fbe92654fe32da1a2ba91c1abb15196855
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-14 22:28:17 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-10-29 05:00:47 +0000

    hn: Refresh VF offloads after bringing it up
    
    VF readiness can precede its first initialization.  In particular,
    iflib populates if_hwassist during init, so copying it while the VF is
    still down can leave hn advertising checksum and TSO capabilities with
    no hardware-assist flags.  The stack then uses software segmentation
    until a capability ioctl happens to refresh the copied state.
    
    Synchronize enabled capabilities and hardware-assist flags after the VF
    up ioctl succeeds, before switching the datapath and enabling transparent
    VF transmit.  Use the existing helper in the common initialization path,
    covering both normal bring-up and delayed VF initialization.
    
    Sponsored by:   BBOX.io
    
    (cherry picked from commit 7c43b915de433bf7a9988faccd6e638f02e47fea)
---
 sys/dev/hyperv/netvsc/if_hn.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c
index 8c79ae7b003b..e69e41fe98d8 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -1800,6 +1800,12 @@ hn_xpnt_vf_init(struct hn_softc *sc)
 		return;
 	}
 
+	/*
+	 * Some VF drivers initialize hwassist only when brought up.  Refresh
+	 * the offload state before allowing transmit through the VF.
+	 */
+	hn_xpnt_vf_iocsetcaps(sc, NULL);
+
 	/*
 	 * NOTE:
 	 * Datapath setting must happen _after_ bringing the VF up.