From: Kevin Traynor <ktraynor@redhat.com>
To: David Marchand <david.marchand@redhat.com>, dev@dpdk.org
Cc: stephen@networkplumber.org, anatoly.burakov@intel.com,
thomas@monjalon.net, John Griffin <john.griffin@intel.com>,
Fiona Trahe <fiona.trahe@intel.com>,
Deepak Kumar Jain <deepak.k.jain@intel.com>
Subject: Re: [dpdk-dev] [PATCH v3 07/12] log: add log stream accessor
Date: Fri, 25 Oct 2019 20:05:53 +0100 [thread overview]
Message-ID: <f1b38130-34c9-a9af-7401-38c9c798f1ee@redhat.com> (raw)
In-Reply-To: <1572011772-23271-8-git-send-email-david.marchand@redhat.com>
On 25/10/2019 14:56, David Marchand wrote:
> Define an accessor so that users can write their debug message to the
> same stream than the rte_log infrastructure.
> Use it in the qat infrastructure.
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> ---
> Changelog since v1:
> - use ternary operator,
>
> ---
> drivers/common/qat/qat_logs.c | 3 +--
> drivers/common/qat/qat_logs.h | 3 +--
> lib/librte_eal/common/eal_common_log.c | 33 +++++++++++++++++++--------------
> lib/librte_eal/common/include/rte_log.h | 13 +++++++++++++
> lib/librte_eal/rte_eal_version.map | 3 +++
> 5 files changed, 37 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
> index 7a86170..f97aba1 100644
> --- a/drivers/common/qat/qat_logs.c
> +++ b/drivers/common/qat/qat_logs.c
> @@ -19,8 +19,7 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
> if (level > (uint32_t)(rte_log_get_level(logtype)))
> return 0;
>
> - rte_hexdump(rte_logs.file == NULL ? stderr : rte_logs.file,
> - title, buf, len);
> + rte_hexdump(rte_log_get_stream(), title, buf, len);
> return 0;
> }
>
> diff --git a/drivers/common/qat/qat_logs.h b/drivers/common/qat/qat_logs.h
> index 4baea12..2e4d394 100644
> --- a/drivers/common/qat/qat_logs.h
> +++ b/drivers/common/qat/qat_logs.h
> @@ -24,8 +24,7 @@ extern int qat_dp_logtype;
> *
> * Dump out the message buffer in a special hex dump output format with
> * characters printed for each line of 16 hex values. The message will be sent
> - * to the stream defined by rte_logs.file or to stderr in case of rte_logs.file
> - * is undefined.
> + * to the stream used by the rte_log infrastructure.
> */
> int
> qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
> diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
> index 4f6f227..e0a7bef 100644
> --- a/lib/librte_eal/common/eal_common_log.c
> +++ b/lib/librte_eal/common/eal_common_log.c
> @@ -71,6 +71,24 @@ rte_openlog_stream(FILE *f)
> return 0;
> }
>
> +FILE *
> +rte_log_get_stream(void)
> +{
> + FILE *f = rte_logs.file;
> +
> + if (f == NULL) {
> + /*
> + * Grab the current value of stderr here, rather than
> + * just initializing default_log_stream to stderr. This
> + * ensures that we will always use the current value
> + * of stderr, even if the application closes and
> + * reopens it.
> + */
> + return default_log_stream ? : stderr;
> + }
> + return f;
> +}
> +
> /* Set global log level */
> void
> rte_log_set_global_level(uint32_t level)
> @@ -396,21 +414,8 @@ rte_log_dump(FILE *f)
> int
> rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap)
> {
> + FILE *f = rte_log_get_stream();
> int ret;
> - FILE *f = rte_logs.file;
> - if (f == NULL) {
> - f = default_log_stream;
> - if (f == NULL) {
> - /*
> - * Grab the current value of stderr here, rather than
> - * just initializing default_log_stream to stderr. This
> - * ensures that we will always use the current value
> - * of stderr, even if the application closes and
> - * reopens it.
> - */
> - f = stderr;
> - }
> - }
>
> if (level > rte_logs.level)
> return 0;
> diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
> index cbb4184..1bb0e66 100644
> --- a/lib/librte_eal/common/include/rte_log.h
> +++ b/lib/librte_eal/common/include/rte_log.h
> @@ -102,6 +102,19 @@ extern struct rte_logs rte_logs;
> int rte_openlog_stream(FILE *f);
>
> /**
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice
> + *
> + * Retrieve the stream used by the logging system (see rte_openlog_stream()
> + * to change it).
> + *
> + * @return
> + * Pointer to the stream.
> + */
> +__rte_experimental
> +FILE *rte_log_get_stream(void);
> +
> +/**
> * Set the global log level.
> *
> * After this call, logs with a level lower or equal than the level
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
> index 0887549..6d7e0e4 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -417,4 +417,7 @@ EXPERIMENTAL {
> rte_mcfg_timer_lock;
> rte_mcfg_timer_unlock;
> rte_rand_max;
> +
> + # added in 19.11
> + rte_log_get_stream;
> };
>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
next prev parent reply other threads:[~2019-10-25 19:06 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 9:32 [dpdk-dev] [PATCH 0/8] EAL and PCI ABI changes for 19.11 David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 1/8] eal: make lcore config private David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 2/8] eal: remove deprecated CPU flags check function David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 3/8] eal: remove deprecated malloc virt2phys function David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 4/8] mem: hide internal heap header David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 5/8] net/bonding: use non deprecated PCI API David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 6/8] pci: remove deprecated functions David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 7/8] log: add log stream accessor David Marchand
2019-10-22 16:34 ` Stephen Hemminger
2019-10-22 16:50 ` David Marchand
2019-10-22 9:32 ` [dpdk-dev] [PATCH 8/8] log: hide internal log structure David Marchand
2019-10-22 16:35 ` Stephen Hemminger
2019-10-23 13:02 ` David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 00/12] EAL and PCI ABI changes for 19.11 David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 01/12] eal: make lcore config private David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 02/12] eal: remove deprecated CPU flags check function David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 03/12] eal: remove deprecated malloc virt2phys function David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 04/12] mem: hide internal heap header David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 05/12] net/bonding: use non deprecated PCI API David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 06/12] pci: remove deprecated functions David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 07/12] log: add log stream accessor David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 08/12] log: hide internal log structure David Marchand
2019-10-24 16:30 ` Thomas Monjalon
2019-10-25 9:19 ` Kevin Traynor
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 09/12] test/mem: remove dependency on EAL internals David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 10/12] eal: deinline lcore APIs David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 11/12] eal: factorize lcore role code in common code David Marchand
2019-10-23 18:54 ` [dpdk-dev] [PATCH v2 12/12] eal: make the global configuration private David Marchand
2019-10-23 21:10 ` [dpdk-dev] [PATCH v2 00/12] EAL and PCI ABI changes for 19.11 Stephen Hemminger
2019-10-24 7:32 ` David Marchand
2019-10-24 15:37 ` Stephen Hemminger
2019-10-24 16:01 ` David Marchand
2019-10-24 16:37 ` Thomas Monjalon
2019-10-25 13:55 ` [dpdk-dev] [PATCH v3 " David Marchand
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 01/12] eal: make lcore config private David Marchand
2019-10-25 15:18 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 02/12] eal: remove deprecated CPU flags check function David Marchand
2019-10-25 15:20 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 03/12] eal: remove deprecated malloc virt2phys function David Marchand
2019-10-25 15:22 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 04/12] mem: hide internal heap header David Marchand
2019-10-25 15:23 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 05/12] net/bonding: use non deprecated PCI API David Marchand
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 06/12] pci: remove deprecated functions David Marchand
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 07/12] log: add log stream accessor David Marchand
2019-10-25 19:05 ` Kevin Traynor [this message]
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 08/12] test/mem: remove dependency on EAL internals David Marchand
2019-10-25 15:24 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 09/12] eal: deinline lcore APIs David Marchand
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 10/12] eal: factorize lcore role code David Marchand
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 11/12] eal: make the global configuration private David Marchand
2019-10-25 15:27 ` Burakov, Anatoly
2019-10-25 13:56 ` [dpdk-dev] [PATCH v3 12/12] doc: announce global logs struct removal from ABI David Marchand
2019-10-25 15:30 ` Burakov, Anatoly
2019-10-25 15:33 ` Thomas Monjalon
2019-10-26 18:14 ` Kevin Traynor
2019-10-26 18:48 ` David Marchand
2019-10-26 19:18 ` [dpdk-dev] [PATCH v3 00/12] EAL and PCI ABI changes for 19.11 David Marchand
2019-10-27 6:26 ` David Marchand
2019-10-27 9:56 ` David Marchand
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=f1b38130-34c9-a9af-7401-38c9c798f1ee@redhat.com \
--to=ktraynor@redhat.com \
--cc=anatoly.burakov@intel.com \
--cc=david.marchand@redhat.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=john.griffin@intel.com \
--cc=stephen@networkplumber.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).