Remove buf_iova access when RTE_IOVA_AS_PA is not defined.

Cc: sta...@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zh...@intel.com>
---
 drivers/net/iavf/iavf_rxtx_vec_avx512.c | 20 ++++++++++----------
 drivers/net/iavf/iavf_rxtx_vec_common.h | 12 ++++++++++++
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/net/iavf/iavf_rxtx_vec_avx512.c 
b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
index b416a716cf..f1507de79e 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_avx512.c
+++ b/drivers/net/iavf/iavf_rxtx_vec_avx512.c
@@ -78,8 +78,13 @@ iavf_rxq_rearm(struct iavf_rx_queue *rxq)
                }
        }
 
+#if RTE_IOVA_AS_PA
        const __m512i iova_offsets =  _mm512_set1_epi64(offsetof
                                                        (struct rte_mbuf, 
buf_iova));
+#else
+       const __m512i iova_offsets =  _mm512_set1_epi64(offsetof
+                                                       (struct rte_mbuf, 
buf_addr));
+#endif
        const __m512i headroom = _mm512_set1_epi64(RTE_PKTMBUF_HEADROOM);
 
 #ifndef RTE_LIBRTE_IAVF_16BYTE_RX_DESC
@@ -1896,8 +1901,7 @@ iavf_vtx1(volatile struct iavf_tx_desc *txdp,
        if (offload)
                iavf_txd_enable_offload(pkt, &high_qw);
 
-       __m128i descriptor = _mm_set_epi64x(high_qw,
-                                           pkt->buf_iova + pkt->data_off);
+       __m128i descriptor = _mm_set_epi64x(high_qw, _PKT_DATA_OFF_U64(pkt));
        _mm_storeu_si128((__m128i *)txdp, descriptor);
 }
 
@@ -1946,14 +1950,10 @@ iavf_vtx(volatile struct iavf_tx_desc *txdp,
 
                __m512i desc0_3 =
                        _mm512_set_epi64
-                               (hi_qw3,
-                                pkt[3]->buf_iova + pkt[3]->data_off,
-                                hi_qw2,
-                                pkt[2]->buf_iova + pkt[2]->data_off,
-                                hi_qw1,
-                                pkt[1]->buf_iova + pkt[1]->data_off,
-                                hi_qw0,
-                                pkt[0]->buf_iova + pkt[0]->data_off);
+                               (hi_qw3, _PKT_DATA_OFF_U64(pkt[3]),
+                                hi_qw2, _PKT_DATA_OFF_U64(pkt[2]),
+                                hi_qw1, _PKT_DATA_OFF_U64(pkt[1]),
+                                hi_qw0, _PKT_DATA_OFF_U64(pkt[0]));
                _mm512_storeu_si512((void *)txdp, desc0_3);
        }
 
diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h 
b/drivers/net/iavf/iavf_rxtx_vec_common.h
index a59cb2ceee..4aeeb4baaa 100644
--- a/drivers/net/iavf/iavf_rxtx_vec_common.h
+++ b/drivers/net/iavf/iavf_rxtx_vec_common.h
@@ -15,6 +15,12 @@
 #pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
 
+#if RTE_IOVA_AS_PA
+       #define _PKT_DATA_OFF_U64(pkt) ((pkt)->buf_iova + (pkt)->data_off)
+#else
+       #define _PKT_DATA_OFF_U64(pkt) ((u64)(pkt)->buf_addr + (pkt)->data_off)
+#endif
+
 static __rte_always_inline uint16_t
 reassemble_packets(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_bufs,
                   uint16_t nb_bufs, uint8_t *split_flags)
@@ -421,9 +427,15 @@ iavf_rxq_rearm_common(struct iavf_rx_queue *rxq, 
__rte_unused bool avx512)
                mb0 = rxp[0];
                mb1 = rxp[1];
 
+#if RTE_IOVA_AS_PA
                /* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */
                RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, buf_iova) !=
                                offsetof(struct rte_mbuf, buf_addr) + 8);
+#else
+               /* load buf_addr(lo 64bit) and next(hi 64bit) */
+               RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, next) !=
+                               offsetof(struct rte_mbuf, buf_addr) + 8);
+#endif
                vaddr0 = _mm_loadu_si128((__m128i *)&mb0->buf_addr);
                vaddr1 = _mm_loadu_si128((__m128i *)&mb1->buf_addr);
 
-- 
2.31.1

Reply via email to