Skip to contentSkip to conversation

net/mlx5: fix unix socket server file name

PATCH Applied Xueming Li 3 participants 3 messages Nov 3, 2020 – Nov 13, 2020 Network drivers

lore
Share & tools
lore

Xueming Li

author
#0 lore raw

PATCH 1/1 net/mlx5: fix unix socket server file name

mlx_steering_dump_parser.py tool failed to dump flow due to socket file name changed.

Change socket file name back to make it consistent.

Fixes b1e15224849b ("common/mlx5: fix PCI driver name")
---
 drivers/net/mlx5/linux/mlx5_socket.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/mlx5/linux/mlx5_socket.c +5 -9
index 08af905126..1938453980 100644
@@ -20,16 +20,11 @@
 
 /* PMD socket service for tools. */
 
+#define MLX5_SOCKET_PATH "/var/tmp/dpdk_net_mlx5_%d"
+
 int server_socket; /* Unix socket for primary process. */
 struct rte_intr_handle server_intr_handle; /* Interrupt handler. */
 
-static void
-mlx5_pmd_make_path(struct sockaddr_un *addr, int pid)
-{
-	snprintf(addr->sun_path, sizeof(addr->sun_path), "/var/tmp/dpdk_%s_%d",
-		 MLX5_DRIVER_NAME, pid);
-}
-
 /**
  * Handle server pmd socket interrupts.
  */
@@ -186,7 +181,8 @@ mlx5_pmd_socket_init(void)
 	ret = fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
 	if (ret < 0)
 		goto error;
-	mlx5_pmd_make_path(&sun, getpid());
+	snprintf(sun.sun_path, sizeof(sun.sun_path), MLX5_SOCKET_PATH,
+		 getpid());
 	remove(sun.sun_path);
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
@@ -225,6 +221,6 @@ RTE_FINI(mlx5_pmd_socket_uninit)
 	mlx5_pmd_interrupt_handler_uninstall();
 	claim_zero(close(server_socket));
 	server_socket = 0;
-	MKSTR(path, "/var/tmp/dpdk_%s_%d", MLX5_DRIVER_NAME, getpid());
+	MKSTR(path, MLX5_SOCKET_PATH, getpid());
 	claim_zero(remove(path));
 }
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 12 lines

-----Original Message-----
From: Xueming Li <[email protected]>
Sent: Tuesday, November 3, 2020 10:29
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>
Cc: [email protected]; Xueming(Steven) Li <[email protected]>; Asaf Penso <[email protected]>; Bing Zhao <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix unix socket server file name

mlx_steering_dump_parser.py tool failed to dump flow due to socket file name changed.

Quoted 7 lines

Change socket file name back to make it consistent.

Fixes b1e15224849b ("common/mlx5: fix PCI driver name")
Quoted 49 lines
---
 drivers/net/mlx5/linux/mlx5_socket.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/mlx5/linux/mlx5_socket.c +2 -0
index 08af905126..1938453980 100644
@@ -20,16 +20,11 @@
 
 /* PMD socket service for tools. */
 
+#define MLX5_SOCKET_PATH "/var/tmp/dpdk_net_mlx5_%d"
+
 int server_socket; /* Unix socket for primary process. */  struct

rte_intr_handle server_intr_handle; /* Interrupt handler. */

drivers/net/mlx5/linux/mlx5_socket.c +0 -3
-static void
-mlx5_pmd_make_path(struct sockaddr_un *addr, int pid) -{
-	snprintf(addr->sun_path, sizeof(addr->sun_path),

"/var/tmp/dpdk_%s_%d",

drivers/net/mlx5/linux/mlx5_socket.c +3 -5
-		 MLX5_DRIVER_NAME, pid);
-}
-
 /**
  * Handle server pmd socket interrupts.
  */
@@ -186,7 +181,8 @@ mlx5_pmd_socket_init(void)
 	ret = fcntl(server_socket, F_SETFL, flags | O_NONBLOCK);
 	if (ret < 0)
 		goto error;
-	mlx5_pmd_make_path(&sun, getpid());
+	snprintf(sun.sun_path, sizeof(sun.sun_path), MLX5_SOCKET_PATH,
+		 getpid());
 	remove(sun.sun_path);
 	ret = bind(server_socket, (const struct sockaddr *)&sun, sizeof(sun));
 	if (ret < 0) {
@@ -225,6 +221,6 @@ RTE_FINI(mlx5_pmd_socket_uninit)
 	mlx5_pmd_interrupt_handler_uninstall();
 	claim_zero(close(server_socket));
 	server_socket = 0;
-	MKSTR(path, "/var/tmp/dpdk_%s_%d", MLX5_DRIVER_NAME,
 getpid());
+	MKSTR(path, MLX5_SOCKET_PATH, getpid());
 	claim_zero(remove(path));

}
--
2.25.1