[PATCH v4 11/11] member: use common AVX512 build support

2025-03-29 Thread Bruce Richardson
Use the support for building AVX512 code present in lib/meson.build
rather than reimplementing it in the library meson.build file.

Signed-off-by: Bruce Richardson 
---
 lib/member/meson.build | 46 +++---
 1 file changed, 7 insertions(+), 39 deletions(-)

diff --git a/lib/member/meson.build b/lib/member/meson.build
index 4341b424df..07f9afaed9 100644
--- a/lib/member/meson.build
+++ b/lib/member/meson.build
@@ -20,44 +20,12 @@ sources = files(
 
 deps += ['hash', 'ring']
 
-# compile AVX512 version if:
-if dpdk_conf.has('RTE_ARCH_X86_64') and binutils_ok
-# compile AVX512 version if either:
-# a. we have AVX512 supported in minimum instruction set
-#baseline
-# b. it's not minimum instruction set, but supported by
-#compiler
-#
-# in former case, just add avx512 C file to files list
-# in latter case, compile c file to static lib, using correct
-# compiler flags, and then have the .o file from static lib
-# linked into main lib.
-
-member_avx512_args = cc_avx512_flags
-if not is_ms_compiler
-member_avx512_args += '-mavx512ifma'
-endif
-
-# check if all required flags already enabled
-sketch_avx512_flags = ['__AVX512F__', '__AVX512DQ__', '__AVX512IFMA__']
-
-sketch_avx512_on = true
-foreach f:sketch_avx512_flags
-if cc.get_define(f, args: machine_args) == ''
-sketch_avx512_on = false
-endif
-endforeach
-
-if sketch_avx512_on == true
-cflags += ['-DCC_AVX512_SUPPORT']
-sources += files('rte_member_sketch_avx512.c')
-elif cc.has_multi_arguments(member_avx512_args)
-sketch_avx512_tmp = static_library('sketch_avx512_tmp',
-'rte_member_sketch_avx512.c',
-include_directories: includes,
-dependencies: [static_rte_eal, static_rte_hash],
-c_args: cflags + member_avx512_args)
-objs += sketch_avx512_tmp.extract_objects('rte_member_sketch_avx512.c')
-cflags += ['-DCC_AVX512_SUPPORT']
+# compile AVX512 version if we have avx512 on MSVC or the 'ifma' flag on 
GCC/Clang
+if dpdk_conf.has('RTE_ARCH_X86_64')
+if is_ms_compiler
+sources_avx512 += files('rte_member_sketch_avx512.c')
+elif cc.has_argument('-mavx512ifma')
+sources_avx512 += files('rte_member_sketch_avx512.c')
+cflags_avx512 += '-mavx512ifma'
 endif
 endif
-- 
2.43.0



RE: [PATCH] app/testpmd: fix VLAN header parsing

2025-03-29 Thread Morten Brørup
> From: Raslan Darawsheh [mailto:rasl...@nvidia.com]
> Sent: Sunday, 23 March 2025 13.28
> 
> Updated the `get_ethertype_by_ptype` function to correctly parse VLAN
> headers.
> 
> Fixes: 76730c7b9b5a ("app/testpmd: use packet type parsing API")
> Cc: haij...@huawei.com
> 
> Signed-off-by: Raslan Darawsheh 
> ---
>  app/test-pmd/csumonly.c | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
> index 5b906eaa53..302cc4cc66 100644
> --- a/app/test-pmd/csumonly.c
> +++ b/app/test-pmd/csumonly.c
> @@ -468,6 +468,7 @@ get_ethertype_by_ptype(struct rte_ether_hdr
> *eth_hdr, uint32_t ptype)
>  {
>   struct rte_vlan_hdr *vlan_hdr;
>   uint16_t ethertype;
> + uint32_t i = 0;
> 
>   switch (ptype) {
>   case RTE_PTYPE_L3_IPV4:
> @@ -486,10 +487,11 @@ get_ethertype_by_ptype(struct rte_ether_hdr
> *eth_hdr, uint32_t ptype)
>   return _htons(RTE_ETHER_TYPE_IPV6);
>   default:
>   ethertype = eth_hdr->ether_type;
> - while (eth_hdr->ether_type == _htons(RTE_ETHER_TYPE_VLAN)
> ||
> - eth_hdr->ether_type == _htons(RTE_ETHER_TYPE_QINQ)) {
> + while (ethertype == _htons(RTE_ETHER_TYPE_VLAN) ||
> + ethertype == _htons(RTE_ETHER_TYPE_QINQ)) {
>   vlan_hdr = (struct rte_vlan_hdr *)
> - ((char *)eth_hdr + sizeof(*eth_hdr));
> + ((char *)eth_hdr + sizeof(*eth_hdr) +
> + (i * sizeof(struct rte_vlan_hdr)));

Doesn't work; "i" is not incremented, and remains 0.
Instead do this: Initialize (struct rte_vlan_hdr 
*)vlan_hdr=RTE_PTR_ADD(eth_hdr, offsetof(rte_ether_hdr, ether_type)) before the 
loop, and move vlan_hdr+=RTE_VLAN_HLEN inside the loop.

>   ethertype = vlan_hdr->eth_proto;
>   }
>   return ethertype;
> --
> 2.39.5 (Apple Git-154)