app/testpmd: fix lcore ID restriction

Message ID 20240415194631.124343-1-sivaprasad.tummala@amd.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers
Series app/testpmd: fix lcore ID restriction |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation fail Compilation issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build fail github build: failed
ci/iol-sample-apps-testing warning Testing issues
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing fail Testing issues
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-amd64-testing fail Testing issues
ci/iol-unit-arm64-testing fail Testing issues
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-compile-arm64-testing fail Testing issues

Commit Message

Sivaprasad Tummala April 15, 2024, 7:46 p.m. UTC
  With modern CPUs, it is possible to have higher
CPU count thus we can have higher RTE_MAX_LCORES.
In testpmd application, the current config forwarding
cores option "--nb-cores" is hard limited to 255.

The patch fixes this constraint and also adjusts the lcore
data structure to 32-bit to align with rte lcore APIs.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
 app/test-pmd/parameters.c | 2 +-
 app/test-pmd/testpmd.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger April 15, 2024, 9:54 p.m. UTC | #1
On Mon, 15 Apr 2024 19:46:31 +0000
Sivaprasad Tummala <sivaprasad.tummala@amd.com> wrote:

> +				nb_fwd_lcores = (lcoreid_t) n;

This should really be using strtoul() not atoi() because it offers
more error checking.
  
Stephen Hemminger April 15, 2024, 9:56 p.m. UTC | #2
On Mon, 15 Apr 2024 19:46:31 +0000
Sivaprasad Tummala <sivaprasad.tummala@amd.com> wrote:

> --- a/app/test-pmd/testpmd.h
> +++ b/app/test-pmd/testpmd.h
> @@ -84,7 +84,7 @@ extern volatile uint8_t f_quit;
>  /* Maximum number of pools supported per Rx queue */
>  #define MAX_MEMPOOL 8
>  
> -typedef uint8_t  lcoreid_t;
> +typedef uint32_t lcoreid_t;
>  typedef uint16_t portid_t;
>  typedef uint16_t queueid_t;
>  typedef uint16_t streamid_t;
> -- 

The other DPDK API's are using unsigned for lcore_id.
On the platforms that DPDK supports both are the same size.
  

Patch

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index c13f7564bf..6d2bf9b7c1 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1072,7 +1072,7 @@  launch_args_parse(int argc, char** argv)
 		case TESTPMD_OPT_NB_CORES_NUM:
 			n = atoi(optarg);
 			if (n > 0 && n <= nb_lcores)
-				nb_fwd_lcores = (uint8_t) n;
+				nb_fwd_lcores = (lcoreid_t) n;
 			else
 				rte_exit(EXIT_FAILURE,
 					"nb-cores should be > 0 and <= %d\n",
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 0afae7d771..9facd7f281 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -84,7 +84,7 @@  extern volatile uint8_t f_quit;
 /* Maximum number of pools supported per Rx queue */
 #define MAX_MEMPOOL 8
 
-typedef uint8_t  lcoreid_t;
+typedef uint32_t lcoreid_t;
 typedef uint16_t portid_t;
 typedef uint16_t queueid_t;
 typedef uint16_t streamid_t;