[v2,2/2] net/i40e: fix mingw build error

Message ID 20210127084745.73116-3-leyi.rong@intel.com (mailing list archive)
State Superseded, archived
Headers
Series fix mingw build error |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Leyi Rong Jan. 27, 2021, 8:47 a.m. UTC
  Disable i40e avx512 code path for windows build to
avoid the mingw build error.

Fixes: e6a6a138919f ("net/i40e: add AVX512 vector path")

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
---
 drivers/net/i40e/meson.build | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
  

Comments

Bruce Richardson Jan. 27, 2021, 10:40 a.m. UTC | #1
On Wed, Jan 27, 2021 at 04:47:45PM +0800, Leyi Rong wrote:
> Disable i40e avx512 code path for windows build to
> avoid the mingw build error.
> 
> Fixes: e6a6a138919f ("net/i40e: add AVX512 vector path")
> 
> Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> ---
>  drivers/net/i40e/meson.build | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
> index c0acdf4fd4..34c9dfa681 100644
> --- a/drivers/net/i40e/meson.build
> +++ b/drivers/net/i40e/meson.build
> @@ -54,19 +54,21 @@ if arch_subdir == 'x86'
>  		cc.has_argument('-mavx512f') and
>  		cc.has_argument('-mavx512bw'))
>  
> -	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
> -		cflags += ['-DCC_AVX512_SUPPORT']
> -		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
> -		if cc.has_argument('-march=skylake-avx512')
> -			avx512_args += '-march=skylake-avx512'
> +	if not is_windows or cc.get_id() == 'clang'
> +		if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true

Rather than changing this whole block to indent it further following the
new condition check, I think a simpler fix might be to insert:

if is_windows and cc.get_id() != 'clang'
	i40e_avx512_cc_support = false
endif

just after the initial assignment to i40e_avx512_cc_support. [Alternatively,
you can include those conditions in the assignment itself, but it's
probably more readable done separately as I show above.]

/Bruce
  
Leyi Rong Jan. 27, 2021, 12:18 p.m. UTC | #2
> -----Original Message-----
> From: Bruce Richardson <bruce.richardson@intel.com>
> Sent: Wednesday, January 27, 2021 6:41 PM
> To: Rong, Leyi <leyi.rong@intel.com>
> Cc: talshn@nvidia.com; Zhang, Qi Z <qi.z.zhang@intel.com>; Kadam, Pallavi
> <pallavi.kadam@intel.com>; Yigit, Ferruh <ferruh.yigit@intel.com>; Menon,
> Ranjit <ranjit.menon@intel.com>; Xing, Beilei <beilei.xing@intel.com>;
> dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v2 2/2] net/i40e: fix mingw build error
> 
> On Wed, Jan 27, 2021 at 04:47:45PM +0800, Leyi Rong wrote:
> > Disable i40e avx512 code path for windows build to avoid the mingw
> > build error.
> >
> > Fixes: e6a6a138919f ("net/i40e: add AVX512 vector path")
> >
> > Signed-off-by: Leyi Rong <leyi.rong@intel.com>
> > ---
> >  drivers/net/i40e/meson.build | 26 ++++++++++++++------------
> >  1 file changed, 14 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/net/i40e/meson.build
> > b/drivers/net/i40e/meson.build index c0acdf4fd4..34c9dfa681 100644
> > --- a/drivers/net/i40e/meson.build
> > +++ b/drivers/net/i40e/meson.build
> > @@ -54,19 +54,21 @@ if arch_subdir == 'x86'
> >  		cc.has_argument('-mavx512f') and
> >  		cc.has_argument('-mavx512bw'))
> >
> > -	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
> > -		cflags += ['-DCC_AVX512_SUPPORT']
> > -		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
> > -		if cc.has_argument('-march=skylake-avx512')
> > -			avx512_args += '-march=skylake-avx512'
> > +	if not is_windows or cc.get_id() == 'clang'
> > +		if i40e_avx512_cpu_support == true or i40e_avx512_cc_support
> ==
> > +true
> 
> Rather than changing this whole block to indent it further following the new
> condition check, I think a simpler fix might be to insert:
> 
> if is_windows and cc.get_id() != 'clang'
> 	i40e_avx512_cc_support = false
> endif
> 
> just after the initial assignment to i40e_avx512_cc_support. [Alternatively, you
> can include those conditions in the assignment itself, but it's probably more
> readable done separately as I show above.]
> 
> /Bruce

Agree, seems clear to put the logic block separately. Thanks~
  

Patch

diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index c0acdf4fd4..34c9dfa681 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -54,19 +54,21 @@  if arch_subdir == 'x86'
 		cc.has_argument('-mavx512f') and
 		cc.has_argument('-mavx512bw'))
 
-	if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
-		cflags += ['-DCC_AVX512_SUPPORT']
-		avx512_args = [cflags, '-mavx512f', '-mavx512bw']
-		if cc.has_argument('-march=skylake-avx512')
-			avx512_args += '-march=skylake-avx512'
+	if not is_windows or cc.get_id() == 'clang'
+		if i40e_avx512_cpu_support == true or i40e_avx512_cc_support == true
+			cflags += ['-DCC_AVX512_SUPPORT']
+			avx512_args = [cflags, '-mavx512f', '-mavx512bw']
+			if cc.has_argument('-march=skylake-avx512')
+				avx512_args += '-march=skylake-avx512'
+			endif
+			i40e_avx512_lib = static_library('i40e_avx512_lib',
+					'i40e_rxtx_vec_avx512.c',
+					dependencies: [static_rte_ethdev,
+						static_rte_kvargs, static_rte_hash],
+					include_directories: includes,
+					c_args: avx512_args)
+			objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c')
 		endif
-		i40e_avx512_lib = static_library('i40e_avx512_lib',
-				'i40e_rxtx_vec_avx512.c',
-				dependencies: [static_rte_ethdev,
-					static_rte_kvargs, static_rte_hash],
-				include_directories: includes,
-				c_args: avx512_args)
-		objs += i40e_avx512_lib.extract_objects('i40e_rxtx_vec_avx512.c')
 	endif
 elif arch_subdir == 'ppc'
        sources += files('i40e_rxtx_vec_altivec.c')