[v2,1/6] examples/l3fwd: fix lcore ID restriction

Message ID 20231219032826.4814-2-sivaprasad.tummala@amd.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series fix lcore ID restriction |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Sivaprasad Tummala Dec. 19, 2023, 3:28 a.m. UTC
  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: af75078fece3 ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
---
 examples/l3fwd/main.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
  

Comments

Konstantin Ananyev Dec. 19, 2023, 12:05 p.m. UTC | #1
> 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: af75078fece3 ("first public release")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> ---
>  examples/l3fwd/main.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 3bf28aec0c..ed116da09c 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;
>  	uint8_t queue_id;
> -	uint8_t lcore_id;
> +	uint16_t lcore_id;
>  } __rte_cache_aligned;
> 
>  static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
> @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)
>  static int
>  check_lcore_params(void)
>  {
> -	uint8_t queue, lcore;
> -	uint16_t i;
> +	uint8_t queue;
> +	uint16_t i, 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 %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 off \n",
> +			printf("warning: lcore %hu is on socket %d with numa off\n",
>  				lcore, socketid);
>  		}
>  	}
> @@ -359,7 +359,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;
> @@ -500,6 +500,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;
> 
> @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
>  		for (i = 0; i < _NUM_FLD; i++){
>  			errno = 0;
>  			int_fld[i] = strtoul(str_fld[i], &end, 0);
> -			if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
> +			if (errno != 0 || end == str_fld[i] || int_fld[i] >
> +									max_fld[i])
>  				return -1;
>  		}
>  		if (nb_lcore_params >= MAX_LCORE_PARAMS) {
> @@ -531,7 +534,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;
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
 

> 2.25.1
  
Konstantin Ananyev Dec. 19, 2023, 12:30 p.m. UTC | #2
> 
> > 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: af75078fece3 ("first public release")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> > ---
> >  examples/l3fwd/main.c | 19 +++++++++++--------
> >  1 file changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> > index 3bf28aec0c..ed116da09c 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;
> >  	uint8_t queue_id;

Actually one comment: 
As lcore_id becomes uint16_t it might be worth to do the same queue_id,
they usually are very much related. 

> > -	uint8_t lcore_id;
> > +	uint16_t lcore_id;
> >  } __rte_cache_aligned;
> >
> >  static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
> > @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)
> >  static int
> >  check_lcore_params(void)
> >  {
> > -	uint8_t queue, lcore;
> > -	uint16_t i;
> > +	uint8_t queue;
> > +	uint16_t i, 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 %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 off \n",
> > +			printf("warning: lcore %hu is on socket %d with numa off\n",
> >  				lcore, socketid);
> >  		}
> >  	}
> > @@ -359,7 +359,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;
> > @@ -500,6 +500,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;
> >
> > @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
> >  		for (i = 0; i < _NUM_FLD; i++){
> >  			errno = 0;
> >  			int_fld[i] = strtoul(str_fld[i], &end, 0);
> > -			if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
> > +			if (errno != 0 || end == str_fld[i] || int_fld[i] >
> > +									max_fld[i])
> >  				return -1;
> >  		}
> >  		if (nb_lcore_params >= MAX_LCORE_PARAMS) {
> > @@ -531,7 +534,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;
> > --
> 
> Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> 
> 
> > 2.25.1
  
Sivaprasad Tummala Dec. 19, 2023, 2:18 p.m. UTC | #3
[AMD Official Use Only - General]

Hi Konstantin,

> -----Original Message-----
> From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> Sent: Tuesday, December 19, 2023 6:00 PM
> To: Konstantin Ananyev <konstantin.ananyev@huawei.com>; Tummala, Sivaprasad
> <Sivaprasad.Tummala@amd.com>; david.hunt@intel.com;
> anatoly.burakov@intel.com; jerinj@marvell.com; radu.nicolau@intel.com;
> gakhil@marvell.com; cristian.dumitrescu@intel.com; Yigit, Ferruh
> <Ferruh.Yigit@amd.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> >
> > > 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: af75078fece3 ("first public release")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> > > ---
> > >  examples/l3fwd/main.c | 19 +++++++++++--------
> > >  1 file changed, 11 insertions(+), 8 deletions(-)
> > >
> > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> > > 3bf28aec0c..ed116da09c 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;
> > >     uint8_t queue_id;
>
> Actually one comment:
> As lcore_id becomes uint16_t it might be worth to do the same queue_id, they
> usually are very much related.
Yes, that's a valid statement for one network interface.
With multiple interfaces, it's a combination of port/queue that maps to a specific lcore.
If there a NICs that support more than 256 queues, then it makes sense to change the
queue_id type as well.

Please let me know your thoughts.
>
> > > -   uint8_t lcore_id;
> > > +   uint16_t lcore_id;
> > >  } __rte_cache_aligned;
> > >
> > >  static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
> > > @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)  static int
> > >  check_lcore_params(void)
> > >  {
> > > -   uint8_t queue, lcore;
> > > -   uint16_t i;
> > > +   uint8_t queue;
> > > +   uint16_t i, 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 %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 off \n",
> > > +                   printf("warning: lcore %hu is on socket %d with
> > > + numa off\n",
> > >                             lcore, socketid);
> > >             }
> > >     }
> > > @@ -359,7 +359,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; @@ -500,6 +500,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;
> > >
> > > @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
> > >             for (i = 0; i < _NUM_FLD; i++){
> > >                     errno = 0;
> > >                     int_fld[i] = strtoul(str_fld[i], &end, 0);
> > > -                   if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
> > > +                   if (errno != 0 || end == str_fld[i] || int_fld[i] >
> > > +
> > > + max_fld[i])
> > >                             return -1;
> > >             }
> > >             if (nb_lcore_params >= MAX_LCORE_PARAMS) { @@ -531,7
> > > +534,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;
> > > --
> >
> > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> >
> >
> > > 2.25.1
  
Konstantin Ananyev Dec. 19, 2023, 3:10 p.m. UTC | #4
Hi Sivaprasad,

> 
> Hi Konstantin,
> 
> > -----Original Message-----
> > From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > Sent: Tuesday, December 19, 2023 6:00 PM
> > To: Konstantin Ananyev <konstantin.ananyev@huawei.com>; Tummala, Sivaprasad
> > <Sivaprasad.Tummala@amd.com>; david.hunt@intel.com;
> > anatoly.burakov@intel.com; jerinj@marvell.com; radu.nicolau@intel.com;
> > gakhil@marvell.com; cristian.dumitrescu@intel.com; Yigit, Ferruh
> > <Ferruh.Yigit@amd.com>
> > Cc: dev@dpdk.org; stable@dpdk.org
> > Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
> >
> > Caution: This message originated from an External Source. Use proper caution
> > when opening attachments, clicking links, or responding.
> >
> >
> > >
> > > > 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: af75078fece3 ("first public release")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> > > > ---
> > > >  examples/l3fwd/main.c | 19 +++++++++++--------
> > > >  1 file changed, 11 insertions(+), 8 deletions(-)
> > > >
> > > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> > > > 3bf28aec0c..ed116da09c 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;
> > > >     uint8_t queue_id;
> >
> > Actually one comment:
> > As lcore_id becomes uint16_t it might be worth to do the same queue_id, they
> > usually are very much related.
> Yes, that's a valid statement for one network interface.
> With multiple interfaces, it's a combination of port/queue that maps to a specific lcore.
> If there a NICs that support more than 256 queues, then it makes sense to change the
> queue_id type as well.

AFAIK, majority of modern NICs do support more than 256 queues.
That's why in rte_ethev API queue_id is uint16_t.

> 
> Please let me know your thoughts.
> >
> > > > -   uint8_t lcore_id;
> > > > +   uint16_t lcore_id;
> > > >  } __rte_cache_aligned;
> > > >
> > > >  static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
> > > > @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)  static int
> > > >  check_lcore_params(void)
> > > >  {
> > > > -   uint8_t queue, lcore;
> > > > -   uint16_t i;
> > > > +   uint8_t queue;
> > > > +   uint16_t i, 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 %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 off \n",
> > > > +                   printf("warning: lcore %hu is on socket %d with
> > > > + numa off\n",
> > > >                             lcore, socketid);
> > > >             }
> > > >     }
> > > > @@ -359,7 +359,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; @@ -500,6 +500,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;
> > > >
> > > > @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
> > > >             for (i = 0; i < _NUM_FLD; i++){
> > > >                     errno = 0;
> > > >                     int_fld[i] = strtoul(str_fld[i], &end, 0);
> > > > -                   if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
> > > > +                   if (errno != 0 || end == str_fld[i] || int_fld[i] >
> > > > +
> > > > + max_fld[i])
> > > >                             return -1;
> > > >             }
> > > >             if (nb_lcore_params >= MAX_LCORE_PARAMS) { @@ -531,7
> > > > +534,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;
> > > > --
> > >
> > > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > >
> > >
> > > > 2.25.1
  
Sivaprasad Tummala Dec. 20, 2023, 1:32 a.m. UTC | #5
[AMD Official Use Only - General]

Hi Konstantin,

> -----Original Message-----
> From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> Sent: Tuesday, December 19, 2023 8:40 PM
> To: Tummala, Sivaprasad <Sivaprasad.Tummala@amd.com>;
> david.hunt@intel.com; anatoly.burakov@intel.com; jerinj@marvell.com;
> radu.nicolau@intel.com; gakhil@marvell.com; cristian.dumitrescu@intel.com; Yigit,
> Ferruh <Ferruh.Yigit@amd.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> Hi Sivaprasad,
>
> >
> > Hi Konstantin,
> >
> > > -----Original Message-----
> > > From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > > Sent: Tuesday, December 19, 2023 6:00 PM
> > > To: Konstantin Ananyev <konstantin.ananyev@huawei.com>; Tummala,
> > > Sivaprasad <Sivaprasad.Tummala@amd.com>; david.hunt@intel.com;
> > > anatoly.burakov@intel.com; jerinj@marvell.com;
> > > radu.nicolau@intel.com; gakhil@marvell.com;
> > > cristian.dumitrescu@intel.com; Yigit, Ferruh <Ferruh.Yigit@amd.com>
> > > Cc: dev@dpdk.org; stable@dpdk.org
> > > Subject: RE: [PATCH v2 1/6] examples/l3fwd: fix lcore ID restriction
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > >
> > > > > 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: af75078fece3 ("first public release")
> > > > > Cc: stable@dpdk.org
> > > > >
> > > > > Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
> > > > > ---
> > > > >  examples/l3fwd/main.c | 19 +++++++++++--------
> > > > >  1 file changed, 11 insertions(+), 8 deletions(-)
> > > > >
> > > > > diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index
> > > > > 3bf28aec0c..ed116da09c 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;
> > > > >     uint8_t queue_id;
> > >
> > > Actually one comment:
> > > As lcore_id becomes uint16_t it might be worth to do the same
> > > queue_id, they usually are very much related.
> > Yes, that's a valid statement for one network interface.
> > With multiple interfaces, it's a combination of port/queue that maps to a specific
> lcore.
> > If there a NICs that support more than 256 queues, then it makes sense
> > to change the queue_id type as well.
>
> AFAIK, majority of modern NICs do support more than 256 queues.
> That's why in rte_ethev API queue_id is uint16_t.
Thanks. Will update the queue_id type to uint16_t in next version.
>
> >
> > Please let me know your thoughts.
> > >
> > > > > -   uint8_t lcore_id;
> > > > > +   uint16_t lcore_id;
> > > > >  } __rte_cache_aligned;
> > > > >
> > > > >  static struct lcore_params
> > > > > lcore_params_array[MAX_LCORE_PARAMS];
> > > > > @@ -292,8 +292,8 @@ setup_l3fwd_lookup_tables(void)  static int
> > > > >  check_lcore_params(void)
> > > > >  {
> > > > > -   uint8_t queue, lcore;
> > > > > -   uint16_t i;
> > > > > +   uint8_t queue;
> > > > > +   uint16_t i, 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 %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 off
> \n",
> > > > > +                   printf("warning: lcore %hu is on socket %d
> > > > > + with numa off\n",
> > > > >                             lcore, socketid);
> > > > >             }
> > > > >     }
> > > > > @@ -359,7 +359,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; @@ -500,6 +500,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;
> > > > >
> > > > > @@ -518,7 +520,8 @@ parse_config(const char *q_arg)
> > > > >             for (i = 0; i < _NUM_FLD; i++){
> > > > >                     errno = 0;
> > > > >                     int_fld[i] = strtoul(str_fld[i], &end, 0);
> > > > > -                   if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
> > > > > +                   if (errno != 0 || end == str_fld[i] ||
> > > > > + int_fld[i] >
> > > > > +
> > > > > + max_fld[i])
> > > > >                             return -1;
> > > > >             }
> > > > >             if (nb_lcore_params >= MAX_LCORE_PARAMS) { @@ -531,7
> > > > > +534,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;
> > > > > --
> > > >
> > > > Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>
> > > >
> > > >
> > > > > 2.25.1
  

Patch

diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
index 3bf28aec0c..ed116da09c 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;
 	uint8_t queue_id;
-	uint8_t lcore_id;
+	uint16_t lcore_id;
 } __rte_cache_aligned;
 
 static struct lcore_params lcore_params_array[MAX_LCORE_PARAMS];
@@ -292,8 +292,8 @@  setup_l3fwd_lookup_tables(void)
 static int
 check_lcore_params(void)
 {
-	uint8_t queue, lcore;
-	uint16_t i;
+	uint8_t queue;
+	uint16_t i, 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 %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 off \n",
+			printf("warning: lcore %hu is on socket %d with numa off\n",
 				lcore, socketid);
 		}
 	}
@@ -359,7 +359,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;
@@ -500,6 +500,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;
 
@@ -518,7 +520,8 @@  parse_config(const char *q_arg)
 		for (i = 0; i < _NUM_FLD; i++){
 			errno = 0;
 			int_fld[i] = strtoul(str_fld[i], &end, 0);
-			if (errno != 0 || end == str_fld[i] || int_fld[i] > 255)
+			if (errno != 0 || end == str_fld[i] || int_fld[i] >
+									max_fld[i])
 				return -1;
 		}
 		if (nb_lcore_params >= MAX_LCORE_PARAMS) {
@@ -531,7 +534,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;