Currently the config option allows lcore IDs up to 255,
irrespective of RTE_MAX_LCORES and needs to be fixed.

The patch fixes these constraints by allowing all
lcore IDs up to RTE_MAX_LCORES.

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

Signed-off-by: Sivaprasad Tummala <sivaprasad.tumm...@amd.com>
Acked-by: Konstantin Ananyev <konstantin.anan...@huawei.com>
Acked-by: Morten Brørup <m...@smartsharesystems.com>
Acked-by: Ferruh Yigit <ferruh.yi...@amd.com>
---
 examples/l3fwd/main.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 4d4738b92b..9fb4fe97d4 100644
--- a/examples/l3fwd/main.c
+++ b/examples/l3fwd/main.c
@@ -99,7 +99,7 @@ struct parm_cfg parm_config;
 struct lcore_params {
        uint16_t port_id;
        uint16_t queue_id;
-       uint8_t lcore_id;
+       uint32_t lcore_id;
 } __rte_cache_aligned;
 
 static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
@@ -293,7 +293,7 @@ static int
 check_lcore_params(void)
 {
        uint16_t queue, i;
-       uint8_t lcore;
+       uint32_t lcore;
        int socketid;
 
        for (i = 0; i < nb_lcore_params; ++i) {
@@ -304,12 +304,12 @@ 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 
mask\n", lcore);
+                       printf("error: lcore %u 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 
off \n",
+                       printf("warning: lcore %u is on socket %d with numa 
off\n",
                                lcore, socketid);
                }
        }
@@ -359,14 +359,14 @@ static int
 init_lcore_rx_queues(void)
 {
        uint16_t i, nb_rx_queue;
-       uint8_t lcore;
+       uint32_t lcore;
 
        for (i = 0; i < nb_lcore_params; ++i) {
                lcore = lcore_params[i].lcore_id;
                nb_rx_queue = lcore_conf[lcore].n_rx_queue;
                if (nb_rx_queue >= MAX_RX_QUEUE_PER_LCORE) {
                        printf("error: too many queues (%u) for lcore: %u\n",
-                               (unsigned int)nb_rx_queue + 1, (unsigned 
int)lcore);
+                               (unsigned int)nb_rx_queue + 1, lcore);
                        return -1;
                } else {
                        lcore_conf[lcore].rx_queue_list[nb_rx_queue].port_id =
@@ -500,8 +500,8 @@ parse_config(const char *q_arg)
        char *str_fld[_NUM_FLD];
        int i;
        unsigned size;
-       uint16_t max_fld[_NUM_FLD] = {USHRT_MAX,
-                               USHRT_MAX, UCHAR_MAX};
+       uint32_t max_fld[_NUM_FLD] = {USHRT_MAX,
+                               USHRT_MAX, RTE_MAX_LCORE};
 
        nb_lcore_params = 0;
 
@@ -534,7 +534,7 @@ parse_config(const char *q_arg)
                lcore_params_array[nb_lcore_params].queue_id =
                        (uint16_t)int_fld[FLD_QUEUE];
                lcore_params_array[nb_lcore_params].lcore_id =
-                       (uint8_t)int_fld[FLD_LCORE];
+                       (uint32_t)int_fld[FLD_LCORE];
                ++nb_lcore_params;
        }
        lcore_params = lcore_params_array;
-- 
2.34.1

Reply via email to