Skip to content

Commit 12b996d

Browse files
Moshe ShemeshSaeed Mahameed
authored andcommitted
net/mlx5: Fix dump_command mailbox length printed
Dump command mailbox length printed was correct only if data_only flag was set. For the case that data_only flag was clear the offset to stop printing at was wrong and so the buffer printed was too short. Changed the print loop to stop according to number of buffers in mailbox. Fixes: e126ba9 ("mlx5: Add driver for Mellanox Connect-IB adapters") Signed-off-by: Moshe Shemesh <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent ed644fa commit 12b996d

File tree

1 file changed

+3
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+3
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/cmd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,11 @@ static void dump_command(struct mlx5_core_dev *dev,
722722
struct mlx5_cmd_msg *msg = input ? ent->in : ent->out;
723723
u16 op = MLX5_GET(mbox_in, ent->lay->in, opcode);
724724
struct mlx5_cmd_mailbox *next = msg->next;
725+
int n = mlx5_calc_cmd_blocks(msg);
725726
int data_only;
726727
u32 offset = 0;
727728
int dump_len;
729+
int i;
728730

729731
data_only = !!(mlx5_core_debug_mask & (1 << MLX5_CMD_DATA));
730732

@@ -751,7 +753,7 @@ static void dump_command(struct mlx5_core_dev *dev,
751753
offset += sizeof(*ent->lay);
752754
}
753755

754-
while (next && offset < msg->len) {
756+
for (i = 0; i < n && next; i++) {
755757
if (data_only) {
756758
dump_len = min_t(int, MLX5_CMD_DATA_BLOCK_SIZE, msg->len - offset);
757759
dump_buf(next->buf, dump_len, 1, offset);

0 commit comments

Comments
 (0)