From nobody Mon Jun 17 17:41:25 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 4W2xyF3Ljnz5PJFv; Mon, 17 Jun 2024 17:41:25 +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 4W2xyF2xDXz46Dj; Mon, 17 Jun 2024 17:41:25 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1718646085; 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=S00MYPge2EeyRfSfy95hhTbv9KNB4yC2JgA9mx0FO5s=; b=UxPIRX8AQug7MiYId3wFO3mw7QPJs0dYGBKoZrOszyYpKnngnposvJsSUqnarjrK07aJzj CsVmdtORHtKRqbBLMIeNBp0IJahhuBBSYt4DaK/IORFJOi27ekoMdwFfIN3OG8v+3xTKmO v35d4FqEIL8H4vHDB8+/NhpplanCrcsHn4b9ZCcfgKMLnplbnBsGSoisoKd9zbEzeqvO2U PZbH94dZDctqmHbkPvjyFH4b7R4ApkHpAFQGtYQQ8ql2g0NoBprjMgwy7OewRR0+y4c3EZ FU5KW7u9pOzCNu9zLhfj3Cp95LuCK4cCvZwq0XSwI4GzifRGY0Mi1BkQE3HEbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1718646085; a=rsa-sha256; cv=none; b=cI1KwCO5Tc082s5QD44hBwmX5sQLkUYnSU7F8B7Tly/b3xuxExlfJQZD/oHzeoGKMdRGoy ggu3b/NgAT7sYV58N5PKvC1ctnccqXDj1u9wyzh8zlqKtoznySeFCUCBNoqg+MpFJg3wiu +nxXP3YuKtmBS4i+4au+GSSXJRx5AnLAmp6RtaCis1Cvvfp8fXNqxBy5tUPsJxVok/0F0s 6I5gReRE9r38VF5oLXfM3K111QLjShBoYB2TcgXOt2UMugG+G/RQeXVE+gR4evZiUNEINk ihPRHxfZkQWbdJcc7OgieEzGiebDlY3GUlf5ojs1FhBUJC50FBlqSaVlmf0Ilg== 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=1718646085; 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=S00MYPge2EeyRfSfy95hhTbv9KNB4yC2JgA9mx0FO5s=; b=ExDVNdMWfKnwVg/oAvPvSGfhjahIHTuuyAphCvXLL1e5kDg9/N8XrIwMHzSIm25kU3ZMRO bx2dyERY1hxNFMLnHDyaLaosFYyJ+VVdaN9pTCQFqo2XaXrdOdBKJUBBhIqQ1rPSxPMh7U Y5Jbd4axEsydM0zbYU8RErRosIfRPoLHpOwlKz+C0g5vD8SsQtp3NEkQV48wCom+27i3w7 7p2YGuIsSkqeaz5qwQknMNwq+1SIk9IZxKBMU2NzFhjiMXF6TtcAVIcuWGyymy9q2hHNwq +HJeg9V+/MyQicX06MBrwMmH3XvL3TBi8b9HAk1NSiRGWl34v8dcqvaCSM06tQ== 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 4W2xyF2XwfzPvc; Mon, 17 Jun 2024 17:41:25 +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 45HHfPHw021581; Mon, 17 Jun 2024 17:41:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 45HHfPNF021578; Mon, 17 Jun 2024 17:41:25 GMT (envelope-from git) Date: Mon, 17 Jun 2024 17:41:25 GMT Message-Id: <202406171741.45HHfPNF021578@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: 4471ff11969e - main - cxgbev(4): Shared code for the VF driver to query a VF's VLAN config. 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: 4471ff11969ec6bd2e5d3c745fc5ba90fda596ed Auto-Submitted: auto-generated The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=4471ff11969ec6bd2e5d3c745fc5ba90fda596ed commit 4471ff11969ec6bd2e5d3c745fc5ba90fda596ed Author: Navdeep Parhar AuthorDate: 2024-06-12 22:24:25 +0000 Commit: Navdeep Parhar CommitDate: 2024-06-17 17:29:17 +0000 cxgbev(4): Shared code for the VF driver to query a VF's VLAN config. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/common/common.h | 1 + sys/dev/cxgbe/common/t4vf_hw.c | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/sys/dev/cxgbe/common/common.h b/sys/dev/cxgbe/common/common.h index a49c21576994..6e80ce40648b 100644 --- a/sys/dev/cxgbe/common/common.h +++ b/sys/dev/cxgbe/common/common.h @@ -948,6 +948,7 @@ int t4vf_get_vfres(struct adapter *adapter); int t4vf_prep_adapter(struct adapter *adapter); int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, unsigned int *naddr, u8 *addr); +int t4vf_get_vf_vlan(struct adapter *adapter); int t4_bar2_sge_qregs(struct adapter *adapter, unsigned int qid, enum t4_bar2_qtype qtype, int user, u64 *pbar2_qoffset, unsigned int *pbar2_qid); diff --git a/sys/dev/cxgbe/common/t4vf_hw.c b/sys/dev/cxgbe/common/t4vf_hw.c index a0c2eb5f60b3..8091eb5db2f9 100644 --- a/sys/dev/cxgbe/common/t4vf_hw.c +++ b/sys/dev/cxgbe/common/t4vf_hw.c @@ -429,3 +429,30 @@ int t4vf_get_vf_mac(struct adapter *adapter, unsigned int port, return ret; } + +/* + * t4vf_get_vf_vlan - Get the VLAN ID to be set to the VI of this VF. + * @adapter: The adapter + * + * Find the VLAN ID to be set to the VF's VI. The requested VLAN ID + * is from the host OS via callback in the PF driver. + */ +int t4vf_get_vf_vlan(struct adapter *adapter) +{ + struct fw_acl_vlan_cmd cmd = {0}; + int vlan = 0; + int ret = 0; + + cmd.op_to_vfn = htonl(V_FW_CMD_OP(FW_ACL_VLAN_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_READ); + + /* Note: Do not enable the ACL */ + cmd.en_to_len16 = htonl((unsigned int)FW_LEN16(cmd)); + + ret = t4vf_wr_mbox(adapter, &cmd, sizeof(cmd), &cmd); + + if (!ret) + vlan = be16_to_cpu(cmd.vlanid[0]); + + return vlan; +}