From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [PATCH v3 3/3] app/testpmd: add CL for ptype mapping configure Date: Tue, 21 Mar 2017 15:53:33 +0000 Message-ID: <3cacac5b-773a-6e16-23f1-0efb790150e0@intel.com> References: <20170317104512.25969-1-qi.z.zhang@intel.com> <20170317104512.25969-4-qi.z.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: dev@dpdk.org To: Qi Zhang , jingjing.wu@intel.com, helin.zhang@intel.com Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0A2FA3B5 for ; Tue, 21 Mar 2017 16:53:36 +0100 (CET) In-Reply-To: <20170317104512.25969-4-qi.z.zhang@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/17/2017 10:45 AM, 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 <...> > +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; > + int ret = -ENOTSUP; > +#ifdef RTE_LIBRTE_I40E_PMD > + int max_ptype_num = 256; > + struct rte_pmd_i40e_ptype_mapping mapping[max_ptype_num]; > + uint16_t count; > + int i; > +#endif > + > + 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 Why this #ifdef exists? I thinks only wrapping the API with #ifdef should be enough, like other commands in this patch?