DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andre Muezerie <andremue@linux.microsoft.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
	Vamsi Attunuru <vattunuru@marvell.com>
Cc: dev@dpdk.org, Andre Muezerie <andremue@linux.microsoft.com>
Subject: [PATCH] drivers/net: use intrinsic to access content of __m128i
Date: Fri, 27 Dec 2024 11:44:44 -0800	[thread overview]
Message-ID: <1735328684-10684-1-git-send-email-andremue@linux.microsoft.com> (raw)

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 | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
index fbd1f73c1e..bbc4490f49 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx_sse.c
@@ -58,10 +58,10 @@ 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. */
-		*(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];
+		*(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);
 
 		/* Reset rearm data. */
 		*(uint64_t *)&m0->rearm_data = droq->rearm_data;
-- 
2.47.0.vfs.0.3


             reply	other threads:[~2024-12-27 19:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-27 19:44 Andre Muezerie [this message]
2024-12-28  1:23 ` [PATCH v2] " Andre Muezerie

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=1735328684-10684-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 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).