代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 83d21ff84152f5912ce3e53ecb577216243fb4e4 Mon Sep 17 00:00:00 2001
From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Date: Mon, 7 Mar 2022 18:48:21 +0200
Subject: [PATCH 121/122] app/testpmd: fix use of indirect action after port
close
When a port was closed, indirect actions could remain
with their handles no longer valid.
If a newly attached device was assigned the same ID as the closed port,
those indirect actions became accessible again.
Any attempt to use them resulted in an undefined behavior.
Automatically flush indirect actions when a port is closed.
Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
---
app/test-pmd/config.c | 31 +++++++++++++++++++++++++++++++
app/test-pmd/testpmd.c | 1 +
app/test-pmd/testpmd.h | 1 +
3 files changed, 33 insertions(+)
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 496e787edd..a7fffc3d1d 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1743,6 +1743,37 @@ port_action_handle_destroy(portid_t port_id,
return ret;
}
+int
+port_action_handle_flush(portid_t port_id)
+{
+ struct rte_port *port;
+ struct port_indirect_action **tmp;
+ int ret = 0;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN) ||
+ port_id == (portid_t)RTE_PORT_ALL)
+ return -EINVAL;
+ port = &ports[port_id];
+ tmp = &port->actions_list;
+ while (*tmp != NULL) {
+ struct rte_flow_error error;
+ struct port_indirect_action *pia = *tmp;
+
+ /* Poisoning to make sure PMDs update it in case of error. */
+ memset(&error, 0x44, sizeof(error));
+ if (pia->handle != NULL &&
+ rte_flow_action_handle_destroy
+ (port_id, pia->handle, &error) != 0) {
+ printf("Indirect action #%u not destroyed\n", pia->id);
+ ret = port_flow_complain(&error);
+ tmp = &pia->next;
+ } else {
+ *tmp = pia->next;
+ free(pia);
+ }
+ }
+ return ret;
+}
/** Get indirect action by port + id */
struct rte_flow_action_handle *
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c4be9abe73..ac090bde06 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -3212,6 +3212,7 @@ close_port(portid_t pid)
if (is_proc_primary()) {
port_flow_flush(pi);
port_flex_item_flush(pi);
+ port_action_handle_flush(pi);
rte_eth_dev_close(pi);
}
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 9c24cb07e0..042802b205 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -881,6 +881,7 @@ int port_action_handle_create(portid_t port_id, uint32_t id,
const struct rte_flow_action *action);
int port_action_handle_destroy(portid_t port_id,
uint32_t n, const uint32_t *action);
+int port_action_handle_flush(portid_t port_id);
struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id,
uint32_t id);
int port_action_handle_update(portid_t port_id, uint32_t id,
--
2.22.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。