代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From c2f8baf727df5d43ba3e1366037d31bd6185b77d Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui@huawei.com>
Date: Sun, 8 Oct 2023 14:46:20 +0800
Subject: [PATCH 365/366] app/testpmd: add command to flush multicast MAC addresses
[ upstream commit ef8bd7d0b25abdcc425d4a7e399c66957b15b935 ]
Add command to flush all multicast MAC address
Usage:
mcast_addr flush <port_id> :
flush all multicast MAC address on port_id
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@amd.com>
---
app/test-pmd/cmdline.c | 43 +++++++++++++++++++++
app/test-pmd/config.c | 18 +++++++++
app/test-pmd/testpmd.h | 1 +
doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++++
4 files changed, 69 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index ec8f385..8facca3 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -510,6 +510,9 @@ static void cmd_help_long_parsed(void *parsed_result,
"mcast_addr remove (port_id) (mcast_addr)\n"
" Remove a multicast MAC address from port_id.\n\n"
+ "mcast_addr flush (port_id)\n"
+ " Flush all multicast MAC addresses on port_id.\n\n"
+
"set vf mac addr (port_id) (vf_id) (XX:XX:XX:XX:XX:XX)\n"
" Set the MAC address for a VF from the PF.\n\n"
@@ -11004,6 +11007,45 @@ cmdline_parse_inst_t cmd_mcast_addr = {
},
};
+/* *** FLUSH MULTICAST MAC ADDRESS ON PORT *** */
+struct cmd_mcast_addr_flush_result {
+ cmdline_fixed_string_t mcast_addr_cmd;
+ cmdline_fixed_string_t what;
+ uint16_t port_num;
+};
+
+static void cmd_mcast_addr_flush_parsed(void *parsed_result,
+ __rte_unused struct cmdline *cl,
+ __rte_unused void *data)
+{
+ struct cmd_mcast_addr_flush_result *res = parsed_result;
+
+ mcast_addr_flush(res->port_num);
+}
+
+static cmdline_parse_token_string_t cmd_mcast_addr_flush_cmd =
+ TOKEN_STRING_INITIALIZER(struct cmd_mcast_addr_result,
+ mcast_addr_cmd, "mcast_addr");
+static cmdline_parse_token_string_t cmd_mcast_addr_flush_what =
+ TOKEN_STRING_INITIALIZER(struct cmd_mcast_addr_result, what,
+ "flush");
+static cmdline_parse_token_num_t cmd_mcast_addr_flush_portnum =
+ TOKEN_NUM_INITIALIZER(struct cmd_mcast_addr_result, port_num,
+ RTE_UINT16);
+
+static cmdline_parse_inst_t cmd_mcast_addr_flush = {
+ .f = cmd_mcast_addr_flush_parsed,
+ .data = (void *)0,
+ .help_str = "mcast_addr flush <port_id> : "
+ "flush all multicast MAC addresses on port_id",
+ .tokens = {
+ (void *)&cmd_mcast_addr_flush_cmd,
+ (void *)&cmd_mcast_addr_flush_what,
+ (void *)&cmd_mcast_addr_flush_portnum,
+ NULL,
+ },
+};
+
/* vf vlan anti spoof configuration */
/* Common result structure for vf vlan anti spoof */
@@ -17867,6 +17909,7 @@ cmdline_parse_ctx_t main_ctx[] = {
(cmdline_parse_inst_t *)&cmd_set_port_meter_stats_mask,
(cmdline_parse_inst_t *)&cmd_show_port_meter_stats,
(cmdline_parse_inst_t *)&cmd_mcast_addr,
+ (cmdline_parse_inst_t *)&cmd_mcast_addr_flush,
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_anti_spoof,
(cmdline_parse_inst_t *)&cmd_set_vf_mac_anti_spoof,
(cmdline_parse_inst_t *)&cmd_set_vf_vlan_stripq,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 61dc56f..af00078 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -5459,6 +5459,24 @@ mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr)
mcast_addr_pool_append(port, mc_addr);
}
+void
+mcast_addr_flush(portid_t port_id)
+{
+ int ret;
+
+ if (port_id_is_invalid(port_id, ENABLED_WARN))
+ return;
+
+ ret = rte_eth_dev_set_mc_addr_list(port_id, NULL, 0);
+ if (ret != 0) {
+ fprintf(stderr,
+ "Failed to flush all multicast MAC addresses on port_id %u\n",
+ port_id);
+ return;
+ }
+ mcast_addr_pool_destroy(port_id);
+}
+
void
port_dcb_info_display(portid_t port_id)
{
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 54d3112..30c7177 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -1051,6 +1051,7 @@ void show_mcast_macs(portid_t port_id);
/* Functions to manage the set of filtered Multicast MAC addresses */
void mcast_addr_add(portid_t port_id, struct rte_ether_addr *mc_addr);
void mcast_addr_remove(portid_t port_id, struct rte_ether_addr *mc_addr);
+void mcast_addr_flush(portid_t port_id);
void port_dcb_info_display(portid_t port_id);
uint8_t *open_file(const char *file_path, uint32_t *size);
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index ecf89aa..c33c845 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -1406,6 +1406,13 @@ filtered by port::
testpmd> mcast_addr remove (port_id) (mcast_addr)
+mcast_addr flush
+~~~~~~~~~~~~~~~~
+
+Flush all multicast MAC addresses on port_id::
+
+ testpmd> mcast_addr flush (port_id)
+
mac_addr add (for VF)
~~~~~~~~~~~~~~~~~~~~~
--
2.41.0.windows.2
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。