!314 [sync] PR-313: Support flow rule keeping capability for hns3 PMD and testpmd

From: @openeuler-sync-bot 
Reviewed-by: @li-huisong 
Signed-off-by: @li-huisong
This commit is contained in:
openeuler-ci-bot 2023-03-15 01:52:09 +00:00 committed by Gitee
commit 2ec70c0050
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 160 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From 1ee0d9b0270d2a6954c6276aa08f437232707f18 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 15 Dec 2022 01:41:41 +0000
Subject: net/hns3: declare flow rule keeping capability
[ upstream commit 27fd46521517cae0f456dad850a04f18de0690f8 ]
The driver supports create flow rules when device is stopped, and
re-setup flow rules when restarting, so declare support
RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP.
The driver also supports to create indirect actions when device is
stopped, and keeps the indirect actions when restarting, so declare
support RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP.
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Dongdong Liu <liudongdong3@huawei.com>
---
drivers/net/hns3/hns3_common.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c
index 9bfbe1161f..3c5e07f1bd 100644
--- a/drivers/net/hns3/hns3_common.c
+++ b/drivers/net/hns3/hns3_common.c
@@ -91,10 +91,11 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info)
if (hns3_dev_get_support(hw, OUTER_UDP_CKSUM))
info->tx_offload_capa |= RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM;
+ info->dev_capa = RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP |
+ RTE_ETH_DEV_CAPA_FLOW_SHARED_OBJECT_KEEP;
if (hns3_dev_get_support(hw, INDEP_TXRX))
- info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
- RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
- info->dev_capa &= ~RTE_ETH_DEV_CAPA_FLOW_RULE_KEEP;
+ info->dev_capa |= RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP |
+ RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP;
if (hns3_dev_get_support(hw, PTP))
info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
--
2.23.0

View File

@ -0,0 +1,106 @@
From c4daf6ffbb78fb4cb2ec3b6d632364d5e077cf10 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Thu, 15 Dec 2022 01:41:42 +0000
Subject: app/testpmd: add --disable-flow-flush option
[ upstream commit 543df472bced6a9bf0e45c290c3af852486b474a ]
This patch adds "--disable-flow-flush" parameter, which could used to
disable port flow flush when stop port. It allows testing keep flow
rules or shared flow objects across restart.
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
---
app/test-pmd/parameters.c | 4 ++++
app/test-pmd/testpmd.c | 7 ++++++-
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/run_app.rst | 5 +++++
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 435687fa6d..e147be28b3 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -184,6 +184,7 @@ usage(char* progname)
"disable print of designated event or all of them.\n");
printf(" --flow-isolate-all: "
"requests flow API isolated mode on all ports at initialization time.\n");
+ printf(" --disable-flow-flush: disable port flow flush when stop port.\n");
printf(" --tx-offloads=0xXXXXXXXX: hexadecimal bitmask of TX queue offloads\n");
printf(" --rx-offloads=0xXXXXXXXX: hexadecimal bitmask of RX queue offloads\n");
printf(" --hot-plug: enable hot plug for device.\n");
@@ -674,6 +675,7 @@ launch_args_parse(int argc, char** argv)
{ "rxfreet", 1, 0, 0 },
{ "no-flush-rx", 0, 0, 0 },
{ "flow-isolate-all", 0, 0, 0 },
+ { "disable-flow-flush", 0, 0, 0 },
{ "rxoffs", 1, 0, 0 },
{ "rxpkts", 1, 0, 0 },
{ "txpkts", 1, 0, 0 },
@@ -1381,6 +1383,8 @@ launch_args_parse(int argc, char** argv)
rmv_interrupt = 0;
if (!strcmp(lgopts[opt_idx].name, "flow-isolate-all"))
flow_isolate_all = 1;
+ if (!strcmp(lgopts[opt_idx].name, "disable-flow-flush"))
+ no_flow_flush = 1;
if (!strcmp(lgopts[opt_idx].name, "tx-offloads")) {
char *end = NULL;
n = strtoull(optarg, &end, 16);
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 32098d4701..20134c5234 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -371,6 +371,11 @@ uint8_t no_flush_rx = 0; /* flush by default */
*/
uint8_t flow_isolate_all;
+/*
+ * Disable port flow flush when stop port.
+ */
+uint8_t no_flow_flush = 0; /* do flow flush by default */
+
/*
* Avoids to check link status when starting/stopping a port.
*/
@@ -3173,7 +3178,7 @@ stop_port(portid_t pid)
}
}
- if (port->flow_list)
+ if (port->flow_list && !no_flow_flush)
port_flow_flush(pi);
if (eth_dev_stop_mp(pi) != 0)
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 480dc3fa34..be7454ab44 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -398,6 +398,7 @@ extern uint8_t numa_support; /**< set by "--numa" parameter */
extern uint16_t port_topology; /**< set by "--port-topology" parameter */
extern uint8_t no_flush_rx; /**<set by "--no-flush-rx" parameter */
extern uint8_t flow_isolate_all; /**< set by "--flow-isolate-all */
+extern uint8_t no_flow_flush; /**< set by "--disable-flow-flush" parameter */
extern uint8_t mp_alloc_type;
/**< set by "--mp-anon" or "--mp-alloc" parameter */
extern uint32_t eth_link_speed;
diff --git a/doc/guides/testpmd_app_ug/run_app.rst b/doc/guides/testpmd_app_ug/run_app.rst
index 30edef07ea..e0b99d34cd 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -459,6 +459,11 @@ The command line options are:
Ports that do not support this mode are automatically discarded.
+* ``--disable-flow-flush``
+
+ Disable port flow flush when stopping port.
+ This allows testing keep flow rules or shared flow objects across restart.
+
* ``--tx-offloads=0xXXXXXXXX``
Set the hexadecimal bitmask of TX queue offloads.
--
2.23.0

View File

@ -1,6 +1,6 @@
Name: dpdk
Version: 21.11
Release: 33
Release: 34
Packager: packaging@6wind.com
URL: http://dpdk.org
%global source_version 21.11
@ -255,6 +255,8 @@ Patch9233: 0233-net-hns3-remove-debug-condition-for-Tx-prepare.patch
Patch9234: 0234-net-hns3-separate-Tx-prepare-from-getting-Tx-functio.patch
Patch9235: 0235-net-hns3-make-getting-Tx-function-static.patch
Patch9236: 0236-net-hns3-extract-common-functions-to-set-Rx-Tx.patch
Patch9237: 0237-net-hns3-declare-flow-rule-keeping-capability.patch
Patch9238: 0238-app-testpmd-add-disable-flow-flush-option.patch
Summary: Data Plane Development Kit core
Group: System Environment/Libraries
@ -397,6 +399,12 @@ strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko
/usr/sbin/depmod
%changelog
* Fri Mar 03 2023 chenjiji <chenjiji09@163.com> - 21.11-34
Support flow rule keeping capability for hns3 PMD and
testpmd. Patchs are as follow:
- net/hns3: declare flow rule keeping capability
- app/testpmd: add --disable-flow-flush option
* Tue Feb 21 2023 chenjiji <chenjiji09@163.com> - 21.11-33
refactor Rc/Tx function of hns3 PMD
And patchs are as follows: