From nobody Mon Nov 17 15:35:45 2025 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 4d9Bf95CC2z6GRVC; Mon, 17 Nov 2025 15:35:45 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d9Bf939K1z3JSW; Mon, 17 Nov 2025 15:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763393745; 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=dz4PTYK2Oex23p2+/dPUMCnYzkUpEsuFUHZU4SZ+Iuk=; b=uhmq2UlScUpEgWAXRTXmowjELp8J7ozlXdhHOBOdeeqfOc0FfmncFWvCSGY6ARMsFv6kmq qGaWV623PxK4G4P4TZj6EYW44K5SxzhQOAUULtU19egGAAeWUG4WGOhtQXHM/W6xUBDuaY VGx6+ee6f8ahIDwMmqtIxfM80mIIVIW+OtieCfDiYu9JXgY7ZjUrce2Fq8BtFiAlr6NDrp DyC5X0/4y3nPrjIWU3IAGvdJzqzJ28z5dGLPsNu9kkMoy4xk2TRTWvhfn7Qbz/FBUU9+3I sQg0kTijoSSKoreBciqIZfpLxVE9QPqDdhxLqK9VFeVcPAr60cNdGLxqRMdqzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763393745; 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=dz4PTYK2Oex23p2+/dPUMCnYzkUpEsuFUHZU4SZ+Iuk=; b=pX382n6TxCXuABsyL46gMWpSQvfH9OoM/P1s4QGSDfdsxF5TqlW2DhPYxerSYiciXqjFNI iOQ0/5QY3GSj9qHKyrAIl05EMnAFc14DLc99vbeFoOpkvj3CAirUkoNWEuHrJkNdj7OzWu kA7A4ul00crrooU7guz3jEdgevHi4wEaTYnenQxF2wfy8GICcaRPIMfFYJC4+G0rHrIbqm C/LIbzqA7MQ6VjmxBkRyG2MP38NAvkYZ3g65yQZqrQII7vL2CUF2lAQhYw/zfgilK783ZU J2oG0Od8OBi+pXrV+3fxFbA2ICQ2lB/iaG/ZrR+bvcnWQYzN/Qago7LQyWfiWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763393745; a=rsa-sha256; cv=none; b=cGW1kagny6glKnKsBDR0A9NwVLItDhLk5dCb7LDLMBOKk6fGkjvCPBqmOYiRTOcPckw2/3 /sSCw+f/PtE0UvtZu+KfGpMemVzQPX1ccBc0Svb/cUHmQkv9B+gLyBqM4NjD95JWjciOGg 5xafHyXimqbIDTyjI0yvd/I2axhjMyznmNjngQCjGvQhJBX1jJWP1QareURE1VVaMm6alB CSLU4zPgaaB79SYDL4+pksT8At2nLKdJmNCKb5QCb6ZQ1/3zba8RUsxyx7KOqheoEu+KZO pXP0KTrg26OTZlgYRK2qJLV/efrN3wFSaMNNs3GsEL5M0gT61o8PgbrBpy+4Ag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d9Bf929nlzL1; Mon, 17 Nov 2025 15:35:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5AHFZjIm093198; Mon, 17 Nov 2025 15:35:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5AHFZjma093195; Mon, 17 Nov 2025 15:35:45 GMT (envelope-from git) Date: Mon, 17 Nov 2025 15:35:45 GMT Message-Id: <202511171535.5AHFZjma093195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Krzysztof Galazka Subject: git: 1839526b7315 - main - igb(4): Fix VLAN support on VFs List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kgalazka X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1839526b7315cae62efbd2d1493e6243439effcb Auto-Submitted: auto-generated The branch main has been updated by kgalazka: URL: https://cgit.FreeBSD.org/src/commit/?id=1839526b7315cae62efbd2d1493e6243439effcb commit 1839526b7315cae62efbd2d1493e6243439effcb Author: Krzysztof Galazka AuthorDate: 2025-11-17 15:30:26 +0000 Commit: Krzysztof Galazka CommitDate: 2025-11-17 15:30:35 +0000 igb(4): Fix VLAN support on VFs Virtual Functions are considered untrusted and have no control over VLAN filtering configuration in HW. To allow using VLANs on VF intreface driver has to assume that VLAN HW Filtering is always enabled and pass requests for adding or removing VLAN tags to Physical Function driver using Mailbox API. Signed-off-by: Krzysztof Galazka Approved by: kbowling (mentor) Reviewed by: erj (previous version) Tested by: gowtham.kumar.ks_intel.com MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D53245 --- sys/dev/e1000/if_em.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index e3d839b828ed..b8ea3168330b 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -4023,7 +4023,15 @@ em_if_vlan_register(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; sc->shadow_vfta[index] |= (1 << bit); ++sc->num_vlans; - em_if_vlan_filter_write(sc); + if (!sc->vf_ifp) + em_if_vlan_filter_write(sc); + else + /* + * Physical funtion may reject registering VLAN + * but we have no way to inform the stack + * about that. + */ + e1000_vfta_set_vf(&sc->hw, vtag, true); } static void @@ -4036,7 +4044,10 @@ em_if_vlan_unregister(if_ctx_t ctx, u16 vtag) bit = vtag & 0x1F; sc->shadow_vfta[index] &= ~(1 << bit); --sc->num_vlans; - em_if_vlan_filter_write(sc); + if (!sc->vf_ifp) + em_if_vlan_filter_write(sc); + else + e1000_vfta_set_vf(&sc->hw, vtag, false); } static bool @@ -4094,22 +4105,15 @@ em_if_vlan_filter_write(struct e1000_softc *sc) { struct e1000_hw *hw = &sc->hw; - if (sc->vf_ifp) - return; + KASSERT(!sc->vf_ifp, ("VLAN filter write on VF\n")); /* Disable interrupts for lem(4) devices during the filter change */ if (hw->mac.type < em_mac_min) em_if_intr_disable(sc->ctx); for (int i = 0; i < EM_VFTA_SIZE; i++) - if (sc->shadow_vfta[i] != 0) { - /* XXXKB: incomplete VF support, we returned above */ - if (sc->vf_ifp) - e1000_vfta_set_vf(hw, sc->shadow_vfta[i], - true); - else - e1000_write_vfta(hw, i, sc->shadow_vfta[i]); - } + if (sc->shadow_vfta[i] != 0) + e1000_write_vfta(hw, i, sc->shadow_vfta[i]); /* Re-enable interrupts for lem-class devices */ if (hw->mac.type < em_mac_min) @@ -4124,8 +4128,10 @@ em_setup_vlan_hw_support(if_ctx_t ctx) if_t ifp = iflib_get_ifp(ctx); u32 reg; - /* XXXKB: Return early if we are a VF until VF decap and filter - * management is ready and tested. + /* + * Only PFs have control over VLAN HW filtering + * configuration. VFs have to act as if it's always + * enabled. */ if (sc->vf_ifp) return;