From nobody Tue Jul 02 08:06:22 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 4WCwTp345Bz5PhmB; Tue, 02 Jul 2024 08:06:22 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCwTp2JnCz4JBR; Tue, 2 Jul 2024 08:06:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719907582; 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=Cq5Ud420djkypXqsQFQ7SPl7IN8/JcjryvYhvVUeNzg=; b=fAdrbcWZrfinVXbuPwJdae7M1xpzk4Lvbs/0yBTNfOUmfyCCQl+4IBiQqKXuyy3IiSzavX OI3MTcf2X+tdKDupRWbm7YcKCVVV7FZL8V0tM8IG4ydpqlWSQa2gfw23xnrv7T4MoOVRTj ywqy8WkoPPDhdSO9uYmyb8aeKTrE3k2UVDtqDMI+2S3xxYiGUrNBU3E60nXx+Ko/9zPFRl JNuhd65K4mjQjLbEI3DAr7OmLjAbaCoEJMJykcN3ww1MLXqg7dnf+kQMARzhplpKK5DN6m MiOMSY40auJwWQ8OwllnzENekdezLGLXEKuFxYBV7lPHk7Gpw4XTaeuKiZe1Ag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719907582; a=rsa-sha256; cv=none; b=ARhEIDhwsNYGdFwE64Pc4NuitWqy8koTdggSx3zsqCXD6wQ7uX5nEgTJLQaGcIQWudD0V0 edXZgZ7hoR3JSTW3AUDhh0hyo0yQ11mBvPFAz4dTMRkLZNwLeFgkSehKjUj54m7StjpO71 ROz8J0shVWRhk4sf1AwBtwRIfjbCkkc9mQBLGRMkoGpyFw5mOXJxuHvc+VuO7zDoVxNkgM tserqy1/W9GHSkx4uc9Y+E3yqxp3nNCfLDovO0+Bv+cH8bJkhvQMC7FPBFtHdo3iMPGmcT zARsf5nlb/ejI2ZCTrSXMnv7FaPagYU+VA+9rKOd8T42d2dSfhm7msp68usH3A== 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=1719907582; 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=Cq5Ud420djkypXqsQFQ7SPl7IN8/JcjryvYhvVUeNzg=; b=q1dlYLHupnDAymRf0Jqg7b180ykYf+x76oX5cHY0aczfosF2ipfZ1u1P/T6LQt35cvlvi0 x90SRV1osUn1iwtU2dVh0rSJR1D8C8H39MobvYk5DQc/ifGArtMcvytMjYGUhwDNRHANlJ IVnSKzcWrY/8Vvp9c/qjOV8pOGNHla9g3HU+xNlfDLbg2zjmI1doVLXzksMqPneCjmMG7I b6TxVktbbLrboisIgwMKhdNmy0BKGHgom+EDK/1hWjyhVVzY3Igf4KnYUNykftUb2tXvou K4wPD2NvKVp1byf/fyYoISeZhkqzVg35ZCcRm0FFefHyCAxUHPtHdR/xYUGT6w== 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 4WCwTp1l41zgKr; Tue, 2 Jul 2024 08:06:22 +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 46286MB8083254; Tue, 2 Jul 2024 08:06:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46286MwD083244; Tue, 2 Jul 2024 08:06:22 GMT (envelope-from git) Date: Tue, 2 Jul 2024 08:06:22 GMT Message-Id: <202407020806.46286MwD083244@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: df85c75a80f2 - stable/13 - 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: df85c75a80f28bf2a1f70669ad9ee8a4647acfb7 Auto-Submitted: auto-generated The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=df85c75a80f28bf2a1f70669ad9ee8a4647acfb7 commit df85c75a80f28bf2a1f70669ad9ee8a4647acfb7 Author: Navdeep Parhar AuthorDate: 2024-06-17 17:11:16 +0000 Commit: Kristof Provost CommitDate: 2024-07-02 07:45:55 +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 (cherry picked from commit 2d0a01271223ce623c78f5c8236f8f3f4b6ef104) --- 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 706bdf1b9f8b..648182fe31c4 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -928,6 +928,7 @@ struct adapter { u_int vxlan_refcount; int rawf_base; int nrawf; + u_int vlan_id; struct taskqueue *tq[MAX_NCHAN]; /* 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 a6f77a2b7430..93f914c3e2c5 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -2098,9 +2098,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) { @@ -5530,7 +5538,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; @@ -6031,7 +6040,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 d22937ef2bbd..ac28f5b02aff 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",