> -----Original Message----- > From: Alan Dewar [mailto:[email protected]] > Sent: Tuesday, January 16, 2018 3:58 PM > To: Stephen Hemminger <[email protected]> > Cc: Dumitrescu, Cristian <[email protected]>; Kantecki, Tomasz > <[email protected]>; Singh, Jasvinder > <[email protected]>; [email protected]; Alan Dewar > <[email protected]> > Subject: Re: [dpdk-dev] [PATCH v6] sched: make RED scaling configurable > > On Tue, Jan 16, 2018 at 3:50 PM, Alan Dewar > <[email protected]> wrote: > > On Mon, Jan 15, 2018 at 4:52 PM, Stephen Hemminger > > <[email protected]> wrote: > >> > >> On Mon, 15 Jan 2018 16:16:09 +0000 > >> [email protected] 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

