From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <thomas@monjalon.net>
Subject: [dpdk-dev] [PATCH 08/14] net/hns3: add hns3 HW ops structure to operate hardware
Date: Fri, 22 Oct 2021 17:19:59 +0800 [thread overview]
Message-ID: <20211022092006.60959-9-humin29@huawei.com> (raw)
In-Reply-To: <20211022092006.60959-1-humin29@huawei.com>
From: Huisong Li <lihuisong@huawei.com>
This patch adds hns3_hw_ops structure to operate hardware in PF and VF
driver.
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
---
drivers/net/hns3/hns3_ethdev.c | 10 ++++++++++
drivers/net/hns3/hns3_ethdev.h | 13 +++++++++++++
drivers/net/hns3/hns3_ethdev_vf.c | 10 ++++++++++
3 files changed, 33 insertions(+)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 02d4b11029..e1099f5df9 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -7436,6 +7436,15 @@ static const struct hns3_reset_ops hns3_reset_ops = {
.start_service = hns3_start_service,
};
+static void
+hns3_init_hw_ops(struct hns3_hw *hw)
+{
+ hw->ops.add_mc_mac_addr = hns3_add_mc_mac_addr;
+ hw->ops.del_mc_mac_addr = hns3_remove_mc_mac_addr;
+ hw->ops.add_uc_mac_addr = hns3_add_uc_mac_addr;
+ hw->ops.del_uc_mac_addr = hns3_remove_uc_mac_addr;
+}
+
static int
hns3_dev_init(struct rte_eth_dev *eth_dev)
{
@@ -7488,6 +7497,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev)
goto err_init_reset;
hw->reset.ops = &hns3_reset_ops;
+ hns3_init_hw_ops(hw);
ret = hns3_init_pf(eth_dev);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to init pf: %d", ret);
diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h
index 20999ce7ab..9d0a060720 100644
--- a/drivers/net/hns3/hns3_ethdev.h
+++ b/drivers/net/hns3/hns3_ethdev.h
@@ -428,6 +428,17 @@ struct hns3_reset_data {
struct hns3_wait_data *wait_data;
};
+struct hns3_hw_ops {
+ int (*add_mc_mac_addr)(struct hns3_hw *hw,
+ struct rte_ether_addr *mac_addr);
+ int (*del_mc_mac_addr)(struct hns3_hw *hw,
+ struct rte_ether_addr *mac_addr);
+ int (*add_uc_mac_addr)(struct hns3_hw *hw,
+ struct rte_ether_addr *mac_addr);
+ int (*del_uc_mac_addr)(struct hns3_hw *hw,
+ struct rte_ether_addr *mac_addr);
+};
+
#define HNS3_INTR_MAPPING_VEC_RSV_ONE 0
#define HNS3_INTR_MAPPING_VEC_ALL 1
@@ -638,6 +649,8 @@ struct hns3_hw {
struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */
struct hns3_flow_mem_list flow_list;
+ struct hns3_hw_ops ops;
+
/*
* PMD setup and configuration is not thread safe. Since it is not
* performance sensitive, it is better to guarantee thread-safety
diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c
index abb9211a09..b5c6a696f3 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2894,6 +2894,15 @@ static const struct hns3_reset_ops hns3vf_reset_ops = {
.start_service = hns3vf_start_service,
};
+static void
+hns3vf_init_hw_ops(struct hns3_hw *hw)
+{
+ hw->ops.add_mc_mac_addr = hns3vf_add_mc_mac_addr;
+ hw->ops.del_mc_mac_addr = hns3vf_remove_mc_mac_addr;
+ hw->ops.add_uc_mac_addr = hns3vf_add_uc_mac_addr;
+ hw->ops.del_uc_mac_addr = hns3vf_remove_uc_mac_addr;
+}
+
static int
hns3vf_dev_init(struct rte_eth_dev *eth_dev)
{
@@ -2938,6 +2947,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev)
goto err_init_reset;
hw->reset.ops = &hns3vf_reset_ops;
+ hns3vf_init_hw_ops(hw);
ret = hns3vf_init_vf(eth_dev);
if (ret) {
PMD_INIT_LOG(ERR, "Failed to init vf: %d", ret);
--
2.33.0
next prev parent reply other threads:[~2021-10-22 9:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-22 9:19 [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 01/14] net/hns3: rename adding multicast address function in PF Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 02/14] net/hns3: rename adding unicast " Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 03/14] net/hns3: rename removing multicast " Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 04/14] net/hns3: extract a common interface to check duplicates Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 05/14] net/hns3: remove redundant adding multicast MAC interface Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 06/14] net/hns3: rename removing unicast address function in PF Min Hu (Connor)
2021-10-22 9:19 ` [dpdk-dev] [PATCH 07/14] net/hns3: remove redundant multicast operation interface Min Hu (Connor)
2021-10-22 9:19 ` Min Hu (Connor) [this message]
2021-10-22 9:20 ` [dpdk-dev] [PATCH 09/14] net/hns3: use APIs in hns3 HW ops to config MAC features Min Hu (Connor)
2021-10-22 9:20 ` [dpdk-dev] [PATCH 10/14] net/hns3: uniform to config all MAC and MC address Min Hu (Connor)
2021-10-22 9:20 ` [dpdk-dev] [PATCH 11/14] net/hns3: uniform adding and removing MAC address API Min Hu (Connor)
2021-10-22 9:20 ` [dpdk-dev] [PATCH 12/14] net/hns3: uniform common function to check multicast Min Hu (Connor)
2021-10-22 9:20 ` [dpdk-dev] [PATCH 13/14] net/hns3: refactor hns3 set MC MAC addr list API for PF Min Hu (Connor)
2021-10-22 9:20 ` [dpdk-dev] [PATCH 14/14] net/hns3: replace set MC MAC addr list API in VF Min Hu (Connor)
2021-11-01 17:45 ` [dpdk-dev] [PATCH 00/14] refactor MAC handling for hns3 PMD Ferruh Yigit
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=20211022092006.60959-9-humin29@huawei.com \
--to=humin29@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=thomas@monjalon.net \
/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).