[dpdk-dev] [PATCH 01/13] eal/log: introduce log register macro

Jerin Jacob jerinjacobk at gmail.com
Wed Jun 24 15:08:27 CEST 2020


On Wed, Jun 17, 2020 at 3:56 PM Andrew Rybchenko
<arybchenko at solarflare.com> wrote:
>
> On 6/17/20 1:00 PM, Thomas Monjalon wrote:
> > 17/06/2020 08:30, jerinj at marvell.com:
> >> From: Jerin Jacob <jerinj at marvell.com>
> >>
> >> Introducing the RTE_LOG_REGISTER macro to avoid the code duplication
> >> in the log registration process.
> >>
> >> It is a wrapper macro for declaring the logtype, register the log and sets
> >> it's level in the constructor context.
> >>
> >> Signed-off-by: Jerin Jacob <jerinj at marvell.com>
> >> ---
> >> --- a/lib/librte_eal/include/rte_log.h
> >> +++ b/lib/librte_eal/include/rte_log.h
> >> +#define RTE_LOG_REGISTER(type, name, level)                 \
> >> +int type;                                                   \
> >> +RTE_INIT(__##type)                                          \
> >> +{                                                           \
> >> +    type = rte_log_register(RTE_STR(name));                 \
> >> +    if (type >= 0)                                          \
> >> +            rte_log_set_level(type, RTE_LOG_##level);       \
> >> +}
> >
> > It should use rte_log_register_type_and_pick_level()
> > which works for drivers loaded later in the init sequence.
>
> Yes, rte_log_register_type_and_pick_level() should be used.
> Otherwise, if a driver is loaded (the constructor is called)
> after --log-level options processing, the level set using
> the option is not applied.

OK. I will change it in v2.

>
> > rte_log_register() should be deprecated.
>
> +1
>


More information about the dev mailing list