> -----Original Message----- > From: Alan Dewar [mailto:alangordonde...@gmail.com] > Sent: Tuesday, January 16, 2018 3:58 PM > To: Stephen Hemminger <step...@networkplumber.org> > Cc: Dumitrescu, Cristian <cristian.dumitre...@intel.com>; Kantecki, Tomasz > <tomasz.kante...@intel.com>; Singh, Jasvinder > <jasvinder.si...@intel.com>; dev@dpdk.org; Alan Dewar > <alan.de...@att.com> > Subject: Re: [dpdk-dev] [PATCH v6] sched: make RED scaling configurable > > On Tue, Jan 16, 2018 at 3:50 PM, Alan Dewar > <alangordonde...@gmail.com> wrote: > > On Mon, Jan 15, 2018 at 4:52 PM, Stephen Hemminger > > <step...@networkplumber.org> wrote: > >> > >> On Mon, 15 Jan 2018 16:16:09 +0000 > >> alangordonde...@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