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 951E9A034E; Thu, 7 Nov 2019 13:28:01 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1679A1E9DE; Thu, 7 Nov 2019 13:28:01 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 2820D1E9D1 for ; Thu, 7 Nov 2019 13:27:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 04:27:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,278,1569308400"; d="scan'208";a="233243399" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by fmsmga002.fm.intel.com with ESMTP; 07 Nov 2019 04:27:57 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.131]) by IRSMSX106.ger.corp.intel.com ([169.254.8.185]) with mapi id 14.03.0439.000; Thu, 7 Nov 2019 12:27:56 +0000 From: "Iremonger, Bernard" To: "Iremonger, Bernard" , "pbhagavatula@marvell.com" , "Yigit, Ferruh" , "arybchenko@solarflare.com" , "jerinj@marvell.com" , "thomas@monjalon.net" , "Lu, Wenzhuo" , "Wu, Jingjing" , "Mcnamara, John" , "Kovacevic, Marko" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v16 8/8] app/testpmd: add command to set supported ptype mask Thread-Index: AQHVlNckWqswXl6VzkC+ZF9cXpw77Kd/muqwgAAGfkA= Date: Thu, 7 Nov 2019 12:27:56 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260E22EB4@IRSMSX108.ger.corp.intel.com> References: <20191029153722.4547-1-pbhagavatula@marvell.com> <20191106191803.15098-1-pbhagavatula@marvell.com> <20191106191803.15098-9-pbhagavatula@marvell.com> <8CEF83825BEC744B83065625E567D7C260E22E87@IRSMSX108.ger.corp.intel.com> In-Reply-To: <8CEF83825BEC744B83065625E567D7C260E22E87@IRSMSX108.ger.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTc4YjUxMjYtMWMxMC00NTg2LTkwNzQtYTQxMzhkYzA1NTdkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoid2dvZllrZ1JLMUgxK1J3T3B6dmhSXC9NQTVKemdZNTViRnZERzNyT2VVakw0OGZySHlORTdzaDdISzFJREk1eWEifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v16 8/8] app/testpmd: add command to set supported ptype mask 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 Pavin, > > Subject: [dpdk-dev] [PATCH v16 8/8] app/testpmd: add command to set > > supported ptype mask > > > > From: Pavan Nikhilesh > > > > Add command to set supported ptype mask. > > Usage: > > set port ptype_mask > > > > Disable ptype parsing by default. > > > > Signed-off-by: Pavan Nikhilesh > > --- > > app/test-pmd/cmdline.c | 83 +++++++++++++++++++++ > > app/test-pmd/testpmd.c | 5 ++ > > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 ++ > > 3 files changed, 95 insertions(+) > > > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > > 49c45a3f0..7af2c58c3 100644 > > --- a/app/test-pmd/cmdline.c > > +++ b/app/test-pmd/cmdline.c >=20 > The help text should be updated to describe the new command at line 240 i= n > cmdline.c >=20 > > @@ -668,6 +668,9 @@ static void cmd_help_long_parsed(void > > *parsed_result, > > "ptype mapping update (port_id) (hw_ptype) > (sw_ptype)\n" > > " Update a ptype mapping item on a port\n\n" > > > > + "set port (port_id) ptype_mask (ptype_mask)\n" > > + " set packet types classification for a specific > > port\n\n" > > + > > "set port (port_id) queue-region region_id (value) " > > "queue_start_index (value) queue_num (value)\n" > > " Set a queue region on a port\n\n" > > @@ -18916,6 +18919,85 @@ cmdline_parse_inst_t > > cmd_show_port_supported_ptypes =3D { > > }, > > }; > > > > +/* Common result structure for set port ptypes */ struct > > +cmd_set_port_ptypes_result { > > + cmdline_fixed_string_t set; > > + cmdline_fixed_string_t port; > > + portid_t port_id; > > + cmdline_fixed_string_t ptype_mask; > > + uint32_t mask; > > +}; > > + > > +/* Common CLI fields for set port ptypes */ > > +cmdline_parse_token_string_t cmd_set_port_ptypes_set =3D > > + TOKEN_STRING_INITIALIZER > > + (struct cmd_set_port_ptypes_result, > > + set, "set"); > > +cmdline_parse_token_string_t cmd_set_port_ptypes_port =3D > > + TOKEN_STRING_INITIALIZER > > + (struct cmd_set_port_ptypes_result, > > + port, "port"); > > +cmdline_parse_token_num_t cmd_set_port_ptypes_port_id =3D > > + TOKEN_NUM_INITIALIZER > > + (struct cmd_set_port_ptypes_result, > > + port_id, UINT16); > > +cmdline_parse_token_string_t cmd_set_port_ptypes_mask_str =3D > > + TOKEN_STRING_INITIALIZER > > + (struct cmd_set_port_ptypes_result, > > + ptype_mask, "ptype_mask"); > > +cmdline_parse_token_num_t cmd_set_port_ptypes_mask_u32 =3D > > + TOKEN_NUM_INITIALIZER > > + (struct cmd_set_port_ptypes_result, > > + mask, UINT32); > > + > > +static void > > +cmd_set_port_ptypes_parsed( > > + void *parsed_result, > > + __attribute__((unused)) struct cmdline *cl, > > + __attribute__((unused)) void *data) > > +{ > > + struct cmd_set_port_ptypes_result *res =3D parsed_result; > > +#define PTYPE_NAMESIZE 256 > > + char ptype_name[PTYPE_NAMESIZE]; > > + uint16_t port_id =3D res->port_id; > > + uint32_t ptype_mask =3D res->mask; > > + int ret, i; > > + > > + ret =3D rte_eth_dev_get_supported_ptypes(port_id, ptype_mask, > > NULL, 0); The last 2 parameters to the above function do not look correct, here is th= e function declaration: int rte_eth_dev_get_supported_ptypes(uint16_t port_id, uint32_t ptype_mask,= uint32_t *ptypes, int num); ptypes should be a pointer to an array to hold the ptypes, and num should b= e the size of the array. > > + if (ret <=3D 0) { > > + printf("Port %d doesn't support any ptypes.\n", port_id); > > + return; > > + } > > + > > + uint32_t ptypes[ret]; The above declaration can then be moved to the top of the function with the= other declarations. > > + > > + ret =3D rte_eth_dev_set_ptypes(port_id, ptype_mask, ptypes, ret); > > + if (ret <=3D 0) { > > + printf("Unable to set requested ptypes for Port %d\n", > > port_id); > > + return; > > + } > > + > > + printf("Successfully set following ptypes for Port %d\n", port_id); > > + for (i =3D 0; i < ret && ptypes[i] !=3D RTE_PTYPE_UNKNOWN; i++) { > > + rte_get_ptype_name(ptypes[i], ptype_name, > > sizeof(ptype_name)); > > + printf("%s\n", ptype_name); > > + } > > +} > > + > > +cmdline_parse_inst_t cmd_set_port_ptypes =3D { > > + .f =3D cmd_set_port_ptypes_parsed, > > + .data =3D NULL, > > + .help_str =3D "set port ptype_mask ", > > + .tokens =3D { > > + (void *)&cmd_set_port_ptypes_set, > > + (void *)&cmd_set_port_ptypes_port, > > + (void *)&cmd_set_port_ptypes_port_id, > > + (void *)&cmd_set_port_ptypes_mask_str, > > + (void *)&cmd_set_port_ptypes_mask_u32, > > + NULL, > > + }, > > +}; > > + > > /* > > > ********************************************************** > > ********************** */ > > > > /* list of instructions */ > > @@ -19155,6 +19237,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > > (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_set_port_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/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > > 5ba974162..812aebf35 100644 > > --- a/app/test-pmd/testpmd.c > > +++ b/app/test-pmd/testpmd.c > > @@ -2024,6 +2024,7 @@ start_port(portid_t pid) > > queueid_t qi; > > struct rte_port *port; > > struct rte_ether_addr mac_addr; > > + static uint8_t clr_ptypes =3D 1; > > > > if (port_id_is_invalid(pid, ENABLED_WARN)) > > return 0; > > @@ -2153,6 +2154,10 @@ start_port(portid_t pid) > > } > > } > > configure_rxtx_dump_callbacks(verbose_level); > > + if (clr_ptypes) { > > + clr_ptypes =3D 0; > > + rte_eth_dev_set_ptypes(pi, > > RTE_PTYPE_UNKNOWN, NULL, 0); > > + } > > /* start port */ > > if (rte_eth_dev_start(pi) < 0) { > > printf("Fail to start port %d\n", pi); diff --git > > a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > index c68a742eb..f78ac9444 100644 > > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > > @@ -472,6 +472,13 @@ Show ptypes supported for a specific port:: > > > > testpmd> show port (port_id) ptypes > > > > +set port supported ptypes > > +~~~~~~~~~~~~~~~~~~~~~~~~~ > > + > > +set packet types classification for a specific port:: > > + > > + testpmd> set port (port_id) ptypes_mask (mask) > > + > > show device info > > ~~~~~~~~~~~~~~~~ > > > > -- > > 2.17.1 Regards, =20 Bernard.