From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AE0E97EC4 for ; Thu, 6 Nov 2014 15:59:29 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 06 Nov 2014 07:06:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.07,326,1413270000"; d="scan'208";a="627700805" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by fmsmga002.fm.intel.com with ESMTP; 06 Nov 2014 07:06:29 -0800 Received: from irsmsx154.ger.corp.intel.com (163.33.192.96) by IRSMSX103.ger.corp.intel.com (163.33.3.157) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 6 Nov 2014 15:06:26 +0000 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.82]) by IRSMSX154.ger.corp.intel.com ([169.254.12.116]) with mapi id 14.03.0195.001; Thu, 6 Nov 2014 15:06:26 +0000 From: "De Lara Guarch, Pablo" To: lxu Thread-Topic: [dpdk-dev] [PATCH v3] eal: map uio resources after hugepages when the base_virtaddr is configured. Thread-Index: AQHP+dClwryncorqn0ab/daQ87YWkJxTspsA Date: Thu, 6 Nov 2014 15:06:25 +0000 Message-ID: References: <1415193919-17361-1-git-send-email-liang.xu@cinfotech.cn> <1415285223-7662-1-git-send-email-liang.xu@cinfotech.cn> In-Reply-To: <1415285223-7662-1-git-send-email-liang.xu@cinfotech.cn> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH v3] eal: map uio resources after hugepages when the base_virtaddr is configured. 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, 06 Nov 2014 14:59:30 -0000 Include at least signoff. > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of lxu > Sent: Thursday, November 06, 2014 2:47 PM > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH v3] eal: map uio resources after hugepages > when the base_virtaddr is configured. >=20 > --- > lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 29 > ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > index 7e62266..3a218d0 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c > @@ -273,6 +273,24 @@ pci_get_uio_dev(struct rte_pci_device *dev, char > *dstbuf, > return uio_num; > } >=20 > +static inline const struct rte_memseg * > +get_physmem_last(void) > +{ > + const struct rte_memseg * seg =3D rte_eal_get_physmem_layout(); > + const struct rte_memseg * last =3D seg; > + unsigned i =3D 0; > + > + for (i=3D0; i + if (seg->addr =3D=3D NULL) > + break; > + > + if(seg->addr > last->addr) > + last =3D seg; > + > + } > + return last; > +} > + > /* map the PCI resource of a PCI device in virtual memory */ > int > pci_uio_map_resource(struct rte_pci_device *dev) > @@ -290,6 +308,13 @@ pci_uio_map_resource(struct rte_pci_device *dev) > struct mapped_pci_resource *uio_res; > struct pci_map *maps; >=20 > + /* map uio resource into user required virtual address */ > + static void * requested_addr; > + if (internal_config.base_virtaddr && NULL =3D=3D requested_addr) { > + const struct rte_memseg * last =3D get_physmem_last(); > + requested_addr =3D RTE_PTR_ADD(last->addr, last->len); > + } > + > dev->intr_handle.fd =3D -1; > dev->intr_handle.type =3D RTE_INTR_HANDLE_UNKNOWN; >=20 > @@ -371,10 +396,12 @@ pci_uio_map_resource(struct rte_pci_device *dev) > if (maps[j].addr !=3D NULL) > fail =3D 1; > else { > - mapaddr =3D pci_map_resource(NULL, fd, > (off_t)offset, > + mapaddr =3D > pci_map_resource(requested_addr, fd, (off_t)offset, > (size_t)maps[j].size); > if (mapaddr =3D=3D NULL) > fail =3D 1; > + else if (NULL !=3D requested_addr) > + requested_addr =3D (uint8_t > *)mapaddr + maps[j].size; > } >=20 > if (fail) { > -- > 1.9.1