[PATCH 3/3] sched: support for 100G+ rates in subport/pipe config

Stephen Hemminger stephen at networkplumber.org
Wed Oct 19 20:37:14 CEST 2022


On Tue, 18 Oct 2022 13:12:10 +0000
"Dumitrescu, Cristian" <cristian.dumitrescu at intel.com> wrote:

> > -----Original Message-----
> > From: Ajmera, Megha <megha.ajmera at intel.com>
> > Sent: Tuesday, October 18, 2022 6:40 AM
> > To: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>; dev at dpdk.org;
> > Singh, Jasvinder <jasvinder.singh at intel.com>
> > Cc: stable at 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.


More information about the stable mailing list