From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 1EC9C1075 for ; Thu, 16 Mar 2017 17:27:07 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP; 16 Mar 2017 09:27:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,173,1486454400"; d="scan'208";a="77850742" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.237.220.122]) ([10.237.220.122]) by fmsmga006.fm.intel.com with ESMTP; 16 Mar 2017 09:27:04 -0700 To: Qi Zhang , jingjing.wu@intel.com, helin.zhang@intel.com References: <20170227045612.48030-1-qi.z.zhang@intel.com> <20170312120845.31666-1-qi.z.zhang@intel.com> <20170312120845.31666-4-qi.z.zhang@intel.com> Cc: dev@dpdk.org, Pablo de Lara From: Ferruh Yigit Message-ID: <18f75650-47bd-e82f-dcc6-c0d4f7000b2a@intel.com> Date: Thu, 16 Mar 2017 16:27:03 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170312120845.31666-4-qi.z.zhang@intel.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v2 3/3] app/testpmd: add CL for ptype mapping configure 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: , X-List-Received-Date: Thu, 16 Mar 2017 16:27:08 -0000 On 3/12/2017 12:08 PM, Qi Zhang wrote: > Add below command line to configure ptype mapping. > ptype mapping get . > ptype mapping replace . > ptype mapping reset . > ptype mapping update . > > Signed-off-by: Qi Zhang > --- > app/test-pmd/cmdline.c | 372 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 372 insertions(+) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 43fc636..85f07ba 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -575,6 +575,18 @@ static void cmd_help_long_parsed(void *parsed_result, > "E-tag set filter del e-tag-id (value) port (port_id)\n" > " Delete an E-tag forwarding filter on a port\n\n" > > + "ptype mapping get (port_id) (valid_only)\n" > + " Get ptype mapping on a port\n\n" > + > + "ptype mapping replace (port_id) (target) (mask) (pky_type)\n" > + " Replace target with the pkt_type in ptype mapping\n\n" > + > + "ptype mapping reset (port_id)\n" > + " Reset ptype mapping on a port\n\n" > + > + "ptype mapping update (port_id) (hw_ptype) (sw_ptype)\n" > + " Update a ptype mapping item on a port\n\n" > + This adds new root level "ptype" command, I think it would be nice to get an Ack from testpmd maintainers for this. testpmd now supports many commands, and I don't know if it is only me, but I am having hard time to find some commands. Perhaps commands can be grouped better. > , list_pkt_forwarding_modes() > ); > } > @@ -12395,6 +12407,362 @@ cmdline_parse_inst_t cmd_set_vf_vlan_tag = { > }, > }; <...> > +static void > +cmd_ptype_mapping_get_parsed( > + void *parsed_result, > + __attribute__((unused)) struct cmdline *cl, > + __attribute__((unused)) void *data) > +{ > + struct cmd_ptype_mapping_get_result *res = parsed_result; > +#ifdef RTE_LIBRTE_I40E_PMD > + int ret = -ENOTSUP; > + int max_ptype_num = 256; > + struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num]; > + uint16_t count; > + int i; > +#endif This will cause a build error if I40E driver not enabled. Only wrapping the API with #ifdef should be enough. > + > + if (port_id_is_invalid(res->port_id, ENABLED_WARN)) > + return; > + > +#ifdef RTE_LIBRTE_I40E_PMD > + ret = rte_pmd_i40e_ptype_mapping_get(res->port_id, > + mapping, > + max_ptype_num, > + &count, > + res->valid_only); > +#endif > + > + switch (ret) { > + case 0: > + break; > + case -ENODEV: > + printf("invalid port_id %d\n", res->port_id); > + break; > + case -ENOTSUP: > + printf("function not implemented\n"); > + break; > + default: > + printf("programming error: (%s)\n", strerror(-ret)); > + } > + > +#ifdef RTE_LIBRTE_I40E_PMD > + if (!ret) { > + for (i = 0; i < count; i++) > + printf("%3d\t0x%08x\n", > + mapping[i].hw_ptype, mapping[i].sw_ptype); > + } > +#endif > +} > + <...>