* [PATCH] ethtool: added list command to list all available commands @ 2022-03-21 14:25 huzaifa.rahman 2022-03-22 9:36 ` [PATCH v2] ethtool: added help command to list all available huzaifa.rahman 2023-07-03 22:24 ` [PATCH] ethtool: added list command to list all available commands Stephen Hemminger 0 siblings, 2 replies; 6+ messages in thread From: huzaifa.rahman @ 2022-03-21 14:25 UTC (permalink / raw) To: dev; +Cc: Huzaifa696 From: Huzaifa696 <huzaifa.rehman696@gmail.com> help command is needed so user can see all the available commands directly from the command line along with the formats. Signed-off-by: Huzaifa696 <huzaifa.rehman696@gmail.com> --- doc/guides/sample_app_ug/ethtool.rst | 1 + examples/ethtool/ethtool-app/ethapp.c | 38 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst index 159e9e0639..6e57015170 100644 --- a/doc/guides/sample_app_ug/ethtool.rst +++ b/doc/guides/sample_app_ug/ethtool.rst @@ -58,6 +58,7 @@ they do as follows: * ``validate``: Check that given MAC address is valid unicast address * ``vlan``: Add/remove VLAN id * ``quit``: Exit program +* ``help``: List all available commands Explanation diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 78e86534e8..361e2daf9b 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -57,6 +57,8 @@ cmdline_parse_token_string_t pcmd_stats_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "stats"); cmdline_parse_token_string_t pcmd_drvinfo_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "drvinfo"); +cmdline_parse_token_string_t pcmd_list_token_cmd = + TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "help"); cmdline_parse_token_string_t pcmd_link_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "link"); @@ -133,6 +135,11 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode = cmdline_parse_token_num_t pcmd_vlan_token_vid = TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, RTE_UINT16); +void +list_cmd(unsigned int sr, const char *name, const char *format, const char *description) +{ + printf("%-4d%-17s%-45s%-50s\n", sr, name, format, description); +} static void pcmd_quit_callback(__rte_unused void *ptr_params, @@ -142,6 +149,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params, cmdline_quit(ctx); } +static void +pcmd_list_callback(__rte_unused void *ptr_params, + struct cmdline *ctx, + __rte_unused void *ptr_data) +{ + printf("%-4s%-17s%-45s%-50s\n\n", "Sr.", "Name", "Format", "Description"); + list_cmd(1, "drvinfo", "drvinfo", "Print driver info"); + list_cmd(2, "open", "open <port_id>", "Open port"); + list_cmd(3, "pause", "pause <port_id> <all|tx|rx|none>", "Get/set port pause state"); + list_cmd(4, "stop", "stop <port_id>", "Stop port"); + list_cmd(5, "portstats", "portstats <port_id>", "Print port statistics"); + list_cmd(6, "link", "link", "Print port link states"); + list_cmd(7, "macaddr", "macaddr <port_id> <mac_addr>", "Gets/sets MAC address"); + list_cmd(8, "mtu", "mtu <port_id> <mtu_value>", "Set NIC MTU"); + list_cmd(9, "regs", "regs <port_id> <filename>", "Dump port register(s) to file"); + list_cmd(10, "ringparam", "ringparam <port_id> <tx_param> <rx_param>", "Get/set ring parameters"); + list_cmd(11, "rxmode", "rxmode <port_id>", "Toggle port Rx mode"); + list_cmd(12, "validate", "validate <mac_addr>", "Check that given MAC address is valid unicast address"); + list_cmd(13, "vlan", "vlan <port_id> <add|del> <vlan_id>", "Add/remove VLAN id"); + list_cmd(14, "eeprom", "eeprom <port_id> <filename>", "Dump EEPROM to file"); + list_cmd(15, "module-eeprom", "module-eeprom <port_id> <filename>", "Dump plugin module EEPROM to file"); + list_cmd(16, "quit", "quit", "Exit program"); + list_cmd(17, "help", "help", "List all available commands"); +} static void pcmd_drvinfo_callback(__rte_unused void *ptr_params, @@ -680,6 +711,12 @@ cmdline_parse_inst_t pcmd_drvinfo = { .help_str = "drvinfo\n Print driver info", .tokens = {(void *)&pcmd_drvinfo_token_cmd, NULL}, }; +cmdline_parse_inst_t pcmd_list_cmds = { + .f = pcmd_list_callback, + .data = NULL, + .help_str = "help\n List all available commands", + .tokens = {(void *)&pcmd_list_token_cmd, NULL}, +}; cmdline_parse_inst_t pcmd_link = { .f = pcmd_link_callback, .data = NULL, @@ -871,6 +908,7 @@ cmdline_parse_inst_t pcmd_vlan = { cmdline_parse_ctx_t list_prompt_commands[] = { + (cmdline_parse_inst_t *)&pcmd_list_cmds, (cmdline_parse_inst_t *)&pcmd_drvinfo, (cmdline_parse_inst_t *)&pcmd_eeprom, (cmdline_parse_inst_t *)&pcmd_module_eeprom, -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2] ethtool: added help command to list all available 2022-03-21 14:25 [PATCH] ethtool: added list command to list all available commands huzaifa.rahman @ 2022-03-22 9:36 ` huzaifa.rahman 2022-05-27 5:14 ` Huzaifa Rahman 2023-07-03 22:24 ` [PATCH] ethtool: added list command to list all available commands Stephen Hemminger 1 sibling, 1 reply; 6+ messages in thread From: huzaifa.rahman @ 2022-03-22 9:36 UTC (permalink / raw) To: dev; +Cc: huzaifa.rahman Help command is not available for ethtool example. It is needed so user can see all the available commands directly from the command line along with the formats. Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com> --- doc/guides/sample_app_ug/ethtool.rst | 1 + examples/ethtool/ethtool-app/ethapp.c | 38 +++++++++++++++++++++++++++ examples/ethtool/ethtool-app/ethapp.h | 1 + 3 files changed, 40 insertions(+) diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst index 159e9e0639..6e57015170 100644 --- a/doc/guides/sample_app_ug/ethtool.rst +++ b/doc/guides/sample_app_ug/ethtool.rst @@ -58,6 +58,7 @@ they do as follows: * ``validate``: Check that given MAC address is valid unicast address * ``vlan``: Add/remove VLAN id * ``quit``: Exit program +* ``help``: List all available commands Explanation diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c index 78e86534e8..1c0e6c050f 100644 --- a/examples/ethtool/ethtool-app/ethapp.c +++ b/examples/ethtool/ethtool-app/ethapp.c @@ -57,6 +57,8 @@ cmdline_parse_token_string_t pcmd_stats_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "stats"); cmdline_parse_token_string_t pcmd_drvinfo_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "drvinfo"); +cmdline_parse_token_string_t pcmd_list_token_cmd = + TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "help"); cmdline_parse_token_string_t pcmd_link_token_cmd = TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "link"); @@ -133,6 +135,11 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode = cmdline_parse_token_num_t pcmd_vlan_token_vid = TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, RTE_UINT16); +void +print_cmd_info(unsigned int sr, const char *name, const char *format, const char *description) +{ + printf("%-4u%-17s%-45s%-50s\n", sr, name, format, description); +} static void pcmd_quit_callback(__rte_unused void *ptr_params, @@ -142,6 +149,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params, cmdline_quit(ctx); } +static void +pcmd_help_callback(__rte_unused void *ptr_params, + __rte_unused struct cmdline *ctx, + __rte_unused void *ptr_data) +{ + printf("%-4s%-17s%-45s%-50s\n\n", "Sr.", "Name", "Format", "Description"); + print_cmd_info(1, "drvinfo", "drvinfo", "Print driver info"); + print_cmd_info(2, "open", "open <port_id>", "Open port"); + print_cmd_info(3, "pause", "pause <port_id> [<all|tx|rx|none>]", "Get/set port pause state"); + print_cmd_info(4, "stop", "stop <port_id>", "Stop port"); + print_cmd_info(5, "portstats", "portstats <port_id>", "Print port statistics"); + print_cmd_info(6, "link", "link", "Print port link states"); + print_cmd_info(7, "macaddr", "macaddr <port_id> [<mac_addr>]", "Gets/sets MAC address"); + print_cmd_info(8, "mtu", "mtu <port_id> <mtu_value>", "Set NIC MTU"); + print_cmd_info(9, "regs", "regs <port_id> <filename>", "Dump port register(s) to file"); + print_cmd_info(10, "ringparam", "ringparam <port_id> [<tx_param> <rx_param>]", "Get/set ring parameters"); + print_cmd_info(11, "rxmode", "rxmode <port_id>", "Toggle port Rx mode"); + print_cmd_info(12, "validate", "validate <mac_addr>", "Check that given MAC address is valid unicast address"); + print_cmd_info(13, "vlan", "vlan <port_id> <add|del> <vlan_id>", "Add/remove VLAN id"); + print_cmd_info(14, "eeprom", "eeprom <port_id> <filename>", "Dump EEPROM to file"); + print_cmd_info(15, "module-eeprom", "module-eeprom <port_id> <filename>", "Dump plugin module EEPROM to file"); + print_cmd_info(16, "quit", "quit", "Exit program"); + print_cmd_info(17, "help", "help", "List all available commands"); +} static void pcmd_drvinfo_callback(__rte_unused void *ptr_params, @@ -680,6 +711,12 @@ cmdline_parse_inst_t pcmd_drvinfo = { .help_str = "drvinfo\n Print driver info", .tokens = {(void *)&pcmd_drvinfo_token_cmd, NULL}, }; +cmdline_parse_inst_t pcmd_help_cmds = { + .f = pcmd_help_callback, + .data = NULL, + .help_str = "help\n List all available commands", + .tokens = {(void *)&pcmd_list_token_cmd, NULL}, +}; cmdline_parse_inst_t pcmd_link = { .f = pcmd_link_callback, .data = NULL, @@ -871,6 +908,7 @@ cmdline_parse_inst_t pcmd_vlan = { cmdline_parse_ctx_t list_prompt_commands[] = { + (cmdline_parse_inst_t *)&pcmd_help_cmds, (cmdline_parse_inst_t *)&pcmd_drvinfo, (cmdline_parse_inst_t *)&pcmd_eeprom, (cmdline_parse_inst_t *)&pcmd_module_eeprom, diff --git a/examples/ethtool/ethtool-app/ethapp.h b/examples/ethtool/ethtool-app/ethapp.h index 7a70480c88..4db09ed771 100644 --- a/examples/ethtool/ethtool-app/ethapp.h +++ b/examples/ethtool/ethtool-app/ethapp.h @@ -10,3 +10,4 @@ void unlock_port(int idx_port); void mark_port_inactive(int idx_port); void mark_port_active(int idx_port); void mark_port_newmac(int idx_port); +void print_cmd_info(unsigned int sr, const char *name, const char *format, const char *description); -- 2.25.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ethtool: added help command to list all available 2022-03-22 9:36 ` [PATCH v2] ethtool: added help command to list all available huzaifa.rahman @ 2022-05-27 5:14 ` Huzaifa Rahman 2022-05-30 10:42 ` Ferruh Yigit 0 siblings, 1 reply; 6+ messages in thread From: Huzaifa Rahman @ 2022-05-27 5:14 UTC (permalink / raw) To: dev [-- Attachment #1: Type: text/plain, Size: 5722 bytes --] Hi, The following tests are failing but my patch is not related to anything related to these. Please re-run the tests. Failed Tests: - mtu_update - scatter Thanks, Huzaifa On Tue, Mar 22, 2022 at 2:36 PM huzaifa.rahman <huzaifa.rahman@emumba.com> wrote: > Help command is not available for ethtool example. It is needed so user > can see all the available commands directly from the command line along > with the formats. > > Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com> > --- > doc/guides/sample_app_ug/ethtool.rst | 1 + > examples/ethtool/ethtool-app/ethapp.c | 38 +++++++++++++++++++++++++++ > examples/ethtool/ethtool-app/ethapp.h | 1 + > 3 files changed, 40 insertions(+) > > diff --git a/doc/guides/sample_app_ug/ethtool.rst > b/doc/guides/sample_app_ug/ethtool.rst > index 159e9e0639..6e57015170 100644 > --- a/doc/guides/sample_app_ug/ethtool.rst > +++ b/doc/guides/sample_app_ug/ethtool.rst > @@ -58,6 +58,7 @@ they do as follows: > * ``validate``: Check that given MAC address is valid unicast address > * ``vlan``: Add/remove VLAN id > * ``quit``: Exit program > +* ``help``: List all available commands > > > Explanation > diff --git a/examples/ethtool/ethtool-app/ethapp.c > b/examples/ethtool/ethtool-app/ethapp.c > index 78e86534e8..1c0e6c050f 100644 > --- a/examples/ethtool/ethtool-app/ethapp.c > +++ b/examples/ethtool/ethtool-app/ethapp.c > @@ -57,6 +57,8 @@ cmdline_parse_token_string_t pcmd_stats_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "stats"); > cmdline_parse_token_string_t pcmd_drvinfo_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "drvinfo"); > +cmdline_parse_token_string_t pcmd_list_token_cmd = > + TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "help"); > cmdline_parse_token_string_t pcmd_link_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "link"); > > @@ -133,6 +135,11 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode = > cmdline_parse_token_num_t pcmd_vlan_token_vid = > TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, RTE_UINT16); > > +void > +print_cmd_info(unsigned int sr, const char *name, const char *format, > const char *description) > +{ > + printf("%-4u%-17s%-45s%-50s\n", sr, name, format, description); > +} > > static void > pcmd_quit_callback(__rte_unused void *ptr_params, > @@ -142,6 +149,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params, > cmdline_quit(ctx); > } > > +static void > +pcmd_help_callback(__rte_unused void *ptr_params, > + __rte_unused struct cmdline *ctx, > + __rte_unused void *ptr_data) > +{ > + printf("%-4s%-17s%-45s%-50s\n\n", "Sr.", "Name", "Format", > "Description"); > + print_cmd_info(1, "drvinfo", "drvinfo", "Print driver info"); > + print_cmd_info(2, "open", "open <port_id>", "Open port"); > + print_cmd_info(3, "pause", "pause <port_id> [<all|tx|rx|none>]", > "Get/set port pause state"); > + print_cmd_info(4, "stop", "stop <port_id>", "Stop port"); > + print_cmd_info(5, "portstats", "portstats <port_id>", "Print port > statistics"); > + print_cmd_info(6, "link", "link", "Print port link states"); > + print_cmd_info(7, "macaddr", "macaddr <port_id> [<mac_addr>]", > "Gets/sets MAC address"); > + print_cmd_info(8, "mtu", "mtu <port_id> <mtu_value>", "Set NIC > MTU"); > + print_cmd_info(9, "regs", "regs <port_id> <filename>", "Dump port > register(s) to file"); > + print_cmd_info(10, "ringparam", "ringparam <port_id> [<tx_param> > <rx_param>]", "Get/set ring parameters"); > + print_cmd_info(11, "rxmode", "rxmode <port_id>", "Toggle port Rx > mode"); > + print_cmd_info(12, "validate", "validate <mac_addr>", "Check that > given MAC address is valid unicast address"); > + print_cmd_info(13, "vlan", "vlan <port_id> <add|del> <vlan_id>", > "Add/remove VLAN id"); > + print_cmd_info(14, "eeprom", "eeprom <port_id> <filename>", "Dump > EEPROM to file"); > + print_cmd_info(15, "module-eeprom", "module-eeprom <port_id> > <filename>", "Dump plugin module EEPROM to file"); > + print_cmd_info(16, "quit", "quit", "Exit program"); > + print_cmd_info(17, "help", "help", "List all available commands"); > +} > > static void > pcmd_drvinfo_callback(__rte_unused void *ptr_params, > @@ -680,6 +711,12 @@ cmdline_parse_inst_t pcmd_drvinfo = { > .help_str = "drvinfo\n Print driver info", > .tokens = {(void *)&pcmd_drvinfo_token_cmd, NULL}, > }; > +cmdline_parse_inst_t pcmd_help_cmds = { > + .f = pcmd_help_callback, > + .data = NULL, > + .help_str = "help\n List all available commands", > + .tokens = {(void *)&pcmd_list_token_cmd, NULL}, > +}; > cmdline_parse_inst_t pcmd_link = { > .f = pcmd_link_callback, > .data = NULL, > @@ -871,6 +908,7 @@ cmdline_parse_inst_t pcmd_vlan = { > > > cmdline_parse_ctx_t list_prompt_commands[] = { > + (cmdline_parse_inst_t *)&pcmd_help_cmds, > (cmdline_parse_inst_t *)&pcmd_drvinfo, > (cmdline_parse_inst_t *)&pcmd_eeprom, > (cmdline_parse_inst_t *)&pcmd_module_eeprom, > diff --git a/examples/ethtool/ethtool-app/ethapp.h > b/examples/ethtool/ethtool-app/ethapp.h > index 7a70480c88..4db09ed771 100644 > --- a/examples/ethtool/ethtool-app/ethapp.h > +++ b/examples/ethtool/ethtool-app/ethapp.h > @@ -10,3 +10,4 @@ void unlock_port(int idx_port); > void mark_port_inactive(int idx_port); > void mark_port_active(int idx_port); > void mark_port_newmac(int idx_port); > +void print_cmd_info(unsigned int sr, const char *name, const char > *format, const char *description); > -- > 2.25.1 > > [-- Attachment #2: Type: text/html, Size: 11386 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ethtool: added help command to list all available 2022-05-27 5:14 ` Huzaifa Rahman @ 2022-05-30 10:42 ` Ferruh Yigit 2022-07-26 11:09 ` Huzaifa Rahman 0 siblings, 1 reply; 6+ messages in thread From: Ferruh Yigit @ 2022-05-30 10:42 UTC (permalink / raw) To: Huzaifa Rahman, dev On 5/27/2022 6:14 AM, Huzaifa Rahman wrote: > [CAUTION: External Email] > Hi, > > The following tests are failing but my patch is not related to anything > related to these. Please re-run the tests. > > Failed Tests: > - mtu_update > - scatter > Hi Huzaifa, Agree, it looks unrelated, I will trigger the test again, can please check in ~10 mins. > > Thanks, > > Huzaifa > > > > On Tue, Mar 22, 2022 at 2:36 PM huzaifa.rahman > <huzaifa.rahman@emumba.com <mailto:huzaifa.rahman@emumba.com>> wrote: > > Help command is not available for ethtool example. It is needed so user > can see all the available commands directly from the command line along > with the formats. > > Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com > <mailto:huzaifa.rahman@emumba.com>> > --- > doc/guides/sample_app_ug/ethtool.rst | 1 + > examples/ethtool/ethtool-app/ethapp.c | 38 +++++++++++++++++++++++++++ > examples/ethtool/ethtool-app/ethapp.h | 1 + > 3 files changed, 40 insertions(+) > <...> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] ethtool: added help command to list all available 2022-05-30 10:42 ` Ferruh Yigit @ 2022-07-26 11:09 ` Huzaifa Rahman 0 siblings, 0 replies; 6+ messages in thread From: Huzaifa Rahman @ 2022-07-26 11:09 UTC (permalink / raw) To: Ferruh Yigit; +Cc: dev [-- Attachment #1: Type: text/plain, Size: 1317 bytes --] Hi, Is there any other work/changes required for this patch to be submitted? Thanks On Mon, May 30, 2022 at 3:42 PM Ferruh Yigit <ferruh.yigit@xilinx.com> wrote: > On 5/27/2022 6:14 AM, Huzaifa Rahman wrote: > > [CAUTION: External Email] > > Hi, > > > > The following tests are failing but my patch is not related to anything > > related to these. Please re-run the tests. > > > > Failed Tests: > > - mtu_update > > - scatter > > > > Hi Huzaifa, > > Agree, it looks unrelated, I will trigger the test again, can please > check in ~10 mins. > > > > > Thanks, > > > > Huzaifa > > > > > > > > On Tue, Mar 22, 2022 at 2:36 PM huzaifa.rahman > > <huzaifa.rahman@emumba.com <mailto:huzaifa.rahman@emumba.com>> wrote: > > > > Help command is not available for ethtool example. It is needed so > user > > can see all the available commands directly from the command line > along > > with the formats. > > > > Signed-off-by: huzaifa.rahman <huzaifa.rahman@emumba.com > > <mailto:huzaifa.rahman@emumba.com>> > > --- > > doc/guides/sample_app_ug/ethtool.rst | 1 + > > examples/ethtool/ethtool-app/ethapp.c | 38 > +++++++++++++++++++++++++++ > > examples/ethtool/ethtool-app/ethapp.h | 1 + > > 3 files changed, 40 insertions(+) > > > > <...> > [-- Attachment #2: Type: text/html, Size: 4048 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ethtool: added list command to list all available commands 2022-03-21 14:25 [PATCH] ethtool: added list command to list all available commands huzaifa.rahman 2022-03-22 9:36 ` [PATCH v2] ethtool: added help command to list all available huzaifa.rahman @ 2023-07-03 22:24 ` Stephen Hemminger 1 sibling, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2023-07-03 22:24 UTC (permalink / raw) To: huzaifa.rahman; +Cc: dev, Huzaifa696 On Mon, 21 Mar 2022 19:25:47 +0500 "huzaifa.rahman" <huzaifa.rahman@emumba.com> wrote: > From: Huzaifa696 <huzaifa.rehman696@gmail.com> > > help command is needed so user can see all the available commands directly > from the command line along with the formats. > > Signed-off-by: Huzaifa696 <huzaifa.rehman696@gmail.com> Developer Certificate of Origin is intended to a legal assertion. Therefore you must use your legal name (not alias here). > --- > doc/guides/sample_app_ug/ethtool.rst | 1 + > examples/ethtool/ethtool-app/ethapp.c | 38 +++++++++++++++++++++++++++ > 2 files changed, 39 insertions(+) > > diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst > index 159e9e0639..6e57015170 100644 > --- a/doc/guides/sample_app_ug/ethtool.rst > +++ b/doc/guides/sample_app_ug/ethtool.rst > @@ -58,6 +58,7 @@ they do as follows: > * ``validate``: Check that given MAC address is valid unicast address > * ``vlan``: Add/remove VLAN id > * ``quit``: Exit program > +* ``help``: List all available commands > > > Explanation > diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c > index 78e86534e8..361e2daf9b 100644 > --- a/examples/ethtool/ethtool-app/ethapp.c > +++ b/examples/ethtool/ethtool-app/ethapp.c > @@ -57,6 +57,8 @@ cmdline_parse_token_string_t pcmd_stats_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "stats"); > cmdline_parse_token_string_t pcmd_drvinfo_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "drvinfo"); > +cmdline_parse_token_string_t pcmd_list_token_cmd = > + TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "help"); > cmdline_parse_token_string_t pcmd_link_token_cmd = > TOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, "link"); > > @@ -133,6 +135,11 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode = > cmdline_parse_token_num_t pcmd_vlan_token_vid = > TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, RTE_UINT16); > > +void > +list_cmd(unsigned int sr, const char *name, const char *format, const char *description) > +{ > + printf("%-4d%-17s%-45s%-50s\n", sr, name, format, description); > +} > > static void > pcmd_quit_callback(__rte_unused void *ptr_params, > @@ -142,6 +149,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params, > cmdline_quit(ctx); > } > > +static void > +pcmd_list_callback(__rte_unused void *ptr_params, > + struct cmdline *ctx, > + __rte_unused void *ptr_data) > +{ > + printf("%-4s%-17s%-45s%-50s\n\n", "Sr.", "Name", "Format", "Description"); > + list_cmd(1, "drvinfo", "drvinfo", "Print driver info"); > + list_cmd(2, "open", "open <port_id>", "Open port"); > + list_cmd(3, "pause", "pause <port_id> <all|tx|rx|none>", "Get/set port pause state"); > + list_cmd(4, "stop", "stop <port_id>", "Stop port"); > + list_cmd(5, "portstats", "portstats <port_id>", "Print port statistics"); > + list_cmd(6, "link", "link", "Print port link states"); > + list_cmd(7, "macaddr", "macaddr <port_id> <mac_addr>", "Gets/sets MAC address"); > + list_cmd(8, "mtu", "mtu <port_id> <mtu_value>", "Set NIC MTU"); > + list_cmd(9, "regs", "regs <port_id> <filename>", "Dump port register(s) to file"); > + list_cmd(10, "ringparam", "ringparam <port_id> <tx_param> <rx_param>", "Get/set ring parameters"); > + list_cmd(11, "rxmode", "rxmode <port_id>", "Toggle port Rx mode"); > + list_cmd(12, "validate", "validate <mac_addr>", "Check that given MAC address is valid unicast address"); > + list_cmd(13, "vlan", "vlan <port_id> <add|del> <vlan_id>", "Add/remove VLAN id"); > + list_cmd(14, "eeprom", "eeprom <port_id> <filename>", "Dump EEPROM to file"); > + list_cmd(15, "module-eeprom", "module-eeprom <port_id> <filename>", "Dump plugin module EEPROM to file"); > + list_cmd(16, "quit", "quit", "Exit program"); > + list_cmd(17, "help", "help", "List all available commands"); > +} I think with some additional programming effort. The help command could extract the existing help command strings for this. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-07-03 22:24 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-03-21 14:25 [PATCH] ethtool: added list command to list all available commands huzaifa.rahman 2022-03-22 9:36 ` [PATCH v2] ethtool: added help command to list all available huzaifa.rahman 2022-05-27 5:14 ` Huzaifa Rahman 2022-05-30 10:42 ` Ferruh Yigit 2022-07-26 11:09 ` Huzaifa Rahman 2023-07-03 22:24 ` [PATCH] ethtool: added list command to list all available commands Stephen Hemminger
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.