From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DD10BA055F; Fri, 27 May 2022 07:14:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 879C540E50; Fri, 27 May 2022 07:14:58 +0200 (CEST) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by mails.dpdk.org (Postfix) with ESMTP id 1150240E25 for ; Fri, 27 May 2022 07:14:57 +0200 (CEST) Received: by mail-lf1-f52.google.com with SMTP id v8so5245321lfd.8 for ; Thu, 26 May 2022 22:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=emumba-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=3KeLIiG+nL3wlsh1yedZaKp3o4sgLEctk4lmuWxYzvY=; b=MivEDBr6pmyfZE5jcCY+xMS3VmzNgf4w3poIXC4BG/B4AOl9r5nN91dIVODN/dK3by vayBfUNZgBFPCKNh5lLVafmqDGj/aYHrzC0vh4/TkTOgrt69lyDMpTbX5vDQLp0qAyPG X5SmRB+2JZo4+s4AXocgoylS1qPQZljtQkbcq9d3yOze1a/K7rj73Pf49ATnUtlP8KHN 19SQw03CmFyPxlTT0cVGFKqlYCRYPD5OqvRCbJjMQ683N50BE72bnK80nCZQh46dd0nW 0LkasCQqjgLwctvZcxKnxBK2YFT/ByNISWtUu5njMtyri9EwQiyqsh7q269fZMHi/EYw F8bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=3KeLIiG+nL3wlsh1yedZaKp3o4sgLEctk4lmuWxYzvY=; b=B/VQoVKQpsdEsl5nOEVsKUBeEcMiQYmlEV2FxC7K8O+LoJgc4czHp1DI54B7Qvxosu ywEAg/KAeypLrpYqjp9uv64oxr41QObQ+atGnNMWGUnWXWq3eYwM5n1U+8S4tSceQSpY IPI+zmUORyBzD2wIy/Tfw2ptfL45dRhPxUMMDMsgbN1PU43b8EsdywBTUOu+uZ1Y7XNq +c685g3YZiVuJu/bZM3BSHyVmc3tQLjvpAVJk+JgbAuH45Uv2LZhs/eyYyZewN76VwNO 8EqFYR1n4pCgUchEu6hhTYaixkmgOYA2hy7z+PYJUx3YAXrvHxEoegnoNtDHb3O5yQRR dYOg== X-Gm-Message-State: AOAM533VWiF0f0JavwPRjM+197YH7FS99PrUdrz6sfuxWmuau1td4d3U mFRY0kupyME1sckfRgmVtMn248Ts4WD0+uGYHldDmuGW1a33wVSJ X-Google-Smtp-Source: ABdhPJySPGR8d5hjl9eYRqj2SoleYYX4Yh05x6UeI5+nsubcyiRXWV7DHbZ+79Y66tmT3+76k2IPsB2brxc2zeMrDaQ= X-Received: by 2002:ac2:482b:0:b0:478:99b0:4bc8 with SMTP id 11-20020ac2482b000000b0047899b04bc8mr10044539lft.344.1653628496306; Thu, 26 May 2022 22:14:56 -0700 (PDT) MIME-Version: 1.0 References: <20220321142547.82966-1-huzaifa.rahman@emumba.com> <20220322093615.260856-1-huzaifa.rahman@emumba.com> In-Reply-To: <20220322093615.260856-1-huzaifa.rahman@emumba.com> From: Huzaifa Rahman Date: Fri, 27 May 2022 10:14:45 +0500 Message-ID: Subject: Re: [PATCH v2] ethtool: added help command to list all available To: dev@dpdk.org Content-Type: multipart/alternative; boundary="0000000000001cf7f805dff76377" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --0000000000001cf7f805dff76377 Content-Type: text/plain; charset="UTF-8" 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 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 > --- > 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 ", "Open port"); > + print_cmd_info(3, "pause", "pause []", > "Get/set port pause state"); > + print_cmd_info(4, "stop", "stop ", "Stop port"); > + print_cmd_info(5, "portstats", "portstats ", "Print port > statistics"); > + print_cmd_info(6, "link", "link", "Print port link states"); > + print_cmd_info(7, "macaddr", "macaddr []", > "Gets/sets MAC address"); > + print_cmd_info(8, "mtu", "mtu ", "Set NIC > MTU"); > + print_cmd_info(9, "regs", "regs ", "Dump port > register(s) to file"); > + print_cmd_info(10, "ringparam", "ringparam [ > ]", "Get/set ring parameters"); > + print_cmd_info(11, "rxmode", "rxmode ", "Toggle port Rx > mode"); > + print_cmd_info(12, "validate", "validate ", "Check that > given MAC address is valid unicast address"); > + print_cmd_info(13, "vlan", "vlan ", > "Add/remove VLAN id"); > + print_cmd_info(14, "eeprom", "eeprom ", "Dump > EEPROM to file"); > + print_cmd_info(15, "module-eeprom", "module-eeprom > ", "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 > > --0000000000001cf7f805dff76377 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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.co= m>
---
=C2=A0doc/guides/sample_app_ug/ethtool.rst=C2=A0 |=C2=A0 1 +
=C2=A0examples/ethtool/ethtool-app/ethapp.c | 38 ++++++++++++++++++++++++++= +
=C2=A0examples/ethtool/ethtool-app/ethapp.h |=C2=A0 1 +
=C2=A03 files changed, 40 insertions(+)

diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_u= g/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:
=C2=A0* ``validate``: Check that given MAC address is valid unicast address=
=C2=A0* ``vlan``: Add/remove VLAN id
=C2=A0* ``quit``: Exit program
+* ``help``: List all available commands


=C2=A0Explanation
diff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethto= ol-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 =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 TOKEN_STRING_INITIALIZER(struct pcmd_get_params= , cmd, "stats");
=C2=A0cmdline_parse_token_string_t pcmd_drvinfo_token_cmd =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 TOKEN_STRING_INITIALIZER(struct pcmd_get_params= , cmd, "drvinfo");
+cmdline_parse_token_string_t pcmd_list_token_cmd =3D
+=C2=A0 =C2=A0 =C2=A0 =C2=A0TOKEN_STRING_INITIALIZER(struct pcmd_get_params= , cmd, "help");
=C2=A0cmdline_parse_token_string_t pcmd_link_token_cmd =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 TOKEN_STRING_INITIALIZER(struct pcmd_get_params= , cmd, "link");

@@ -133,6 +135,11 @@ cmdline_parse_token_string_t pcmd_vlan_token_mode =3D<= br style=3D"user-select: auto;"> =C2=A0cmdline_parse_token_num_t pcmd_vlan_token_vid =3D
=C2=A0 =C2=A0 =C2=A0 =C2=A0 TOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, = vid, RTE_UINT16);

+void
+print_cmd_info(unsigned int sr, const char *name, const char *format, cons= t char *description)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0printf("%-4u%-17s%-45s%-50s\n", sr, n= ame, format, description);
+}

=C2=A0static void
=C2=A0pcmd_quit_callback(__rte_unused void *ptr_params,
@@ -142,6 +149,30 @@ pcmd_quit_callback(__rte_unused void *ptr_params,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cmdline_quit(ctx);
=C2=A0}

+static void
+pcmd_help_callback(__rte_unused void *ptr_params,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__rte_unused struct cmdline *ctx,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0__rte_unused void *ptr_data)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0printf("%-4s%-17s%-45s%-50s\n\n", &qu= ot;Sr.", "Name", "Format", "Description"= );
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(1, "drvinfo", "dr= vinfo", "Print driver info");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(3, "pause", "paus= e <port_id> [<all|tx|rx|none>]", "Get/set port pause = state");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(4, "stop", "stop = <port_id>", "Stop port");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(5, "portstats", "= portstats <port_id>", "Print port statistics");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(6, "link", "link&= quot;, "Print port link states");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(7, "macaddr", "ma= caddr <port_id> [<mac_addr>]", "Gets/sets MAC address= ");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(8, "mtu", "mtu &l= t;port_id> <mtu_value>", "Set NIC MTU");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(9, "regs", "regs = <port_id> <filename>", "Dump port register(s) to file= ");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(10, "ringparam", "= ;ringparam <port_id> [<tx_param> <rx_param>]", "= ;Get/set ring parameters");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(11, "rxmode", "rx= mode <port_id>", "Toggle port Rx mode");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(12, "validate", "= validate <mac_addr>", "Check that given MAC address is vali= d unicast address");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(13, "vlan", "vlan= <port_id> <add|del> <vlan_id>", "Add/remove VL= AN id");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(14, "eeprom", "ee= prom <port_id> <filename>", "Dump EEPROM to file"= ;);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(15, "module-eeprom", &= quot;module-eeprom <port_id> <filename>", "Dump plugi= n module EEPROM to file");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(16, "quit", "quit= ", "Exit program");
+=C2=A0 =C2=A0 =C2=A0 =C2=A0print_cmd_info(17, "help", "help= ", "List all available commands");
+}

=C2=A0static void
=C2=A0pcmd_drvinfo_callback(__rte_unused void *ptr_params,
@@ -680,6 +711,12 @@ cmdline_parse_inst_t pcmd_drvinfo =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .help_str =3D "drvinfo\n=C2=A0 =C2=A0 =C2= =A0Print driver info",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .tokens =3D {(void *)&pcmd_drvinfo_token_cm= d, NULL},
=C2=A0};
+cmdline_parse_inst_t pcmd_help_cmds =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.f =3D pcmd_help_callback,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.data =3D NULL,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.help_str =3D "help\n=C2=A0 =C2=A0 =C2=A0L= ist all available commands",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0.tokens =3D {(void *)&pcmd_list_token_cmd, = NULL},
+};
=C2=A0cmdline_parse_inst_t pcmd_link =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .f =3D pcmd_link_callback,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 .data =3D NULL,
@@ -871,6 +908,7 @@ cmdline_parse_inst_t pcmd_vlan =3D {


=C2=A0cmdline_parse_ctx_t list_prompt_commands[] =3D {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0(cmdline_parse_inst_t *)&pcmd_help_cmds, =C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_drvinfo,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_eeprom,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cmdline_parse_inst_t *)&pcmd_module_eeprom= ,
diff --git a/examples/ethtool/ethtool-app/ethapp.h b/examples/ethtool/ethto= ol-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);
=C2=A0void mark_port_inactive(int idx_port);
=C2=A0void 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

--0000000000001cf7f805dff76377--