[PATCH v7 12/14] examples/l3fwd-power: fix port ID restriction

Sivaprasad Tummala sivaprasad.tummala at amd.com
Tue Mar 26 13:55:51 CET 2024


Currently application supports port IDs up to 255
irrespective of RTE_MAX_ETHPORTS.

The patch fixes these constraints by allowing port
IDs up to RTE_MAX_ETHPORTS.

Fixes: f88e7c175a68 ("examples/l3fwd-power: add high/regular perf cores options")
Cc: radu.nicolau at intel.com
Cc: stable at dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala at amd.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
 examples/l3fwd-power/main.c      | 4 ++--
 examples/l3fwd-power/perf_core.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index eac92ef875..a993af0408 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -1659,7 +1659,7 @@ parse_config(const char *q_arg)
 	int i;
 	unsigned size;
 	unsigned int max_fld[_NUM_FLD] = {
-		255,
+		RTE_MAX_ETHPORTS,
 		RTE_MAX_QUEUES_PER_PORT,
 		RTE_MAX_LCORE
 	};
@@ -1691,7 +1691,7 @@ parse_config(const char *q_arg)
 			return -1;
 		}
 		lcore_params_array[nb_lcore_params].port_id =
-				(uint8_t)int_fld[FLD_PORT];
+				(uint16_t)int_fld[FLD_PORT];
 		lcore_params_array[nb_lcore_params].queue_id =
 				(uint16_t)int_fld[FLD_QUEUE];
 		lcore_params_array[nb_lcore_params].lcore_id =
diff --git a/examples/l3fwd-power/perf_core.c b/examples/l3fwd-power/perf_core.c
index fbd7864cb9..e4bdb62121 100644
--- a/examples/l3fwd-power/perf_core.c
+++ b/examples/l3fwd-power/perf_core.c
@@ -133,7 +133,7 @@ parse_perf_config(const char *q_arg)
 	int i;
 	unsigned int size;
 	unsigned int max_fld[_NUM_FLD] = {
-		255,
+		RTE_MAX_ETHPORTS,
 		RTE_MAX_QUEUES_PER_PORT,
 		255,
 		RTE_MAX_LCORE
@@ -168,7 +168,7 @@ parse_perf_config(const char *q_arg)
 			return -1;
 		}
 		prf_lc_prms[nb_prf_lc_prms].port_id =
-				(uint8_t)int_fld[FLD_PORT];
+				(uint16_t)int_fld[FLD_PORT];
 		prf_lc_prms[nb_prf_lc_prms].queue_id =
 				(uint16_t)int_fld[FLD_QUEUE];
 		prf_lc_prms[nb_prf_lc_prms].high_perf =
-- 
2.25.1



More information about the stable mailing list