On Fri, Jun 26, 2020 at 04:47:34PM +0200, David Marchand wrote: > DPDK components and applications can have their say when a new lcore is > initialized. For this, they can register a callback for initializing and > releasing their private data. > > Signed-off-by: David Marchand <david.march...@redhat.com>
2 more minor comments. > diff --git a/app/test/test_lcores.c b/app/test/test_lcores.c > index 864bcbade7..e36dceedf9 100644 > --- a/app/test/test_lcores.c > +++ b/app/test/test_lcores.c > @@ -5,6 +5,7 @@ > #include <pthread.h> > #include <string.h> > > +#include <rte_common.h> > #include <rte_lcore.h> > > #include "test.h" > @@ -113,6 +114,229 @@ test_non_eal_lcores(unsigned int eal_threads_count) > return ret; > } > > +struct limit_lcore_context { > + unsigned int init; > + unsigned int max; > + unsigned int uninit; > +}; > +static int > +limit_lcores_init(unsigned int lcore_id __rte_unused, void *arg) > +{ > + struct limit_lcore_context *l = arg; > + > + l->init++; > + if (l->init > l->max) > + return -1; > + return 0; > +} > +static void > +limit_lcores_uninit(unsigned int lcore_id __rte_unused, void *arg) > +{ > + struct limit_lcore_context *l = arg; > + > + l->uninit++; > +} missing empty lines [...] > +static int > +test_non_eal_lcores_callback(unsigned int eal_threads_count) > +{ > + struct thread_context thread_contexts[2]; > + unsigned int non_eal_threads_count; > + struct limit_lcore_context l[2]; > + unsigned int registered_count; > + struct thread_context *t; > + void *handle[2]; > + unsigned int i; > + int ret; > + > + memset(l, 0, sizeof(l)); > + handle[0] = handle[1] = NULL; > + non_eal_threads_count = 0; > + registered_count = 0; > + what about initializing it at declaration? struct thread_context thread_contexts[2] = {}; struct limit_lcore_context l[2] = {}; void *handle[2] = {};