[v2,2/6] examples/l3fwd-power: fix lcore ID restriction
Checks
Commit Message
Currently the config option allows lcore IDs up to 255,
irrespective of RTE_MAX_LCORES and needs to be fixed.
The patch allows config options based on DPDK config.
Fixes: f88e7c175a68 ("examples/l3fwd-power: add high/regular perf cores options")
Cc: radu.nicolau@intel.com
Cc: stable@dpdk.org
Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
examples/l3fwd-power/main.c | 16 +++++++++-------
examples/l3fwd-power/main.h | 2 +-
2 files changed, 10 insertions(+), 8 deletions(-)
@@ -1399,8 +1399,8 @@ main_legacy_loop(__rte_unused void *dummy)
static int
check_lcore_params(void)
{
- uint8_t queue, lcore;
- uint16_t i;
+ uint8_t queue;
+ uint16_t lcore, i;
int socketid;
for (i = 0; i < nb_lcore_params; ++i) {
@@ -1411,13 +1411,13 @@ check_lcore_params(void)
}
lcore = lcore_params[i].lcore_id;
if (!rte_lcore_is_enabled(lcore)) {
- printf("error: lcore %hhu is not enabled in lcore "
+ printf("error: lcore %hu is not enabled in lcore "
"mask\n", lcore);
return -1;
}
if ((socketid = rte_lcore_to_socket_id(lcore) != 0) &&
(numa_on == 0)) {
- printf("warning: lcore %hhu is on socket %d with numa "
+ printf("warning: lcore %hu is on socket %d with numa "
"off\n", lcore, socketid);
}
if (app_mode == APP_MODE_TELEMETRY && lcore == rte_lcore_id()) {
@@ -1469,7 +1469,7 @@ static int
init_lcore_rx_queues(void)
{
uint16_t i, nb_rx_queue;
- uint8_t lcore;
+ uint16_t lcore;
for (i = 0; i < nb_lcore_params; ++i) {
lcore = lcore_params[i].lcore_id;
@@ -1661,6 +1661,8 @@ parse_config(const char *q_arg)
char *str_fld[_NUM_FLD];
int i;
unsigned size;
+ unsigned int max_fld[_NUM_FLD] = {RTE_MAX_ETHPORTS,
+ 255, RTE_MAX_LCORE};
nb_lcore_params = 0;
@@ -1681,7 +1683,7 @@ parse_config(const char *q_arg)
errno = 0;
int_fld[i] = strtoul(str_fld[i], &end, 0);
if (errno != 0 || end == str_fld[i] || int_fld[i] >
- 255)
+ max_fld[i])
return -1;
}
if (nb_lcore_params >= MAX_LCORE_PARAMS) {
@@ -1694,7 +1696,7 @@ parse_config(const char *q_arg)
lcore_params_array[nb_lcore_params].queue_id =
(uint8_t)int_fld[FLD_QUEUE];
lcore_params_array[nb_lcore_params].lcore_id =
- (uint8_t)int_fld[FLD_LCORE];
+ (uint16_t)int_fld[FLD_LCORE];
++nb_lcore_params;
}
lcore_params = lcore_params_array;
@@ -10,7 +10,7 @@
struct lcore_params {
uint16_t port_id;
uint8_t queue_id;
- uint8_t lcore_id;
+ uint16_t lcore_id;
} __rte_cache_aligned;
extern struct lcore_params *lcore_params;