From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 964BEA2EFC for ; Mon, 16 Sep 2019 12:48:09 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 991851C029; Mon, 16 Sep 2019 12:48:08 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id DCD001BFF5 for ; Mon, 16 Sep 2019 12:48:05 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Sep 2019 03:48:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,492,1559545200"; d="scan'208";a="188572044" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by orsmga003.jf.intel.com with ESMTP; 16 Sep 2019 03:48:03 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.26]) by IRSMSX101.ger.corp.intel.com ([169.254.1.129]) with mapi id 14.03.0439.000; Mon, 16 Sep 2019 11:48:02 +0100 From: "Iremonger, Bernard" To: "vattunuru@marvell.com" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "Wu, Jingjing" , "thomas@monjalon.net" Thread-Topic: [dpdk-dev] [PATCH v2 1/1] app/testpmd: add console cmd to show port supported ptypes Thread-Index: AQHVafXThfMMnHJfC02r1Rqu0mruB6cuIhuQ Date: Mon, 16 Sep 2019 10:48:02 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260DF840D@IRSMSX108.ger.corp.intel.com> References: <20190901040731.13820-1-vattunuru@marvell.com> <20190913054039.11072-1-vattunuru@marvell.com> In-Reply-To: <20190913054039.11072-1-vattunuru@marvell.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzgwODcyZWUtYWQ0NC00Y2JhLThlMTktNzJkNzY1MDI4M2UyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiR0pzdnJpVlwvcUZWKzRudE1KbFdTZExZZjNSVm5rdkQwNU1xOGFWSlhYMFo4enJFRUkxK0R1Zm53d2JCYTVCazAifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v2 1/1] app/testpmd: add console cmd to show port supported ptypes X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Vamsi, > -----Original Message----- > From: vattunuru@marvell.com [mailto:vattunuru@marvell.com] > Sent: Friday, September 13, 2019 6:41 AM > To: dev@dpdk.org > Cc: Lu, Wenzhuo ; Wu, Jingjing > ; Iremonger, Bernard > ; thomas@monjalon.net; Vamsi Attunuru > > Subject: [dpdk-dev] [PATCH v2 1/1] app/testpmd: add console cmd to show > port supported ptypes >=20 > From: Vamsi Attunuru >=20 > Patch adds a runtime function to display port supported ptypes in differe= nt > layers. >=20 > Signed-off-by: Vamsi Attunuru > --- > V2 Changes: > * Replaced numbers with macros. > * Updated 19.11 release notes with command details. > * Corrected patch title. >=20 > app/test-pmd/cmdline.c | 113 > ++++++++++++++++++++++++++++ > doc/guides/rel_notes/release_19_11.rst | 4 + > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++ > 3 files changed, 124 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 56783aa..c0f77aa 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -238,6 +238,10 @@ static void cmd_help_long_parsed(void > *parsed_result, > " Show Tx metadata value set" > " for a specific port\n\n" >=20 > + "show port (port_id) ptypes\n" > + " Show port supported ptypes" > + " for a specific port\n\n" > + > "show device info (|all)" > " Show general information about devices > probed.\n\n" > ); > @@ -18820,6 +18824,114 @@ cmdline_parse_inst_t > cmd_show_tx_metadata =3D { > }, > }; >=20 > +/* show port supported ptypes */ > + > +/* Common result structure for show port ptypes */ struct > +cmd_show_port_supported_ptypes_result { > + cmdline_fixed_string_t show; > + cmdline_fixed_string_t port; > + portid_t port_id; > + cmdline_fixed_string_t ptypes; > +}; > + > +/* Common CLI fields for show port ptypes */ > +cmdline_parse_token_string_t cmd_show_port_supported_ptypes_show > =3D > + TOKEN_STRING_INITIALIZER > + (struct cmd_show_port_supported_ptypes_result, > + show, "show"); > +cmdline_parse_token_string_t cmd_show_port_supported_ptypes_port =3D > + TOKEN_STRING_INITIALIZER > + (struct cmd_show_port_supported_ptypes_result, > + port, "port"); > +cmdline_parse_token_num_t cmd_show_port_supported_ptypes_port_id > =3D > + TOKEN_NUM_INITIALIZER > + (struct cmd_show_port_supported_ptypes_result, > + port_id, UINT16); > +cmdline_parse_token_string_t > cmd_show_port_supported_ptypes_ptypes =3D > + TOKEN_STRING_INITIALIZER > + (struct cmd_show_port_supported_ptypes_result, > + ptypes, "ptypes"); > + > +static void > +cmd_show_port_supported_ptypes_parsed( > + void *parsed_result, > + __attribute__((unused)) struct cmdline *cl, > + __attribute__((unused)) void *data) > +{ > +#define RSVD_PTYPE_MASK 0xf0000000 > +#define MAX_PTYPES_PER_LAYER 16 > +#define LTYPE_NAMESIZE 32 > +#define PTYPE_NAMESIZE 256 > + struct cmd_show_port_supported_ptypes_result *res =3D > parsed_result; > + char buf[PTYPE_NAMESIZE], ltype[LTYPE_NAMESIZE]; > + uint32_t ptype_mask =3D RTE_PTYPE_L2_MASK; > + uint32_t ptypes[MAX_PTYPES_PER_LAYER]; > + uint16_t port_id =3D res->port_id; > + int ret, i; > + > + ret =3D rte_eth_dev_get_supported_ptypes(port_id, ptype_mask, > NULL, 0); > + if (ret < 0) > + return; > + > + while (ptype_mask !=3D RSVD_PTYPE_MASK) { > + > + switch (ptype_mask) { > + case RTE_PTYPE_L2_MASK: > + strlcpy(ltype, "L2", sizeof(ltype)); > + break; > + case RTE_PTYPE_L3_MASK: > + strlcpy(ltype, "L3", sizeof(ltype)); > + break; > + case RTE_PTYPE_L4_MASK: > + strlcpy(ltype, "L4", sizeof(ltype)); > + break; > + case RTE_PTYPE_TUNNEL_MASK: > + strlcpy(ltype, "Tunnel", sizeof(ltype)); > + break; > + case RTE_PTYPE_INNER_L2_MASK: > + strlcpy(ltype, "Inner L2", sizeof(ltype)); > + break; > + case RTE_PTYPE_INNER_L3_MASK: > + strlcpy(ltype, "Inner L3", sizeof(ltype)); > + break; > + case RTE_PTYPE_INNER_L4_MASK: > + strlcpy(ltype, "Inner L4", sizeof(ltype)); > + break; > + default: > + return; > + } > + > + ret =3D rte_eth_dev_get_supported_ptypes(res->port_id, > + ptype_mask, ptypes, > + > MAX_PTYPES_PER_LAYER); > + > + if (ret > 0) > + printf("Supported %s ptypes:\n", ltype); > + else > + printf("%s ptypes unsupported\n", ltype); > + > + for (i =3D 0; i < ret; ++i) { > + rte_get_ptype_name(ptypes[i], buf, sizeof(buf)); > + printf("%s\n", buf); > + } > + > + ptype_mask <<=3D 4; > + } > +} > + > +cmdline_parse_inst_t cmd_show_port_supported_ptypes =3D { > + .f =3D cmd_show_port_supported_ptypes_parsed, > + .data =3D NULL, > + .help_str =3D "show port ptypes", > + .tokens =3D { > + (void *)&cmd_show_port_supported_ptypes_show, > + (void *)&cmd_show_port_supported_ptypes_port, > + (void *)&cmd_show_port_supported_ptypes_port_id, > + (void *)&cmd_show_port_supported_ptypes_ptypes, > + NULL, > + }, > +}; > + > /* > ********************************************************** > ********************** */ >=20 > /* list of instructions */ > @@ -19058,6 +19170,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (cmdline_parse_inst_t *)&cmd_clear_input_set, > (cmdline_parse_inst_t *)&cmd_show_vf_stats, > (cmdline_parse_inst_t *)&cmd_clear_vf_stats, > + (cmdline_parse_inst_t *)&cmd_show_port_supported_ptypes, > (cmdline_parse_inst_t *)&cmd_ptype_mapping_get, > (cmdline_parse_inst_t *)&cmd_ptype_mapping_replace, > (cmdline_parse_inst_t *)&cmd_ptype_mapping_reset, diff --git > a/doc/guides/rel_notes/release_19_11.rst > b/doc/guides/rel_notes/release_19_11.rst > index 8490d89..61e726c 100644 > --- a/doc/guides/rel_notes/release_19_11.rst > +++ b/doc/guides/rel_notes/release_19_11.rst > @@ -56,6 +56,10 @@ New Features > Also, make sure to start the actual text at the margin. >=20 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D >=20 > +* **Added ability to print port supported ptypes on testpmd app.** Suggest rewording above line to something like the following: * **Added command to print port supported ptypes to testpmd application.** > + > + Added a console command to testpmd app, ``show port (port_id) > + ptypes`` which gives ability to print port supported ptypes in differe= nt > protocol layers. >=20 > Removed Items > ------------- > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 313e070..1acd958 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -467,6 +467,13 @@ Show Tx metadata value set for a specific port:: >=20 > testpmd> show port (port_id) tx_metadata >=20 > +show port supported ptypes > +~~~~~~~~~~~~~~~~~~~~~~~~~~ > + > +Show ptypes supported for a specific port:: > + > + testpmd> show port (port_id) ptypes > + > show device info > ~~~~~~~~~~~~~~~~ >=20 > -- > 2.8.4 Regards, Bernard.