DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>
Subject: [dpdk-dev] [PATCH 1/4] net/hns3: add query basic info support for VF
Date: Sun, 13 Jun 2021 11:05:05 +0800	[thread overview]
Message-ID: <1623553508-5478-2-git-send-email-humin29@huawei.com> (raw)
In-Reply-To: <1623553508-5478-1-git-send-email-humin29@huawei.com>

From: Chengchang Tang <tangchengchang@huawei.com>

There are some feautres of VF depend on PF, so it's necessary for VF
to know whether current PF supports. Therefore, the final capability
set of VF will be composed of the capability set of hardware and the
capability set of PF.

For comatibility reasons, the mailbox HNS3_MBX_GET_TCINFO has been
modified to obatin more basic information about the current PF, including
the communication interface version and current PF capabilities set.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
 drivers/net/hns3/hns3_ethdev.h    |  1 +
 drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++---------------
 drivers/net/hns3/hns3_mbx.h       | 10 +++++++-
 3 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 575bacd..ee84519 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -488,6 +488,7 @@ struct hns3_hw {
 	struct hns3_rx_missed_stats imissed_stats;
 	uint64_t oerror_stats;
 	uint32_t fw_version;
+	uint16_t pf_vf_if_version;  /* version of communication interface */
 
 	uint16_t num_msi;
 	uint16_t total_tqps_num;    /* total task queue pairs of this PF */
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index e582503..dc95e71 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -1409,26 +1409,38 @@ hns3vf_get_queue_depth(struct hns3_hw *hw)
 }
 
 static int
-hns3vf_get_tc_info(struct hns3_hw *hw)
+hns3vf_get_num_tc(struct hns3_hw *hw)
 {
-	uint8_t resp_msg;
-	int ret;
+	uint8_t num_tc = 0;
 	uint32_t i;
 
-	ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_TCINFO, 0, NULL, 0,
-				true, &resp_msg, sizeof(resp_msg));
+	for (i = 0; i < HNS3_MAX_TC_NUM; i++) {
+		if (hw->hw_tc_map & BIT(i))
+			num_tc++;
+	}
+	return num_tc;
+}
+
+static int
+hns3vf_get_basic_info(struct hns3_hw *hw)
+{
+	uint8_t resp_msg[HNS3_MBX_MAX_RESP_DATA_SIZE];
+	struct hns3_basic_info *basic_info;
+	int ret;
+
+	ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_BASIC_INFO, 0, NULL, 0,
+				true, resp_msg, sizeof(resp_msg));
 	if (ret) {
-		hns3_err(hw, "VF request to get TC info from PF failed %d",
-			 ret);
+		hns3_err(hw, "failed to get basic info from PF, ret = %d.",
+				ret);
 		return ret;
 	}
 
-	hw->hw_tc_map = resp_msg;
+	basic_info = (struct hns3_basic_info *)resp_msg;
+	hw->hw_tc_map = basic_info->hw_tc_map;
+	hw->num_tc = hns3vf_get_num_tc(hw);
+	hw->pf_vf_if_version = basic_info->pf_vf_if_version;
 
-	for (i = 0; i < HNS3_MAX_TC_NUM; i++) {
-		if (hw->hw_tc_map & BIT(i))
-			hw->num_tc++;
-	}
 
 	return 0;
 }
@@ -1468,6 +1480,11 @@ hns3vf_get_configuration(struct hns3_hw *hw)
 
 	hns3vf_get_push_lsc_cap(hw);
 
+	/* Get basic info from PF */
+	ret = hns3vf_get_basic_info(hw);
+	if (ret)
+		return ret;
+
 	/* Get queue configuration from PF */
 	ret = hns3vf_get_queue_info(hw);
 	if (ret)
@@ -1483,12 +1500,7 @@ hns3vf_get_configuration(struct hns3_hw *hw)
 	if (ret)
 		return ret;
 
-	ret = hns3vf_get_port_base_vlan_filter_state(hw);
-	if (ret)
-		return ret;
-
-	/* Get tc configuration from PF */
-	return hns3vf_get_tc_info(hw);
+	return hns3vf_get_port_base_vlan_filter_state(hw);
 }
 
 static int
diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h
index 86d32e6..f07dbe3 100644
--- a/drivers/net/hns3/hns3_mbx.h
+++ b/drivers/net/hns3/hns3_mbx.h
@@ -18,7 +18,7 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_API_NEGOTIATE,         /* (VF -> PF) negotiate API version */
 	HNS3_MBX_GET_QINFO,             /* (VF -> PF) get queue config */
 	HNS3_MBX_GET_QDEPTH,            /* (VF -> PF) get queue depth */
-	HNS3_MBX_GET_TCINFO,            /* (VF -> PF) get TC config */
+	HNS3_MBX_GET_BASIC_INFO,        /* (VF -> PF) get basic info */
 	HNS3_MBX_GET_RETA,              /* (VF -> PF) get RETA */
 	HNS3_MBX_GET_RSS_KEY,           /* (VF -> PF) get RSS key */
 	HNS3_MBX_GET_MAC_ADDR,          /* (VF -> PF) get MAC addr */
@@ -47,6 +47,14 @@ enum HNS3_MBX_OPCODE {
 	HNS3_MBX_PUSH_LINK_STATUS = 201, /* (IMP -> PF) get port link status */
 };
 
+struct hns3_basic_info {
+	uint8_t hw_tc_map;
+	uint8_t rsv;
+	uint16_t pf_vf_if_version;
+	/* capabilities of VF dependent on PF */
+	uint32_t caps;
+};
+
 /* below are per-VF mac-vlan subcodes */
 enum hns3_mbx_mac_vlan_subcode {
 	HNS3_MBX_MAC_VLAN_UC_MODIFY = 0,        /* modify UC mac addr */
-- 
2.7.4


  reply	other threads:[~2021-06-13  3:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-13  3:05 [dpdk-dev] [PATCH 0/4] features for hns3 PMD Min Hu (Connor)
2021-06-13  3:05 ` Min Hu (Connor) [this message]
2021-06-13  3:05 ` [dpdk-dev] [PATCH 2/4] net/hns3: support for VF modify VLAN filter state Min Hu (Connor)
2021-06-13  3:05 ` [dpdk-dev] [PATCH 3/4] net/hns3: support multiple TC MAC pause Min Hu (Connor)
2021-06-13  3:05 ` [dpdk-dev] [PATCH 4/4] net/hns3: supports disabling PFC by dev configure API Min Hu (Connor)
2021-06-14 14:59   ` Andrew Rybchenko
2021-06-14 15:00 ` [dpdk-dev] [PATCH 0/4] features for hns3 PMD Andrew Rybchenko
2021-07-09  1:32   ` Min Hu (Connor)
2021-07-09  9:20     ` Andrew Rybchenko
2021-07-10  1:59       ` Min Hu (Connor)
2021-07-10  1:58 ` [dpdk-dev] [PATCH v2 0/3] " Min Hu (Connor)
2021-07-10  1:58   ` [dpdk-dev] [PATCH v2 1/3] net/hns3: add query basic info support for VF Min Hu (Connor)
2021-07-10  1:58   ` [dpdk-dev] [PATCH v2 2/3] net/hns3: support for VF modify VLAN filter state Min Hu (Connor)
2021-07-10  1:58   ` [dpdk-dev] [PATCH v2 3/3] net/hns3: support multiple TC MAC pause Min Hu (Connor)
2021-07-13  9:43   ` [dpdk-dev] [PATCH v2 0/3] features for hns3 PMD Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1623553508-5478-2-git-send-email-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).