From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3BCD542FBA; Thu, 3 Aug 2023 01:50:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC0D4406BA; Thu, 3 Aug 2023 01:50:31 +0200 (CEST) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by mails.dpdk.org (Postfix) with ESMTP id 2E374406B8 for ; Thu, 3 Aug 2023 01:50:30 +0200 (CEST) Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-63cef62a944so2272146d6.1 for ; Wed, 02 Aug 2023 16:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1691020229; x=1691625029; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=yEU7wC3+ztxXAImWwCXDyxRAu5vY+lMGMid2VzNIe9c=; b=L936/5D2ULTEzEjWXHK/V77tcZIi40D8m+buVEfftOphjVThpUiwsmzqRoM/hVssM4 irLwv0wEso467nrD/eNZd1cJp5xLTYA5DbYxvfz63Wp80MkmfHft00OTjscNgzB0zCyy M1G6+LvzVsHNdTHME8PcBP0axmbncKCzeME8aYARlWH+utKqKDSan+WM6blt2RpKb1Gl lzmdUwghq60LsG0gSbZ2JB0CYhiOvr3JYw8+uyPW9ngpMtkIPaOY9lrb07Ps2+gDafRC nQy92nmzTESqExOh49ET+8sIqqoVs0CgRLsLXwhjWCPZi2NOWwscyxUbA/tcpAs4K9al uX4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691020229; x=1691625029; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yEU7wC3+ztxXAImWwCXDyxRAu5vY+lMGMid2VzNIe9c=; b=ATpywQzJ7nN9aceWyZsyKn79sF/GwG+2ydzC86rpNWpuOSRE8+Ns4MTsMuZIOAg4S0 qeWACbuvKNyaQhEhYsfZ7JdYV3Wewdao7Q3TO1ngn8SBlTUypdGIFmUy7rl3IWonubEi IHexScjKIr6Ixk6oycvV5VbvqLai8ydDYxQfGSNTk04RZAIHJ0s/5t7BeNa05Uw/o+bq vPjxgNeoImPnUuw3sbaF1u47mMEQTDlQzdj3GTi2p2hk1Qjnt7ew6xoWp+ZSg3a5tBDA Ky1Cy19S4tXhnucCxKayyegjYWIcpKrbsKfLMPfOuY2XDnEe4NvHFxPBxGRs1eh89pRe c29Q== X-Gm-Message-State: ABy/qLZG1DtS5ALifyZgA3bsy9tnsFRew9EJQTvHuqZEceL+ukgd5Urz 8WNAZ5MxTlLrIGWLcvCRAI5MKV663h9E3z9C4+xo+Q== X-Google-Smtp-Source: APBJJlF7DIAG2nXNi6BjOwOhtoHxQ9CF3e8GvFZWIrJcdBcPKEsui+ojCPbWKDd9qsDAButwSC0E6qtZ9NwYBmKWaO0= X-Received: by 2002:ad4:50ca:0:b0:63c:f8b5:4601 with SMTP id e10-20020ad450ca000000b0063cf8b54601mr16318721qvq.7.1691020229530; Wed, 02 Aug 2023 16:50:29 -0700 (PDT) MIME-Version: 1.0 References: <20230802211150.939121-1-sivaprasad.tummala@amd.com> In-Reply-To: <20230802211150.939121-1-sivaprasad.tummala@amd.com> From: =?UTF-8?Q?Stanis=C5=82aw_Kardach?= Date: Thu, 3 Aug 2023 01:50:17 +0200 Message-ID: Subject: Re: [PATCH 1/2] eal: remove RTE_CPUFLAG_NUMFLAGS To: Sivaprasad Tummala Cc: Ruifeng Wang , Min Zhou , David Christensen , Bruce Richardson , Konstantin Ananyev , dev Content-Type: multipart/alternative; boundary="00000000000016eed40601f9546f" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --00000000000016eed40601f9546f Content-Type: text/plain; charset="UTF-8" On Wed, Aug 2, 2023, 23:12 Sivaprasad Tummala wrote: > This patch removes RTE_CPUFLAG_NUMFLAGS to allow new CPU > features without breaking ABI each time. > I'm not sure I understand the reason for removing the last element canary. It's quite useful in the coffee that you're refactoring. Isn't it so that you want to essentially remove the test (other commit in this series)? Because that I can understand as a forward compatibility measure. > > Signed-off-by: Sivaprasad Tummala > --- > lib/eal/arm/include/rte_cpuflags_32.h | 1 - > lib/eal/arm/include/rte_cpuflags_64.h | 1 - > lib/eal/arm/rte_cpuflags.c | 7 +++++-- > lib/eal/loongarch/include/rte_cpuflags.h | 1 - > lib/eal/loongarch/rte_cpuflags.c | 7 +++++-- > lib/eal/ppc/include/rte_cpuflags.h | 1 - > lib/eal/ppc/rte_cpuflags.c | 7 +++++-- > lib/eal/riscv/include/rte_cpuflags.h | 1 - > lib/eal/riscv/rte_cpuflags.c | 7 +++++-- > lib/eal/x86/include/rte_cpuflags.h | 1 - > lib/eal/x86/rte_cpuflags.c | 7 +++++-- > 11 files changed, 25 insertions(+), 16 deletions(-) > > diff --git a/lib/eal/arm/include/rte_cpuflags_32.h > b/lib/eal/arm/include/rte_cpuflags_32.h > index 4e254428a2..41ab0d5f21 100644 > --- a/lib/eal/arm/include/rte_cpuflags_32.h > +++ b/lib/eal/arm/include/rte_cpuflags_32.h > @@ -43,7 +43,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_V7L, > RTE_CPUFLAG_V8L, > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/arm/include/rte_cpuflags_64.h > b/lib/eal/arm/include/rte_cpuflags_64.h > index aa7a56d491..ea5193e510 100644 > --- a/lib/eal/arm/include/rte_cpuflags_64.h > +++ b/lib/eal/arm/include/rte_cpuflags_64.h > @@ -37,7 +37,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_SVEBF16, > RTE_CPUFLAG_AARCH64, > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/arm/rte_cpuflags.c b/lib/eal/arm/rte_cpuflags.c > index 56e7b2e689..447a8d9f9f 100644 > --- a/lib/eal/arm/rte_cpuflags.c > +++ b/lib/eal/arm/rte_cpuflags.c > @@ -139,8 +139,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > { > const struct feature_entry *feat; > hwcap_registers_t regs = {0}; > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + if (feature >= num_flags) > return -ENOENT; > > feat = &rte_cpu_feature_table[feature]; > @@ -154,7 +155,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const char * > rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) > { > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > + > + if (feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > diff --git a/lib/eal/loongarch/include/rte_cpuflags.h > b/lib/eal/loongarch/include/rte_cpuflags.h > index 1c80779262..9ff8baaa3c 100644 > --- a/lib/eal/loongarch/include/rte_cpuflags.h > +++ b/lib/eal/loongarch/include/rte_cpuflags.h > @@ -27,7 +27,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_LBT_ARM, > RTE_CPUFLAG_LBT_MIPS, > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS /**< This should always be the last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/loongarch/rte_cpuflags.c > b/lib/eal/loongarch/rte_cpuflags.c > index 0a75ca58d4..642eb42509 100644 > --- a/lib/eal/loongarch/rte_cpuflags.c > +++ b/lib/eal/loongarch/rte_cpuflags.c > @@ -66,8 +66,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > { > const struct feature_entry *feat; > hwcap_registers_t regs = {0}; > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + if (feature >= num_flags) > return -ENOENT; > > feat = &rte_cpu_feature_table[feature]; > @@ -81,7 +82,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const char * > rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) > { > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > + > + if (feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > diff --git a/lib/eal/ppc/include/rte_cpuflags.h > b/lib/eal/ppc/include/rte_cpuflags.h > index a88355d170..b74e7a73ee 100644 > --- a/lib/eal/ppc/include/rte_cpuflags.h > +++ b/lib/eal/ppc/include/rte_cpuflags.h > @@ -49,7 +49,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_HTM, > RTE_CPUFLAG_ARCH_2_07, > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/ppc/rte_cpuflags.c b/lib/eal/ppc/rte_cpuflags.c > index 61db5c216d..3a639ef45a 100644 > --- a/lib/eal/ppc/rte_cpuflags.c > +++ b/lib/eal/ppc/rte_cpuflags.c > @@ -90,8 +90,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > { > const struct feature_entry *feat; > hwcap_registers_t regs = {0}; > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + if (feature >= num_flags) > return -ENOENT; > > feat = &rte_cpu_feature_table[feature]; > @@ -105,7 +106,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const char * > rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) > { > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > + > + if (feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > diff --git a/lib/eal/riscv/include/rte_cpuflags.h > b/lib/eal/riscv/include/rte_cpuflags.h > index 66e787f898..803c3655ae 100644 > --- a/lib/eal/riscv/include/rte_cpuflags.h > +++ b/lib/eal/riscv/include/rte_cpuflags.h > @@ -43,7 +43,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_RISCV_ISA_Y, /* Reserved */ > RTE_CPUFLAG_RISCV_ISA_Z, /* Reserved */ > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS,/**< This should always be the last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/riscv/rte_cpuflags.c b/lib/eal/riscv/rte_cpuflags.c > index 4f6d29b947..a452261188 100644 > --- a/lib/eal/riscv/rte_cpuflags.c > +++ b/lib/eal/riscv/rte_cpuflags.c > @@ -95,8 +95,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > { > const struct feature_entry *feat; > hwcap_registers_t regs = {0}; > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + if (feature >= num_flags) > return -ENOENT; > > feat = &rte_cpu_feature_table[feature]; > @@ -110,7 +111,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const char * > rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) > { > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > + > + if (feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > diff --git a/lib/eal/x86/include/rte_cpuflags.h > b/lib/eal/x86/include/rte_cpuflags.h > index 92e90fb6e0..7fc6117243 100644 > --- a/lib/eal/x86/include/rte_cpuflags.h > +++ b/lib/eal/x86/include/rte_cpuflags.h > @@ -135,7 +135,6 @@ enum rte_cpu_flag_t { > RTE_CPUFLAG_WAITPKG, /**< UMONITOR/UMWAIT/TPAUSE */ > > /* The last item */ > - RTE_CPUFLAG_NUMFLAGS, /**< This should always be the > last! */ > }; > > #include "generic/rte_cpuflags.h" > diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c > index d6b518251b..00d17c7515 100644 > --- a/lib/eal/x86/rte_cpuflags.c > +++ b/lib/eal/x86/rte_cpuflags.c > @@ -149,8 +149,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const struct feature_entry *feat; > cpuid_registers_t regs; > unsigned int maxleaf; > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + if (feature >= num_flags) > /* Flag does not match anything in the feature tables */ > return -ENOENT; > > @@ -176,7 +177,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) > const char * > rte_cpu_get_flag_name(enum rte_cpu_flag_t feature) > { > - if (feature >= RTE_CPUFLAG_NUMFLAGS) > + unsigned int num_flags = RTE_DIM(rte_cpu_feature_table); > + > + if (feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > -- > 2.34.1 > > --00000000000016eed40601f9546f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Aug 2, 2023, 23:12 Sivaprasad Tummala <sivaprasad.tummala@amd.com> wrote:
This patch removes RTE_CPUFLAG_NUMFLAGS to allow new = CPU
features without breaking ABI each time.
I'm not sure I understand the reason for removing the last = element canary. It's quite useful in the coffee that you're refacto= ring.
Isn't it so that you want to essentially r= emove the test (other commit in this series)?
Becaus= e that I can understand as a forward compatibility measure.

Signed-off-by: Sivaprasad Tummala <sivapra= sad.tummala@amd.com>
---
=C2=A0lib/eal/arm/include/rte_cpuflags_32.h=C2=A0 =C2=A0 | 1 -
=C2=A0lib/eal/arm/include/rte_cpuflags_64.h=C2=A0 =C2=A0 | 1 -
=C2=A0lib/eal/arm/rte_cpuflags.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 7 +++++--
=C2=A0lib/eal/loongarch/include/rte_cpuflags.h | 1 -
=C2=A0lib/eal/loongarch/rte_cpuflags.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| 7= +++++--
=C2=A0lib/eal/ppc/include/rte_cpuflags.h=C2=A0 =C2=A0 =C2=A0 =C2=A0| 1 - =C2=A0lib/eal/ppc/rte_cpuflags.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 7 +++++--
=C2=A0lib/eal/riscv/include/rte_cpuflags.h=C2=A0 =C2=A0 =C2=A0| 1 -
=C2=A0lib/eal/riscv/rte_cpuflags.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0| 7 +++++--
=C2=A0lib/eal/x86/include/rte_cpuflags.h=C2=A0 =C2=A0 =C2=A0 =C2=A0| 1 - =C2=A0lib/eal/x86/rte_cpuflags.c=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| 7 +++++--
=C2=A011 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/lib/eal/arm/include/rte_cpuflags_32.h b/lib/eal/arm/include/rt= e_cpuflags_32.h
index 4e254428a2..41ab0d5f21 100644
--- a/lib/eal/arm/include/rte_cpuflags_32.h
+++ b/lib/eal/arm/include/rte_cpuflags_32.h
@@ -43,7 +43,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_V7L,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_V8L,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS,/**< This should always= be the last! */
=C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/arm/include/rte_cpuflags_64.h b/lib/eal/arm/include/rt= e_cpuflags_64.h
index aa7a56d491..ea5193e510 100644
--- a/lib/eal/arm/include/rte_cpuflags_64.h
+++ b/lib/eal/arm/include/rte_cpuflags_64.h
@@ -37,7 +37,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_SVEBF16,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_AARCH64,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS,/**< This should always= be the last! */
=C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/arm/rte_cpuflags.c b/lib/eal/arm/rte_cpuflags.c
index 56e7b2e689..447a8d9f9f 100644
--- a/lib/eal/arm/rte_cpuflags.c
+++ b/lib/eal/arm/rte_cpuflags.c
@@ -139,8 +139,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 const struct feature_entry *feat;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 hwcap_registers_t regs =3D {0};
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOENT;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 feat =3D &rte_cpu_feature_table[feature]; @@ -154,7 +155,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0const char *
=C2=A0rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rte_cpu_feature_table[feature].name;
=C2=A0}
diff --git a/lib/eal/loongarch/include/rte_cpuflags.h b/lib/eal/loongarch/i= nclude/rte_cpuflags.h
index 1c80779262..9ff8baaa3c 100644
--- a/lib/eal/loongarch/include/rte_cpuflags.h
+++ b/lib/eal/loongarch/include/rte_cpuflags.h
@@ -27,7 +27,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_LBT_ARM,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_LBT_MIPS,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS /**< This should always= be the last! */
=C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/loongarch/rte_cpuflags.c b/lib/eal/loongarch/rte_cpufl= ags.c
index 0a75ca58d4..642eb42509 100644
--- a/lib/eal/loongarch/rte_cpuflags.c
+++ b/lib/eal/loongarch/rte_cpuflags.c
@@ -66,8 +66,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 const struct feature_entry *feat;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 hwcap_registers_t regs =3D {0};
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOENT;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 feat =3D &rte_cpu_feature_table[feature]; @@ -81,7 +82,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
=C2=A0const char *
=C2=A0rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rte_cpu_feature_table[feature].name;
=C2=A0}
diff --git a/lib/eal/ppc/include/rte_cpuflags.h b/lib/eal/ppc/include/rte_c= puflags.h
index a88355d170..b74e7a73ee 100644
--- a/lib/eal/ppc/include/rte_cpuflags.h
+++ b/lib/eal/ppc/include/rte_cpuflags.h
@@ -49,7 +49,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_HTM,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_ARCH_2_07,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS,/**< This should always= be the last! */
=C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/ppc/rte_cpuflags.c b/lib/eal/ppc/rte_cpuflags.c
index 61db5c216d..3a639ef45a 100644
--- a/lib/eal/ppc/rte_cpuflags.c
+++ b/lib/eal/ppc/rte_cpuflags.c
@@ -90,8 +90,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 const struct feature_entry *feat;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 hwcap_registers_t regs =3D {0};
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOENT;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 feat =3D &rte_cpu_feature_table[feature]; @@ -105,7 +106,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0const char *
=C2=A0rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rte_cpu_feature_table[feature].name;
=C2=A0}
diff --git a/lib/eal/riscv/include/rte_cpuflags.h b/lib/eal/riscv/include/r= te_cpuflags.h
index 66e787f898..803c3655ae 100644
--- a/lib/eal/riscv/include/rte_cpuflags.h
+++ b/lib/eal/riscv/include/rte_cpuflags.h
@@ -43,7 +43,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_RISCV_ISA_Y, /* Reserved */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_RISCV_ISA_Z, /* Reserved */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS,/**< This should always= be the last! */
=C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/riscv/rte_cpuflags.c b/lib/eal/riscv/rte_cpuflags.c index 4f6d29b947..a452261188 100644
--- a/lib/eal/riscv/rte_cpuflags.c
+++ b/lib/eal/riscv/rte_cpuflags.c
@@ -95,8 +95,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature)
=C2=A0{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 const struct feature_entry *feat;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 hwcap_registers_t regs =3D {0};
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOENT;

=C2=A0 =C2=A0 =C2=A0 =C2=A0 feat =3D &rte_cpu_feature_table[feature]; @@ -110,7 +111,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0const char *
=C2=A0rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rte_cpu_feature_table[feature].name;
=C2=A0}
diff --git a/lib/eal/x86/include/rte_cpuflags.h b/lib/eal/x86/include/rte_c= puflags.h
index 92e90fb6e0..7fc6117243 100644
--- a/lib/eal/x86/include/rte_cpuflags.h
+++ b/lib/eal/x86/include/rte_cpuflags.h
@@ -135,7 +135,6 @@ enum rte_cpu_flag_t {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 RTE_CPUFLAG_WAITPKG,=C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 /**< UMONITOR/UMWAIT/TPAUSE */

=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* The last item */
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_CPUFLAG_NUMFLAGS,=C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/**< This should always be the last! */ =C2=A0};

=C2=A0#include "generic/rte_cpuflags.h"
diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c
index d6b518251b..00d17c7515 100644
--- a/lib/eal/x86/rte_cpuflags.c
+++ b/lib/eal/x86/rte_cpuflags.c
@@ -149,8 +149,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0 =C2=A0 =C2=A0 =C2=A0 const struct feature_entry *feat;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 cpuid_registers_t regs;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned int maxleaf;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);

-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 /* Flag does not ma= tch anything in the feature tables */
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -ENOENT;

@@ -176,7 +177,9 @@ rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature) =C2=A0const char *
=C2=A0rte_cpu_get_flag_name(enum rte_cpu_flag_t feature)
=C2=A0{
-=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D RTE_CPUFLAG_NUMFLAGS)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int num_flags =3D RTE_DIM(rte_cpu_feat= ure_table);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (feature >=3D num_flags)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return NULL;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return rte_cpu_feature_table[feature].name;
=C2=A0}
--
2.34.1

--00000000000016eed40601f9546f--