From nobody Tue Nov 03 02:41:55 2026 X-Original-To: dev-commits-src-main@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 4jJXsH338hz6xft7 for ; Tue, 03 Nov 2026 02:41:55 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jJXsH2Tbvz4QSB for ; Tue, 03 Nov 2026 02:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793673715; 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=sKcy5lhlMfVt6OEmEOaFrjU5uzXU7VM2Tw4Xv3OgrFo=; b=dOMsl1LMwgkYW5gltWkjAYuALQXkWwuKca87znoCUPJcR68Io6n17+y/AhcZ+pynvweW9c G81Xs2brCWEtzq/8DefoXQZvgGdps9PswURy44JUHzmrXjNFIrr+k8LN/E6vi37W/SoOKU dx/tMp82ms7sBq/MVhzc0ZyurAxonDR340E10j1gbmUMKQ9qtHJARFjqWxbr0lg5s6HpYw hdkSIuS23V+1MdmDEXi6sUMJulJAcGQkGdT1mO06N7isESmvPsH7P1LlwEr3OCMvEZGtk3 AH8hu5CKGmuS4OSzU31O2JAut519Fmw7Xwj/6tWK/+mKANx8w96ETVbngUorXg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1793673715; b=Ss+Mkuje2jONuE2y4sTArD5J85QilxNbihOmUvL3C5nHgR7NShbMzJy5ztKXu46U9+ttjO 6+KpgRRUtdMd9ilK8eCsEcuuAte1r2JFd3eDmr+W+lkmvVINtitoSCtjGLNWpSY7iff6fm XGznRrjT7t3+KszECGC1KocTQFLVmsj9t/jAN5i8npT4zf+6yeAQSahwwF4eD1K0Uh2D7a fY27KmGo/M6YnpB1DeAQvGDlIq8I9EncHfRYtZOkCLn805dIt/OFdPEesQyOIzbeaOLzoK wfx8xbnfbJ/6GJ4go6P76uhk6DmTG2u+fEpxFz6anqqoEASSnbkFFByk05xwyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1793673715; 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=sKcy5lhlMfVt6OEmEOaFrjU5uzXU7VM2Tw4Xv3OgrFo=; b=JQGrExRlCK2ap41IVlKQgXxq/TBUzcD2A4CZGBnGzEwTXZmopOBCmz6cF05y3KmaREwTJ5 8FHG0m1n5DrIdohq4B8VvG37/0tOQqog4Qj0nYlpRICZPY8kN2gvE4mChv4uZkID6qI49M IXHdBYdOASpaY5CN9WNXzE6r+kKcBBCgo1wRuIsVOuUU+IF/u36Vl6tjJbKJj9Ta7zsNK3 gw5pO8PoI85F5JECJ9EqHORGmpjBRNF8yBo4zJq8JfYUDTbT+vdxgGOK8dfWqiQAG5SFDS cq2pvfUbPHwqKeEC6HgpEKYOEbx7MnDtwxCzC73cEwKkm8/jDbHjFtjqlij7zA== 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 4jJXsH27cvz1BNm for ; Tue, 03 Nov 2026 02:41:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3b546 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 03 Nov 2026 02:41:55 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 933c4f6e06c2 - main - iavf: Honor negotiated VLAN offload capabilities List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: Commit messages for the main branch of the src repository 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: 933c4f6e06c276548783247242b75814027159eb Auto-Submitted: auto-generated Date: Tue, 03 Nov 2026 02:41:55 +0000 Message-Id: <6ae949f3.3b546.570a42a7@gitrepo.freebsd.org> The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=933c4f6e06c276548783247242b75814027159eb commit 933c4f6e06c276548783247242b75814027159eb Author: Kevin Bowling AuthorDate: 2026-11-02 00:40:25 +0000 Commit: Kevin Bowling CommitDate: 2026-11-03 02:41:46 +0000 iavf: Honor negotiated VLAN offload capabilities The driver advertised VLAN offload unconditionally, even when the PF did not grant it, as observed with an E835 VF under Hyper-V. This tells the stack to rely on hardware tag insertion and sends the PF unsupported VLAN filter requests. Advertise hardware VLAN tagging and filtering only when GET_VF_RESOURCES grants the legacy VLAN capability. Do not allocate filter shadow entries or send ADD_VLAN/DEL_VLAN requests without that capability. Retain VLAN MTU and checksum/TSO support for software-tagged packets. Keep advertised capabilities stable across resets, since existing VLAN interfaces may already rely on them. If resource rediscovery removes previously advertised VLAN offload, leave the VF stopped and require reattachment rather than resume with a stale offload contract. A newly granted capability is not exposed until reattach. MFC after: 2 weeks Sponsored by: BBOX.io --- sys/dev/iavf/iavf_vc_common.c | 5 +++++ sys/dev/iavf/if_iavf_iflib.c | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/dev/iavf/iavf_vc_common.c b/sys/dev/iavf/iavf_vc_common.c index a605ec0901bf..c67f660f9356 100644 --- a/sys/dev/iavf/iavf_vc_common.c +++ b/sys/dev/iavf/iavf_vc_common.c @@ -483,6 +483,11 @@ iavf_sync_vlans(struct iavf_sc *sc) int error, first_error; sx_assert(iflib_ctx_lock_get(sc->vsi.ctx), SA_XLOCKED); + /* Software VLANs need no PF filter configuration. */ + if ((sc->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) == 0) { + atomic_store_rel_32(&sc->vlan_batch_pending, 0); + return (0); + } if (iavf_test_state(&sc->state, IAVF_STATE_RESET_PENDING) || iavf_test_state(&sc->state, IAVF_STATE_RESET_RECOVERY) || iavf_test_state(&sc->state, IAVF_STATE_VC_POLLING) || diff --git a/sys/dev/iavf/if_iavf_iflib.c b/sys/dev/iavf/if_iavf_iflib.c index 304347316a75..4fb0237d2d7c 100644 --- a/sys/dev/iavf/if_iavf_iflib.c +++ b/sys/dev/iavf/if_iavf_iflib.c @@ -414,7 +414,11 @@ iavf_if_attach_pre(if_ctx_t ctx) if ((sc->vf_res->vf_cap_flags & (VIRTCHNL_VF_OFFLOAD_RSS_REG | VIRTCHNL_VF_OFFLOAD_RSS_PF)) == VIRTCHNL_VF_OFFLOAD_RSS_PF) scctx->isc_rss_table_size = sc->vf_res->rss_lut_size; - scctx->isc_capabilities = scctx->isc_capenable = IAVF_CAPS; + scctx->isc_capabilities = IAVF_CAPS; + if ((sc->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) == 0) + scctx->isc_capabilities &= + ~(IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWFILTER); + scctx->isc_capenable = scctx->isc_capabilities; scctx->isc_tx_csum_flags = CSUM_OFFLOAD; return (0); @@ -1123,6 +1127,16 @@ iavf_reestablish_vc(struct iavf_sc *sc) if (error != 0) goto fail; + /* Do not keep advertising an offload that the PF no longer provides. */ + if ((vsi->shared->isc_capabilities & IFCAP_VLAN_HWTAGGING) != 0 && + (sc->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) == 0) { + if (iavf_mbx_log_allowed(sc)) + device_printf(sc->dev, + "PF VLAN offload capabilities changed; reattach the VF\n"); + error = ENOTSUP; + goto fail; + } + if (vsi->num_tx_queues > sc->vsi_res->num_queue_pairs || vsi->num_rx_queues > sc->vsi_res->num_queue_pairs || vsi->num_rx_queues + 1 > sc->vf_res->max_vectors) { @@ -2027,6 +2041,8 @@ iavf_if_vlan_register(if_ctx_t ctx, u16 vtag) struct iavf_sc *sc = iavf_sc_from_ctx(ctx); struct iavf_vsi *vsi = &sc->vsi; + if ((vsi->shared->isc_capabilities & IFCAP_VLAN_HWFILTER) == 0) + return; if ((vtag == 0) || (vtag > 4095)) /* Invalid */ return; @@ -2054,6 +2070,8 @@ iavf_if_vlan_unregister(if_ctx_t ctx, u16 vtag) struct iavf_vsi *vsi = &sc->vsi; int i = 0; + if ((vsi->shared->isc_capabilities & IFCAP_VLAN_HWFILTER) == 0) + return; if ((vtag == 0) || (vtag > 4095) || (vsi->num_vlans == 0)) /* Invalid */ return;