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 29FCD133F for ; Wed, 22 Mar 2017 02:25:20 +0100 (CET) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP; 21 Mar 2017 18:25:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,202,1486454400"; d="scan'208";a="79188337" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 21 Mar 2017 18:25:19 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 21 Mar 2017 18:25:16 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 21 Mar 2017 18:25:15 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.20]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Wed, 22 Mar 2017 09:24:42 +0800 From: "Zhang, Qi Z" To: "Yigit, Ferruh" , "Wu, Jingjing" , "Zhang, Helin" CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v3 3/3] app/testpmd: add CL for ptype mapping configure Thread-Index: AQHSnwSCF6eUtugdi06Vqo7MB2uMlqGe8nCAgAEkcDA= Date: Wed, 22 Mar 2017 01:24:42 +0000 Message-ID: <039ED4275CED7440929022BC67E706115306A38B@SHSMSX103.ccr.corp.intel.com> References: <20170317104512.25969-1-qi.z.zhang@intel.com> <20170317104512.25969-4-qi.z.zhang@intel.com> <3cacac5b-773a-6e16-23f1-0efb790150e0@intel.com> In-Reply-To: <3cacac5b-773a-6e16-23f1-0efb790150e0@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 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: Wed, 22 Mar 2017 01:25:21 -0000 > -----Original Message----- > From: Yigit, Ferruh > Sent: Tuesday, March 21, 2017 11:54 PM > To: Zhang, Qi Z ; Wu, Jingjing ; > Zhang, Helin > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v3 3/3] app/testpmd: add CL for ptype mapp= ing > configure >=20 > 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 >=20 > <...> >=20 > > +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 =3D parsed_result; > > + int ret =3D -ENOTSUP; > > +#ifdef RTE_LIBRTE_I40E_PMD > > + int max_ptype_num =3D 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 =3D 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 =3D 0; i < count; i++) > > + printf("%3d\t0x%08x\n", > > + mapping[i].hw_ptype, mapping[i].sw_ptype); > > + } > > +#endif >=20 > Why this #ifdef exists? > I thinks only wrapping the API with #ifdef should be enough, like other > commands in this patch? struct rte_pmd_i40e_ptype_mapping defined in rte_pmd_i40e.h and it will only be included when is RTE_LIBRTE_I40E_PMD is enabled in cmdl= ine.c so I can't remove it