Used rte_mbuf_data_iova API to get the physical address of mbuf data.

Signed-off-by: Shijith Thotton <sthot...@marvell.com>
---
 app/test/test_dmadev.c | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c
index 9e8e101f40..fe62e98af8 100644
--- a/app/test/test_dmadev.c
+++ b/app/test/test_dmadev.c
@@ -110,8 +110,8 @@ do_multi_copies(int16_t dev_id, uint16_t vchan,
                for (j = 0; j < COPY_LEN/sizeof(uint64_t); j++)
                        src_data[j] = rte_rand();
 
-               if (rte_dma_copy(dev_id, vchan, srcs[i]->buf_iova + 
srcs[i]->data_off,
-                               dsts[i]->buf_iova + dsts[i]->data_off, 
COPY_LEN, 0) != id_count++)
+               if (rte_dma_copy(dev_id, vchan, rte_mbuf_data_iova(srcs[i]),
+                                rte_mbuf_data_iova(dsts[i]), COPY_LEN, 0) != 
id_count++)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
i);
        }
        rte_dma_submit(dev_id, vchan);
@@ -317,9 +317,8 @@ test_failure_in_full_burst(int16_t dev_id, uint16_t vchan, 
bool fence,
        rte_dma_stats_get(dev_id, vchan, &baseline); /* get a baseline set of 
stats */
        for (i = 0; i < COMP_BURST_SZ; i++) {
                int id = rte_dma_copy(dev_id, vchan,
-                               (i == fail_idx ? 0 : (srcs[i]->buf_iova + 
srcs[i]->data_off)),
-                               dsts[i]->buf_iova + dsts[i]->data_off,
-                               COPY_LEN, OPT_FENCE(i));
+                                     (i == fail_idx ? 0 : 
rte_mbuf_data_iova(srcs[i])),
+                                     rte_mbuf_data_iova(dsts[i]), COPY_LEN, 
OPT_FENCE(i));
                if (id < 0)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
i);
                if (i == fail_idx)
@@ -407,9 +406,8 @@ test_individual_status_query_with_failure(int16_t dev_id, 
uint16_t vchan, bool f
 
        for (j = 0; j < COMP_BURST_SZ; j++) {
                int id = rte_dma_copy(dev_id, vchan,
-                               (j == fail_idx ? 0 : (srcs[j]->buf_iova + 
srcs[j]->data_off)),
-                               dsts[j]->buf_iova + dsts[j]->data_off,
-                               COPY_LEN, OPT_FENCE(j));
+                                     (j == fail_idx ? 0 : 
rte_mbuf_data_iova(srcs[j])),
+                                     rte_mbuf_data_iova(dsts[j]), COPY_LEN, 
OPT_FENCE(j));
                if (id < 0)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
j);
                if (j == fail_idx)
@@ -470,9 +468,8 @@ test_single_item_status_query_with_failure(int16_t dev_id, 
uint16_t vchan,
 
        for (j = 0; j < COMP_BURST_SZ; j++) {
                int id = rte_dma_copy(dev_id, vchan,
-                               (j == fail_idx ? 0 : (srcs[j]->buf_iova + 
srcs[j]->data_off)),
-                               dsts[j]->buf_iova + dsts[j]->data_off,
-                               COPY_LEN, 0);
+                                     (j == fail_idx ? 0 : 
rte_mbuf_data_iova(srcs[j])),
+                                     rte_mbuf_data_iova(dsts[j]), COPY_LEN, 0);
                if (id < 0)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
j);
                if (j == fail_idx)
@@ -529,15 +526,14 @@ test_multi_failure(int16_t dev_id, uint16_t vchan, struct 
rte_mbuf **srcs, struc
 
        /* enqueue and gather completions in one go */
        for (j = 0; j < COMP_BURST_SZ; j++) {
-               uintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;
+               uintptr_t src = rte_mbuf_data_iova(srcs[j]);
                /* set up for failure if the current index is anywhere is the 
fails array */
                for (i = 0; i < num_fail; i++)
                        if (j == fail[i])
                                src = 0;
 
-               int id = rte_dma_copy(dev_id, vchan,
-                               src, dsts[j]->buf_iova + dsts[j]->data_off,
-                               COPY_LEN, 0);
+               int id = rte_dma_copy(dev_id, vchan, src, 
rte_mbuf_data_iova(dsts[j]),
+                                     COPY_LEN, 0);
                if (id < 0)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
j);
        }
@@ -565,15 +561,14 @@ test_multi_failure(int16_t dev_id, uint16_t vchan, struct 
rte_mbuf **srcs, struc
 
        /* enqueue and gather completions in bursts, but getting errors one at 
a time */
        for (j = 0; j < COMP_BURST_SZ; j++) {
-               uintptr_t src = srcs[j]->buf_iova + srcs[j]->data_off;
+               uintptr_t src = rte_mbuf_data_iova(srcs[j]);
                /* set up for failure if the current index is anywhere is the 
fails array */
                for (i = 0; i < num_fail; i++)
                        if (j == fail[i])
                                src = 0;
 
-               int id = rte_dma_copy(dev_id, vchan,
-                               src, dsts[j]->buf_iova + dsts[j]->data_off,
-                               COPY_LEN, 0);
+               int id = rte_dma_copy(dev_id, vchan, src, 
rte_mbuf_data_iova(dsts[j]),
+                                     COPY_LEN, 0);
                if (id < 0)
                        ERR_RETURN("Error with rte_dma_copy for buffer %u\n", 
j);
        }
-- 
2.25.1

Reply via email to