All of lore.kernel.org
 help / color / mirror / Atom feed
From: Himanshu Madhani <hmadhani@marvell.com>
To: <James.Bottomley@HansenPartnership.com>, <martin.petersen@oracle.com>
Cc: <hmadhani@marvell.com>, <linux-scsi@vger.kernel.org>
Subject: [PATCH 03/25] qla2xxx: Add sysfs node for D-Port Diagnostics AEN data
Date: Wed, 12 Feb 2020 13:44:14 -0800	[thread overview]
Message-ID: <20200212214436.25532-4-hmadhani@marvell.com> (raw)
In-Reply-To: <20200212214436.25532-1-hmadhani@marvell.com>

From: Joe Carnuccio <joe.carnuccio@cavium.com>

This patch adds SysFS node to show D-Port diag data.

Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
Signed-off-by: Himanshu Madhani <hmadhani@marvell.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 21 +++++++++++++++++++++
 drivers/scsi/qla2xxx/qla_def.h  |  1 +
 drivers/scsi/qla2xxx/qla_isr.c  |  1 +
 3 files changed, 23 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 927115dc2526..de1930cd53fb 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -2323,6 +2323,26 @@ qla2x00_port_no_show(struct device *dev, struct device_attribute *attr,
 	return scnprintf(buf, PAGE_SIZE, "%u\n", vha->hw->port_no);
 }
 
+static ssize_t
+qla2x00_dport_diagnostics_show(struct device *dev,
+    struct device_attribute *attr, char *buf)
+{
+	scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
+
+	if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw) &&
+	    !IS_QLA28XX(vha->hw))
+		return scnprintf(buf, PAGE_SIZE, "\n");
+
+	if (!*vha->dport_data)
+		return scnprintf(buf, PAGE_SIZE, "\n");
+
+	return scnprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n",
+	    vha->dport_data[0], vha->dport_data[1],
+	    vha->dport_data[2], vha->dport_data[3]);
+}
+static DEVICE_ATTR(dport_diagnostics, 0444,
+	   qla2x00_dport_diagnostics_show, NULL);
+
 static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_driver_version_show, NULL);
 static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
 static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
@@ -2431,6 +2451,7 @@ struct device_attribute *qla2x00_host_attrs[] = {
 	&dev_attr_port_speed,
 	&dev_attr_port_no,
 	&dev_attr_fw_attr,
+	&dev_attr_dport_diagnostics,
 	NULL, /* reserve for qlini_mode */
 	NULL, /* reserve for ql2xiniexchg */
 	NULL, /* reserve for ql2xexchoffld */
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index b59643883ad1..22f859bef778 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -4541,6 +4541,7 @@ typedef struct scsi_qla_host {
 	uint8_t n2n_node_name[WWN_SIZE];
 	uint8_t n2n_port_name[WWN_SIZE];
 	uint16_t	n2n_id;
+	__le16 dport_data[4];
 	struct list_head gpnid_list;
 	struct fab_scan scan;
 
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index e40705d38cea..73b6cfd14581 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1254,6 +1254,7 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
 		ql_dbg(ql_dbg_async, vha, 0x5052,
 		    "D-Port Diagnostics: %04x %04x %04x %04x\n",
 		    mb[0], mb[1], mb[2], mb[3]);
+		memcpy(vha->dport_data, mb, sizeof(vha->dport_data));
 		if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) {
 			static char *results[] = {
 			    "start", "done(pass)", "done(error)", "undefined" };
-- 
2.12.0


  parent reply	other threads:[~2020-02-12 21:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-12 21:44 [PATCH 00/25] qla2xxx: Updates for the driver Himanshu Madhani
2020-02-12 21:44 ` [PATCH 01/25] qla2xxx: Add beacon LED config sysfs interface Himanshu Madhani
2020-02-12 21:44 ` [PATCH 02/25] qla2xxx: Move free of fcport out of interrupt context Himanshu Madhani
2020-02-12 21:44 ` Himanshu Madhani [this message]
2020-02-12 21:44 ` [PATCH 04/25] qla2xxx: Remove all DIX-0 references Himanshu Madhani
2020-02-12 21:44 ` [PATCH 05/25] qla2xxx: Add endianizer macro calls to fc host stats Himanshu Madhani
2020-02-12 21:44 ` [PATCH 06/25] qla2xxx: Add changes in preparation for vendor extended FDMI/RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 07/25] qla2xxx: Add vendor extended RDP additions and amendments Himanshu Madhani
2020-02-12 21:44 ` [PATCH 08/25] qla2xxx: Add ql2xrdpenable module parameter for RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 09/25] qla2xxx: Add vendor extended FDMI commands Himanshu Madhani
2020-02-12 21:44 ` [PATCH 10/25] qla2xxx: Display message for FCE enabled Himanshu Madhani
2020-02-12 21:44 ` [PATCH 11/25] qla2xxx: Show correct port speed capabilities for RDP command Himanshu Madhani
2020-02-12 21:44 ` [PATCH 12/25] qla2xxx: Cleanup ELS/PUREX iocb fields Himanshu Madhani
2020-02-12 21:44 ` [PATCH 13/25] qla2xxx: Add deferred queue for processing ABTS and RDP Himanshu Madhani
2020-02-12 21:44 ` [PATCH 14/25] qla2xxx: Handle cases for limiting RDP response payload length Himanshu Madhani
2020-02-12 21:44 ` [PATCH 15/25] qla2xxx: Fix RDP response size Himanshu Madhani
2020-02-12 21:44 ` [PATCH 16/25] qla2xxx: Use endian macros to assign static fields in fwdump header Himanshu Madhani
2020-02-12 21:44 ` [PATCH 17/25] qla2xxx: Correction to selection of loopback/echo test Himanshu Madhani
2020-02-12 21:44 ` [PATCH 18/25] qla2xxx: Fix qla2x00_echo_test() based on ISP type Himanshu Madhani
2020-02-12 21:44 ` [PATCH 19/25] qla2xxx: Print portname for logging in qla24xx_logio_entry() Himanshu Madhani
2020-02-12 21:44 ` [PATCH 20/25] qla2xxx: Use correct ISP28xx active FW region Himanshu Madhani
2020-02-12 21:44 ` [PATCH 21/25] qla2xxx: Save rscn_gen for new fcport Himanshu Madhani
2020-02-12 21:44 ` [PATCH 22/25] qla2xxx: Fix control flags for login/logout IOCB Himanshu Madhani
2020-02-12 21:44 ` [PATCH 23/25] qla2xxx: Add fixes for mailbox command Himanshu Madhani
2020-02-12 21:44 ` [PATCH 24/25] qla2xxx: Use QLA_FW_STOPPED macro to propagate flag Himanshu Madhani
2020-02-12 21:44 ` [PATCH 25/25] qla2xxx: Update driver version to 10.01.00.24-k Himanshu Madhani
2020-02-21 23:33 ` [PATCH 00/25] qla2xxx: Updates for the driver Martin K. Petersen
2020-02-24 16:36   ` Himanshu Madhani
2020-02-25  4:32   ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200212214436.25532-4-hmadhani@marvell.com \
    --to=hmadhani@marvell.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.