!319 [sync] PR-317: sync patches to enable hinic flow director
From: @openeuler-sync-bot Reviewed-by: @jiangheng12 Signed-off-by: @jiangheng12
This commit is contained in:
commit
fc34a752c5
1816
backport-0001-net-hinic-add-flow-director-filter.patch
Normal file
1816
backport-0001-net-hinic-add-flow-director-filter.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
From 0023e525a52cd5c9463332c5f5b9e95a4c07d938 Mon Sep 17 00:00:00 2001
|
||||
From: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
Date: Sat, 27 Jun 2020 11:55:47 +0800
|
||||
Subject: [PATCH] net/hinic: add TCAM filter switch for flow director
|
||||
|
||||
When the filter rule needs to use the TCAM method, driver
|
||||
enables the TCAM filter switch, otherwise disables it, which
|
||||
can improve the performance of microcode in FDIR scenarios that
|
||||
does not use TCAM method.
|
||||
|
||||
Fixes: 1fe89aa37f36 ("net/hinic: add flow director filter")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
---
|
||||
drivers/net/hinic/base/hinic_pmd_cmd.h | 1 +
|
||||
drivers/net/hinic/base/hinic_pmd_niccfg.c | 41 +++++++++++++++++++++++
|
||||
drivers/net/hinic/base/hinic_pmd_niccfg.h | 11 ++++++
|
||||
drivers/net/hinic/hinic_pmd_flow.c | 13 +++++++
|
||||
4 files changed, 66 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hinic/base/hinic_pmd_cmd.h b/drivers/net/hinic/base/hinic_pmd_cmd.h
|
||||
index 09918a76fa..9ecb712334 100644
|
||||
--- a/drivers/net/hinic/base/hinic_pmd_cmd.h
|
||||
+++ b/drivers/net/hinic/base/hinic_pmd_cmd.h
|
||||
@@ -120,6 +120,7 @@ enum hinic_port_cmd {
|
||||
HINIC_PORT_CMD_UP_TC_GET_FLOW = 0xb1,
|
||||
HINIC_PORT_CMD_UP_TC_FLUSH_TCAM = 0xb2,
|
||||
HINIC_PORT_CMD_UP_TC_CTRL_TCAM_BLOCK = 0xb3,
|
||||
+ HINIC_PORT_CMD_UP_TC_ENABLE = 0xb4,
|
||||
|
||||
HINIC_PORT_CMD_SET_IPSU_MAC = 0xcb,
|
||||
HINIC_PORT_CMD_GET_IPSU_MAC = 0xcc,
|
||||
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.c b/drivers/net/hinic/base/hinic_pmd_niccfg.c
|
||||
index e894503d73..67f6bc4070 100644
|
||||
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.c
|
||||
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.c
|
||||
@@ -2114,3 +2114,44 @@ int hinic_flush_tcam_rule(void *hwdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
+int hinic_set_fdir_tcam_rule_filter(void *hwdev, bool enable)
|
||||
+{
|
||||
+ struct hinic_port_tcam_info port_tcam_cmd;
|
||||
+ u16 out_size = sizeof(port_tcam_cmd);
|
||||
+ int err;
|
||||
+
|
||||
+ if (!hwdev)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ memset(&port_tcam_cmd, 0, sizeof(port_tcam_cmd));
|
||||
+ port_tcam_cmd.mgmt_msg_head.resp_aeq_num = HINIC_AEQ1;
|
||||
+ port_tcam_cmd.func_id = hinic_global_func_id(hwdev);
|
||||
+ port_tcam_cmd.tcam_enable = (u8)enable;
|
||||
+
|
||||
+ err = l2nic_msg_to_mgmt_sync(hwdev, HINIC_PORT_CMD_UP_TC_ENABLE,
|
||||
+ &port_tcam_cmd, sizeof(port_tcam_cmd),
|
||||
+ &port_tcam_cmd, &out_size);
|
||||
+ if ((port_tcam_cmd.mgmt_msg_head.status != HINIC_MGMT_CMD_UNSUPPORTED &&
|
||||
+ port_tcam_cmd.mgmt_msg_head.status) || err || !out_size) {
|
||||
+ if (err == HINIC_MBOX_VF_CMD_ERROR &&
|
||||
+ HINIC_IS_VF((struct hinic_hwdev *)hwdev)) {
|
||||
+ err = HINIC_MGMT_CMD_UNSUPPORTED;
|
||||
+ PMD_DRV_LOG(WARNING, "VF doesn't support setting fdir tcam filter");
|
||||
+ return err;
|
||||
+ }
|
||||
+ PMD_DRV_LOG(ERR, "Set fdir tcam filter failed, err: %d, "
|
||||
+ "status: 0x%x, out size: 0x%x, enable: 0x%x",
|
||||
+ err, port_tcam_cmd.mgmt_msg_head.status, out_size,
|
||||
+ enable);
|
||||
+ return -EFAULT;
|
||||
+ }
|
||||
+
|
||||
+ if (port_tcam_cmd.mgmt_msg_head.status == HINIC_MGMT_CMD_UNSUPPORTED) {
|
||||
+ err = HINIC_MGMT_CMD_UNSUPPORTED;
|
||||
+ PMD_DRV_LOG(WARNING, "Fw doesn't support setting fdir tcam filter");
|
||||
+ }
|
||||
+
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+
|
||||
diff --git a/drivers/net/hinic/base/hinic_pmd_niccfg.h b/drivers/net/hinic/base/hinic_pmd_niccfg.h
|
||||
index 846b5973ec..73b16b4d69 100644
|
||||
--- a/drivers/net/hinic/base/hinic_pmd_niccfg.h
|
||||
+++ b/drivers/net/hinic/base/hinic_pmd_niccfg.h
|
||||
@@ -766,6 +766,15 @@ struct hinic_port_qfilter_info {
|
||||
u32 key;
|
||||
};
|
||||
|
||||
+struct hinic_port_tcam_info {
|
||||
+ struct hinic_mgmt_msg_head mgmt_msg_head;
|
||||
+
|
||||
+ u16 func_id;
|
||||
+ u8 tcam_enable;
|
||||
+ u8 rsvd1;
|
||||
+ u32 rsvd2;
|
||||
+};
|
||||
+
|
||||
#define HINIC_MAX_TCAM_RULES_NUM (10240)
|
||||
#define HINIC_TCAM_BLOCK_ENABLE 1
|
||||
#define HINIC_TCAM_BLOCK_DISABLE 0
|
||||
@@ -941,4 +950,6 @@ int hinic_free_tcam_block(void *hwdev, u8 block_type, u16 *index);
|
||||
|
||||
int hinic_flush_tcam_rule(void *hwdev);
|
||||
|
||||
+int hinic_set_fdir_tcam_rule_filter(void *hwdev, bool enable);
|
||||
+
|
||||
#endif /* _HINIC_PMD_NICCFG_H_ */
|
||||
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
index cc0744da2d..a7bad570bb 100644
|
||||
--- a/drivers/net/hinic/hinic_pmd_flow.c
|
||||
+++ b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
@@ -1900,6 +1900,8 @@ void hinic_free_fdir_filter(struct hinic_nic_dev *nic_dev)
|
||||
{
|
||||
(void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
|
||||
|
||||
+ (void)hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, false);
|
||||
+
|
||||
(void)hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_DPORT);
|
||||
|
||||
(void)hinic_clear_fdir_tcam(nic_dev->hwdev, TCAM_PKT_BGP_SPORT);
|
||||
@@ -2801,6 +2803,15 @@ static int hinic_add_tcam_filter(struct rte_eth_dev *dev,
|
||||
fdir_tcam_rule->index);
|
||||
return rc;
|
||||
}
|
||||
+
|
||||
+ rc = hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, true);
|
||||
+ if (rc && rc != HINIC_MGMT_CMD_UNSUPPORTED) {
|
||||
+ (void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0,
|
||||
+ false);
|
||||
+ (void)hinic_del_tcam_rule(nic_dev->hwdev,
|
||||
+ fdir_tcam_rule->index);
|
||||
+ return rc;
|
||||
+ }
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&tcam_info->tcam_list, tcam_filter, entries);
|
||||
@@ -3197,6 +3208,8 @@ static void hinic_clear_all_fdir_filter(struct rte_eth_dev *dev)
|
||||
|
||||
(void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0, false);
|
||||
|
||||
+ (void)hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, false);
|
||||
+
|
||||
(void)hinic_flush_tcam_rule(nic_dev->hwdev);
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
From d7964ce192e79507d3b32b4a02e6293a40eb4708 Mon Sep 17 00:00:00 2001
|
||||
From: Yunjian Wang <wangyunjian@huawei.com>
|
||||
Date: Tue, 28 Jul 2020 20:34:46 +0800
|
||||
Subject: [PATCH] net/hinic: check memory allocations in flow creation
|
||||
|
||||
The function rte_zmalloc() could return NULL, the return
|
||||
value need to be checked.
|
||||
|
||||
Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
|
||||
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
|
||||
---
|
||||
drivers/net/hinic/hinic_pmd_flow.c | 12 ++++++++++++
|
||||
1 file changed, 12 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
index a7bad570bb..503a32fff0 100644
|
||||
--- a/drivers/net/hinic/hinic_pmd_flow.c
|
||||
+++ b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
@@ -2977,6 +2977,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
if (!ret) {
|
||||
ntuple_filter_ptr = rte_zmalloc("hinic_ntuple_filter",
|
||||
sizeof(struct hinic_ntuple_filter_ele), 0);
|
||||
+ if (ntuple_filter_ptr == NULL) {
|
||||
+ PMD_DRV_LOG(ERR, "Failed to allocate ntuple_filter_ptr");
|
||||
+ goto out;
|
||||
+ }
|
||||
rte_memcpy(&ntuple_filter_ptr->filter_info,
|
||||
&ntuple_filter,
|
||||
sizeof(struct rte_eth_ntuple_filter));
|
||||
@@ -3003,6 +3007,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
ethertype_filter_ptr =
|
||||
rte_zmalloc("hinic_ethertype_filter",
|
||||
sizeof(struct hinic_ethertype_filter_ele), 0);
|
||||
+ if (ethertype_filter_ptr == NULL) {
|
||||
+ PMD_DRV_LOG(ERR, "Failed to allocate ethertype_filter_ptr");
|
||||
+ goto out;
|
||||
+ }
|
||||
rte_memcpy(ðertype_filter_ptr->filter_info,
|
||||
ðertype_filter,
|
||||
sizeof(struct rte_eth_ethertype_filter));
|
||||
@@ -3036,6 +3044,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
if (!ret) {
|
||||
fdir_rule_ptr = rte_zmalloc("hinic_fdir_rule",
|
||||
sizeof(struct hinic_fdir_rule_ele), 0);
|
||||
+ if (fdir_rule_ptr == NULL) {
|
||||
+ PMD_DRV_LOG(ERR, "Failed to allocate fdir_rule_ptr");
|
||||
+ goto out;
|
||||
+ }
|
||||
rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule,
|
||||
sizeof(struct hinic_fdir_rule));
|
||||
TAILQ_INSERT_TAIL(&nic_dev->filter_fdir_rule_list,
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
From 0c87a15f5f1ccb9eefb6231aea9d095686f2def4 Mon Sep 17 00:00:00 2001
|
||||
From: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
Date: Mon, 14 Sep 2020 22:31:42 +0800
|
||||
Subject: [PATCH] net/hinic: fix filters on memory allocation failure
|
||||
|
||||
If rte_zmalloc failed, pmd driver should also delete the ntuple
|
||||
filter or ethertype filter or normal and tcam filter that already
|
||||
added before.
|
||||
|
||||
Fixes: d7964ce192e7 ("net/hinic: check memory allocations in flow creation")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
---
|
||||
drivers/net/hinic/hinic_pmd_flow.c | 19 +++++++++++++++----
|
||||
1 file changed, 15 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
index 70fd4450c2..9888a8793b 100644
|
||||
--- a/drivers/net/hinic/hinic_pmd_flow.c
|
||||
+++ b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
@@ -694,6 +694,7 @@ static int hinic_ntuple_item_check_end(const struct rte_flow_item *item,
|
||||
item, "Not supported by ntuple filter");
|
||||
return -rte_errno;
|
||||
}
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2981,6 +2982,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
sizeof(struct hinic_ntuple_filter_ele), 0);
|
||||
if (ntuple_filter_ptr == NULL) {
|
||||
PMD_DRV_LOG(ERR, "Failed to allocate ntuple_filter_ptr");
|
||||
+ (void)hinic_add_del_ntuple_filter(dev,
|
||||
+ &ntuple_filter, FALSE);
|
||||
goto out;
|
||||
}
|
||||
rte_memcpy(&ntuple_filter_ptr->filter_info,
|
||||
@@ -3011,6 +3014,8 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
sizeof(struct hinic_ethertype_filter_ele), 0);
|
||||
if (ethertype_filter_ptr == NULL) {
|
||||
PMD_DRV_LOG(ERR, "Failed to allocate ethertype_filter_ptr");
|
||||
+ (void)hinic_add_del_ethertype_filter(dev,
|
||||
+ ðertype_filter, FALSE);
|
||||
goto out;
|
||||
}
|
||||
rte_memcpy(ðertype_filter_ptr->filter_info,
|
||||
@@ -3034,11 +3039,10 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
actions, &fdir_rule, error);
|
||||
if (!ret) {
|
||||
if (fdir_rule.mode == HINIC_FDIR_MODE_NORMAL) {
|
||||
- ret = hinic_add_del_fdir_filter(dev,
|
||||
- &fdir_rule, TRUE);
|
||||
+ ret = hinic_add_del_fdir_filter(dev, &fdir_rule, TRUE);
|
||||
} else if (fdir_rule.mode == HINIC_FDIR_MODE_TCAM) {
|
||||
- ret = hinic_add_del_tcam_fdir_filter(dev,
|
||||
- &fdir_rule, TRUE);
|
||||
+ ret = hinic_add_del_tcam_fdir_filter(dev, &fdir_rule,
|
||||
+ TRUE);
|
||||
} else {
|
||||
PMD_DRV_LOG(INFO, "flow fdir rule create failed, rule mode wrong");
|
||||
goto out;
|
||||
@@ -3048,6 +3052,13 @@ static struct rte_flow *hinic_flow_create(struct rte_eth_dev *dev,
|
||||
sizeof(struct hinic_fdir_rule_ele), 0);
|
||||
if (fdir_rule_ptr == NULL) {
|
||||
PMD_DRV_LOG(ERR, "Failed to allocate fdir_rule_ptr");
|
||||
+ if (fdir_rule.mode == HINIC_FDIR_MODE_NORMAL)
|
||||
+ hinic_add_del_fdir_filter(dev,
|
||||
+ &fdir_rule, FALSE);
|
||||
+ else if (fdir_rule.mode == HINIC_FDIR_MODE_TCAM)
|
||||
+ hinic_add_del_tcam_fdir_filter(dev,
|
||||
+ &fdir_rule, FALSE);
|
||||
+
|
||||
goto out;
|
||||
}
|
||||
rte_memcpy(&fdir_rule_ptr->filter_info, &fdir_rule,
|
||||
--
|
||||
2.23.0
|
||||
|
||||
40
backport-0005-net-hinic-fix-TCAM-filter-set.patch
Normal file
40
backport-0005-net-hinic-fix-TCAM-filter-set.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 19cc028345f3c2318fad89db34eec276a0af4dd2 Mon Sep 17 00:00:00 2001
|
||||
From: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
Date: Mon, 14 Sep 2020 22:31:43 +0800
|
||||
Subject: [PATCH] net/hinic: fix TCAM filter set
|
||||
|
||||
hinic supports two methods: linear table and tcam table,
|
||||
if tcam filter enables failed but linear table is ok,
|
||||
which also needs to enable filter, so for this scene,
|
||||
driver should not close fdir switch.
|
||||
|
||||
Fixes: f4ca3fd54c4d ("net/hinic: create and destroy flow director filter")
|
||||
Cc: stable@dpdk.org
|
||||
|
||||
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
|
||||
---
|
||||
drivers/net/hinic/hinic_pmd_flow.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
index 9888a8793b..d71a42afbd 100644
|
||||
--- a/drivers/net/hinic/hinic_pmd_flow.c
|
||||
+++ b/drivers/net/hinic/hinic_pmd_flow.c
|
||||
@@ -2809,8 +2809,12 @@ static int hinic_add_tcam_filter(struct rte_eth_dev *dev,
|
||||
|
||||
rc = hinic_set_fdir_tcam_rule_filter(nic_dev->hwdev, true);
|
||||
if (rc && rc != HINIC_MGMT_CMD_UNSUPPORTED) {
|
||||
- (void)hinic_set_fdir_filter(nic_dev->hwdev, 0, 0, 0,
|
||||
- false);
|
||||
+ /*
|
||||
+ * hinic supports two methods: linear table and tcam
|
||||
+ * table, if tcam filter enables failed but linear table
|
||||
+ * is ok, which also needs to enable filter, so for this
|
||||
+ * scene, driver should not close fdir switch.
|
||||
+ */
|
||||
(void)hinic_del_tcam_rule(nic_dev->hwdev,
|
||||
fdir_tcam_rule->index);
|
||||
return rc;
|
||||
--
|
||||
2.23.0
|
||||
|
||||
10
dpdk.spec
10
dpdk.spec
@ -1,6 +1,6 @@
|
||||
Name: dpdk
|
||||
Version: 19.11
|
||||
Release: 25
|
||||
Release: 26
|
||||
Packager: packaging@6wind.com
|
||||
URL: http://dpdk.org
|
||||
%global source_version 19.11
|
||||
@ -54,6 +54,11 @@ Patch6005: backport-gro-trim-tail-padding-bytes.patch
|
||||
Patch6006: backport-gro-check-payload-length-after-trim.patch
|
||||
Patch6007: backport-net-hinic-fix-crash-in-secondary-process.patch
|
||||
Patch6008: fix-virtio-hardthrough-scenes-device-init-bug.patch
|
||||
Patch6009: backport-0001-net-hinic-add-flow-director-filter.patch
|
||||
Patch6010: backport-0002-net-hinic-add-TCAM-filter-switch-for-flow-director.patch
|
||||
Patch6011: backport-0003-net-hinic-check-memory-allocations-in-flow-creation.patch
|
||||
Patch6012: backport-0004-net-hinic-fix-filters-on-memory-allocation-failure.patch
|
||||
Patch6013: backport-0005-net-hinic-fix-TCAM-filter-set.patch
|
||||
|
||||
Summary: Data Plane Development Kit core
|
||||
Group: System Environment/Libraries
|
||||
@ -223,6 +228,9 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko
|
||||
/usr/sbin/depmod
|
||||
|
||||
%changelog
|
||||
* Thu Mar 09 2023 jiangheng <jiangheng14@huawei.com> - 19.11-26
|
||||
- sync patches to enable hinic flow director
|
||||
|
||||
* Sat Dec 3 2022 wangzongchao <wangzongchao@huawei.com> - 19.11-25
|
||||
- fix the virtio hardthrough scenes device init bug
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user