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 3E8154306C; Tue, 15 Aug 2023 08:10:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD49842B71; Tue, 15 Aug 2023 08:10:29 +0200 (CEST) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by mails.dpdk.org (Postfix) with ESMTP id 69A52427E9 for ; Tue, 15 Aug 2023 08:10:28 +0200 (CEST) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-765a7768f1dso421262085a.0 for ; Mon, 14 Aug 2023 23:10:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf.com; s=google; t=1692079828; x=1692684628; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zj4PepGyR0QqKbFow7YNEGOsH7S2G5Oc7ZCAcjBrJn4=; b=n4VEfMEmaOt/+Dey8MxzkHDAyZgMBIc4JPqbWtsFno7sfZ8lZQRVSQa7RfNMq+0G9c QBDw4NPgdkZIuxEXymkHBc5AH5dDI05qreSV/Z5t1UTTUQB39Je9VOlt8DPiuTQkXLMs 8x4qIKTYN/A11uHMooS26zJ7LlrqOc7NebxdbWpI8qbKB6q5bAcq2HSABhQhXGD5XOL9 fcLwkeOD3Kp4U4toSQZiXBhEHMnepb64l76zMSikDP9KYDfzqLy+iO+XJM6lEfSR94+4 CL2xWkJ6XtOq4PavEcbp2VvfmU9d4xmfHqJ3i0d0+9fpL6H2XGEe6HVMuQSrxriu1gKM yV2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692079828; x=1692684628; 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=zj4PepGyR0QqKbFow7YNEGOsH7S2G5Oc7ZCAcjBrJn4=; b=kXQmip5oNsVekOvJlzVEsGdTL4UIyQvbQ7f1nb9wosenbviAjfv4U0MmQpsBcDL0yV FDZhW7UvlQa96JG0tfEWbP5duxzsHFL8W0W0HJD2roSIMvCJo4Cez8uLKqx3UFuD3tpW 07N/FGtEVRL609gpEtXwkb+z0X5uMowHIGatFy+TAL14Ge98kDc1/hHlHWv8owybY2J1 LyPU5D4/9X2pHE/1zzVV0OIa3GCQWhZ1VbYHdN3Bg79uHA425ues6o59j9PVzfX5kVml ZA1cLy2GuwBRyhm+i/CVdxmLscn9efizZsaaCDKOPlEdo16I97E9o2tlVCs5BBoKhw1f WRcw== X-Gm-Message-State: AOJu0Yy6lzM8NQ3obLV5aWnvooZ7DdttGs+GSfwB34akPoQMAZs3FhuB wbzv3uDRqds9jXr9OfzIEOGGBBTYNEjIgmONC2s0R4HjfhNLTmPa X-Google-Smtp-Source: AGHT+IFILTUTPIjYkWkPUCO94IWqUN6L/oDxtL98dKDjVugMrWf4UmjbnHdXKAl8OgHWzS4dPZo6TaE9zcELlm6whlw= X-Received: by 2002:a05:620a:389e:b0:76c:b422:d459 with SMTP id qp30-20020a05620a389e00b0076cb422d459mr11100715qkn.27.1692079827793; Mon, 14 Aug 2023 23:10:27 -0700 (PDT) MIME-Version: 1.0 References: <20230802211150.939121-1-sivaprasad.tummala@amd.com> <20230811060755.481572-1-sivaprasad.tummala@amd.com> <20230811060755.481572-2-sivaprasad.tummala@amd.com> In-Reply-To: <20230811060755.481572-2-sivaprasad.tummala@amd.com> From: =?UTF-8?Q?Stanis=C5=82aw_Kardach?= Date: Tue, 15 Aug 2023 08:10:17 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] eal: remove NUMFLAGS enumeration To: Sivaprasad Tummala Cc: Ruifeng Wang , Min Zhou , David Christensen , Bruce Richardson , Konstantin Ananyev , dev Content-Type: multipart/alternative; boundary="0000000000001167690602f009d9" 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 --0000000000001167690602f009d9 Content-Type: text/plain; charset="UTF-8" On Fri, Aug 11, 2023, 08:08 Sivaprasad Tummala wrote: > This patch removes RTE_CPUFLAG_NUMFLAGS to allow new CPU > features without breaking ABI each time. > > 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! */ > }; > Since there is no description of V1 to V2 changes, could you point me to what has changed? Also I see you're still removing the RTE_CPUFLAG_NUMFLAGS (what I call a last element canary). Why? If you're concerned with ABI, then we're talking about an application linking dynamically with DPDK or talking via some RPC channel with another DPDK application. So clashing with this definition does not come into question. One should rather use rte_cpu_get_flag_enabled(). Also if you want to introduce new features, one would add them yo the rte_cpuflags headers, unless you'd like to not add those and keep an undocumented list "above" the last defined element. Could you explain a bit more Your use-case? > > #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..f33fee242b 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 ((unsigned int)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 ((unsigned int)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..73b53b8a3a 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 ((unsigned int)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 ((unsigned int)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..a173c62631 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 ((unsigned int)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 ((unsigned int)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..6d3f8f16cc 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 ((unsigned int)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 ((unsigned int)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..22061cb6d3 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 ((unsigned int)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 ((unsigned int)feature >= num_flags) > return NULL; > return rte_cpu_feature_table[feature].name; > } > -- > 2.34.1 > > --0000000000001167690602f009d9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Aug 11, 2023, 08:08 Sivaprasad Tummala <sivaprasad.tummala@amd.com> wrote= :
This patch removes RTE_CPUFLAG_NU= MFLAGS to allow new CPU
features without breaking ABI each time.

Signed-off-by: Sivaprasad Tummala <sivaprasad.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};
Since there is no de= scription of V1 to V2 changes, could you point me to what has changed?
Also I see you're still removing the RTE_CPUFLAG_NUM= FLAGS (what I call a last element canary). Why? If you're concerned wit= h ABI, then we're talking about an application linking dynamically with= DPDK or talking via some RPC channel with another DPDK application. So cla= shing with this definition does not come into question. One should rather u= se rte_cpu_get_flag_enabled().
Also if you want to i= ntroduce new features, one would add them yo the rte_cpuflags headers, unle= ss you'd like to not add those and keep an undocumented list "abov= e" the last defined element.=C2=A0
Could you ex= plain a bit more Your use-case?

=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..f33fee242b 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 ((unsigned int)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 ((unsigned int)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..73b53b8a3a 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 ((unsigned int)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 ((unsigned int)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..a173c62631 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 ((unsigned int)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 ((unsigned int)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..6d3f8f16cc 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 ((unsigned int)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 ((unsigned int)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..22061cb6d3 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 ((unsigned int)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 ((unsigned int)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

--0000000000001167690602f009d9--