diff mbox series

[01/14] qla2xxx: Add host attribute to trigger MPI hang

Message ID 20210805102005.20183-2-njavali@marvell.com
State Superseded
Headers show
Series [01/14] qla2xxx: Add host attribute to trigger MPI hang | expand

Commit Message

Nilesh Javali Aug. 5, 2021, 10:19 a.m. UTC
From: Arun Easi <aeasi@marvell.com>

Add a mechanism to trigger MPI pause for debugging purpose.

Signed-off-by: Arun Easi <aeasi@marvell.com>
Signed-off-by: Nilesh Javali <njavali@marvell.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Himanshu Madhani Aug. 5, 2021, 3:21 p.m. UTC | #1
> On Aug 5, 2021, at 5:19 AM, Nilesh Javali <njavali@marvell.com> wrote:
> 
> From: Arun Easi <aeasi@marvell.com>
> 
> Add a mechanism to trigger MPI pause for debugging purpose.
> 
> Signed-off-by: Arun Easi <aeasi@marvell.com>
> Signed-off-by: Nilesh Javali <njavali@marvell.com>
> ---
> drivers/scsi/qla2xxx/qla_attr.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index 22191e9a04a0..4a0a5b4e688d 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -1887,6 +1887,30 @@ qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
> 	return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]);
> }
> 
> +static ssize_t
> +qla2x00_mpi_pause_store(struct device *dev,
> +	struct device_attribute *attr, const char *buf, size_t count)
> +{
> +	scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
> +	int rval = 0;
> +
> +	if (sscanf(buf, "%d", &rval) != 1)
> +		return -EINVAL;
> +
> +	ql_log(ql_log_warn, vha, 0x7089, "Pausing MPI...\n");
> +
> +	rval = qla83xx_wr_reg(vha, 0x002012d4, 0x30000001);
> +
> +	if (rval != QLA_SUCCESS) {
> +		ql_log(ql_log_warn, vha, 0x708a, "Unable to pause MPI.\n");
> +		count = 0;
> +	}
> +
> +	return count;
> +}
> +
> +static DEVICE_ATTR(mpi_pause, S_IWUSR, NULL, qla2x00_mpi_pause_store);
> +
> /* ----- */
> 
> static ssize_t
> @@ -2482,6 +2506,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
> 	&dev_attr_fw_attr,
> 	&dev_attr_dport_diagnostics,
> 	&dev_attr_edif_doorbell,
> +	&dev_attr_mpi_pause,
> 	NULL, /* reserve for qlini_mode */
> 	NULL, /* reserve for ql2xiniexchg */
> 	NULL, /* reserve for ql2xexchoffld */
> -- 
> 2.19.0.rc0
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 22191e9a04a0..4a0a5b4e688d 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1887,6 +1887,30 @@  qla2x00_port_speed_show(struct device *dev, struct device_attribute *attr,
 	return scnprintf(buf, PAGE_SIZE, "%s\n", spd[ha->link_data_rate]);
 }
 
+static ssize_t
+qla2x00_mpi_pause_store(struct device *dev,
+	struct device_attribute *attr, const char *buf, size_t count)
+{
+	scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
+	int rval = 0;
+
+	if (sscanf(buf, "%d", &rval) != 1)
+		return -EINVAL;
+
+	ql_log(ql_log_warn, vha, 0x7089, "Pausing MPI...\n");
+
+	rval = qla83xx_wr_reg(vha, 0x002012d4, 0x30000001);
+
+	if (rval != QLA_SUCCESS) {
+		ql_log(ql_log_warn, vha, 0x708a, "Unable to pause MPI.\n");
+		count = 0;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR(mpi_pause, S_IWUSR, NULL, qla2x00_mpi_pause_store);
+
 /* ----- */
 
 static ssize_t
@@ -2482,6 +2506,7 @@  struct device_attribute *qla2x00_host_attrs[] = {
 	&dev_attr_fw_attr,
 	&dev_attr_dport_diagnostics,
 	&dev_attr_edif_doorbell,
+	&dev_attr_mpi_pause,
 	NULL, /* reserve for qlini_mode */
 	NULL, /* reserve for ql2xiniexchg */
 	NULL, /* reserve for ql2xexchoffld */