> > > > > diff --git a/lib/librte_sched/rte_red.c > > > > > b/lib/librte_sched/rte_red.c > > > > > +int > > > > > +rte_red_set_scaling(uint16_t max_red_queue_length) { > > > > > + int8_t count; > > > > > + > > > > > + if (rte_red_init_done) > > > > > + /** > > > > > + * Can't change the scaling once the red table has been > > > > > + * computed. > > > > > + */ > > > > > + return -1; > > > > > > > > Is there a reason why we cannot simply reset the scaling here? > > > > > > Actually we could, but I was originally thinking that you might be > > > happier keeping with a one-time RED initialization function, but > > > then had to introduce the rte_reset_red_scaling function for the > > > unit-tests. I'm happy > > to > > > do RED reinitialization here, if you are. > > > > > > > Hi Alan, > > > > What is the intention of the new rte_red_set_scaling() function? > > 1. Is it to be called only once, before any RED object gets created? > > 2. Is it possible to call it post-init, but in this case any RED > > object already created are not impacted (they continue to work)? > > > > If the answer is 2, then yes, we could simply drop the > > __rte_red_reset() and do the RED globals reset as part of the > > rte_red_set_scaling() function transparently. > > > > If the answer is 1, then we probably need to keep your approach: we > > need a global rte_red_init_done flag, and rte_red_set_scaling() could > > only be called at init time before any red objects are created. > > > > I probably need to spend more time assessing all the code implications. > > > > Regards, > > Cristian > > Hi Alan, > > After talking to Tomasz, we agreed that 2. Is not an option, as any > previously created red object will be broken. > > So 1. Is the right answer, therefore this function can be called only once > and only before any red objects are created. So, IMO we should do this: -when rte_red_init_done is true, we need to return error -when rte_red_init_done is false, we need to perform red initialization and set this flag > > Agree?
Yes, as long as you're happy with keeping __rte_red_reset for the unit-tests. > Please also add a comment in the Doxygen description of rte_red_set_caling() > in the rte_red.h file, stating that this function can be called only once and > only before any red objects are created. Will do. > Regards, > Cristian