On Fri, Apr 9, 2021 at 3:01 PM Bruce Richardson <bruce.richard...@intel.com> wrote: > > On Fri, Apr 09, 2021 at 02:43:34PM +0200, David Marchand wrote: > > Let's try to enforce the convention where drivers use a pmd. logtype > > with their class reflected in it and libraries use a lib. logtype. > > > > RTE_LOG_REGISTER now interprets the log type name: > > - if none or a name starting with a . is passed, then the default logtype > > is used as a prefix, > > - else the name is used as is to deal with components that do not comply > > with the current convention, > > > > Note: achieved with below command (+ manual edit on crypto/virtio, > > compress/mlx5 and regex/mlx5). > > $ git grep -l RTE_LOG_REGISTER drivers/ | > > while read file; do > > pattern=${file##drivers/}; > > class=${pattern%%/*}; > > pattern=${pattern#$class/}; > > pattern=pmd.$class.${pattern%%/*}; > > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), > > '$pattern'\(\|\..*\),/RTE_LOG_REGISTER(\1, \2,/' $file; > > done > > > > $ git grep -l RTE_LOG_REGISTER lib/ | > > while read file; do > > pattern=${file##lib/librte_}; > > pattern=lib.${pattern%%/*}; > > sed -i -e 's/RTE_LOG_REGISTER(\(.*\), > > '$pattern'\(\|\..*\),/RTE_LOG_REGISTER(\1, \2,/' $file; > > done > > > > Signed-off-by: David Marchand <david.march...@redhat.com> > > --- > > This is an alternative to the devtools check I had proposed [1]. > > This can be seen as a RFC, but if people are happy with it, I don't see > > much to add. > > > > 1: https://patchwork.dpdk.org/project/dpdk/list/?series=15796 > > > > --- > <snip> > > diff --git a/drivers/common/dpaax/dpaax_iova_table.c > > b/drivers/common/dpaax/dpaax_iova_table.c > > index 91bee65e7b..fb315f02e9 100644 > > --- a/drivers/common/dpaax/dpaax_iova_table.c > > +++ b/drivers/common/dpaax/dpaax_iova_table.c > > @@ -460,4 +460,4 @@ dpaax_handle_memevents(void) > > dpaax_memevent_cb, NULL); > > } > > > > -RTE_LOG_REGISTER(dpaax_logger, pmd.common.dpaax, ERR); > > +RTE_LOG_REGISTER(dpaax_logger, , ERR); > > Sorry, but this blank field looks really wrong to me, and I'd rather find a > better solution. > > How about as part of the cflags for each component adding > "-D" flag with the default component log name, that can be used in place of > the blank, or added to as needed?
Ok, resolving this name at build time is better. I prefer separate macros though: - keeping RTE_LOG_REGISTER untouched (and usable out of the dpdk tree) - introducing RTE_LOG_REGISTER_DEFAULT_LOGTYPE(type, level) (for components who need only one handle) - introducing RTE_LOG_REGISTER_LOGTYPE(type, suffix, level) (for those who want more). -- David Marchand