Skip to contentSkip to conversation

app/dma-perf: fix physical address seg-fault

PATCH Superseded Vipin Varghese 2 participants 2 messages Oct 19, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 app/dma-perf: fix physical address seg-fault

do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return the start of the virtual address for both src and dst. But in case of iova mode set as PA, this results in seg-fault. This is because rte_memcpy uses VA address and not PA.

This fix invokes rte_pktmbuf_mtod for both src and dst.

Bugzilla ID: 1269

Fixes 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")

---

v2:
- suggest use of pktmbuf_mtod for both va and pa by Anoob.

V3:
- add const to src suggested by Jerin.

---
 app/test-dma-perf/benchmark.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
app/test-dma-perf/benchmark.c +4 -3
index 0601e0d171..9b1f58c78c 100644
@@ -288,10 +288,11 @@ do_cpu_mem_copy(void *p)
 
 	while (1) {
 		for (i = 0; i < nr_buf; i++) {
+			const void *src = rte_pktmbuf_mtod(dsts[i], void *);
+			void *dst = rte_pktmbuf_mtod(srcs[i], void *);
+
 			/* copy buffer form src to dst */
-			rte_memcpy((void *)(uintptr_t)rte_mbuf_data_iova(dsts[i]),
-				(void *)(uintptr_t)rte_mbuf_data_iova(srcs[i]),
-				(size_t)buf_size);
+			rte_memcpy(dst, src, (size_t)buf_size);
 			worker_info->total_cpl++;
 		}
 		if (worker_info->stop_flag)
Signature · 1 line
2.34.1
Acked-by on v3 1/1
#1 lore raw
Quoted 18 lines · Vipin Varghese

do_cpu_mem_copy uses DPDK API rte_mbuf_data_iova to return the start of the virtual address for both src and dst. But in case of iova mode set as PA, this results in seg-fault. This is because rte_memcpy uses VA address and not PA.

This fix invokes rte_pktmbuf_mtod for both src and dst.

Bugzilla ID: 1269

Fixes 623dc9364dc6 ("app/dma-perf: introduce DMA performance test")

---

...