From nobody Mon Jun 17 17:41:26 2024 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 4W2xyG5Wh3z5PJRM; Mon, 17 Jun 2024 17:41:26 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W2xyG3zmXz45rh; Mon, 17 Jun 2024 17:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718646086; 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=DrYIBCaT/YqoA+5W3iLdcd3m/nq/Vul8ZkYNRFa+GTg=; b=qlW+1dXtBKk5qe+yDdnCBdBn4JZS+ndsmxAQ66e/f0/XG/5ctLrpbEdtdCP/h81cFhlfiQ 79hXfT8mK4tGaLqiwe97ND4T+ojOmwCs03BzdO/5fcprTjj14KOJzrOxEzpQ/NExBMXOP3 BdLZy3werZoEmgbK4Ij1TZQcWrfyIuZMKL5oLaWeiY1jnhwDXhkhyxx6jxTzdxFxTyhh8N x88cLCscNOata5i32WcKVBux1w4p4GELR58jrM3JfYSOY6foii2GysMrdDy8hp+bWiHu3l 91odVeuJYTKl61+Mn2Cvje+dVYigFos5GzprL2qilJ5jGq/VxUSr8Rx9mCF9MA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718646086; a=rsa-sha256; cv=none; b=k83JetkgmhMJjWVGw2nb4ERd6e/ALr88pvaDzOn6VFbj5UvdE2kNTgsK4QywovLFG5qEWW FA82xIm2lbj5F3wmmZ+WgUMM/FGMz9HyH0TBANonuPpBDmbkppCpEXnLK6di8Hc3gTURPe CP5j+CENUn0UOUjs9s8ZM4UQDl8EmQktOG35H1JkvKVKV5tG361csM4dfmUCcwzgqFWo5K uVY1KxeKvxYs2oWoafbRGA4S690Dmeh7EfS5K+nYRG/HF0TSFHBUDERClRpdOniALouvMv Pxd+DF4kE1jU55ahMuvgW7WLSTsQHIGfFBw1fYxs7uB8uZbMqdD5N9SPQw/S/g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718646086; 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=DrYIBCaT/YqoA+5W3iLdcd3m/nq/Vul8ZkYNRFa+GTg=; b=TCR1DfEUaCsdTWrfwel4CzAsUTkOVoTPTbUfxSJn6kJn1aspqsK4ubmR4SzqVCNSGllQKn q4eEIq5AiDDWS/A8GguHPbgcdi9SL9r9HXRwgPqMu3a8W1knE9PVS+DASDW9N+pGRXSA+7 NnewMQoKs1ZNk68Vh40X7ILf93Nd+VFg/7YNmHMfrVAhRV9IGJDGJi1s484jMSvkkZERwO gGF/SC2cTWigPmcXQUsec2idZi/eoeO+84ukqIHvsDvtZcQqPnQ3Dhm8BaZWXPlpgMtLRf alFmaH4fsqQIdCtbrRTtWFnAuu6khgfwzdMXKEuTR4iypR2jfn6PjGN4uizW6Q== 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 4W2xyG3c2GzPk3; Mon, 17 Jun 2024 17:41:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 45HHfQBe021648; Mon, 17 Jun 2024 17:41:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45HHfQio021645; Mon, 17 Jun 2024 17:41:26 GMT (envelope-from git) Date: Mon, 17 Jun 2024 17:41:26 GMT Message-Id: <202406171741.45HHfQio021645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 2d0a01271223 - main - cxgbev(4): Pay attention to the VLAN configuration for the VF. 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2d0a01271223ce623c78f5c8236f8f3f4b6ef104 Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=2d0a01271223ce623c78f5c8236f8f3f4b6ef104 commit 2d0a01271223ce623c78f5c8236f8f3f4b6ef104 Author: Navdeep Parhar AuthorDate: 2024-06-17 17:11:16 +0000 Commit: Navdeep Parhar CommitDate: 2024-06-17 17:35:14 +0000 cxgbev(4): Pay attention to the VLAN configuration for the VF. Make sure that the transmit traffic is tagged correctly or else the firmware will refuse to transmit and will report an ACL violation. On receive the hardware will make sure that tagged traffic is delivered to the appropriate VM. The driver only asserts that the VLAN id that was extracted from the wire traffic matches the VF's configuration. All this works when associating a specific VLAN id with a VF. The 'trunk' setting likely needs more work. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 + sys/dev/cxgbe/t4_sge.c | 20 +++++++++++++++----- sys/dev/cxgbe/t4_vf.c | 2 ++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index 9ab672ba6442..36529601dffa 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -929,6 +929,7 @@ struct adapter { u_int vxlan_refcount; int rawf_base; int nrawf; + u_int vlan_id; struct taskqueue *tq[MAX_NPORTS]; /* General purpose taskqueues */ struct port_info *port[MAX_NPORTS]; diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 505f2d1bf677..350d385ac490 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -2086,9 +2086,17 @@ have_mbuf: } if (cpl->vlan_ex) { - m0->m_pkthdr.ether_vtag = be16toh(cpl->vlan); - m0->m_flags |= M_VLANTAG; - rxq->vlan_extraction++; + if (sc->flags & IS_VF && sc->vlan_id) { + /* + * HW is not setup correctly if extracted vlan_id does + * not match the VF's setting. + */ + MPASS(be16toh(cpl->vlan) == sc->vlan_id); + } else { + m0->m_pkthdr.ether_vtag = be16toh(cpl->vlan); + m0->m_flags |= M_VLANTAG; + rxq->vlan_extraction++; + } } if (rxq->iq.flags & IQ_RX_TIMESTAMP) { @@ -5476,7 +5484,8 @@ write_txpkt_vm_wr(struct adapter *sc, struct sge_txq *txq, struct mbuf *m0) ctrl1 |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(m0->m_pkthdr.ether_vtag); txq->vlan_insertion++; - } + } else if (sc->vlan_id) + ctrl1 |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(sc->vlan_id); /* CPL header */ cpl->ctrl0 = txq->cpl_ctrl0; @@ -5977,7 +5986,8 @@ write_txpkts_vm_wr(struct adapter *sc, struct sge_txq *txq) ctrl1 |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(m->m_pkthdr.ether_vtag); txq->vlan_insertion++; - } + } else if (sc->vlan_id) + ctrl1 |= F_TXPKT_VLAN_VLD | V_TXPKT_VLAN(sc->vlan_id); /* CPL header */ cpl->ctrl0 = txq->cpl_ctrl0; diff --git a/sys/dev/cxgbe/t4_vf.c b/sys/dev/cxgbe/t4_vf.c index 24c80aaa7b2d..8ca6dd98a66f 100644 --- a/sys/dev/cxgbe/t4_vf.c +++ b/sys/dev/cxgbe/t4_vf.c @@ -660,6 +660,8 @@ t4vf_attach(device_t dev) t4_os_set_hw_addr(pi, mac); pmask &= ~(1 << p); + sc->vlan_id = t4vf_get_vf_vlan(sc); + /* No t4_link_start. */ snprintf(pi->lockname, sizeof(pi->lockname), "%sp%d",