From: Yang Ming <ming.1.yang@nokia-sbell.com>
To: Dariusz Sosnowski <dsosnowski@nvidia.com>,
Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>
Cc: dev@dpdk.org, Yang Ming <ming.1.yang@nokia-sbell.com>
Subject: [PATCH 1/2] net/mlx5: improve socket file path
Date: Fri, 13 Dec 2024 17:24:42 +0800 [thread overview]
Message-ID: <20241213092444.2987-1-ming.1.yang@nokia-sbell.com> (raw)
1. /var/tmp is hard code which is not a good style
2. /var/tmp may be not allowed to be written via container's
read only mode.
Signed-off-by: Yang Ming <ming.1.yang@nokia-sbell.com>
---
drivers/net/mlx5/linux/mlx5_socket.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 6ce0e59643..7fa6e5345c 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -20,7 +20,7 @@
/* PMD socket service for tools. */
-#define MLX5_SOCKET_PATH "/var/tmp/dpdk_net_mlx5_%d"
+#define MLX5_SOCKET_FNAME "dpdk_net_mlx5"
#define MLX5_ALL_PORT_IDS 0xffff
int server_socket = -1; /* Unix socket for primary process. */
@@ -177,8 +177,8 @@ mlx5_pmd_socket_init(void)
ret = fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
if (ret < 0)
goto close;
- snprintf(sun.sun_path, sizeof(sun.sun_path), MLX5_SOCKET_PATH,
- getpid());
+ snprintf(sun.sun_path, sizeof(sun.sun_path), "%s/%s_%d",
+ rte_eal_get_runtime_dir(), MLX5_SOCKET_FNAME, getpid());
remove(sun.sun_path);
ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
if (ret < 0) {
@@ -223,6 +223,7 @@ mlx5_pmd_socket_uninit(void)
mlx5_pmd_socket_handle, NULL);
claim_zero(close(server_socket));
server_socket = -1;
- MKSTR(path, MLX5_SOCKET_PATH, getpid());
+ MKSTR(path, "%s/%s_%d", rte_eal_get_runtime_dir(), MLX5_SOCKET_FNAME,
+ getpid());
claim_zero(remove(path));
}
--
2.34.1
next reply other threads:[~2024-12-13 9:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-13 9:24 Yang Ming [this message]
2024-12-13 9:24 ` [PATCH 2/2] net/mlx5: improve log " Yang Ming
2024-12-13 17:12 ` [PATCH 1/2] net/mlx5: improve socket " Stephen Hemminger
2024-12-13 17:16 ` Bruce Richardson
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=20241213092444.2987-1-ming.1.yang@nokia-sbell.com \
--to=ming.1.yang@nokia-sbell.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=orika@nvidia.com \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
/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).