[dpdk-dev] [PATCH v4 7/9] eal: add lcore init callbacks
Olivier Matz
olivier.matz at 6wind.com
Tue Jun 30 12:09:04 CEST 2020
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.marchand at redhat.com>
[...]
> +/**
> + * Register callbacks invoked when initializing and uninitializing a lcore.
> + *
> + * This function calls the init callback with all initialized lcores.
> + * Any error reported by the init callback triggers a rollback calling the
> + * uninit callback for each lcore.
> + * If this step succeeds, the callbacks are put in the lcore callbacks list
> + * that will get called for each lcore allocation/release.
> + *
> + * Note: callbacks execution is serialised under a lock protecting the lcores
> + * and callbacks list.
> + *
> + * @param name
> + * A name serving as a small description for this callback.
> + * @param init
> + * The callback invoked when a lcore_id is initialized.
> + * @param uninit
> + * The callback invoked when a lcore_id is uninitialized.
nit: it could be highlighted that init or uninit can be NULL.
> + * @param arg
> + * An optional argument that gets passed to the callback when it gets
> + * invoked.
> + * @return
> + * On success, returns an opaque pointer for the registered object.
> + * On failure (either memory allocation issue in the function itself or an
> + * error is returned by the init callback itself), returns NULL.
> + */
> +__rte_experimental
> +void *
> +rte_lcore_callback_register(const char *name, rte_lcore_init_cb init,
> + rte_lcore_uninit_cb uninit, void *arg);
More information about the dev
mailing list