Commit 287e0df0 authored by Alaa Hleihel's avatar Alaa Hleihel Committed by Saeed Mahameed

net/mlx5: Display the command index in command mailbox dump

Multiple commands can be printed at the same time which can
lead to wrong order of their lines in dmesg output.
As a result, it's hard to match data dumps to the correct command
or which command was fully dumped at some point.

Fix this by displaying the corresponding command index, and also
indicate when a command was fully dumped.
Signed-off-by: default avatarAlaa Hleihel <alaa@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 2119bda6
...@@ -263,15 +263,15 @@ static int verify_signature(struct mlx5_cmd_work_ent *ent) ...@@ -263,15 +263,15 @@ static int verify_signature(struct mlx5_cmd_work_ent *ent)
return 0; return 0;
} }
static void dump_buf(void *buf, int size, int data_only, int offset) static void dump_buf(void *buf, int size, int data_only, int offset, int idx)
{ {
__be32 *p = buf; __be32 *p = buf;
int i; int i;
for (i = 0; i < size; i += 16) { for (i = 0; i < size; i += 16) {
pr_debug("%03x: %08x %08x %08x %08x\n", offset, be32_to_cpu(p[0]), pr_debug("cmd[%d]: %03x: %08x %08x %08x %08x\n", idx, offset,
be32_to_cpu(p[1]), be32_to_cpu(p[2]), be32_to_cpu(p[0]), be32_to_cpu(p[1]),
be32_to_cpu(p[3])); be32_to_cpu(p[2]), be32_to_cpu(p[3]));
p += 4; p += 4;
offset += 16; offset += 16;
} }
...@@ -802,39 +802,41 @@ static void dump_command(struct mlx5_core_dev *dev, ...@@ -802,39 +802,41 @@ static void dump_command(struct mlx5_core_dev *dev,
int dump_len; int dump_len;
int i; int i;
mlx5_core_dbg(dev, "cmd[%d]: start dump\n", ent->idx);
data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA)); data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA));
if (data_only) if (data_only)
mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_DATA, mlx5_core_dbg_mask(dev, 1 << MLX5_CMD_DATA,
"dump command data %s(0x%x) %s\n", "cmd[%d]: dump command data %s(0x%x) %s\n",
mlx5_command_str(op), op, ent->idx, mlx5_command_str(op), op,
input ? "INPUT" : "OUTPUT"); input ? "INPUT" : "OUTPUT");
else else
mlx5_core_dbg(dev, "dump command %s(0x%x) %s\n", mlx5_core_dbg(dev, "cmd[%d]: dump command %s(0x%x) %s\n",
mlx5_command_str(op), op, ent->idx, mlx5_command_str(op), op,
input ? "INPUT" : "OUTPUT"); input ? "INPUT" : "OUTPUT");
if (data_only) { if (data_only) {
if (input) { if (input) {
dump_buf(ent->lay->in, sizeof(ent->lay->in), 1, offset); dump_buf(ent->lay->in, sizeof(ent->lay->in), 1, offset, ent->idx);
offset += sizeof(ent->lay->in); offset += sizeof(ent->lay->in);
} else { } else {
dump_buf(ent->lay->out, sizeof(ent->lay->out), 1, offset); dump_buf(ent->lay->out, sizeof(ent->lay->out), 1, offset, ent->idx);
offset += sizeof(ent->lay->out); offset += sizeof(ent->lay->out);
} }
} else { } else {
dump_buf(ent->lay, sizeof(*ent->lay), 0, offset); dump_buf(ent->lay, sizeof(*ent->lay), 0, offset, ent->idx);
offset += sizeof(*ent->lay); offset += sizeof(*ent->lay);
} }
for (i = 0; i < n && next; i++) { for (i = 0; i < n && next; i++) {
if (data_only) { if (data_only) {
dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset); dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset);
dump_buf(next->buf, dump_len, 1, offset); dump_buf(next->buf, dump_len, 1, offset, ent->idx);
offset += MLX5_CMD_DATA_BLOCK_SIZE; offset += MLX5_CMD_DATA_BLOCK_SIZE;
} else { } else {
mlx5_core_dbg(dev, "command block:\n"); mlx5_core_dbg(dev, "cmd[%d]: command block:\n", ent->idx);
dump_buf(next->buf, sizeof(struct mlx5_cmd_prot_block), 0, offset); dump_buf(next->buf, sizeof(struct mlx5_cmd_prot_block), 0, offset,
ent->idx);
offset += sizeof(struct mlx5_cmd_prot_block); offset += sizeof(struct mlx5_cmd_prot_block);
} }
next = next->next; next = next->next;
...@@ -842,6 +844,8 @@ static void dump_command(struct mlx5_core_dev *dev, ...@@ -842,6 +844,8 @@ static void dump_command(struct mlx5_core_dev *dev,
if (data_only) if (data_only)
pr_debug("\n"); pr_debug("\n");
mlx5_core_dbg(dev, "cmd[%d]: end dump\n", ent->idx);
} }
static u16 msg_to_opcode(struct mlx5_cmd_msg *in) static u16 msg_to_opcode(struct mlx5_cmd_msg *in)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment