Skip to contentSkip to conversation

net/mlx5: add queue hardware object context dump

PATCH In review Kiran Vedere 3 participants 3 messages Jun 4, 2024 – Jun 30, 2024 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: add queue hardware object context dump

Add debug capability to mlx5 PMD to dump SQ/RQ/CQ HW object context for a given port/queue. The context dump can provide some real-time information on cause of certain Tx/Rx Failures.

---
 .mailmap                               |   1 +
 doc/guides/nics/mlx5.rst               |  11 ++
 doc/guides/rel_notes/release_24_07.rst |   5 +
 drivers/common/mlx5/mlx5_devx_cmds.c   |  87 +++++++++++++
 drivers/common/mlx5/mlx5_devx_cmds.h   |   9 ++
 drivers/common/mlx5/mlx5_prm.h         |  30 +++++
 drivers/common/mlx5/version.map        |   3 +
 drivers/net/mlx5/mlx5_rx.c             |  82 ++++++++++++
 drivers/net/mlx5/mlx5_rxtx.c           |  24 ++++
 drivers/net/mlx5/mlx5_rxtx.h           |   2 +
 drivers/net/mlx5/mlx5_testpmd.c        | 174 +++++++++++++++++++++++++
 drivers/net/mlx5/mlx5_tx.c             |  85 ++++++++++++
 drivers/net/mlx5/rte_pmd_mlx5.h        |  36 +++++
 drivers/net/mlx5/version.map           |   2 +
 14 files changed, 551 insertions(+)
.mailmap +1 -0
index 87fa24714e..a5ee56fe0c 100644
@@ -762,6 +762,7 @@ Kiran KN <[email protected]>
 Kiran Kumar K <[email protected]>
 Kiran Kumar <[email protected]> <[email protected]>
 Kiran Patil <[email protected]>
+Kiran Vedere <[email protected]>
 Kirill Rybalchenko <[email protected]>
 Kishore Padmanabha <[email protected]>
 Klaus Degner <[email protected]>
doc/guides/nics/mlx5.rst +11 -0
index b5928d40b2..40e36de7e8 100644
@@ -2601,3 +2601,14 @@ Destroy GENEVE TLV parser for specific port::
 
 This command doesn't destroy the global list,
 For releasing options, ``flush`` command should be used.
+
+Dump RQ/SQ/CQ HW Context for debug purposes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Dump RQ/CQ HW Context for a given port/queue to a file:
+
+   testpmd> mlx5 port (port_id) queue (queue_id) dump rq_context (file_name)
+
+Dump SQ/CQ HW Context for a given port/queue to a file:
+
+   testpmd> mlx5 port (port_id) queue (queue_id) dump sq_context (file_name)
doc/guides/rel_notes/release_24_07.rst +5 -0
index ffbe9ce051..c18a0be469 100644
@@ -81,6 +81,11 @@ New Features
 
   * Added SSE/NEON vector datapath.
 
+* **Add Queue Hardware object context dump.**
+
+  * Added debug capability  to mlx5 PMD to dump SQ/RQ/CQ HW object context for
+    a given port/queue. The context dump could provide useful information when
+    debugging certain Rx/Tx Failures.
 
 Removed Items
 -------------
drivers/common/mlx5/mlx5_devx_cmds.c +87 -0

105 lines not on this page · raw message

drivers/common/mlx5/mlx5_devx_cmds.h +9 -0
index c79f8dc48d..540f002088 100644
@@ -735,6 +735,15 @@ struct mlx5_devx_obj *mlx5_devx_cmd_create_sq(void *ctx,
 __rte_internal
 int mlx5_devx_cmd_modify_sq(struct mlx5_devx_obj *sq,
 			    struct mlx5_devx_modify_sq_attr *sq_attr);
+__rte_internal
+int mlx5_devx_cmd_query_sq(struct mlx5_devx_obj *sq, void *out, size_t outlen);
+
+__rte_internal
+int mlx5_devx_cmd_query_cq(struct mlx5_devx_obj *cq, void *out, size_t outlen);
+
+__rte_internal
+int mlx5_devx_cmd_query_rq(struct mlx5_devx_obj *rq, void *out, size_t outlen);
+
 __rte_internal
 struct mlx5_devx_obj *mlx5_devx_cmd_create_tis(void *ctx,
 					   struct mlx5_devx_tis_attr *tis_attr);
drivers/common/mlx5/mlx5_prm.h +30 -0
index 178a18a978..359f02f17c 100644
@@ -1215,6 +1215,7 @@ enum {
 	MLX5_CMD_OP_QUERY_HCA_CAP = 0x100,
 	MLX5_CMD_OP_CREATE_MKEY = 0x200,
 	MLX5_CMD_OP_CREATE_CQ = 0x400,
+	MLX5_CMD_OP_QUERY_CQ = 0x402,
 	MLX5_CMD_OP_CREATE_QP = 0x500,
 	MLX5_CMD_OP_RST2INIT_QP = 0x502,
 	MLX5_CMD_OP_INIT2RTR_QP = 0x503,
@@ -1240,6 +1241,7 @@ enum {
 	MLX5_CMD_OP_MODIFY_TIR = 0x901,
 	MLX5_CMD_OP_CREATE_SQ = 0X904,
 	MLX5_CMD_OP_MODIFY_SQ = 0X905,
+	MLX5_CMD_OP_QUERY_SQ = 0x907,
 	MLX5_CMD_OP_CREATE_RQ = 0x908,
 	MLX5_CMD_OP_MODIFY_RQ = 0x909,
 	MLX5_CMD_OP_QUERY_RQ = 0x90b,
@@ -3140,6 +3142,14 @@ struct mlx5_ifc_sqc_bits {
 	struct mlx5_ifc_wq_bits wq;
 };
 
+struct mlx5_ifc_query_sq_out_bits {
+	u8 status[0x8];
+	u8 reserved_at_8[0x18];
+	u8 syndrome[0x20];
+	u8 reserved_at_40[0xc0];
+	struct mlx5_ifc_sqc_bits sq_context;
+};
+
 struct mlx5_ifc_query_sq_in_bits {
 	u8 opcode[0x10];
 	u8 reserved_at_10[0x10];
@@ -3361,6 +3371,26 @@ struct mlx5_ifc_create_cq_in_bits {
 	u8 pas[];
 };
 
+struct mlx5_ifc_query_cq_out_bits {
+	u8 status[0x8];
+	u8 reserved_at_8[0x18];
+	u8 syndrome[0x20];
+	u8 reserved_at_40[0x40];
+	struct mlx5_ifc_cqc_bits cq_context;
+	u8 reserved_at_280[0x600];
+	u8 pas[][0x40];
+};
+
+struct mlx5_ifc_query_cq_in_bits {
+	u8 opcode[0x10];
+	u8 reserved_at_10[0x10];
+	u8 reserved_at_20[0x10];
+	u8 op_mod[0x10];
+	u8 reserved_at_40[0x8];
+	u8 cqn[0x18];
+	u8 reserved_at_60[0x20];
+};
+
 enum {
 	MLX5_GENERAL_OBJ_TYPE_GENEVE_TLV_OPT = 0x000b,
 	MLX5_GENERAL_OBJ_TYPE_DEK = 0x000c,
drivers/common/mlx5/version.map +3 -0
index 589a450145..a2f72ef46a 100644
@@ -51,6 +51,9 @@ INTERNAL {
 	mlx5_devx_cmd_modify_rq;
 	mlx5_devx_cmd_modify_rqt;
 	mlx5_devx_cmd_modify_sq;
+	mlx5_devx_cmd_query_sq;
+	mlx5_devx_cmd_query_rq;
+	mlx5_devx_cmd_query_cq;
 	mlx5_devx_cmd_modify_tir;
 	mlx5_devx_cmd_modify_virtq;
 	mlx5_devx_cmd_qp_query_tis_td;
drivers/net/mlx5/mlx5_rx.c +82 -0

85 lines not on this page · raw message

drivers/net/mlx5/mlx5_rxtx.c +24 -0
index d3d4470acd..eadadcdffb 100644
@@ -353,6 +353,30 @@ mlx5_dump_debug_information(const char *fname, const char *hex_title,
 	fclose(fd);
 }
 
+/**
+ * Dump information to a logfile
+ *
+ * @param fd
+ *   File descriptor to logfile. File descriptor open/close is managed by caller.
+ * @param title
+ *   If not NULL this string is printed as a header to the output
+ *   and the output will be in hexadecimal view.
+ * @param buf
+ *   This is the buffer address to print out.
+ * @param len
+ *   The number of bytes to dump out.
+ */
+void
+mlx5_dump_to_file(FILE *fd, const char *title,
+			    const void *buf, unsigned int len)
+{
+	if (title)
+		rte_hexdump(fd, title, buf, len);
+	else
+		fprintf(fd, "%s", (const char *)buf);
+	fprintf(fd, "\n\n\n");
+}
+
 /**
  * Modify a Verbs/DevX queue state.
  * This must be called from the primary process.
drivers/net/mlx5/mlx5_rxtx.h +2 -0
index b109d50758..3fa9245769 100644
@@ -38,6 +38,8 @@ void mlx5_set_cksum_table(void);
 void mlx5_set_swp_types_table(void);
 void mlx5_dump_debug_information(const char *path, const char *title,
 				 const void *buf, unsigned int len);
+void mlx5_dump_to_file(FILE *fd, const char *title,
+				 const void *buf, unsigned int len);
 int mlx5_queue_state_modify_primary(struct rte_eth_dev *dev,
 			const struct mlx5_mp_arg_queue_state_modify *sm);
 int mlx5_queue_state_modify(struct rte_eth_dev *dev,
drivers/net/mlx5/mlx5_testpmd.c +174 -0

186 lines not on this page · raw message

drivers/net/mlx5/mlx5_tx.c +85 -0

88 lines not on this page · raw message

drivers/net/mlx5/rte_pmd_mlx5.h +36 -0
index 004be0eea1..c823280717 100644
@@ -331,6 +331,42 @@ __rte_experimental
 int
 rte_pmd_mlx5_destroy_geneve_tlv_parser(void *handle);
 
+/**
+ * Dump Rx Queue Context for a given port/queue
+ *
+ * @param[in] port_id
+ *   Port ID
+ * @param[in] queue_id
+ *   Queue ID
+ * @param[in] filename
+ *   Name of file to dump the Rx Queue Context
+ *
+ * @return
+ *   0 for success, non-zero value depending on failure type
+ */
+
+__rte_experimental
+int
+rte_pmd_mlx5_rxq_dump_contexts(uint16_t port_id, uint16_t queue_id, const char *filename);
+
+/**
+ * Dump Tx Queue Context for a given port/queue
+ *
+ * @param[in] port_id
+ *   Port ID
+ * @param[in] queue_id
+ *   Queue ID
+ * @param[in] filename
+ *   Name of file to dump the Tx Queue Context
+ *
+ * @return
+ *   0 for success, non-zero value depending on failure type
+ */
+
+__rte_experimental
+int
+rte_pmd_mlx5_txq_dump_contexts(uint16_t port_id, uint16_t queue_id, const char *filename);
+
 #ifdef __cplusplus
 }
 #endif
drivers/net/mlx5/version.map +2 -0
index 8fb0e07303..f76b7ec18f 100644
@@ -20,4 +20,6 @@ EXPERIMENTAL {
 	# added in 24.03
 	rte_pmd_mlx5_create_geneve_tlv_parser;
 	rte_pmd_mlx5_destroy_geneve_tlv_parser;
+	rte_pmd_mlx5_txq_dump_contexts;
+	rte_pmd_mlx5_rxq_dump_contexts;
 };
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Kiran Vedere <[email protected]>
Sent: Wednesday, June 5, 2024 12:12 AM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Dariusz Sosnowski <[email protected]>
Subject: [PATCH] net/mlx5: add queue hardware object context dump

Quoted 5 lines

Add debug capability to mlx5 PMD to dump SQ/RQ/CQ HW object context for a given port/queue. The context dump can provide some real-time information on cause of certain Tx/Rx Failures.

#2 lore raw
In reply to Kiran Vedere

Hi,
From: Kiran Vedere <[email protected]>
Sent: Wednesday, June 5, 2024 12:11 AM
To: [email protected]
Cc: Matan Azrad; Raslan Darawsheh; Slava Ovsiienko; Dariusz Sosnowski
Subject: [PATCH] net/mlx5: add queue hardware object context dump

Add debug capability to mlx5 PMD to dump SQ/RQ/CQ HW object context for a given port/queue. The context dump can provide some real-time information on cause of certain Tx/Rx Failures.

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh