From nobody Tue Sep 15 02:01:54 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hkQHk4zWVz6sM9d for ; Tue, 15 Sep 2026 02:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hkQHk30TGz4YVf for ; Tue, 15 Sep 2026 02:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789437714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kl07Ao9ZG3o7Pl6OYMwe/YLfta3f8eD027q32lt8JSg=; b=U7M6TrZEXxxCyM50k7GG8JMzZ+Ogd30Rfrbmpl3Bos63XofyjZv7Y2fB2viFooR9GPeRM4 g+oidCADswXVS66zTF/guXYrfCvQeXB9+MSoNIP1wEB5Qb07sIxv6k91mgjOtBAO5h18Nz GvDsM8gPue4GsTlQyyq0/+HWvAHUPg0uUdtZVvWrQw9E6jaF0SyNJE9xBsNX/2lAQ9G0Ei hSuXM0jfE5mrgBYLTqv+8YSRThzCfrmVR4W/vabkExr5Rqi1yiroYMr0R4HggVVrf+JKI/ zkO0U75asnqkFqOjvy653BmO+TxVYWwa67sja/PzfS4pw8wBUM+nmSWDfVsIHw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789437714; b=g71Ko9Miu3LgOYg9kYlgEftsU6IIrN+0DnD06GG8PA71dlB2zzO7m/fkA+/n0+bqeAZeJ8 xcCZm1CII0ldGaEez/JVgYBn+9NzUWT/rR/OH6pJ56i7sSmtTYZ+AA8t9cNIX3meW+m+ms Xx5/EQ1DqXAA6Ju460J1trg8OozIc0XWM5hsGWORaPzo6RVCH/1aWFmvYX5NK41pxkYvCv tUJJf0NX4MbLWE91zGuUYKYch5xuNqlQg+fythHXS/npLfjMFJfzhhbfDpQL+XTwhUK1Fu 1W5dl24VbA6VWmQtMvJoxmVMqry2Q+EloaOnyCWZqeU4MjqJYu4nOreORWU8yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789437714; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kl07Ao9ZG3o7Pl6OYMwe/YLfta3f8eD027q32lt8JSg=; b=mA+RUxPob42mJSM7s2s/tCuh5cBfugRWjMBbO2QKCKYZV6F6Yu+rlqkmRTp3dIJ2UFv5JM aUZF1OEPPqV3syh6midp24O2EU+86f5jsqqOMCGqiNaaE3mIdRoqN7Azt3fasQEfQYEAbJ MDB4WEWTVxcBuIAeuhTKx0cY+vgWBac8s5Y2IqvvxG67NFjkwi1LF4z8PcQ/FhIMbd3L/o rZoKZkDSlMgUgg7fTH+PsDWs9SYocTUO+uJQRgkr6el8qEvebN7JQdNrGtI8S4ZNxDGd1w OxENP3hQAX+iIKnG6IyUyPB2d+KYCpkNY9CVh+jOp3qQuHiEgg9cegirvixoYg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hkQHk24L8zgl2 for ; Tue, 15 Sep 2026 02:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2620f by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 15 Sep 2026 02:01:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 6b3b1d6d4f43 - main - hn: Serialize VF link events with datapath handoff List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6b3b1d6d4f43d1521e5e10b759e3542deaf23667 Auto-Submitted: auto-generated Date: Tue, 15 Sep 2026 02:01:54 +0000 Message-Id: <6aa8a712.2620f.231a1fe5@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=6b3b1d6d4f43d1521e5e10b759e3542deaf23667 commit 6b3b1d6d4f43d1521e5e10b759e3542deaf23667 Author: Kevin Bowling AuthorDate: 2026-09-15 00:22:13 +0000 Commit: Kevin Bowling CommitDate: 2026-09-15 02:01:35 +0000 hn: Serialize VF link events with datapath handoff Hold hn_vf_lock across the VF identity/state check and link publication. Otherwise an event can observe an enabled VF, pause during fallback, then overwrite the freshly reported synthetic carrier with stale VF state. Ignore events while switching or after the association generation changes. The link notification only queues further work, so the callback does not need the sleepable hn lock. Document that association serial numbers are currently diagnostic: hn_ismyvf() matches the VF by MAC, while notifications gate availability. MFC after: 2 weeks Sponsored by: BBOX.io --- sys/dev/hyperv/netvsc/if_hn.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index a36656b89b76..e4774b285a15 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2132,10 +2132,16 @@ static void hn_ifnet_lnkevent(void *xsc, if_t ifp, int link_state) { struct hn_softc *sc = xsc; + struct rm_priotracker pt; + /* Publish before a concurrent handoff can restore synthetic carrier. */ + rm_rlock(&sc->hn_vf_lock, &pt); if (sc->hn_vf_ifp == ifp && - (sc->hn_xvf_flags & HN_XVFFLAG_ENABLED)) + (sc->hn_xvf_flags & (HN_XVFFLAG_ENABLED | HN_XVFFLAG_SWITCHING)) == + HN_XVFFLAG_ENABLED && sc->hn_vf_active_assoc == + atomic_load_acq_int(&sc->hn_vf_assoc)) if_link_state_change(sc->hn_ifp, link_state); + rm_runlock(&sc->hn_vf_lock, &pt); } static int @@ -7527,6 +7533,7 @@ hn_nvs_handle_notify(struct hn_softc *sc, const struct vmbus_chanpkt_hdr *pkt) if_printf(sc->hn_ifp, "invalid VF association notification\n"); return; } + /* The serial is diagnostic; hn_ismyvf() matches the VF by MAC. */ /* Preserve withdrawals even when the worker coalesces notices. */ state = (atomic_load_int(&sc->hn_vf_assoc) + HN_VF_ASSOC_GENINC) & ~HN_VF_ASSOC_ALLOCATED;