git: d4fd7d7978f0 - stable/13 - cxgbev(4): Shared code for the VF driver to query a VF's VLAN config.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 02 Jul 2024 08:06:20 UTC
The branch stable/13 has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=d4fd7d7978f03510422a87dcf78edd4a58265150
commit d4fd7d7978f03510422a87dcf78edd4a58265150
Author: Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2024-06-12 22:24:25 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-07-02 07:45:55 +0000
cxgbev(4): Shared code for the VF driver to query a VF's VLAN config.
MFC after: 1 week
Sponsored by: Chelsio Communications
(cherry picked from commit 4471ff11969ec6bd2e5d3c745fc5ba90fda596ed)
---
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 0861e3df4bee..0871ca8c40f1 100644
--- a/sys/dev/cxgbe/common/common.h
+++ b/sys/dev/cxgbe/common/common.h
@@ -944,6 +944,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;
+}