DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: mb@smartsharesystems.com, bruce.richardson@intel.com,
	wenzhuo.lu@intel.com
Cc: dev@dpdk.org, wenjun1.wu@intel.com,
	Qi Zhang <qi.z.zhang@intel.com>,
	stable@dpdk.org
Subject: [PATCH 3/3] net/iavf: support no IOVA as PA mode
Date: Sun, 11 Dec 2022 16:52:56 -0500	[thread overview]
Message-ID: <20221211215256.370099-4-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20221211215256.370099-1-qi.z.zhang@intel.com>

Remove buf_iova access when RTE_IOVA_AS_PA is not defined.

Cc: stable@dpdk.org

Signed-off-by: Qi Zhang <qi.z.zhang@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


  parent reply	other threads:[~2022-12-11 13:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-11 21:52 [PATCH 0/3] support no IOVA as PA mode for some Intel NIC Qi Zhang
2022-12-11 21:52 ` [PATCH 1/3] net/ice: support no IOVA as PA mode Qi Zhang
2022-12-11 21:52 ` [PATCH 2/3] net/i40e: " Qi Zhang
2022-12-11 21:52 ` Qi Zhang [this message]
2022-12-12  0:47 ` [PATCH 0/3] support no IOVA as PA mode for some Intel NIC Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221211215256.370099-4-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=mb@smartsharesystems.com \
    --cc=stable@dpdk.org \
    --cc=wenjun1.wu@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).