From: Yang Ming <ming.1.yang@nokia-sbell.com>
To: dev@dpdk.org
Cc: bingz@nvidia.com, dsosnowski@nvidia.com,
stephen@networkplumber.org, julien.meunier@nokia.com
Subject: Re: [PATCH v2 2/2] net/mlx5: enhance log file path
Date: Thu, 10 Apr 2025 15:53:59 +0800 [thread overview]
Message-ID: <59bb400d-5e49-4ecb-941e-2513894d6930@nokia-sbell.com> (raw)
In-Reply-To: <20250321132750.4237-2-ming.1.yang@nokia-sbell.com>
On 2025/3/21 21:27, Yang Ming wrote:
> The directory /var/log may not be writable in a container's
> read-only mode. To address this issue, use the DPDK runtime
> directory as an alternative when /var/log is not writable.
>
> Cc: bingz@nvidia.com
> Cc: dsosnowski@nvidia.com
> Cc: stephen@networkplumber.org
> Cc: julien.meunier@nokia.com
>
> Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
> ---
> drivers/net/mlx5/mlx5_rxtx.c | 33 ++++++++++++++++++++++++---------
> 1 file changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
> index 9c075f6a56..9e63d38524 100644
> --- a/drivers/net/mlx5/mlx5_rxtx.c
> +++ b/drivers/net/mlx5/mlx5_rxtx.c
> @@ -6,12 +6,14 @@
> #include <stdint.h>
> #include <string.h>
> #include <stdlib.h>
> +#include <unistd.h>
>
> #include <rte_mbuf.h>
> #include <rte_mempool.h>
> #include <rte_prefetch.h>
> #include <rte_common.h>
> #include <rte_branch_prediction.h>
> +#include <rte_eal.h>
> #include <rte_ether.h>
> #include <rte_cycles.h>
> #include <rte_flow.h>
> @@ -411,20 +413,33 @@ mlx5_dump_debug_information(const char *fname, const char *hex_title,
> {
> FILE *fd;
>
> - MKSTR(path, "%s/%s", MLX5_SYSTEM_LOG_DIR, fname);
> - fd = fopen(path, "a+");
> - if (!fd) {
> - DRV_LOG(WARNING, "cannot open %s for debug dump", path);
> - MKSTR(path2, "./%s", fname);
> + if (access(MLX5_SYSTEM_LOG_DIR, W_OK) == 0) {
> + MKSTR(path, "%s/%s", MLX5_SYSTEM_LOG_DIR, fname);
> + fd = fopen(path, "a+");
> + if (!fd)
> + DRV_LOG(WARNING, "cannot open %s for debug dump", path);
> + else
> + DRV_LOG(INFO, "New debug dump in file %s", path);
> + } else {
> + MKSTR(path2, "%s/%s", rte_eal_get_runtime_dir(), fname);
> fd = fopen(path2, "a+");
> + if (!fd)
> + DRV_LOG(WARNING, "cannot open %s for debug dump", path2);
> + else
> + DRV_LOG(INFO, "New debug dump in file %s", path2);
> + }
> +
> + if (!fd) {
> + MKSTR(path3, "./%s", fname);
> + fd = fopen(path3, "a+");
> if (!fd) {
> - DRV_LOG(ERR, "cannot open %s for debug dump", path2);
> + DRV_LOG(ERR, "cannot open %s for debug dump", path3);
> return;
> + } else {
> + DRV_LOG(INFO, "New debug dump in file %s", path3);
> }
> - DRV_LOG(INFO, "New debug dump in file %s", path2);
> - } else {
> - DRV_LOG(INFO, "New debug dump in file %s", path);
> }
> +
> if (hex_title)
> rte_hexdump(fd, hex_title, buf, hex_len);
> else
Hi Experts,
is there any chance to review and accept this patch?
Brs,
Yang Ming
prev parent reply other threads:[~2025-04-10 7:54 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 9:24 [PATCH 1/2] net/mlx5: improve socket " Yang Ming
2024-12-13 9:24 ` [PATCH 2/2] net/mlx5: improve log " Yang Ming
2025-03-04 6:23 ` Bing Zhao
2025-03-05 3:20 ` Yang Ming
2025-03-10 14:59 ` Stephen Hemminger
2025-03-12 2:32 ` [External] " Yang Ming
2025-03-17 16:05 ` Bing Zhao
2025-03-21 9:48 ` Ming 1. Yang (NSB)
2024-12-13 17:12 ` [PATCH 1/2] net/mlx5: improve socket " Stephen Hemminger
2024-12-13 17:16 ` Bruce Richardson
2025-01-03 2:51 ` Yang Ming
2025-03-12 2:55 ` Yang Ming
2025-03-14 11:48 ` Dariusz Sosnowski
2025-03-21 13:27 ` [PATCH v2 1/2] net/mlx5: enhance " Yang Ming
2025-03-21 13:27 ` [PATCH v2 2/2] net/mlx5: enhance log " Yang Ming
2025-04-10 7:53 ` Yang Ming [this message]
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=59bb400d-5e49-4ecb-941e-2513894d6930@nokia-sbell.com \
--to=ming.1.yang@nokia-sbell.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=julien.meunier@nokia.com \
--cc=stephen@networkplumber.org \
/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).