Commit 1d2c717b authored by Moshe Shemesh's avatar Moshe Shemesh Committed by Saeed Mahameed
Browse files

net/mlx5: Add last command failure syndrome to debugfs



Add syndrome of last command failure per command type to debugfs to ease
debugging of such failure.
last_failed_syndrome - last command failed syndrome returned by FW.

Signed-off-by: default avatarMoshe Shemesh <moshe@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 4c7c8a6d
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1887,7 +1887,8 @@ static int cmd_exec(struct mlx5_core_dev *dev, void *in, int in_size, void *out,
	return err;
}

static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status, int err)
static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status,
			   u32 syndrome, int err)
{
	struct mlx5_cmd_stats *stats;

@@ -1902,6 +1903,7 @@ static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status, int
	if (err == -EREMOTEIO) {
		stats->failed_mbox_status++;
		stats->last_failed_mbox_status = status;
		stats->last_failed_syndrome = syndrome;
	}
	spin_unlock_irq(&stats->lock);
}
@@ -1909,6 +1911,7 @@ static void cmd_status_log(struct mlx5_core_dev *dev, u16 opcode, u8 status, int
/* preserve -EREMOTEIO for outbox.status != OK, otherwise return err as is */
static int cmd_status_err(struct mlx5_core_dev *dev, int err, u16 opcode, void *out)
{
	u32 syndrome = MLX5_GET(mbox_out, out, syndrome);
	u8 status = MLX5_GET(mbox_out, out, status);

	if (err == -EREMOTEIO) /* -EREMOTEIO is preserved */
@@ -1917,7 +1920,7 @@ static int cmd_status_err(struct mlx5_core_dev *dev, int err, u16 opcode, void *
	if (!err && status != MLX5_CMD_STAT_OK)
		err = -EREMOTEIO;

	cmd_status_log(dev, opcode, status, err);
	cmd_status_log(dev, opcode, status, syndrome, err);
	return err;
}

+2 −0
Original line number Diff line number Diff line
@@ -192,6 +192,8 @@ void mlx5_cmdif_debugfs_init(struct mlx5_core_dev *dev)
					   &stats->last_failed_errno);
			debugfs_create_u8("last_failed_mbox_status", 0400, stats->root,
					  &stats->last_failed_mbox_status);
			debugfs_create_x32("last_failed_syndrome", 0400, stats->root,
					   &stats->last_failed_syndrome);
		}
	}
}
+2 −0
Original line number Diff line number Diff line
@@ -272,6 +272,8 @@ struct mlx5_cmd_stats {
	u32		last_failed_errno;
	/* last bad status returned by FW */
	u8		last_failed_mbox_status;
	/* last command failed syndrome returned by FW */
	u32		last_failed_syndrome;
	struct dentry  *root;
	/* protect command average calculations */
	spinlock_t	lock;