From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 400FF6841 for ; Mon, 4 Sep 2017 17:44:08 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Sep 2017 08:44:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,475,1498546800"; d="scan'208";a="1214549807" Received: from irsmsx108.ger.corp.intel.com ([163.33.3.3]) by fmsmga002.fm.intel.com with ESMTP; 04 Sep 2017 08:44:05 -0700 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX108.ger.corp.intel.com (163.33.3.3) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 4 Sep 2017 16:44:04 +0100 Received: from irsmsx109.ger.corp.intel.com ([169.254.13.28]) by irsmsx112.ger.corp.intel.com ([169.254.1.110]) with mapi id 14.03.0319.002; Mon, 4 Sep 2017 16:44:04 +0100 From: "Burakov, Anatoly" To: Santosh Shukla , "dev@dpdk.org" CC: "thomas@monjalon.net" , "jerin.jacob@caviumnetworks.com" , "hemant.agrawal@nxp.com" , "olivier.matz@6wind.com" , "maxime.coquelin@redhat.com" , "Gonzalez Monroy, Sergio" , "Richardson, Bruce" , "shreyansh.jain@nxp.com" , "gaetan.rivet@6wind.com" , "stephen@networkplumber.org" , "aconole@redhat.com" Thread-Topic: [PATCH v7 9/9] eal/rte_malloc: honor iova mode in virt2phy Thread-Index: AQHTIgkb6+lN5gx5JkyWqKNmOrKAFKKk5Ncg Date: Mon, 4 Sep 2017 15:44:03 +0000 Message-ID: References: <20170814161059.6684-1-santosh.shukla@caviumnetworks.com> <20170831032618.7120-1-santosh.shukla@caviumnetworks.com> <20170831032618.7120-10-santosh.shukla@caviumnetworks.com> In-Reply-To: <20170831032618.7120-10-santosh.shukla@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_IC x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNGNjZWMxODItMzFmYi00OGQwLWIyNDEtMjEwOTUxYWUxY2QzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IlZlem16SmM2NmN0NEF6MGNhenZXNGMwVUhMem91RkpJeTBNVXk5d0VlZVk9In0= dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v7 9/9] eal/rte_malloc: honor iova mode in virt2phy 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: Mon, 04 Sep 2017 15:44:08 -0000 > From: Santosh Shukla [mailto:santosh.shukla@caviumnetworks.com] > Sent: Thursday, August 31, 2017 4:26 AM > To: dev@dpdk.org > Cc: thomas@monjalon.net; jerin.jacob@caviumnetworks.com; > hemant.agrawal@nxp.com; olivier.matz@6wind.com; > maxime.coquelin@redhat.com; Gonzalez Monroy, Sergio > ; Richardson, Bruce > ; shreyansh.jain@nxp.com; > gaetan.rivet@6wind.com; Burakov, Anatoly ; > stephen@networkplumber.org; aconole@redhat.com; Santosh Shukla > > Subject: [PATCH v7 9/9] eal/rte_malloc: honor iova mode in virt2phy >=20 > Check iova mode and accordingly return phy addr. >=20 > Signed-off-by: Santosh Shukla > Signed-off-by: Jerin Jacob > Reviewed-by: Maxime Coquelin > --- > lib/librte_eal/common/rte_malloc.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_eal/common/rte_malloc.c > b/lib/librte_eal/common/rte_malloc.c > index 5c0627bf4..d65c05a4d 100644 > --- a/lib/librte_eal/common/rte_malloc.c > +++ b/lib/librte_eal/common/rte_malloc.c > @@ -251,10 +251,17 @@ rte_malloc_set_limit(__rte_unused const char > *type, phys_addr_t rte_malloc_virt2phy(const void *addr) { > + phys_addr_t paddr; > const struct malloc_elem *elem =3D malloc_elem_from_data(addr); > if (elem =3D=3D NULL) > return RTE_BAD_PHYS_ADDR; > if (elem->ms->phys_addr =3D=3D RTE_BAD_PHYS_ADDR) > return RTE_BAD_PHYS_ADDR; > - return elem->ms->phys_addr + ((uintptr_t)addr - (uintptr_t)elem- > >ms->addr); > + > + if (rte_eal_iova_mode() =3D=3D RTE_IOVA_VA) > + paddr =3D (uintptr_t)addr; > + else > + paddr =3D elem->ms->phys_addr + > + ((uintptr_t)addr - (uintptr_t)elem->ms->addr); > + return paddr; > } Hi Santosh, I think there's a RTE_PTR_DIFF macro for stuff like this, but otherwise Reviewed-by: Anatoly Burakov