* [PATCH] drivers/net: use intrinsic to access content of __m128i
@ 2024-12-27 19:44 Andre Muezerie
2024-12-28 1:23 ` [PATCH v2] " Andre Muezerie
0 siblings, 1 reply; 4+ messages in thread
From: Andre Muezerie @ 2024-12-27 19:44 UTC (permalink / raw)
To: Bruce Richardson, Konstantin Ananyev, Vamsi Attunuru; +Cc: dev, Andre Muezerie
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] drivers/net: use intrinsic to access content of __m128i
2024-12-27 19:44 [PATCH] drivers/net: use intrinsic to access content of __m128i Andre Muezerie
@ 2024-12-28 1:23 ` Andre Muezerie
2025-02-05 4:50 ` [EXTERNAL] " Vamsi Krishna Attunuru
0 siblings, 1 reply; 4+ messages in thread
From: Andre Muezerie @ 2024-12-28 1:23 UTC (permalink / raw)
To: andremue; +Cc: bruce.richardson, dev, konstantin.v.ananyev, vattunuru
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [EXTERNAL] [PATCH v2] drivers/net: use intrinsic to access content of __m128i
2024-12-28 1:23 ` [PATCH v2] " Andre Muezerie
@ 2025-02-05 4:50 ` Vamsi Krishna Attunuru
2025-02-05 16:50 ` Jerin Jacob
0 siblings, 1 reply; 4+ messages in thread
From: Vamsi Krishna Attunuru @ 2025-02-05 4:50 UTC (permalink / raw)
To: Andre Muezerie; +Cc: bruce.richardson, dev, konstantin.v.ananyev
>-----Original Message-----
>From: Andre Muezerie <andremue@linux.microsoft.com>
>Sent: Saturday, December 28, 2024 6:53 AM
>To: andremue@linux.microsoft.com
>Cc: bruce.richardson@intel.com; dev@dpdk.org;
>konstantin.v.ananyev@yandex.ru; Vamsi Krishna Attunuru
><vattunuru@marvell.com>
>Subject: [EXTERNAL] [PATCH v2] drivers/net: use intrinsic to access content of
>__m128i
>
>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'
>
>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>
Acked-by: Vamsi Attunuru <vattunuru@marvell.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [EXTERNAL] [PATCH v2] drivers/net: use intrinsic to access content of __m128i
2025-02-05 4:50 ` [EXTERNAL] " Vamsi Krishna Attunuru
@ 2025-02-05 16:50 ` Jerin Jacob
0 siblings, 0 replies; 4+ messages in thread
From: Jerin Jacob @ 2025-02-05 16:50 UTC (permalink / raw)
To: Vamsi Krishna Attunuru, Andre Muezerie
Cc: bruce.richardson, dev, konstantin.v.ananyev
> -----Original Message-----
> From: Vamsi Krishna Attunuru <vattunuru@marvell.com>
> Sent: Wednesday, February 5, 2025 10:20 AM
> To: Andre Muezerie <andremue@linux.microsoft.com>
> Cc: bruce.richardson@intel.com; dev@dpdk.org;
> konstantin.v.ananyev@yandex.ru
> Subject: RE: [EXTERNAL] [PATCH v2] drivers/net: use intrinsic to access content
> of __m128i
>
> >-----Original Message----- >From: Andre Muezerie <andremue@ linux.
> >microsoft. com> >Sent: Saturday, December 28, 2024 6: 53 AM >To:
> >andremue@ linux. microsoft. com >Cc: bruce. richardson@ intel. com;
> >dev@ dpdk. org; >konstantin. v. ananyev@ yandex. ru;
>
>
>
> >-----Original Message-----
> >From: Andre Muezerie <andremue@linux.microsoft.com>
> >Sent: Saturday, December 28, 2024 6:53 AM
> >To: andremue@linux.microsoft.com
> >Cc: bruce.richardson@intel.com; dev@dpdk.org;
> >konstantin.v.ananyev@yandex.ru; Vamsi Krishna Attunuru
> ><vattunuru@marvell.com>
> >Subject: [EXTERNAL] [PATCH v2] drivers/net: use intrinsic to access
> >content of __m128i
> >
> >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'
> >
> >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>
>
> Acked-by: Vamsi Attunuru <vattunuru@marvell.com>
Applied to dpdk-next-net-mrvl/for-main. Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-02-05 16:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-27 19:44 [PATCH] drivers/net: use intrinsic to access content of __m128i Andre Muezerie
2024-12-28 1:23 ` [PATCH v2] " Andre Muezerie
2025-02-05 4:50 ` [EXTERNAL] " Vamsi Krishna Attunuru
2025-02-05 16:50 ` Jerin Jacob
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).