From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id BD6BDA0096 for ; Wed, 5 Jun 2019 05:11:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C7F71B94D; Wed, 5 Jun 2019 05:11:11 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A88282AB for ; Wed, 5 Jun 2019 05:11:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 20:11:08 -0700 X-ExtLoop1: 1 Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga006.jf.intel.com with ESMTP; 04 Jun 2019 20:11:08 -0700 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 20:11:08 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.408.0; Tue, 4 Jun 2019 20:11:07 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.120]) with mapi id 14.03.0415.000; Wed, 5 Jun 2019 11:11:05 +0800 From: "Li, Xiaoyun" To: "Ye, Xiaolong" CC: "Wu, Jingjing" , "Wiles, Keith" , "Liang, Cunming" , "Maslekar, Omkar" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for ntb Thread-Index: AQHVGejlkP1iUW2xJEm5zaROxaK52aaKqrCAgAG3RuA= Date: Wed, 5 Jun 2019 03:11:04 +0000 Message-ID: References: <20190603084611.40931-1-xiaoyun.li@intel.com> <20190603084611.40931-5-xiaoyun.li@intel.com> <20190604084841.GA96452@intel.com> In-Reply-To: <20190604084841.GA96452@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 4/6] examples/ntb: enable an example for ntb 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 > -----Original Message----- > From: Ye, Xiaolong > Sent: Tuesday, June 4, 2019 16:49 > To: Li, Xiaoyun > Cc: Wu, Jingjing ; Wiles, Keith ; > Liang, Cunming ; Maslekar, Omkar > ; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 4/6] examples/ntb: enable an example for n= tb > > [snip] >=20 > >--- > >+ > >+int > >+main(int argc, char **argv) > >+{ > >+ int ret, i; > >+ > >+ signal(SIGINT, signal_handler); > >+ signal(SIGTERM, signal_handler); > >+ > >+ ret =3D rte_eal_init(argc, argv); > >+ if (ret < 0) > >+ rte_exit(EXIT_FAILURE, "Error with EAL initialization.\n"); > >+ > >+ /* Find 1st ntb rawdev. */ > >+ for (i =3D 0; i < RTE_RAWDEV_MAX_DEVS; i++) > >+ if (rte_rawdevs[i].driver_name && > >+ (strncmp(rte_rawdevs[i].driver_name, "raw_ntb", 7) =3D=3D 0) && > >+ (rte_rawdevs[i].attached =3D=3D 1)) > >+ break; >=20 > Can replace above code block with rawdev API rte_rawdev_get_dev_id. >=20 In fact, I've considered this API. But this API uses name (device name) not= driver name to identify device and it uses strcmp not strncmp. But I want the first device who driver is ''raw_ntb". The device name is se= t to "NTB:[bus]:[dev].[func]" which is specific to the device. > Thanks, > Xiaolong >=20 > >+ > >+ if (i =3D=3D RTE_RAWDEV_MAX_DEVS) > >+ rte_exit(EXIT_FAILURE, "Cannot find any ntb device.\n"); > >+ > >+ dev_id =3D i; > >+ > >+ argc -=3D ret; > >+ argv +=3D ret; > >+ > >+ ret =3D parse_args(argc, argv); > >+ if (ret < 0) > >+ rte_exit(EXIT_FAILURE, "Invalid arguments\n"); > >+ > >+ rte_rawdev_start(dev_id); > >+ > >+ if (interactive) { > >+ sleep(1); > >+ prompt(); > >+ } > >+ > >+ return 0; > >+} > >-- > >2.17.1 > >