[dpdk-dev,37/41] net/enic: use contiguous allocation for DMA memory

Message ID 02c5ec20a2faa96f18dc58f869a330475c0bb018.1520083504.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Anatoly Burakov March 3, 2018, 1:46 p.m. UTC
  Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---

Notes:
    It is not 100% clear that second call to memzone_reserve
    is allocating DMA memory. Corrections welcome.

 drivers/net/enic/enic_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

John Daley (johndale) March 5, 2018, 7:45 p.m. UTC | #1
Hi Anatoly,
Looks good, see inline for details.
Acked-by: John Daley <johndale@cisco.com>

Thanks,
John

> -----Original Message-----
> From: Anatoly Burakov [mailto:anatoly.burakov@intel.com]
> Sent: Saturday, March 03, 2018 5:46 AM
> To: dev@dpdk.org
> Cc: John Daley (johndale) <johndale@cisco.com>; Hyong Youb Kim (hyonkim)
> <hyonkim@cisco.com>; keith.wiles@intel.com; jianfeng.tan@intel.com;
> andras.kovacs@ericsson.com; laszlo.vadkeri@ericsson.com;
> benjamin.walker@intel.com; bruce.richardson@intel.com;
> thomas@monjalon.net; konstantin.ananyev@intel.com;
> kuralamudhan.ramakrishnan@intel.com; louise.m.daly@intel.com;
> nelio.laranjeiro@6wind.com; yskoh@mellanox.com; pepperjo@japf.ch;
> jerin.jacob@caviumnetworks.com; hemant.agrawal@nxp.com;
> olivier.matz@6wind.com
> Subject: [PATCH 37/41] net/enic: use contiguous allocation for DMA memory
> 
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> 
> Notes:
>     It is not 100% clear that second call to memzone_reserve
>     is allocating DMA memory. Corrections welcome.
The 2nd call is allocating DMA memory so I believe your patch is correct.
> 
>  drivers/net/enic/enic_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index
> ec9d343..cb2a7ba 100644
> --- a/drivers/net/enic/enic_main.c
> +++ b/drivers/net/enic/enic_main.c
> @@ -319,7 +319,7 @@ enic_alloc_consistent(void *priv, size_t size,
>  	struct enic *enic = (struct enic *)priv;
>  	struct enic_memzone_entry *mze;
> 
> -	rz = rte_memzone_reserve_aligned((const char *)name,
> +	rz = rte_memzone_reserve_aligned_contig((const char *)name,
>  					 size, SOCKET_ID_ANY, 0,
> ENIC_ALIGN);
>  	if (!rz) {
>  		pr_err("%s : Failed to allocate memory requested for %s\n",
> @@ -787,7 +787,7 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
>  		 "vnic_cqmsg-%s-%d-%d", enic->bdf_name, queue_idx,
>  		instance++);
> 
> -	wq->cqmsg_rz = rte_memzone_reserve_aligned((const char *)name,
> +	wq->cqmsg_rz = rte_memzone_reserve_aligned_contig((const char
> *)name,
>  						   sizeof(uint32_t),
>  						   SOCKET_ID_ANY, 0,
>  						   ENIC_ALIGN);
This is a send completion landing spot which is DMA'd to by the NIC so it does have to be contiguous. However the size is only 4 bytes so it might not matter.
> --
> 2.7.4
  

Patch

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index ec9d343..cb2a7ba 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -319,7 +319,7 @@  enic_alloc_consistent(void *priv, size_t size,
 	struct enic *enic = (struct enic *)priv;
 	struct enic_memzone_entry *mze;
 
-	rz = rte_memzone_reserve_aligned((const char *)name,
+	rz = rte_memzone_reserve_aligned_contig((const char *)name,
 					 size, SOCKET_ID_ANY, 0, ENIC_ALIGN);
 	if (!rz) {
 		pr_err("%s : Failed to allocate memory requested for %s\n",
@@ -787,7 +787,7 @@  int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
 		 "vnic_cqmsg-%s-%d-%d", enic->bdf_name, queue_idx,
 		instance++);
 
-	wq->cqmsg_rz = rte_memzone_reserve_aligned((const char *)name,
+	wq->cqmsg_rz = rte_memzone_reserve_aligned_contig((const char *)name,
 						   sizeof(uint32_t),
 						   SOCKET_ID_ANY, 0,
 						   ENIC_ALIGN);