From: Andre Muezerie <andremue@linux.microsoft.com>
To: andremue@linux.microsoft.com
Cc: bruce.richardson@intel.com, dev@dpdk.org,
konstantin.v.ananyev@yandex.ru, vattunuru@marvell.com
Subject: [PATCH v2] drivers/net: use intrinsic to access content of __m128i
Date: Fri, 27 Dec 2024 17:23:03 -0800 [thread overview]
Message-ID: <1735348983-19590-1-git-send-email-andremue@linux.microsoft.com> (raw)
In-Reply-To: <1735328684-10684-1-git-send-email-andremue@linux.microsoft.com>
Compiler intrinsics should be used to access/manipulate contents
of __m128i.
Existing code results in the error below when compiled with MSVC:
../drivers/net/octeon_ep/cnxk_ep_rx_sse.c(61): error C2440:
'type cast': cannot convert from '__m128i' to 'rte_xmm_t'
The fix is to use an intrinsic instead. This compiles fine with
gcc, clang and msvc.
Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
---
drivers/net/octeon_ep/cnxk_ep_rx_sse.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
index fbd1f73c1e..d17ec46211 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
@@ -58,10 +58,21 @@ cnxk_ep_process_pkts_vec_sse(struct rte_mbuf **rx_pkts, struct otx_ep_droq *droq
s23 = _mm_shuffle_epi8(s23, cpy_mask);
/* Store packet length and data length to mbuf. */
+#ifdef RTE_ARCH_64
+ *(uint64_t *)&m0->pkt_len = _mm_extract_epi64(s01, 0);
+ *(uint64_t *)&m1->pkt_len = _mm_extract_epi64(s01, 1);
+ *(uint64_t *)&m2->pkt_len = _mm_extract_epi64(s23, 0);
+ *(uint64_t *)&m3->pkt_len = _mm_extract_epi64(s23, 1);
+#else
+ /* _mm_extract_epi64 is only available on 64-bit architecture.
+ * The cast below is non-portable and results in compile error
+ * using MSVC.
+ */
*(uint64_t *)&m0->pkt_len = ((rte_xmm_t)s01).u64[0];
*(uint64_t *)&m1->pkt_len = ((rte_xmm_t)s01).u64[1];
*(uint64_t *)&m2->pkt_len = ((rte_xmm_t)s23).u64[0];
*(uint64_t *)&m3->pkt_len = ((rte_xmm_t)s23).u64[1];
+#endif
/* Reset rearm data. */
*(uint64_t *)&m0->rearm_data = droq->rearm_data;
--
2.47.0.vfs.0.3
next prev parent reply other threads:[~2024-12-28 1:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-27 19:44 [PATCH] drivers/net: use intrinsic to access content of __m128i Andre Muezerie
2024-12-28 1:23 ` Andre Muezerie [this message]
2025-02-05 4:50 ` [EXTERNAL] [PATCH v2] " Vamsi Krishna Attunuru
2025-02-05 16:50 ` Jerin Jacob
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=1735348983-19590-1-git-send-email-andremue@linux.microsoft.com \
--to=andremue@linux.microsoft.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=vattunuru@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.