* [PATCH] app/testpmd: add flush multicast MAC address command @ 2023-08-01 2:43 Dengdui Huang 2023-08-01 15:18 ` Stephen Hemminger ` (3 more replies) 0 siblings, 4 replies; 19+ messages in thread From: Dengdui Huang @ 2023-08-01 2:43 UTC (permalink / raw) To: dev Cc: ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Add command to flush multicast MAC address Usage: mcast_addr flush <port_id> : flush multicast MAC address on port_id Signed-off-by: Dengdui Huang <huangdengdui@huawei.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 | 8 ++++ 4 files changed, 70 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0d0723f659..2d9d925776 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" " Remove a MAC address from port_id.\n\n" + "mcast_addr flush (port_id)\n" + " To flush the set of multicast addresses.\n\n" + "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" " Set the default MAC address for port_id.\n\n" @@ -8561,6 +8564,45 @@ static 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 multicast MAC address 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 */ @@ -12929,6 +12971,7 @@ static cmdline_parse_ctx_t builtin_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 11f3a22048..d66d1db37c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -6802,6 +6802,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 the set of filtered addresses on port %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 f1df6a8faf..65d3634f6a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1176,6 +1176,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 a182479ab2..c3ab1507c4 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1320,6 +1320,14 @@ filtered by port:: testpmd> mcast_addr remove (port_id) (mcast_addr) +mcast_addr flush +~~~~~~~~~~~~~~~~ + +To flush the set of multicast addresses +filtered by port:: + + testpmd> mcast_addr flush (port_id) + mac_addr add (for VF) ~~~~~~~~~~~~~~~~~~~~~ -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] app/testpmd: add flush multicast MAC address command 2023-08-01 2:43 [PATCH] app/testpmd: add flush multicast MAC address command Dengdui Huang @ 2023-08-01 15:18 ` Stephen Hemminger 2023-08-02 1:28 ` huangdengdui 2023-08-02 2:41 ` huangdengdui 2023-08-02 6:23 ` [PATCH v2] " Dengdui Huang ` (2 subsequent siblings) 3 siblings, 2 replies; 19+ messages in thread From: Stephen Hemminger @ 2023-08-01 15:18 UTC (permalink / raw) To: Dengdui Huang Cc: dev, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On Tue, 1 Aug 2023 10:43:04 +0800 Dengdui Huang <huangdengdui@huawei.com> wrote: > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 0d0723f659..2d9d925776 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, > "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" > " Remove a MAC address from port_id.\n\n" > > + "mcast_addr flush (port_id)\n" > + " To flush the set of multicast addresses.\n\n" > + > "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" > " Set the default MAC address for port_id.\n\n" Why out this in middle of the mac_addr commands? better to be in logical or alpha order. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] app/testpmd: add flush multicast MAC address command 2023-08-01 15:18 ` Stephen Hemminger @ 2023-08-02 1:28 ` huangdengdui 2023-08-02 2:41 ` huangdengdui 1 sibling, 0 replies; 19+ messages in thread From: huangdengdui @ 2023-08-02 1:28 UTC (permalink / raw) To: Stephen Hemminger Cc: dev, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong 在 2023/8/1 23:18, Stephen Hemminger 写道: > On Tue, 1 Aug 2023 10:43:04 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index 0d0723f659..2d9d925776 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, >> "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" >> " Remove a MAC address from port_id.\n\n" >> >> + "mcast_addr flush (port_id)\n" >> + " To flush the set of multicast addresses.\n\n" >> + >> "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" >> " Set the default MAC address for port_id.\n\n" > > Why out this in middle of the mac_addr commands? better to be in logical or alpha order. Thanks, I will do in v2. ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] app/testpmd: add flush multicast MAC address command 2023-08-01 15:18 ` Stephen Hemminger 2023-08-02 1:28 ` huangdengdui @ 2023-08-02 2:41 ` huangdengdui 2023-08-02 4:16 ` Stephen Hemminger 1 sibling, 1 reply; 19+ messages in thread From: huangdengdui @ 2023-08-02 2:41 UTC (permalink / raw) To: Stephen Hemminger Cc: dev, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong 在 2023/8/1 23:18, Stephen Hemminger 写道: > On Tue, 1 Aug 2023 10:43:04 +0800 > Dengdui Huang <huangdengdui@huawei.com> wrote: > >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index 0d0723f659..2d9d925776 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, >> "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" >> " Remove a MAC address from port_id.\n\n" >> >> + "mcast_addr flush (port_id)\n" >> + " To flush the set of multicast addresses.\n\n" >> + >> "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" >> " Set the default MAC address for port_id.\n\n" > > Why out this in middle of the mac_addr commands? better to be in logical or alpha order. Sorry Stephen, I made a mistake in my reply. It's already in logical order(mac_addr/mcast_addr add/remove---->other setting), the same order as in the doc. The order looks odd because the help command doesn't have a description of "multicast add/remove".Do you agree with this explanation? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] app/testpmd: add flush multicast MAC address command 2023-08-02 2:41 ` huangdengdui @ 2023-08-02 4:16 ` Stephen Hemminger 2023-08-02 6:11 ` huangdengdui 0 siblings, 1 reply; 19+ messages in thread From: Stephen Hemminger @ 2023-08-02 4:16 UTC (permalink / raw) To: huangdengdui Cc: dev, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On Wed, 2 Aug 2023 10:41:46 +0800 huangdengdui <huangdengdui@huawei.com> wrote: > 在 2023/8/1 23:18, Stephen Hemminger 写道: > > On Tue, 1 Aug 2023 10:43:04 +0800 > > Dengdui Huang <huangdengdui@huawei.com> wrote: > > > >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > >> index 0d0723f659..2d9d925776 100644 > >> --- a/app/test-pmd/cmdline.c > >> +++ b/app/test-pmd/cmdline.c > >> @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, > >> "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" > >> " Remove a MAC address from port_id.\n\n" > >> > >> + "mcast_addr flush (port_id)\n" > >> + " To flush the set of multicast addresses.\n\n" > >> + > >> "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" > >> " Set the default MAC address for port_id.\n\n" > > > > Why out this in middle of the mac_addr commands? better to be in logical or alpha order. > Sorry Stephen, I made a mistake in my reply. It's already in logical order(mac_addr/mcast_addr add/remove---->other setting), the same order as in the doc. > The order looks odd because the help command doesn't have a description of "multicast add/remove".Do you agree with this explanation? The help is already a bit of a mess. It really needs to be split up more. Lets add the new line after "set allmulti"? ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH] app/testpmd: add flush multicast MAC address command 2023-08-02 4:16 ` Stephen Hemminger @ 2023-08-02 6:11 ` huangdengdui 0 siblings, 0 replies; 19+ messages in thread From: huangdengdui @ 2023-08-02 6:11 UTC (permalink / raw) To: Stephen Hemminger Cc: dev, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong 在 2023/8/2 12:16, Stephen Hemminger 写道: > On Wed, 2 Aug 2023 10:41:46 +0800 > huangdengdui <huangdengdui@huawei.com> wrote: > >> 在 2023/8/1 23:18, Stephen Hemminger 写道: >>> On Tue, 1 Aug 2023 10:43:04 +0800 >>> Dengdui Huang <huangdengdui@huawei.com> wrote: >>> >>>> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >>>> index 0d0723f659..2d9d925776 100644 >>>> --- a/app/test-pmd/cmdline.c >>>> +++ b/app/test-pmd/cmdline.c >>>> @@ -494,6 +494,9 @@ static void cmd_help_long_parsed(void *parsed_result, >>>> "mac_addr remove (port_id) (XX:XX:XX:XX:XX:XX)\n" >>>> " Remove a MAC address from port_id.\n\n" >>>> >>>> + "mcast_addr flush (port_id)\n" >>>> + " To flush the set of multicast addresses.\n\n" >>>> + >>>> "mac_addr set (port_id) (XX:XX:XX:XX:XX:XX)\n" >>>> " Set the default MAC address for port_id.\n\n" >>> >>> Why out this in middle of the mac_addr commands? better to be in logical or alpha order. >> Sorry Stephen, I made a mistake in my reply. It's already in logical order(mac_addr/mcast_addr add/remove---->other setting), the same order as in the doc. >> The order looks odd because the help command doesn't have a description of "multicast add/remove".Do you agree with this explanation? > > The help is already a bit of a mess. It really needs to be split up more. > > Lets add the new line after "set allmulti"? > OK, I will do in v2. ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v2] app/testpmd: add flush multicast MAC address command 2023-08-01 2:43 [PATCH] app/testpmd: add flush multicast MAC address command Dengdui Huang 2023-08-01 15:18 ` Stephen Hemminger @ 2023-08-02 6:23 ` Dengdui Huang 2023-09-28 17:23 ` Ferruh Yigit 2023-10-08 1:56 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 3 siblings, 1 reply; 19+ messages in thread From: Dengdui Huang @ 2023-08-02 6:23 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Add command to flush multicast MAC address Usage: mcast_addr flush <port_id> : flush multicast MAC address on port_id Signed-off-by: Dengdui Huang <huangdengdui@huawei.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 | 8 ++++ 4 files changed, 70 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 0d0723f659..d5a3bd2287 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -516,6 +516,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" + "mcast_addr flush (port_id)\n" + " To flush the set of multicast addresses.\n\n" + "set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n" @@ -8561,6 +8564,45 @@ static 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 multicast MAC address 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 */ @@ -12929,6 +12971,7 @@ static cmdline_parse_ctx_t builtin_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 11f3a22048..d66d1db37c 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -6802,6 +6802,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 the set of filtered addresses on port %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 f1df6a8faf..65d3634f6a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1176,6 +1176,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 a182479ab2..c3ab1507c4 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1320,6 +1320,14 @@ filtered by port:: testpmd> mcast_addr remove (port_id) (mcast_addr) +mcast_addr flush +~~~~~~~~~~~~~~~~ + +To flush the set of multicast addresses +filtered by port:: + + testpmd> mcast_addr flush (port_id) + mac_addr add (for VF) ~~~~~~~~~~~~~~~~~~~~~ -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2] app/testpmd: add flush multicast MAC address command 2023-08-02 6:23 ` [PATCH v2] " Dengdui Huang @ 2023-09-28 17:23 ` Ferruh Yigit 2023-10-07 8:18 ` huangdengdui 0 siblings, 1 reply; 19+ messages in thread From: Ferruh Yigit @ 2023-09-28 17:23 UTC (permalink / raw) To: Dengdui Huang, dev Cc: stephen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On 8/2/2023 7:23 AM, Dengdui Huang wrote: > Add command to flush multicast MAC address > Usage: > mcast_addr flush <port_id> : > flush multicast MAC address on port_id > > Signed-off-by: Dengdui Huang <huangdengdui@huawei.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 | 8 ++++ > 4 files changed, 70 insertions(+) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 0d0723f659..d5a3bd2287 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -516,6 +516,9 @@ static void cmd_help_long_parsed(void *parsed_result, > "set allmulti (port_id|all) (on|off)\n" > " Set the allmulti mode on port_id, or all.\n\n" > > + "mcast_addr flush (port_id)\n" > + " To flush the set of multicast addresses.\n\n" > +> I assume 'set of multicast address' comes from the API getting 'mc_addr_set' as parameter, but using 'set' is not useful in the command description, what about: "Flush all multicast MAC addresses on port_id." Similarly there are logs/documents below refers as "set of multicast addresses", does it make sense to replace all as "all multicast MAC addresses"? And relating to the ordering, as you said "mcast_addr add|remove ..." is missing, which is contributing to the confusion. Can you please add this first (in a separate patch) to just below "mac_addr .*" group, later put "mcast_addr flush .*' below it in this patch? > "set flow_ctrl rx (on|off) tx (on|off) (high_water)" > " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" > " (on|off) autoneg (on|off) (port_id)\n" > @@ -8561,6 +8564,45 @@ static 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 multicast MAC address on port_id",> What about: "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 */ > @@ -12929,6 +12971,7 @@ static cmdline_parse_ctx_t builtin_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 11f3a22048..d66d1db37c 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -6802,6 +6802,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 the set of filtered addresses on port %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 f1df6a8faf..65d3634f6a 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -1176,6 +1176,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 a182479ab2..c3ab1507c4 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -1320,6 +1320,14 @@ filtered by port:: > > testpmd> mcast_addr remove (port_id) (mcast_addr) > > +mcast_addr flush > +~~~~~~~~~~~~~~~~ > + > +To flush the set of multicast addresses > +filtered by port:: > Can join the lines into single line > + > + testpmd> mcast_addr flush (port_id) > + > mac_addr add (for VF) > ~~~~~~~~~~~~~~~~~~~~~ > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v2] app/testpmd: add flush multicast MAC address command 2023-09-28 17:23 ` Ferruh Yigit @ 2023-10-07 8:18 ` huangdengdui 0 siblings, 0 replies; 19+ messages in thread From: huangdengdui @ 2023-10-07 8:18 UTC (permalink / raw) To: Ferruh Yigit, dev Cc: stephen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On 2023/9/29 1:23, Ferruh Yigit wrote: > On 8/2/2023 7:23 AM, Dengdui Huang wrote: >> Add command to flush multicast MAC address >> Usage: >> mcast_addr flush <port_id> : >> flush multicast MAC address on port_id >> >> Signed-off-by: Dengdui Huang <huangdengdui@huawei.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 | 8 ++++ >> 4 files changed, 70 insertions(+) >> >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index 0d0723f659..d5a3bd2287 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -516,6 +516,9 @@ static void cmd_help_long_parsed(void *parsed_result, >> "set allmulti (port_id|all) (on|off)\n" >> " Set the allmulti mode on port_id, or all.\n\n" >> >> + "mcast_addr flush (port_id)\n" >> + " To flush the set of multicast addresses.\n\n" >> +> > > I assume 'set of multicast address' comes from the API getting > 'mc_addr_set' as parameter, but using 'set' is not useful in the command > description, what about: > "Flush all multicast MAC addresses on port_id." > > Similarly there are logs/documents below refers as "set of multicast > addresses", does it make sense to replace all as "all multicast MAC > addresses"? > > > And relating to the ordering, as you said "mcast_addr add|remove ..." is > missing, which is contributing to the confusion. > Can you please add this first (in a separate patch) to just below > "mac_addr .*" group, later put "mcast_addr flush .*' below it in this patch? > > >> "set flow_ctrl rx (on|off) tx (on|off) (high_water)" >> " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" >> " (on|off) autoneg (on|off) (port_id)\n" >> @@ -8561,6 +8564,45 @@ static 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 multicast MAC address on port_id",> > > What about: > "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 */ >> @@ -12929,6 +12971,7 @@ static cmdline_parse_ctx_t builtin_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 11f3a22048..d66d1db37c 100644 >> --- a/app/test-pmd/config.c >> +++ b/app/test-pmd/config.c >> @@ -6802,6 +6802,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 the set of filtered addresses on port %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 f1df6a8faf..65d3634f6a 100644 >> --- a/app/test-pmd/testpmd.h >> +++ b/app/test-pmd/testpmd.h >> @@ -1176,6 +1176,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 a182479ab2..c3ab1507c4 100644 >> --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst >> +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst >> @@ -1320,6 +1320,14 @@ filtered by port:: >> >> testpmd> mcast_addr remove (port_id) (mcast_addr) >> >> +mcast_addr flush >> +~~~~~~~~~~~~~~~~ >> + >> +To flush the set of multicast addresses >> +filtered by port:: >> > > Can join the lines into single line > >> + >> + testpmd> mcast_addr flush (port_id) >> + >> mac_addr add (for VF) >> ~~~~~~~~~~~~~~~~~~~~~ >> > Thanks for your review, I will do in v3. ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 0/2] fix help string and add a new command 2023-08-01 2:43 [PATCH] app/testpmd: add flush multicast MAC address command Dengdui Huang 2023-08-01 15:18 ` Stephen Hemminger 2023-08-02 6:23 ` [PATCH v2] " Dengdui Huang @ 2023-10-08 1:56 ` Dengdui Huang 2023-10-08 1:56 ` [PATCH v3 1/2] app/testpmd: fix help string Dengdui Huang 2023-10-08 1:56 ` [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 3 siblings, 2 replies; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 1:56 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong This series fix help string and add a new command. v2->v3 add 'mcast_addr add|remove' to help string and update the new command description. v1->v2 update order on help string Dengdui Huang (2): app/testpmd: fix help string app/testpmd: add flush all multicast MAC address command app/test-pmd/cmdline.c | 49 +++++++++++++++++++++ app/test-pmd/config.c | 18 ++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 4 files changed, 75 insertions(+) -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 1/2] app/testpmd: fix help string 2023-10-08 1:56 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang @ 2023-10-08 1:56 ` Dengdui Huang 2023-10-08 2:47 ` fengchengwen 2023-10-08 1:56 ` [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang 1 sibling, 1 reply; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 1:56 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Command help string is missing 'mcast_addr add|remove'. This patch add it. Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> --- app/test-pmd/cmdline.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a0e97719b3..3165347a05 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -516,6 +516,12 @@ static void cmd_help_long_parsed(void *parsed_result, "set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" + "mcast_addr add (port_id) (mcast_addr)\n" + " Add a multicast MAC addresses on port_id.\n\n" + + "mcast_addr remove (port_id) (mcast_addr)" + " Remove a multicast MAC address from port_id.\n\n" + "set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n" -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 1/2] app/testpmd: fix help string 2023-10-08 1:56 ` [PATCH v3 1/2] app/testpmd: fix help string Dengdui Huang @ 2023-10-08 2:47 ` fengchengwen 2023-10-08 6:46 ` huangdengdui 0 siblings, 1 reply; 19+ messages in thread From: fengchengwen @ 2023-10-08 2:47 UTC (permalink / raw) To: Dengdui Huang, dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Hi Dengdui, On 2023/10/8 9:56, Dengdui Huang wrote: > Command help string is missing 'mcast_addr add|remove'. > This patch add it. > > Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") > Cc: stable@dpdk.org > > Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> > --- > app/test-pmd/cmdline.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index a0e97719b3..3165347a05 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -516,6 +516,12 @@ static void cmd_help_long_parsed(void *parsed_result, > "set allmulti (port_id|all) (on|off)\n" > " Set the allmulti mode on port_id, or all.\n\n" > > + "mcast_addr add (port_id) (mcast_addr)\n" > + " Add a multicast MAC addresses on port_id.\n\n" > + > + "mcast_addr remove (port_id) (mcast_addr)" Please add '\n' at last. with above fixed, Acked-by: Chengwen Feng <fengchengwen@huawei.com> > + " Remove a multicast MAC address from port_id.\n\n" > + > "set flow_ctrl rx (on|off) tx (on|off) (high_water)" > " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" > " (on|off) autoneg (on|off) (port_id)\n" > ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 1/2] app/testpmd: fix help string 2023-10-08 2:47 ` fengchengwen @ 2023-10-08 6:46 ` huangdengdui 0 siblings, 0 replies; 19+ messages in thread From: huangdengdui @ 2023-10-08 6:46 UTC (permalink / raw) To: fengchengwen, dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On 2023/10/8 10:47, fengchengwen wrote: > Hi Dengdui, > > On 2023/10/8 9:56, Dengdui Huang wrote: >> Command help string is missing 'mcast_addr add|remove'. >> This patch add it. >> >> Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") >> Cc: stable@dpdk.org >> >> Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> >> --- >> app/test-pmd/cmdline.c | 6 ++++++ >> 1 file changed, 6 insertions(+) >> >> diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c >> index a0e97719b3..3165347a05 100644 >> --- a/app/test-pmd/cmdline.c >> +++ b/app/test-pmd/cmdline.c >> @@ -516,6 +516,12 @@ static void cmd_help_long_parsed(void *parsed_result, >> "set allmulti (port_id|all) (on|off)\n" >> " Set the allmulti mode on port_id, or all.\n\n" >> >> + "mcast_addr add (port_id) (mcast_addr)\n" >> + " Add a multicast MAC addresses on port_id.\n\n" >> + >> + "mcast_addr remove (port_id) (mcast_addr)" > > Please add '\n' at last. > > with above fixed, > Acked-by: Chengwen Feng <fengchengwen@huawei.com> > OK, thanks >> + " Remove a multicast MAC address from port_id.\n\n" >> + >> "set flow_ctrl rx (on|off) tx (on|off) (high_water)" >> " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" >> " (on|off) autoneg (on|off) (port_id)\n" >> ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command 2023-10-08 1:56 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 1:56 ` [PATCH v3 1/2] app/testpmd: fix help string Dengdui Huang @ 2023-10-08 1:56 ` Dengdui Huang 2023-10-08 2:50 ` fengchengwen 1 sibling, 1 reply; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 1:56 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong 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> --- 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 3165347a05..6404d06e8f 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -522,6 +522,9 @@ static void cmd_help_long_parsed(void *parsed_result, "mcast_addr remove (port_id) (mcast_addr)" " 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 flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n" @@ -8567,6 +8570,45 @@ static 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 */ @@ -12935,6 +12977,7 @@ static cmdline_parse_ctx_t builtin_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 709864bb44..7034fa125b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -6829,6 +6829,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 e236845a81..6457ac4c0a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1181,6 +1181,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 e6d218caaa..7a40980d6c 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1323,6 +1323,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.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command 2023-10-08 1:56 ` [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang @ 2023-10-08 2:50 ` fengchengwen 0 siblings, 0 replies; 19+ messages in thread From: fengchengwen @ 2023-10-08 2:50 UTC (permalink / raw) To: Dengdui Huang, dev Cc: stephen, ferruh.yigit, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Hi Dengdui, On 2023/10/8 9:56, Dengdui Huang wrote: > 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> ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v3 0/2] fix help string and add a new command 2023-08-01 2:43 [PATCH] app/testpmd: add flush multicast MAC address command Dengdui Huang ` (2 preceding siblings ...) 2023-10-08 1:56 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang @ 2023-10-08 6:46 ` Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 1/2] app/testpmd: fix help string Dengdui Huang ` (2 more replies) 3 siblings, 3 replies; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 6:46 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, fengchengwen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong This series fix help string and add a new command. v3->v4 help string add '\n' at last. v2->v3 add 'mcast_addr add|remove' to help string and update the new command description. v1->v2 update order on help string. Dengdui Huang (2): app/testpmd: fix help string app/testpmd: add flush all multicast MAC address command app/test-pmd/cmdline.c | 49 +++++++++++++++++++++ app/test-pmd/config.c | 18 ++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ 4 files changed, 75 insertions(+) -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 1/2] app/testpmd: fix help string 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang @ 2023-10-08 6:46 ` Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang 2023-10-09 9:39 ` [PATCH v3 0/2] fix help string and add a new command Ferruh Yigit 2 siblings, 0 replies; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 6:46 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, fengchengwen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong Command help string is missing 'mcast_addr add|remove'. This patch add it. Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses") Cc: stable@dpdk.org Signed-off-by: Dengdui Huang <huangdengdui@huawei.com> Acked-by: Chengwen Feng <fengchengwen@huawei.com> --- app/test-pmd/cmdline.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index a0e97719b3..b934f61be7 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -516,6 +516,12 @@ static void cmd_help_long_parsed(void *parsed_result, "set allmulti (port_id|all) (on|off)\n" " Set the allmulti mode on port_id, or all.\n\n" + "mcast_addr add (port_id) (mcast_addr)\n" + " Add a multicast MAC addresses on port_id.\n\n" + + "mcast_addr remove (port_id) (mcast_addr)\n" + " Remove a multicast MAC address from port_id.\n\n" + "set flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n" -- 2.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 2/2] app/testpmd: add flush all multicast MAC address command 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 1/2] app/testpmd: fix help string Dengdui Huang @ 2023-10-08 6:46 ` Dengdui Huang 2023-10-09 9:39 ` [PATCH v3 0/2] fix help string and add a new command Ferruh Yigit 2 siblings, 0 replies; 19+ messages in thread From: Dengdui Huang @ 2023-10-08 6:46 UTC (permalink / raw) To: dev Cc: stephen, ferruh.yigit, fengchengwen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong 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> --- 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 b934f61be7..45bfedd394 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -522,6 +522,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 flow_ctrl rx (on|off) tx (on|off) (high_water)" " (low_water) (pause_time) (send_xon) mac_ctrl_frame_fwd" " (on|off) autoneg (on|off) (port_id)\n" @@ -8567,6 +8570,45 @@ static 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 */ @@ -12935,6 +12977,7 @@ static cmdline_parse_ctx_t builtin_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 709864bb44..7034fa125b 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -6829,6 +6829,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 e236845a81..6457ac4c0a 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -1181,6 +1181,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 e6d218caaa..7a40980d6c 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -1323,6 +1323,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.33.0 ^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [PATCH v3 0/2] fix help string and add a new command 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 1/2] app/testpmd: fix help string Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang @ 2023-10-09 9:39 ` Ferruh Yigit 2 siblings, 0 replies; 19+ messages in thread From: Ferruh Yigit @ 2023-10-09 9:39 UTC (permalink / raw) To: Dengdui Huang, dev Cc: stephen, fengchengwen, aman.deep.singh, yuying.zhang, anatoly.burakov, liuyonglong On 10/8/2023 7:46 AM, Dengdui Huang wrote: > This series fix help string and add a new command. > > v3->v4 > help string add '\n' at last. > > v2->v3 > add 'mcast_addr add|remove' to help string and > update the new command description. > > v1->v2 > update order on help string. > > Dengdui Huang (2): > app/testpmd: fix help string > app/testpmd: add flush all multicast MAC address command > > For series, Acked-by: Ferruh Yigit <ferruh.yigit@amd.com> Series applied to dpdk-next-net/main, thanks. ^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2023-10-09 9:40 UTC | newest] Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-08-01 2:43 [PATCH] app/testpmd: add flush multicast MAC address command Dengdui Huang 2023-08-01 15:18 ` Stephen Hemminger 2023-08-02 1:28 ` huangdengdui 2023-08-02 2:41 ` huangdengdui 2023-08-02 4:16 ` Stephen Hemminger 2023-08-02 6:11 ` huangdengdui 2023-08-02 6:23 ` [PATCH v2] " Dengdui Huang 2023-09-28 17:23 ` Ferruh Yigit 2023-10-07 8:18 ` huangdengdui 2023-10-08 1:56 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 1:56 ` [PATCH v3 1/2] app/testpmd: fix help string Dengdui Huang 2023-10-08 2:47 ` fengchengwen 2023-10-08 6:46 ` huangdengdui 2023-10-08 1:56 ` [PATCH v3 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang 2023-10-08 2:50 ` fengchengwen 2023-10-08 6:46 ` [PATCH v3 0/2] fix help string and add a new command Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 1/2] app/testpmd: fix help string Dengdui Huang 2023-10-08 6:46 ` [PATCH v4 2/2] app/testpmd: add flush all multicast MAC address command Dengdui Huang 2023-10-09 9:39 ` [PATCH v3 0/2] fix help string and add a new command Ferruh Yigit
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).