From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 611BE9A8E for ; Tue, 10 Mar 2015 08:09:20 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP; 10 Mar 2015 00:03:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,373,1422950400"; d="scan'208";a="465015958" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by FMSMGA003.fm.intel.com with ESMTP; 10 Mar 2015 00:02:37 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 10 Mar 2015 15:08:52 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.150]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.144]) with mapi id 14.03.0224.002; Tue, 10 Mar 2015 15:08:45 +0800 From: "Liu, Jijiang" To: Stephen Hemminger , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0 Thread-Index: AQHQSTOgEw+glJYbjUC1Wa2f/211uJ0VbzQQ Date: Tue, 10 Mar 2015 07:08:44 +0000 Message-ID: <1ED644BD7E0A5F4091CF203DAFB8E4CC01DF0E1E@SHSMSX101.ccr.corp.intel.com> References: <1424013889-2226-1-git-send-email-shemming@brocade.com> <1424013889-2226-2-git-send-email-shemming@brocade.com> In-Reply-To: <1424013889-2226-2-git-send-email-shemming@brocade.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 Cc: Stephen Hemminger Subject: Re: [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0 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: Tue, 10 Mar 2015 07:09:21 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger > Sent: Sunday, February 15, 2015 11:25 PM > To: dev@dpdk.org > Cc: Stephen Hemminger > Subject: [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0 >=20 > It is possible to passthrough a PCI device when running in Xen Paravirt m= ode. > The device driver has to accomodate by using memory zones differently. Th= is > patch models the memory allocation for ENIC device based on changes alrea= dy > done for ixgbe and igb. >=20 > Build tested only; has not been tested on ENIC hardware. > --- Acked-by: Jijiang Liu > v2 -- this patch is added >=20 > lib/librte_pmd_enic/enic_main.c | 19 ++++++++++++++++--- > lib/librte_pmd_enic/vnic/vnic_dev.c | 19 +++++++++++++++---- > 2 files changed, 31 insertions(+), 7 deletions(-) >=20 > diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_m= ain.c > index 48fdca2..0be5172 100644 > --- a/lib/librte_pmd_enic/enic_main.c > +++ b/lib/librte_pmd_enic/enic_main.c > @@ -537,8 +537,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_= t > size, > const struct rte_memzone *rz; > *dma_handle =3D 0; >=20 > - rz =3D rte_memzone_reserve_aligned((const char *)name, > - size, 0, 0, ENIC_ALIGN); > +#ifdef RTE_LIBRTE_XEN_DOM0 > + if (is_xen_dom0_supported()) > + rz =3D rte_memzone_reserve_bounded((char *)name, size, > + 0, 0, ENIC_ALIGN, RTE_PGSIZE_2M); > + else > +#endif > + rz =3D rte_memzone_reserve_aligned((char *)name, size, > + 0, 0, ENIC_ALIGN); > if (!rz) { > pr_err("%s : Failed to allocate memory requested for %s", > __func__, name); > @@ -546,7 +552,14 @@ enic_alloc_consistent(__rte_unused void *priv, size_= t > size, > } >=20 > vaddr =3D rz->addr; > - *dma_handle =3D (dma_addr_t)rz->phys_addr; > + > +#ifdef RTE_LIBRTE_XEN_DOM0 > + if (is_xen_dom0_supported()) > + *dma_handle =3D rte_mem_phy2mch(rz->memseg_id, > + rz->phys_addr); > + else > +#endif > + *dma_handle =3D (dma_addr_t)rz->phys_addr; >=20 > return vaddr; > } > diff --git a/lib/librte_pmd_enic/vnic/vnic_dev.c > b/lib/librte_pmd_enic/vnic/vnic_dev.c > index 6407994..e660aaf 100644 > --- a/lib/librte_pmd_enic/vnic/vnic_dev.c > +++ b/lib/librte_pmd_enic/vnic/vnic_dev.c > @@ -276,9 +276,14 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused)) > struct vnic_dev *vdev, >=20 > vnic_dev_desc_ring_size(ring, desc_count, desc_size); >=20 > - rz =3D rte_memzone_reserve_aligned(z_name, > - ring->size_unaligned, socket_id, > - 0, ENIC_ALIGN); > +#ifdef RTE_LIBRTE_XEN_DOM0 > + if (is_xen_dom0_supported()) > + rz =3D rte_memzone_reserve_bounded(z_name, ring- > >size_unaligned, > + socket_id, 0, ENIC_ALIGN, > RTE_PGSIZE_2M); > + else > +#endif > + rz =3D rte_memzone_reserve_aligned(z_name, ring- > >size_unaligned, > + socket_id, 0, ENIC_ALIGN); > if (!rz) { > pr_err("Failed to allocate ring (size=3D%d), aborting\n", > (int)ring->size); > @@ -292,7 +297,13 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused)) > struct vnic_dev *vdev, > return -ENOMEM; > } >=20 > - ring->base_addr_unaligned =3D (dma_addr_t)rz->phys_addr; > +#ifdef RTE_LIBRTE_XEN_DOM0 > + if (is_xen_dom0_supported()) > + ring->base_addr_unaligned =3D rte_mem_phy2mch(rz- > >memseg_id, > + rz->phys_addr); > + else > +#endif > + ring->base_addr_unaligned =3D (dma_addr_t)rz->phys_addr; >=20 > ring->base_addr =3D ALIGN(ring->base_addr_unaligned, > ring->base_align); > -- > 2.1.4