From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id F1D851E2AB for ; Thu, 14 Jun 2018 12:59:35 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Jun 2018 03:59:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,222,1526367600"; d="scan'208";a="47062256" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga007.fm.intel.com with ESMTP; 14 Jun 2018 03:59:33 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.139]) by IRSMSX101.ger.corp.intel.com ([169.254.1.148]) with mapi id 14.03.0319.002; Thu, 14 Jun 2018 11:59:09 +0100 From: "Iremonger, Bernard" To: Gaetan Rivet , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v7 22/22] app/testpmd: add show device command Thread-Index: AQHT1MxkcRiYr2RwTEaUcQBCxS1l26Rf8eQQ Date: Thu, 14 Jun 2018 10:59:09 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C260CB3577@IRSMSX108.ger.corp.intel.com> References: <1d3660a04c3c1eb1157b78abc45d97d5cfed01fe.1523804657.git.gaetan.rivet@6wind.com> In-Reply-To: <1d3660a04c3c1eb1157b78abc45d97d5cfed01fe.1523804657.git.gaetan.rivet@6wind.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNDBkZTFmMTktZjM2NS00NDNhLWFiN2QtNjU0NTM0NWI2NmJkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiM0tJNUppZFVpMWJlb3JpR0hQSm12VEFlNVlvZlR5OWNQRW5cL3hITVVja0xBZXM1d1d3dFwvZGF5WXBEUlA0dmR6In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 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 v7 22/22] app/testpmd: add show device command 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, 14 Jun 2018 10:59:36 -0000 Hi Gaetan, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Gaetan Rivet > Sent: Sunday, April 15, 2018 4:08 PM > To: dev@dpdk.org > Cc: Gaetan Rivet > Subject: [dpdk-dev] [PATCH v7 22/22] app/testpmd: add show device > command >=20 > A new interactive command is offered: >=20 > show device >=20 > This commands lists all rte_device element matching the device descriptio= n. > e.g.: >=20 > show device bus=3Dpci > show device bus=3Dvdev > show device bus=3Dvdev/class=3Deth > show device bus=3Dvdev,driver=3Dnet_ring/class=3Deth > show device bus=3Dvdev/class=3Deth,name=3Dnet_ring0 >=20 > These devices may not be otherwise useful, some buses will spawn devices > to keep track of their assets without having a driver to use them. >=20 > Signed-off-by: Gaetan Rivet > --- > app/test-pmd/cmdline.c | 52 > ++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 52 insertions(+) >=20 > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index > 40b31ad7e..8ac5fb3ca 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -6701,6 +6701,57 @@ cmdline_parse_inst_t cmd_showportall =3D { > }, > }; >=20 > +/* *** SHOW DEVICE INFO *** */ > +struct cmd_showdevice_result { > + cmdline_fixed_string_t show; > + cmdline_fixed_string_t device; > + cmdline_fixed_string_t filter; > +}; > + > +static void > +cmd_showdevice_dump_device(const struct rte_device *dev) { > + const struct rte_driver *drv =3D dev->driver; > + > + printf("0x%p: %s:%s\n", (const void *)dev, dev->name, > + drv ? drv->name : ""); > +} > + > +static void cmd_showdevice_parsed(void *parsed_result, > + __attribute__((unused)) struct cmdline *cl, > + __attribute__((unused)) void *data) { > + struct cmd_showdevice_result *res =3D parsed_result; > + struct rte_dev_iterator it; > + const struct rte_device *dev; > + > + RTE_DEV_FOREACH(dev, res->filter, &it) > + cmd_showdevice_dump_device(dev); > +} > + > +cmdline_parse_token_string_t cmd_showdevice_show =3D > + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, > + show, "show"); > +cmdline_parse_token_string_t cmd_showdevice_device =3D > + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, > + device, "device"); > +cmdline_parse_token_string_t cmd_showdevice_filter =3D > + TOKEN_STRING_INITIALIZER(struct cmd_showdevice_result, > + filter, NULL); > + > +cmdline_parse_inst_t cmd_showdevice =3D { > + .f =3D cmd_showdevice_parsed, > + .data =3D NULL, > + .help_str =3D "show device " > + "", .help_str should be on one line to avoid checkpatch warning. > + .tokens =3D { > + (void *)&cmd_showdevice_show, > + (void *)&cmd_showdevice_device, > + (void *)&cmd_showdevice_filter, > + NULL, > + }, > +}; > + > /* *** SHOW PORT INFO *** */ > struct cmd_showport_result { > cmdline_fixed_string_t show; > @@ -16038,6 +16089,7 @@ cmdline_parse_ctx_t main_ctx[] =3D { > (cmdline_parse_inst_t *)&cmd_help_long, > (cmdline_parse_inst_t *)&cmd_quit, > (cmdline_parse_inst_t *)&cmd_load_from_file, > + (cmdline_parse_inst_t *)&cmd_showdevice, > (cmdline_parse_inst_t *)&cmd_showport, > (cmdline_parse_inst_t *)&cmd_showqueue, > (cmdline_parse_inst_t *)&cmd_showportall, > -- > 2.11.0 This patch fails to compile on dpdk_18.08.rc0 There should probably be an update to the testpmd documentation also in doc= /guides/testpmd_app_ug/*.rst Regards, Bernard.