From: David Marchand <david.marchand@redhat.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Subject: Re: [dpdk-dev] [PATCH] log: deduce log type from filename
Date: Tue, 13 Apr 2021 17:07:14 +0200 [thread overview]
Message-ID: <CAJFAV8zRROCLMGEFXv8hNQPj635bt1OtYBuAB9H+3eeqHvYH=Q@mail.gmail.com> (raw)
In-Reply-To: <20210409130145.GA1381@bricha3-MOBL.ger.corp.intel.com>
On Fri, Apr 9, 2021 at 3:01 PM Bruce Richardson
<bruce.richardson@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.marchand@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
next prev parent reply other threads:[~2021-04-13 15:07 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-09 12:43 David Marchand
2021-04-09 13:01 ` Bruce Richardson
2021-04-13 15:07 ` David Marchand [this message]
2021-04-26 12:51 ` [dpdk-dev] [PATCH v2] log: register with standardized names David Marchand
2021-05-11 10:09 ` [dpdk-dev] [PATCH v3] " Thomas Monjalon
2021-05-11 11:15 ` David Marchand
2021-05-11 11:49 ` Bruce Richardson
2021-05-11 12:01 ` Thomas Monjalon
2021-05-11 11:59 ` Bruce Richardson
2021-05-11 12:10 ` Thomas Monjalon
2021-05-11 12:24 ` Bruce Richardson
2021-05-11 12:38 ` [dpdk-dev] [PATCH v4] " Thomas Monjalon
2021-05-11 12:52 ` Bruce Richardson
2021-05-11 13:21 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJFAV8zRROCLMGEFXv8hNQPj635bt1OtYBuAB9H+3eeqHvYH=Q@mail.gmail.com' \
--to=david.marchand@redhat.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).