[dpdk-dev] [PATCH v6] sched: make RED scaling configurable

Dumitrescu, Cristian cristian.dumitrescu at intel.com
Tue Jan 16 17:44:16 CET 2018



> -----Original Message-----
> From: Alan Dewar [mailto:alangordondewar at gmail.com]
> Sent: Tuesday, January 16, 2018 3:58 PM
> To: Stephen Hemminger <stephen at networkplumber.org>
> Cc: Dumitrescu, Cristian <cristian.dumitrescu at intel.com>; Kantecki, Tomasz
> <tomasz.kantecki at intel.com>; Singh, Jasvinder
> <jasvinder.singh at intel.com>; dev at dpdk.org; Alan Dewar
> <alan.dewar at att.com>
> Subject: Re: [dpdk-dev] [PATCH v6] sched: make RED scaling configurable
> 
> On Tue, Jan 16, 2018 at 3:50 PM, Alan Dewar
> <alangordondewar at gmail.com> wrote:
> > On Mon, Jan 15, 2018 at 4:52 PM, Stephen Hemminger
> > <stephen at networkplumber.org> wrote:
> >>
> >> On Mon, 15 Jan 2018 16:16:09 +0000
> >> alangordondewar at gmail.com wrote:
> >>
> >> Looks like a good idea, minor editing feedback.
> >>
> >>
> >> > -     red_cfg->min_th = ((uint32_t) min_th) << (wq_log2 +
> RTE_RED_SCALING);
> >> > -     red_cfg->max_th = ((uint32_t) max_th) << (wq_log2 +
> RTE_RED_SCALING);
> >> > -     red_cfg->pa_const = (2 * (max_th - min_th) * maxp_inv) <<
> RTE_RED_SCALING;
> >> > +     red_cfg->min_th = ((uint32_t) min_th) << (wq_log2 +
> rte_red_scaling);
> >> > +     red_cfg->max_th = ((uint32_t) max_th) << (wq_log2 +
> rte_red_scaling);
> >>
> >> While you are at it remove unnecessary parenthesis here.
> >>
> >
> > Okay will do.
> 
> Ah - the compiler doesn't like it if I remove all the unnecessary
> parenthesis. it gives the following error:
> 
> /home/adewar/git-repos/dpdk/lib/librte_sched/rte_red.c:153:49: error:
> suggest parentheses around ‘+’ inside ‘<<’ [-Werror=parentheses]
>   red_cfg->min_th = (uint32_t) min_th << wq_log2 + rte_red_scaling;
> 
> I'll reinstate the ones around the addition.

Alan,

I have a different view here, I suggest we keep the parenthesis as they are, as the code is easier to read and maintain. RED is not the code where you want to play with compiler typecasts and arithmetic.

Regards,
Cristian



More information about the dev mailing list