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 532F41396 for ; Thu, 26 Mar 2015 11:41:04 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 26 Mar 2015 03:41:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,470,1422950400"; d="scan'208";a="546616082" Received: from irsmsx106.ger.corp.intel.com ([163.33.3.31]) by orsmga003.jf.intel.com with ESMTP; 26 Mar 2015 03:41:02 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.49]) by IRSMSX106.ger.corp.intel.com ([163.33.3.31]) with mapi id 14.03.0224.002; Thu, 26 Mar 2015 10:41:01 +0000 From: "Iremonger, Bernard" To: Tetsuya Mukawa , "dev@dpdk.org" Thread-Topic: [PATCH v2 5/6] eal: Use map_idx in pci_uio_map_resource() of bsdapp to work same as linuxapp Thread-Index: AQHQZempdfACrMcb6U2GXKq/FCb7M50tU17AgADAEQCAAIMJIA== Date: Thu, 26 Mar 2015 10:41:00 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C204A027C6@IRSMSX108.ger.corp.intel.com> References: <1426584645-28828-7-git-send-email-mukawa@igel.co.jp> <1427170717-13879-1-git-send-email-mukawa@igel.co.jp> <1427170717-13879-6-git-send-email-mukawa@igel.co.jp> <8CEF83825BEC744B83065625E567D7C204A0245E@IRSMSX108.ger.corp.intel.com> <551373FA.9090001@igel.co.jp> In-Reply-To: <551373FA.9090001@igel.co.jp> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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 v2 5/6] eal: Use map_idx in pci_uio_map_resource() of bsdapp to work same as linuxapp X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2015 10:41:05 -0000 > -----Original Message----- > From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > Sent: Thursday, March 26, 2015 2:51 AM > To: Iremonger, Bernard; dev@dpdk.org > Cc: Richardson, Bruce; david.marchand@6wind.com > Subject: Re: [PATCH v2 5/6] eal: Use map_idx in pci_uio_map_resource() of= bsdapp to work same as > linuxapp >=20 > On 2015/03/26 0:27, Iremonger, Bernard wrote: > > > >> -----Original Message----- > >> From: Tetsuya Mukawa [mailto:mukawa@igel.co.jp] > >> Sent: Tuesday, March 24, 2015 4:19 AM > >> To: dev@dpdk.org > >> Cc: Iremonger, Bernard; Richardson, Bruce; david.marchand@6wind.com; > >> Tetsuya Mukawa > >> Subject: [PATCH v2 5/6] eal: Use map_idx in pci_uio_map_resource() of > >> bsdapp to work same as linuxapp > >> > >> This patch changes code that maps pci resources in bsdapp. > >> Linuxapp has almost same code. To consolidate both, fix > >> implementation of bsdapp to work same as linuxapp. > >> > >> Signed-off-by: Tetsuya Mukawa > >> --- > >> lib/librte_eal/bsdapp/eal/eal_pci.c | 24 ++++++++++++------------ > >> 1 file changed, 12 insertions(+), 12 deletions(-) > >> > >> diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c > >> b/lib/librte_eal/bsdapp/eal/eal_pci.c > >> index 85f8671..08b91b4 100644 > >> --- a/lib/librte_eal/bsdapp/eal/eal_pci.c > >> +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c > >> @@ -195,7 +195,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) > >> static int pci_uio_map_resource(struct rte_pci_device *dev) { > >> - int i, j; > >> + int i, map_idx; > >> char devname[PATH_MAX]; /* contains the /dev/uioX */ > >> void *mapaddr; > >> uint64_t phaddr; > >> @@ -247,31 +247,31 @@ pci_uio_map_resource(struct rte_pci_device *dev) > >> pagesz =3D sysconf(_SC_PAGESIZE); > >> > >> maps =3D uio_res->maps; > >> - for (i =3D uio_res->nb_maps =3D 0; i !=3D PCI_MAX_RESOURCE; i++) { > >> + for (i =3D 0, map_idx =3D 0; i !=3D PCI_MAX_RESOURCE; i++) { > >> > >> - j =3D uio_res->nb_maps; > >> /* skip empty BAR */ > >> if ((phaddr =3D dev->mem_resource[i].phys_addr) =3D=3D 0) > >> continue; > >> > >> /* if matching map is found, then use it */ > >> offset =3D i * pagesz; > >> - maps[j].offset =3D offset; > >> - maps[j].phaddr =3D dev->mem_resource[i].phys_addr; > >> - maps[j].size =3D dev->mem_resource[i].len; > >> - if (maps[j].addr !=3D NULL || > >> - (mapaddr =3D pci_map_resource(NULL, devname, (off_t)offset, > >> - (size_t)maps[j].size) > >> - ) =3D=3D NULL) { > >> + maps[map_idx].offset =3D offset; > >> + maps[map_idx].phaddr =3D dev->mem_resource[i].phys_addr; > >> + maps[map_idx].size =3D dev->mem_resource[i].len; > >> + mapaddr =3D pci_map_resource(NULL, devname, (off_t)offset, > >> + (size_t)maps[map_idx].size); > >> + if ((maps[map_idx].addr !=3D NULL) || (mapaddr =3D=3D NULL)) { > > Hi Tetsuya, > > > > Should be checking for if (mapaddr =3D=3D MAP_FAILED) here. > > Seems to be fixed in patch 6/6 though. >=20 > Hi Bernard, >=20 > Here, bsdapp still has old pci_map_resource(). > Old pci_map_resource() return NULL when mapping is failed. > And this behavior will be changed in 6/6. This is why MAP_FAILED is check= ed in 6/6. >=20 > Regards, > Tetsuya >=20 Hi Tetsuya, Would it make sense to squash patches 5/6 and 6/6 ? Regards, Bernard.