[1/3] net/hinic: restore vectorised code

Message ID 20210115134021.7391-2-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series net build fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand Jan. 15, 2021, 1:40 p.m. UTC
  Following make support removal, the vectorised code is not built
anymore, fix the build flag check.

Fixes: 3cc6ecfdfe85 ("build: remove makefiles")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/hinic/hinic_pmd_rx.c |  6 +++---
 drivers/net/hinic/hinic_pmd_tx.c | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
  

Comments

Ruifeng Wang Jan. 16, 2021, 2:38 p.m. UTC | #1
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Friday, January 15, 2021 9:40 PM
> To: dev@dpdk.org
> Cc: ferruh.yigit@intel.com; stable@dpdk.org; Ziyang Xuan
> <xuanziyang2@huawei.com>; Xiaoyun Wang
> <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou
> <zhouguoyang@huawei.com>; Ciara Power <ciara.power@intel.com>;
> Ruifeng Wang <Ruifeng.Wang@arm.com>; thomas@monjalon.net
> Subject: [PATCH 1/3] net/hinic: restore vectorised code
> 
> Following make support removal, the vectorised code is not built anymore,
> fix the build flag check.
> 
> Fixes: 3cc6ecfdfe85 ("build: remove makefiles")
> Cc: stable@dpdk.org
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/hinic/hinic_pmd_rx.c |  6 +++---
> drivers/net/hinic/hinic_pmd_tx.c | 10 +++++-----
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/hinic/hinic_pmd_rx.c
> b/drivers/net/hinic/hinic_pmd_rx.c
> index a49769a863..842399cc4c 100644
> --- a/drivers/net/hinic/hinic_pmd_rx.c
> +++ b/drivers/net/hinic/hinic_pmd_rx.c
> @@ -4,7 +4,7 @@
> 
>  #include <rte_ether.h>
>  #include <rte_mbuf.h>
> -#ifdef __ARM64_NEON__
> +#ifdef RTE_ARCH_ARM64

We can test '__ARM_NEON' which will be defined by compilers.
https://developer.arm.com/documentation/ihi0053/latest/

>  #include <arm_neon.h>
>  #endif
> 
> @@ -762,7 +762,7 @@ void hinic_free_all_rx_mbufs(struct hinic_rxq *rxq)
> static inline void hinic_rq_cqe_be_to_cpu32(void *dst_le32,
>  					    volatile void *src_be32)
>  {
> -#if defined(__X86_64_SSE__)
> +#if defined(RTE_ARCH_X86_64)
>  	volatile __m128i *wqe_be = (volatile __m128i *)src_be32;
>  	__m128i *wqe_le = (__m128i *)dst_le32;
>  	__m128i shuf_mask =  _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, @@ -
> 770,7 +770,7 @@ static inline void hinic_rq_cqe_be_to_cpu32(void *dst_le32,
> 
>  	/* l2nic just use first 128 bits */
>  	wqe_le[0] = _mm_shuffle_epi8(wqe_be[0], shuf_mask); -#elif
> defined(__ARM64_NEON__)
> +#elif defined(RTE_ARCH_ARM64)
>  	volatile uint8x16_t *wqe_be = (volatile uint8x16_t *)src_be32;
>  	uint8x16_t *wqe_le = (uint8x16_t *)dst_le32;
>  	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, diff --git
> a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c
> index 9d0264e67a..669f82389c 100644
> --- a/drivers/net/hinic/hinic_pmd_tx.c
> +++ b/drivers/net/hinic/hinic_pmd_tx.c
> @@ -7,7 +7,7 @@
>  #include <rte_sctp.h>
>  #include <rte_udp.h>
>  #include <rte_ip.h>
> -#ifdef __ARM64_NEON__
> +#ifdef RTE_ARCH_ARM64
>  #include <arm_neon.h>
>  #endif
> 
> @@ -203,7 +203,7 @@
> 
>  static inline void hinic_sq_wqe_cpu_to_be32(void *data, int nr_wqebb)  { -
> #if defined(__X86_64_SSE__)
> +#if defined(RTE_ARCH_X86_64)
>  	int i;
>  	__m128i *wqe_line = (__m128i *)data;
>  	__m128i shuf_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, @@ -
> 217,7 +217,7 @@ static inline void hinic_sq_wqe_cpu_to_be32(void *data,
> int nr_wqebb)
>  		wqe_line[3] = _mm_shuffle_epi8(wqe_line[3], shuf_mask);
>  		wqe_line += 4;
>  	}
> -#elif defined(__ARM64_NEON__)
> +#elif defined(RTE_ARCH_ARM64)
>  	int i;
>  	uint8x16_t *wqe_line = (uint8x16_t *)data;
>  	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10, @@ -237,7
> +237,7 @@ static inline void hinic_sq_wqe_cpu_to_be32(void *data, int
> nr_wqebb)
> 
>  static inline void hinic_sge_cpu_to_be32(void *data, int nr_sge)  { -#if
> defined(__X86_64_SSE__)
> +#if defined(RTE_ARCH_X86_64)
>  	int i;
>  	__m128i *sge_line = (__m128i *)data;
>  	__m128i shuf_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10, @@ -
> 248,7 +248,7 @@ static inline void hinic_sge_cpu_to_be32(void *data, int
> nr_sge)
>  		*sge_line = _mm_shuffle_epi8(*sge_line, shuf_mask);
>  		sge_line++;
>  	}
> -#elif defined(__ARM64_NEON__)
> +#elif defined(RTE_ARCH_ARM64)
>  	int i;
>  	uint8x16_t *sge_line = (uint8x16_t *)data;
>  	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10,
> --
> 2.23.0
  
David Marchand Jan. 18, 2021, 8:18 a.m. UTC | #2
On Sat, Jan 16, 2021 at 3:39 PM Ruifeng Wang <Ruifeng.Wang@arm.com> wrote:
> > Subject: [PATCH 1/3] net/hinic: restore vectorised code
> >
> > Following make support removal, the vectorised code is not built anymore,
> > fix the build flag check.
> >
> > Fixes: 3cc6ecfdfe85 ("build: remove makefiles")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >  drivers/net/hinic/hinic_pmd_rx.c |  6 +++---
> > drivers/net/hinic/hinic_pmd_tx.c | 10 +++++-----
> >  2 files changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/hinic/hinic_pmd_rx.c
> > b/drivers/net/hinic/hinic_pmd_rx.c
> > index a49769a863..842399cc4c 100644
> > --- a/drivers/net/hinic/hinic_pmd_rx.c
> > +++ b/drivers/net/hinic/hinic_pmd_rx.c
> > @@ -4,7 +4,7 @@
> >
> >  #include <rte_ether.h>
> >  #include <rte_mbuf.h>
> > -#ifdef __ARM64_NEON__
> > +#ifdef RTE_ARCH_ARM64
>
> We can test '__ARM_NEON' which will be defined by compilers.
> https://developer.arm.com/documentation/ihi0053/latest/

On the principle, I agree, but this was not what was tested before.

The activation was only gated by checking for the arm architecture.
See: https://git.dpdk.org/dpdk/tree/drivers/net/hinic/Makefile?id=05b6eee7bdabf7c17ed69c44515e0cd7d6e1da23#n14
So I restored the test as it was before make removal.

What you propose can be done in a followup from the hinic developers,
but the minimal fix is still this current patch.
  
Ruifeng Wang Jan. 18, 2021, 8:26 a.m. UTC | #3
> -----Original Message-----
> From: David Marchand <david.marchand@redhat.com>
> Sent: Monday, January 18, 2021 4:18 PM
> To: Ruifeng Wang <Ruifeng.Wang@arm.com>
> Cc: dev@dpdk.org; ferruh.yigit@intel.com; stable@dpdk.org; Ziyang Xuan
> <xuanziyang2@huawei.com>; Xiaoyun Wang
> <cloud.wangxiaoyun@huawei.com>; Guoyang Zhou
> <zhouguoyang@huawei.com>; Ciara Power <ciara.power@intel.com>;
> thomas@monjalon.net; nd <nd@arm.com>
> Subject: Re: [PATCH 1/3] net/hinic: restore vectorised code
> 
> On Sat, Jan 16, 2021 at 3:39 PM Ruifeng Wang <Ruifeng.Wang@arm.com>
> wrote:
> > > Subject: [PATCH 1/3] net/hinic: restore vectorised code
> > >
> > > Following make support removal, the vectorised code is not built
> > > anymore, fix the build flag check.
> > >
> > > Fixes: 3cc6ecfdfe85 ("build: remove makefiles")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> > >  drivers/net/hinic/hinic_pmd_rx.c |  6 +++---
> > > drivers/net/hinic/hinic_pmd_tx.c | 10 +++++-----
> > >  2 files changed, 8 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/drivers/net/hinic/hinic_pmd_rx.c
> > > b/drivers/net/hinic/hinic_pmd_rx.c
> > > index a49769a863..842399cc4c 100644
> > > --- a/drivers/net/hinic/hinic_pmd_rx.c
> > > +++ b/drivers/net/hinic/hinic_pmd_rx.c
> > > @@ -4,7 +4,7 @@
> > >
> > >  #include <rte_ether.h>
> > >  #include <rte_mbuf.h>
> > > -#ifdef __ARM64_NEON__
> > > +#ifdef RTE_ARCH_ARM64
> >
> > We can test '__ARM_NEON' which will be defined by compilers.
> > https://developer.arm.com/documentation/ihi0053/latest/
> 
> On the principle, I agree, but this was not what was tested before.
> 
> The activation was only gated by checking for the arm architecture.
> See:
> https://git.dpdk.org/dpdk/tree/drivers/net/hinic/Makefile?id=05b6eee7bda
> bf7c17ed69c44515e0cd7d6e1da23#n14
> So I restored the test as it was before make removal.
> 
> What you propose can be done in a followup from the hinic developers, but
> the minimal fix is still this current patch.

I'm OK with this.

Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
> 
> 
> --
> David Marchand
  

Patch

diff --git a/drivers/net/hinic/hinic_pmd_rx.c b/drivers/net/hinic/hinic_pmd_rx.c
index a49769a863..842399cc4c 100644
--- a/drivers/net/hinic/hinic_pmd_rx.c
+++ b/drivers/net/hinic/hinic_pmd_rx.c
@@ -4,7 +4,7 @@ 
 
 #include <rte_ether.h>
 #include <rte_mbuf.h>
-#ifdef __ARM64_NEON__
+#ifdef RTE_ARCH_ARM64
 #include <arm_neon.h>
 #endif
 
@@ -762,7 +762,7 @@  void hinic_free_all_rx_mbufs(struct hinic_rxq *rxq)
 static inline void hinic_rq_cqe_be_to_cpu32(void *dst_le32,
 					    volatile void *src_be32)
 {
-#if defined(__X86_64_SSE__)
+#if defined(RTE_ARCH_X86_64)
 	volatile __m128i *wqe_be = (volatile __m128i *)src_be32;
 	__m128i *wqe_le = (__m128i *)dst_le32;
 	__m128i shuf_mask =  _mm_set_epi8(12, 13, 14, 15, 8, 9, 10,
@@ -770,7 +770,7 @@  static inline void hinic_rq_cqe_be_to_cpu32(void *dst_le32,
 
 	/* l2nic just use first 128 bits */
 	wqe_le[0] = _mm_shuffle_epi8(wqe_be[0], shuf_mask);
-#elif defined(__ARM64_NEON__)
+#elif defined(RTE_ARCH_ARM64)
 	volatile uint8x16_t *wqe_be = (volatile uint8x16_t *)src_be32;
 	uint8x16_t *wqe_le = (uint8x16_t *)dst_le32;
 	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10,
diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c
index 9d0264e67a..669f82389c 100644
--- a/drivers/net/hinic/hinic_pmd_tx.c
+++ b/drivers/net/hinic/hinic_pmd_tx.c
@@ -7,7 +7,7 @@ 
 #include <rte_sctp.h>
 #include <rte_udp.h>
 #include <rte_ip.h>
-#ifdef __ARM64_NEON__
+#ifdef RTE_ARCH_ARM64
 #include <arm_neon.h>
 #endif
 
@@ -203,7 +203,7 @@ 
 
 static inline void hinic_sq_wqe_cpu_to_be32(void *data, int nr_wqebb)
 {
-#if defined(__X86_64_SSE__)
+#if defined(RTE_ARCH_X86_64)
 	int i;
 	__m128i *wqe_line = (__m128i *)data;
 	__m128i shuf_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10,
@@ -217,7 +217,7 @@  static inline void hinic_sq_wqe_cpu_to_be32(void *data, int nr_wqebb)
 		wqe_line[3] = _mm_shuffle_epi8(wqe_line[3], shuf_mask);
 		wqe_line += 4;
 	}
-#elif defined(__ARM64_NEON__)
+#elif defined(RTE_ARCH_ARM64)
 	int i;
 	uint8x16_t *wqe_line = (uint8x16_t *)data;
 	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10,
@@ -237,7 +237,7 @@  static inline void hinic_sq_wqe_cpu_to_be32(void *data, int nr_wqebb)
 
 static inline void hinic_sge_cpu_to_be32(void *data, int nr_sge)
 {
-#if defined(__X86_64_SSE__)
+#if defined(RTE_ARCH_X86_64)
 	int i;
 	__m128i *sge_line = (__m128i *)data;
 	__m128i shuf_mask = _mm_set_epi8(12, 13, 14, 15, 8, 9, 10,
@@ -248,7 +248,7 @@  static inline void hinic_sge_cpu_to_be32(void *data, int nr_sge)
 		*sge_line = _mm_shuffle_epi8(*sge_line, shuf_mask);
 		sge_line++;
 	}
-#elif defined(__ARM64_NEON__)
+#elif defined(RTE_ARCH_ARM64)
 	int i;
 	uint8x16_t *sge_line = (uint8x16_t *)data;
 	const uint8x16_t shuf_mask = {3, 2, 1, 0, 7, 6, 5, 4, 11, 10,