DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Liu, Jijiang" <jijiang.liu@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: Stephen Hemminger <shemming@brocade.com>
Subject: Re: [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0
Date: Tue, 10 Mar 2015 07:08:44 +0000	[thread overview]
Message-ID: <1ED644BD7E0A5F4091CF203DAFB8E4CC01DF0E1E@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1424013889-2226-2-git-send-email-shemming@brocade.com>



> -----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
> 
> It is possible to passthrough a PCI device when running in Xen Paravirt mode.
> The device driver has to accomodate by using memory zones differently. This
> patch models the memory allocation for ENIC device based on changes already
> done for ixgbe and igb.
> 
> Build tested only; has not been tested on ENIC hardware.
> ---

Acked-by: Jijiang Liu <Jijiang.liu@intel.com>

> v2 -- this patch is added
> 
>  lib/librte_pmd_enic/enic_main.c     | 19 ++++++++++++++++---
>  lib/librte_pmd_enic/vnic/vnic_dev.c | 19 +++++++++++++++----
>  2 files changed, 31 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/librte_pmd_enic/enic_main.c b/lib/librte_pmd_enic/enic_main.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 = 0;
> 
> -	rz = rte_memzone_reserve_aligned((const char *)name,
> -		size, 0, 0, ENIC_ALIGN);
> +#ifdef RTE_LIBRTE_XEN_DOM0
> +	if (is_xen_dom0_supported())
> +		rz = rte_memzone_reserve_bounded((char *)name, size,
> +					 0, 0, ENIC_ALIGN, RTE_PGSIZE_2M);
> +	else
> +#endif
> +		rz = 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,
>  	}
> 
>  	vaddr = rz->addr;
> -	*dma_handle = (dma_addr_t)rz->phys_addr;
> +
> +#ifdef RTE_LIBRTE_XEN_DOM0
> +	if (is_xen_dom0_supported())
> +		*dma_handle = rte_mem_phy2mch(rz->memseg_id,
> +					      rz->phys_addr);
> +	else
> +#endif
> +		*dma_handle = (dma_addr_t)rz->phys_addr;
> 
>  	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,
> 
>  	vnic_dev_desc_ring_size(ring, desc_count, desc_size);
> 
> -	rz = 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 = rte_memzone_reserve_bounded(z_name, ring-
> >size_unaligned,
> +					 socket_id, 0, ENIC_ALIGN,
> RTE_PGSIZE_2M);
> +	else
> +#endif
> +		rz = rte_memzone_reserve_aligned(z_name, ring-
> >size_unaligned,
> +					 socket_id, 0, ENIC_ALIGN);
>  	if (!rz) {
>  		pr_err("Failed to allocate ring (size=%d), aborting\n",
>  			(int)ring->size);
> @@ -292,7 +297,13 @@ int vnic_dev_alloc_desc_ring(__attribute__((unused))
> struct vnic_dev *vdev,
>  		return -ENOMEM;
>  	}
> 
> -	ring->base_addr_unaligned = (dma_addr_t)rz->phys_addr;
> +#ifdef RTE_LIBRTE_XEN_DOM0
> +	if (is_xen_dom0_supported())
> +		ring->base_addr_unaligned = rte_mem_phy2mch(rz-
> >memseg_id,
> +							    rz->phys_addr);
> +	else
> +#endif
> +		ring->base_addr_unaligned = (dma_addr_t)rz->phys_addr;
> 
>  	ring->base_addr = ALIGN(ring->base_addr_unaligned,
>  		ring->base_align);
> --
> 2.1.4

  reply	other threads:[~2015-03-10  7:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-15 15:24 [dpdk-dev] [PATCH 1/5] xen: allow choosing dom0 support at runtime Stephen Hemminger
2015-02-15 15:24 ` [dpdk-dev] [PATCH 2/5] enic: fix device to work with Xen DOM0 Stephen Hemminger
2015-03-10  7:08   ` Liu, Jijiang [this message]
2015-02-15 15:24 ` [dpdk-dev] [PATCH 3/5] xen: add phys-addr command line argument Stephen Hemminger
2015-02-26  7:55   ` Liu, Jijiang
2015-02-26 16:09     ` Stephen Hemminger
2015-02-15 15:24 ` [dpdk-dev] [PATCH 4/5] xen: add uio driver Stephen Hemminger
2016-03-22  9:55   ` [dpdk-dev] [PATCH v3 0/3] xen: netfront poll mode driver Jan Blunck
2016-03-22  9:55     ` [dpdk-dev] [PATCH v3 1/3] xen: Add UIO kernel driver Jan Blunck
2016-03-22 10:42       ` Thomas Monjalon
2016-03-22 11:04         ` Jan Blunck
2016-03-22 11:27           ` Thomas Monjalon
2016-03-22 14:39             ` Jan Blunck
2016-03-22  9:55     ` [dpdk-dev] [PATCH v3 2/3] xen: Add netfront poll mode driver Jan Blunck
2016-03-22 10:07       ` David Marchand
2016-03-22 10:42         ` Jan Blunck
2016-03-22  9:55     ` [dpdk-dev] [PATCH v3 3/3] xen: Add documentation Jan Blunck
2016-04-20 14:18     ` [dpdk-dev] [PATCH v3 0/3] xen: netfront poll mode driver Bruce Richardson
2016-05-03  9:38       ` Xie, Huawei
2017-02-05 14:44     ` Thomas Monjalon
2017-02-06 14:27       ` Konrad Rzeszutek Wilk
2015-02-15 15:24 ` [dpdk-dev] [PATCH 5/5] xen: net-front " Stephen Hemminger
2015-07-09  0:10 ` [dpdk-dev] [PATCH 1/5] xen: allow choosing dom0 support at runtime Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1ED644BD7E0A5F4091CF203DAFB8E4CC01DF0E1E@SHSMSX101.ccr.corp.intel.com \
    --to=jijiang.liu@intel.com \
    --cc=dev@dpdk.org \
    --cc=shemming@brocade.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).