git: 7c43b915de43 - main - hn: Refresh VF offloads after bringing it up

From: Kevin Bowling <kbowling_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 01:56:31 UTC
The branch main has been updated by kbowling:

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

commit 7c43b915de433bf7a9988faccd6e638f02e47fea
Author:     Kevin Bowling <kbowling@FreeBSD.org>
AuthorDate: 2026-09-14 22:28:17 +0000
Commit:     Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-09-15 01:56:26 +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.
    
    MFC after:      2 weeks
    Sponsored by:   BBOX.io
---
 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 79fdea371fbb..118f4e42ce4c 100644
--- a/sys/dev/hyperv/netvsc/if_hn.c
+++ b/sys/dev/hyperv/netvsc/if_hn.c
@@ -1787,6 +1787,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.