DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] dmadev: standardize alignment and allocation
@ 2024-02-02  9:06 pbhagavatula
  2024-02-04  1:38 ` fengchengwen
  2024-02-10  6:27 ` [PATCH v2] dmadev: standardize alignment pbhagavatula
  0 siblings, 2 replies; 6+ messages in thread
From: pbhagavatula @ 2024-02-02  9:06 UTC (permalink / raw)
  To: jerinj, Chengwen Feng, Kevin Laatz, Bruce Richardson; +Cc: dev, Pavan Nikhilesh

From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Align fp_objects based on cacheline size, allocate
devices and fp_objects memory on hugepages.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/dmadev/rte_dmadev.c      | 6 ++----
 lib/dmadev/rte_dmadev_core.h | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c
index 67434c805f43..1fe1434019f0 100644
--- a/lib/dmadev/rte_dmadev.c
+++ b/lib/dmadev/rte_dmadev.c
@@ -143,10 +143,9 @@ dma_fp_data_prepare(void)
 	 */
 	size = dma_devices_max * sizeof(struct rte_dma_fp_object) +
 		RTE_CACHE_LINE_SIZE;
-	ptr = malloc(size);
+	ptr = rte_zmalloc("", size, RTE_CACHE_LINE_SIZE);
 	if (ptr == NULL)
 		return -ENOMEM;
-	memset(ptr, 0, size);
 
 	rte_dma_fp_objs = RTE_PTR_ALIGN(ptr, RTE_CACHE_LINE_SIZE);
 	for (i = 0; i < dma_devices_max; i++)
@@ -164,10 +163,9 @@ dma_dev_data_prepare(void)
 		return 0;
 
 	size = dma_devices_max * sizeof(struct rte_dma_dev);
-	rte_dma_devices = malloc(size);
+	rte_dma_devices = rte_zmalloc("", size, RTE_CACHE_LINE_SIZE);
 	if (rte_dma_devices == NULL)
 		return -ENOMEM;
-	memset(rte_dma_devices, 0, size);
 
 	return 0;
 }
diff --git a/lib/dmadev/rte_dmadev_core.h b/lib/dmadev/rte_dmadev_core.h
index 064785686f7f..e8239c2d22b6 100644
--- a/lib/dmadev/rte_dmadev_core.h
+++ b/lib/dmadev/rte_dmadev_core.h
@@ -73,7 +73,7 @@ struct rte_dma_fp_object {
 	rte_dma_completed_t        completed;
 	rte_dma_completed_status_t completed_status;
 	rte_dma_burst_capacity_t   burst_capacity;
-} __rte_aligned(128);
+} __rte_cache_aligned;
 
 extern struct rte_dma_fp_object *rte_dma_fp_objs;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-19  1:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02  9:06 [PATCH] dmadev: standardize alignment and allocation pbhagavatula
2024-02-04  1:38 ` fengchengwen
2024-02-10  6:20   ` [EXT] " Pavan Nikhilesh Bhagavatula
2024-02-10  6:27 ` [PATCH v2] dmadev: standardize alignment pbhagavatula
2024-02-10 11:34   ` fengchengwen
2024-02-19  1:32     ` Thomas Monjalon

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).