DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: add debug support for dumping all rte ports
@ 2022-12-13  9:28 Alex Vesker
  2022-12-21 10:10 ` [PATCH v2] " Alex Vesker
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Vesker @ 2022-12-13  9:28 UTC (permalink / raw)
  To: valex, viacheslavo, thomas, suanmingm, Matan Azrad; +Cc: dev, orika

Add a special value max_uint16 to request dump of all
rte ethernet ports. This is useful for collecting the
full info from all the ports in a single dump.

Signed-off-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_socket.c | 39 ++++++++++++++++++----------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_socket.c b/drivers/net/mlx5/linux/mlx5_socket.c
index 0e01aff0e7..ab1a8075f3 100644
--- a/drivers/net/mlx5/linux/mlx5_socket.c
+++ b/drivers/net/mlx5/linux/mlx5_socket.c
@@ -21,6 +21,7 @@
 /* PMD socket service for tools. */
 
 #define MLX5_SOCKET_PATH "/var/tmp/dpdk_net_mlx5_%d"
+#define MLX5_ALL_PORT_IDS 0xffff
 
 int server_socket = -1; /* Unix socket for primary process. */
 struct rte_intr_handle *server_intr_handle; /* Interrupt handler. */
@@ -35,7 +36,7 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	int ret;
 	struct cmsghdr *cmsg = NULL;
 	uint32_t data[MLX5_SENDMSG_MAX / sizeof(uint32_t)];
-	uint64_t flow_ptr = 0;
+	struct rte_flow *flow_ptr = NULL;
 	uint8_t  buf[CMSG_SPACE(sizeof(int))] = { 0 };
 	struct iovec io = {
 		.iov_base = data,
@@ -92,25 +93,37 @@ mlx5_pmd_socket_handle(void *cb __rte_unused)
 	dump_req = (struct mlx5_flow_dump_req *)msg.msg_iov->iov_base;
 	if (dump_req) {
 		port_id = dump_req->port_id;
-		flow_ptr = dump_req->flow_id;
+		flow_ptr = (struct rte_flow *)((uintptr_t)dump_req->flow_id);
 	} else {
 		DRV_LOG(WARNING, "Invalid message");
 		goto error;
 	}
 
-	if (!rte_eth_dev_is_valid_port(port_id)) {
-		DRV_LOG(WARNING, "Invalid port %u", port_id);
-		goto error;
+	if (port_id == MLX5_ALL_PORT_IDS) {
+		/* Dump all port ids */
+		if (flow_ptr) {
+			DRV_LOG(WARNING, "Flow ptr unsupported with given port id");
+			goto error;
+		}
+
+		RTE_ETH_FOREACH_DEV(port_id) {
+			dev = &rte_eth_devices[port_id];
+			ret = mlx5_flow_dev_dump(dev, NULL, file, &err);
+			if (ret)
+				break;
+		}
+	} else {
+		/* Dump single port id */
+		if (!rte_eth_dev_is_valid_port(port_id)) {
+			DRV_LOG(WARNING, "Invalid port %u", port_id);
+			goto error;
+		}
+
+		/* Dump flow */
+		dev = &rte_eth_devices[port_id];
+		ret = mlx5_flow_dev_dump(dev, flow_ptr, file, &err);
 	}
 
-	/* Dump flow. */
-	dev = &rte_eth_devices[port_id];
-	if (flow_ptr == 0)
-		ret = mlx5_flow_dev_dump(dev, NULL, file, NULL);
-	else
-		ret = mlx5_flow_dev_dump(dev,
-			(struct rte_flow *)((uintptr_t)flow_ptr), file, &err);
-
 	/* Set-up the ancillary data and reply. */
 	msg.msg_controllen = 0;
 	msg.msg_control = NULL;
-- 
2.18.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-04 11:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13  9:28 [PATCH] net/mlx5: add debug support for dumping all rte ports Alex Vesker
2022-12-21 10:10 ` [PATCH v2] " Alex Vesker
2022-12-21 10:42   ` Slava Ovsiienko
2023-01-04 11:44   ` Raslan Darawsheh

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).