[3/3] sched: support for 100G+ rates in subport/pipe config
Checks
Commit Message
Config load functions updated to support 100G rates
for subport and pipes.
Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
---
examples/qos_sched/cfg_file.c | 64 +++++++++++++++++------------------
1 file changed, 32 insertions(+), 32 deletions(-)
Comments
> -----Original Message-----
> From: Ajmera, Megha <megha.ajmera@intel.com>
> Sent: Thursday, October 6, 2022 8:01 PM
> To: dev@dpdk.org; Singh, Jasvinder <jasvinder.singh@intel.com>;
> Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Cc: stable@dpdk.org
> Subject: [PATCH 3/3] sched: support for 100G+ rates in subport/pipe config
>
> Config load functions updated to support 100G rates
> for subport and pipes.
>
> Signed-off-by: Megha Ajmera <megha.ajmera@intel.com>
> ---
> examples/qos_sched/cfg_file.c | 64 +++++++++++++++++------------------
> 1 file changed, 32 insertions(+), 32 deletions(-)
>
> diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c
> index ca871d3287..ca60d616a1 100644
> --- a/examples/qos_sched/cfg_file.c
> +++ b/examples/qos_sched/cfg_file.c
> @@ -64,67 +64,67 @@ cfg_load_pipe(struct rte_cfgfile *cfg, struct
> rte_sched_pipe_params *pipe_params
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tb rate");
> if (entry)
> - pipe_params[j].tb_rate = (uint64_t)atoi(entry);
> + pipe_params[j].tb_rate = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tb size");
> if (entry)
> - pipe_params[j].tb_size = (uint64_t)atoi(entry);
> + pipe_params[j].tb_size = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc period");
> if (entry)
> - pipe_params[j].tc_period = (uint64_t)atoi(entry);
> + pipe_params[j].tc_period = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 0 rate");
> if (entry)
> - pipe_params[j].tc_rate[0] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[0] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 1 rate");
> if (entry)
> - pipe_params[j].tc_rate[1] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[1] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 2 rate");
> if (entry)
> - pipe_params[j].tc_rate[2] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[2] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 3 rate");
> if (entry)
> - pipe_params[j].tc_rate[3] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[3] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 4 rate");
> if (entry)
> - pipe_params[j].tc_rate[4] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[4] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 5 rate");
> if (entry)
> - pipe_params[j].tc_rate[5] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[5] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 6 rate");
> if (entry)
> - pipe_params[j].tc_rate[6] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[6] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 7 rate");
> if (entry)
> - pipe_params[j].tc_rate[7] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[7] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 8 rate");
> if (entry)
> - pipe_params[j].tc_rate[8] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[8] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 9 rate");
> if (entry)
> - pipe_params[j].tc_rate[9] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[9] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 10 rate");
> if (entry)
> - pipe_params[j].tc_rate[10] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[10] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 11 rate");
> if (entry)
> - pipe_params[j].tc_rate[11] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[11] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 12 rate");
> if (entry)
> - pipe_params[j].tc_rate[12] = (uint64_t)atoi(entry);
> + pipe_params[j].tc_rate[12] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 12
> oversubscription weight");
> if (entry)
> @@ -165,67 +165,67 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg,
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tb rate");
> if (entry)
> - subport_profile[i].tb_rate = (uint64_t)atoi(entry);
> + subport_profile[i].tb_rate = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tb size");
> if (entry)
> - subport_profile[i].tb_size = (uint64_t)atoi(entry);
> + subport_profile[i].tb_size = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc period");
> if (entry)
> - subport_profile[i].tc_period = (uint64_t)atoi(entry);
> + subport_profile[i].tc_period = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 0 rate");
> if (entry)
> - subport_profile[i].tc_rate[0] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[0] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 1 rate");
> if (entry)
> - subport_profile[i].tc_rate[1] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[1] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 2 rate");
> if (entry)
> - subport_profile[i].tc_rate[2] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[2] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 3 rate");
> if (entry)
> - subport_profile[i].tc_rate[3] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[3] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 4 rate");
> if (entry)
> - subport_profile[i].tc_rate[4] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[4] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 5 rate");
> if (entry)
> - subport_profile[i].tc_rate[5] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[5] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 6 rate");
> if (entry)
> - subport_profile[i].tc_rate[6] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[6] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 7 rate");
> if (entry)
> - subport_profile[i].tc_rate[7] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[7] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 8 rate");
> if (entry)
> - subport_profile[i].tc_rate[8] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[8] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 9 rate");
> if (entry)
> - subport_profile[i].tc_rate[9] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[9] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 10 rate");
> if (entry)
> - subport_profile[i].tc_rate[10] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[10] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 11 rate");
> if (entry)
> - subport_profile[i].tc_rate[11] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[11] = atol(entry);
>
> entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate");
> if (entry)
> - subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry);
> + subport_profile[i].tc_rate[12] = atol(entry);
> }
>
> return 0;
> --
> 2.25.1
Hi Megha,
Maybe you can explain how removing this typecast can provide support for 100+G rates?
The atoi() function returns a 32-bit value, while the subport and pipe rates are 64-bit values; this typecast can at most remove a compiler warning ...
Regards,
Cristian
> > entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate");
> > if (entry)
> > - subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry);
> > + subport_profile[i].tc_rate[12] = atol(entry);
> > }
> >
> > return 0;
> > --
> > 2.25.1
>
> Hi Megha,
>
> Maybe you can explain how removing this typecast can provide support for
> 100+G rates?
>
> The atoi() function returns a 32-bit value, while the subport and pipe rates are
> 64-bit values; this typecast can at most remove a compiler warning ...
Hi Cristian,
We have now changed 'atoi' to 'atol' which will return 64-bit value so it will take care of 100G+ port speeds. However, I noticed that 'atol' will return signed-64-bit so typecast may still be needed to assign it to unsigned-64-bit variable. Will send updated patch today.
Regards,
Megha
> -----Original Message-----
> From: Ajmera, Megha <megha.ajmera@intel.com>
> Sent: Tuesday, October 18, 2022 6:40 AM
> To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; dev@dpdk.org;
> Singh, Jasvinder <jasvinder.singh@intel.com>
> Cc: stable@dpdk.org
> Subject: RE: [PATCH 3/3] sched: support for 100G+ rates in subport/pipe
> config
>
> > > entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate");
> > > if (entry)
> > > - subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry);
> > > + subport_profile[i].tc_rate[12] = atol(entry);
> > > }
> > >
> > > return 0;
> > > --
> > > 2.25.1
> >
> > Hi Megha,
> >
> > Maybe you can explain how removing this typecast can provide support for
> > 100+G rates?
> >
> > The atoi() function returns a 32-bit value, while the subport and pipe rates
> are
> > 64-bit values; this typecast can at most remove a compiler warning ...
>
> Hi Cristian,
>
> We have now changed 'atoi' to 'atol' which will return 64-bit value so it will
> take care of 100G+ port speeds. However, I noticed that 'atol' will return
> signed-64-bit so typecast may still be needed to assign it to unsigned-64-bit
> variable. Will send updated patch today.
>
> Regards,
> Megha
You need to use 'atoll', not 'atol'. And yes, typecast is still required.
On Tue, 18 Oct 2022 13:12:10 +0000
"Dumitrescu, Cristian" <cristian.dumitrescu@intel.com> wrote:
> > -----Original Message-----
> > From: Ajmera, Megha <megha.ajmera@intel.com>
> > Sent: Tuesday, October 18, 2022 6:40 AM
> > To: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; dev@dpdk.org;
> > Singh, Jasvinder <jasvinder.singh@intel.com>
> > Cc: stable@dpdk.org
> > Subject: RE: [PATCH 3/3] sched: support for 100G+ rates in subport/pipe
> > config
> >
> > > > entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate");
> > > > if (entry)
> > > > - subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry);
> > > > + subport_profile[i].tc_rate[12] = atol(entry);
> > > > }
> > > >
> > > > return 0;
> > > > --
> > > > 2.25.1
> > >
> > > Hi Megha,
> > >
> > > Maybe you can explain how removing this typecast can provide support for
> > > 100+G rates?
> > >
> > > The atoi() function returns a 32-bit value, while the subport and pipe rates
> > are
> > > 64-bit values; this typecast can at most remove a compiler warning ...
> >
> > Hi Cristian,
> >
> > We have now changed 'atoi' to 'atol' which will return 64-bit value so it will
> > take care of 100G+ port speeds. However, I noticed that 'atol' will return
> > signed-64-bit so typecast may still be needed to assign it to unsigned-64-bit
> > variable. Will send updated patch today.
> >
> > Regards,
> > Megha
>
> You need to use 'atoll', not 'atol'. And yes, typecast is still required.
The code should be using strtoull() and checking for errors.
> >
> > You need to use 'atoll', not 'atol'. And yes, typecast is still required.
>
> The code should be using strtoull() and checking for errors.
Thanks Cristian and Stephen. I have sent updated patch-series v4 for review and commit.
@@ -64,67 +64,67 @@ cfg_load_pipe(struct rte_cfgfile *cfg, struct rte_sched_pipe_params *pipe_params
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tb rate");
if (entry)
- pipe_params[j].tb_rate = (uint64_t)atoi(entry);
+ pipe_params[j].tb_rate = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tb size");
if (entry)
- pipe_params[j].tb_size = (uint64_t)atoi(entry);
+ pipe_params[j].tb_size = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc period");
if (entry)
- pipe_params[j].tc_period = (uint64_t)atoi(entry);
+ pipe_params[j].tc_period = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 0 rate");
if (entry)
- pipe_params[j].tc_rate[0] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[0] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 1 rate");
if (entry)
- pipe_params[j].tc_rate[1] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[1] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 2 rate");
if (entry)
- pipe_params[j].tc_rate[2] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[2] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 3 rate");
if (entry)
- pipe_params[j].tc_rate[3] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[3] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 4 rate");
if (entry)
- pipe_params[j].tc_rate[4] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[4] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 5 rate");
if (entry)
- pipe_params[j].tc_rate[5] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[5] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 6 rate");
if (entry)
- pipe_params[j].tc_rate[6] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[6] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 7 rate");
if (entry)
- pipe_params[j].tc_rate[7] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[7] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 8 rate");
if (entry)
- pipe_params[j].tc_rate[8] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[8] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 9 rate");
if (entry)
- pipe_params[j].tc_rate[9] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[9] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 10 rate");
if (entry)
- pipe_params[j].tc_rate[10] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[10] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 11 rate");
if (entry)
- pipe_params[j].tc_rate[11] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[11] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 12 rate");
if (entry)
- pipe_params[j].tc_rate[12] = (uint64_t)atoi(entry);
+ pipe_params[j].tc_rate[12] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, pipe_name, "tc 12 oversubscription weight");
if (entry)
@@ -165,67 +165,67 @@ cfg_load_subport_profile(struct rte_cfgfile *cfg,
entry = rte_cfgfile_get_entry(cfg, sec_name, "tb rate");
if (entry)
- subport_profile[i].tb_rate = (uint64_t)atoi(entry);
+ subport_profile[i].tb_rate = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tb size");
if (entry)
- subport_profile[i].tb_size = (uint64_t)atoi(entry);
+ subport_profile[i].tb_size = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc period");
if (entry)
- subport_profile[i].tc_period = (uint64_t)atoi(entry);
+ subport_profile[i].tc_period = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 0 rate");
if (entry)
- subport_profile[i].tc_rate[0] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[0] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 1 rate");
if (entry)
- subport_profile[i].tc_rate[1] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[1] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 2 rate");
if (entry)
- subport_profile[i].tc_rate[2] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[2] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 3 rate");
if (entry)
- subport_profile[i].tc_rate[3] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[3] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 4 rate");
if (entry)
- subport_profile[i].tc_rate[4] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[4] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 5 rate");
if (entry)
- subport_profile[i].tc_rate[5] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[5] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 6 rate");
if (entry)
- subport_profile[i].tc_rate[6] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[6] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 7 rate");
if (entry)
- subport_profile[i].tc_rate[7] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[7] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 8 rate");
if (entry)
- subport_profile[i].tc_rate[8] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[8] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 9 rate");
if (entry)
- subport_profile[i].tc_rate[9] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[9] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 10 rate");
if (entry)
- subport_profile[i].tc_rate[10] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[10] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 11 rate");
if (entry)
- subport_profile[i].tc_rate[11] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[11] = atol(entry);
entry = rte_cfgfile_get_entry(cfg, sec_name, "tc 12 rate");
if (entry)
- subport_profile[i].tc_rate[12] = (uint64_t)atoi(entry);
+ subport_profile[i].tc_rate[12] = atol(entry);
}
return 0;