All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kashyap Desai <kashyap.desai@broadcom.com>
To: linux-scsi@vger.kernel.org
Cc: Kashyap Desai <kashyap.desai@broadcom.com>, sathya.prakash@broadcom.com
Subject: [PATCH v2 24/24] mpi3mr: add event handling debug prints
Date: Wed,  7 Apr 2021 07:34:51 +0530	[thread overview]
Message-ID: <20210407020451.924822-25-kashyap.desai@broadcom.com> (raw)
In-Reply-To: <20210407020451.924822-1-kashyap.desai@broadcom.com>

[-- Attachment #1: Type: text/plain, Size: 10600 bytes --]

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: sathya.prakash@broadcom.com
---
 drivers/scsi/mpi3mr/mpi3mr_fw.c | 116 ++++++++++++++++++++++
 drivers/scsi/mpi3mr/mpi3mr_os.c | 164 ++++++++++++++++++++++++++++++++
 2 files changed, 280 insertions(+)

diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c
index 88069fbfa2bf..4c92c258ed69 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_fw.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c
@@ -154,6 +154,121 @@ void mpi3mr_repost_sense_buf(struct mpi3mr_ioc *mrioc,
 	spin_unlock(&mrioc->sbq_lock);
 }
 
+
+static void mpi3mr_print_event_data(struct mpi3mr_ioc *mrioc,
+	Mpi3EventNotificationReply_t *event_reply)
+{
+	char *desc = NULL;
+	u16 event;
+
+	event = event_reply->Event;
+
+	switch (event) {
+	case MPI3_EVENT_LOG_DATA:
+		desc = "Log Data";
+		break;
+	case MPI3_EVENT_CHANGE:
+		desc = "Event Change";
+		break;
+	case MPI3_EVENT_GPIO_INTERRUPT:
+		desc = "GPIO Interrupt";
+		break;
+	case MPI3_EVENT_TEMP_THRESHOLD:
+		desc = "Temperature Threshold";
+		break;
+	case MPI3_EVENT_CABLE_MGMT:
+		desc = "Cable Management";
+		break;
+	case MPI3_EVENT_ENERGY_PACK_CHANGE:
+		desc = "Energy Pack Change";
+		break;
+	case MPI3_EVENT_DEVICE_ADDED:
+	{
+		Mpi3DevicePage0_t *event_data =
+		    (Mpi3DevicePage0_t *)event_reply->EventData;
+		ioc_info(mrioc, "Device Added: Dev=0x%04x Form=0x%x\n",
+		    event_data->DevHandle, event_data->DeviceForm);
+		return;
+	}
+	case MPI3_EVENT_DEVICE_INFO_CHANGED:
+	{
+		Mpi3DevicePage0_t *event_data =
+		    (Mpi3DevicePage0_t *)event_reply->EventData;
+		ioc_info(mrioc, "Device Info Changed: Dev=0x%04x Form=0x%x\n",
+		    event_data->DevHandle, event_data->DeviceForm);
+		return;
+	}
+	case MPI3_EVENT_DEVICE_STATUS_CHANGE:
+	{
+		Mpi3EventDataDeviceStatusChange_t *event_data =
+		    (Mpi3EventDataDeviceStatusChange_t *)event_reply->EventData;
+		ioc_info(mrioc, "Device Status Change: Dev=0x%04x RC=0x%x\n",
+		    event_data->DevHandle, event_data->ReasonCode);
+		return;
+	}
+	case MPI3_EVENT_SAS_DISCOVERY:
+	{
+		Mpi3EventDataSasDiscovery_t *event_data =
+		    (Mpi3EventDataSasDiscovery_t *)event_reply->EventData;
+		ioc_info(mrioc, "SAS Discovery: (%s) status (0x%08x) \n",
+		    (event_data->ReasonCode == MPI3_EVENT_SAS_DISC_RC_STARTED) ?
+		    "start" : "stop",
+		    le32_to_cpu(event_data->DiscoveryStatus));
+		return;
+	}
+	case MPI3_EVENT_SAS_BROADCAST_PRIMITIVE:
+		desc = "SAS Broadcast Primitive";
+		break;
+	case MPI3_EVENT_SAS_NOTIFY_PRIMITIVE:
+		desc = "SAS Notify Primitive";
+		break;
+	case MPI3_EVENT_SAS_INIT_DEVICE_STATUS_CHANGE:
+		desc = "SAS Init Device Status Change";
+		break;
+	case MPI3_EVENT_SAS_INIT_TABLE_OVERFLOW:
+		desc = "SAS Init Table Overflow";
+		break;
+	case MPI3_EVENT_SAS_TOPOLOGY_CHANGE_LIST:
+		desc = "SAS Topology Change List";
+		break;
+	case MPI3_EVENT_ENCL_DEVICE_STATUS_CHANGE:
+		desc = "Enclosure Device Status Change";
+		break;
+	case MPI3_EVENT_HARD_RESET_RECEIVED:
+		desc = "Hard Reset Received";
+		break;
+	case MPI3_EVENT_SAS_PHY_COUNTER:
+		desc = "SAS PHY Counter";
+		break;
+	case MPI3_EVENT_SAS_DEVICE_DISCOVERY_ERROR:
+		desc = "SAS Device Discovery Error";
+		break;
+	case MPI3_EVENT_PCIE_TOPOLOGY_CHANGE_LIST:
+		desc = "PCIE Topology Change List";
+		break;
+	case MPI3_EVENT_PCIE_ENUMERATION:
+	{
+		Mpi3EventDataPcieEnumeration_t *event_data =
+		    (Mpi3EventDataPcieEnumeration_t *)event_reply->EventData;
+		ioc_info(mrioc, "PCIE Enumeration: (%s)",
+		    (event_data->ReasonCode ==
+		    MPI3_EVENT_PCIE_ENUM_RC_STARTED) ? "start" : "stop");
+		if (event_data->EnumerationStatus)
+			ioc_info(mrioc, "enumeration_status(0x%08x)\n",
+			    le32_to_cpu(event_data->EnumerationStatus));
+		return;
+	}
+	case MPI3_EVENT_PREPARE_FOR_RESET:
+		desc = "Prepare For Reset";
+		break;
+	}
+
+	if (!desc)
+		return;
+
+	ioc_info(mrioc, "%s\n", desc);
+}
+
 static void mpi3mr_handle_events(struct mpi3mr_ioc *mrioc,
 	Mpi3DefaultReply_t *def_reply)
 {
@@ -161,6 +276,7 @@ static void mpi3mr_handle_events(struct mpi3mr_ioc *mrioc,
 	    (Mpi3EventNotificationReply_t *)def_reply;
 
 	mrioc->change_count = le16_to_cpu(event_reply->IOCChangeCount);
+	mpi3mr_print_event_data(mrioc, event_reply);
 	mpi3mr_os_handle_events(mrioc, event_reply);
 }
 
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index a3610d22f67d..8df058be4d20 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -1003,6 +1003,85 @@ static void mpi3mr_devinfochg_evt_bh(struct mpi3mr_ioc *mrioc,
 
 }
 
+/**
+ * mpi3mr_sastopochg_evt_debug - SASTopoChange details
+ * @mrioc: Adapter instance reference
+ * @event_data: SAS topology change list event data
+ *
+ * Prints information about the SAS topology change event.
+ *
+ * Return: Nothing.
+ */
+static void
+mpi3mr_sastopochg_evt_debug(struct mpi3mr_ioc *mrioc,
+	Mpi3EventDataSasTopologyChangeList_t *event_data)
+{
+	int i;
+	u16 handle;
+	u8 reason_code, phy_number;
+	char *status_str = NULL;
+	u8 link_rate, prev_link_rate;
+
+	switch (event_data->ExpStatus) {
+	case MPI3_EVENT_SAS_TOPO_ES_NOT_RESPONDING:
+		status_str = "remove";
+		break;
+	case MPI3_EVENT_SAS_TOPO_ES_RESPONDING:
+		status_str =  "responding";
+		break;
+	case MPI3_EVENT_SAS_TOPO_ES_DELAY_NOT_RESPONDING:
+		status_str = "remove delay";
+		break;
+	case MPI3_EVENT_SAS_TOPO_ES_NO_EXPANDER:
+		status_str = "direct attached";
+		break;
+	default:
+		status_str = "unknown status";
+		break;
+	}
+	ioc_info(mrioc, "%s :sas topology change: (%s)\n",
+	    __func__, status_str);
+	ioc_info(mrioc,
+	    "%s :\texpander_handle(0x%04x), enclosure_handle(0x%04x) start_phy(%02d), num_entries(%d)\n",
+	    __func__, le16_to_cpu(event_data->ExpanderDevHandle),
+	    le16_to_cpu(event_data->EnclosureHandle),
+	    event_data->StartPhyNum, event_data->NumEntries);
+	for (i = 0; i < event_data->NumEntries; i++) {
+		handle = le16_to_cpu(event_data->PhyEntry[i].AttachedDevHandle);
+		if (!handle)
+			continue;
+		phy_number = event_data->StartPhyNum + i;
+		reason_code = event_data->PhyEntry[i].Status &
+		    MPI3_EVENT_SAS_TOPO_PHY_RC_MASK;
+		switch (reason_code) {
+		case MPI3_EVENT_SAS_TOPO_PHY_RC_TARG_NOT_RESPONDING:
+			status_str = "target remove";
+			break;
+		case MPI3_EVENT_SAS_TOPO_PHY_RC_DELAY_NOT_RESPONDING:
+			status_str = "delay target remove";
+			break;
+		case MPI3_EVENT_SAS_TOPO_PHY_RC_PHY_CHANGED:
+			status_str = "link status change";
+			break;
+		case MPI3_EVENT_SAS_TOPO_PHY_RC_NO_CHANGE:
+			status_str = "link status no change";
+			break;
+		case MPI3_EVENT_SAS_TOPO_PHY_RC_RESPONDING:
+			status_str = "target responding";
+			break;
+		default:
+			status_str = "unknown";
+			break;
+		}
+		link_rate = event_data->PhyEntry[i].LinkRate >> 4;
+		prev_link_rate = event_data->PhyEntry[i].LinkRate & 0xF;
+		ioc_info(mrioc,
+		    "%s :\tphy(%02d), attached_handle(0x%04x): %s: link rate: new(0x%02x), old(0x%02x)\n",
+		    __func__, phy_number, handle, status_str, link_rate,
+		    prev_link_rate);
+	}
+}
+
 /**
  * mpi3mr_sastopochg_evt_bh - SASTopologyChange evt bottomhalf
  * @mrioc: Adapter instance reference
@@ -1024,6 +1103,8 @@ static void mpi3mr_sastopochg_evt_bh(struct mpi3mr_ioc *mrioc,
 	u8 reason_code;
 	struct mpi3mr_tgt_dev *tgtdev = NULL;
 
+	mpi3mr_sastopochg_evt_debug(mrioc, event_data);
+
 	for (i = 0; i < event_data->NumEntries; i++) {
 		handle = le16_to_cpu(event_data->PhyEntry[i].AttachedDevHandle);
 		if (!handle)
@@ -1050,6 +1131,87 @@ static void mpi3mr_sastopochg_evt_bh(struct mpi3mr_ioc *mrioc,
 	}
 }
 
+/**
+ * mpi3mr_pcietopochg_evt_debug - PCIeTopoChange details
+ * @mrioc: Adapter instance reference
+ * @event_data: PCIe topology change list event data
+ *
+ * Prints information about the PCIe topology change event.
+ *
+ * Return: Nothing.
+ */
+static void
+mpi3mr_pcietopochg_evt_debug(struct mpi3mr_ioc *mrioc,
+	Mpi3EventDataPcieTopologyChangeList_t *event_data)
+{
+	int i;
+	u16 handle;
+	u16 reason_code;
+	u8 port_number;
+	char *status_str = NULL;
+	u8 link_rate, prev_link_rate;
+
+	switch (event_data->SwitchStatus) {
+	case MPI3_EVENT_PCIE_TOPO_SS_NOT_RESPONDING:
+		status_str = "remove";
+		break;
+	case MPI3_EVENT_PCIE_TOPO_SS_RESPONDING:
+		status_str =  "responding";
+		break;
+	case MPI3_EVENT_PCIE_TOPO_SS_DELAY_NOT_RESPONDING:
+		status_str = "remove delay";
+		break;
+	case MPI3_EVENT_PCIE_TOPO_SS_NO_PCIE_SWITCH:
+		status_str = "direct attached";
+		break;
+	default:
+		status_str = "unknown status";
+		break;
+	}
+	ioc_info(mrioc, "%s :pcie topology change: (%s)\n",
+	    __func__, status_str);
+	ioc_info(mrioc,
+	    "%s :\tswitch_handle(0x%04x), enclosure_handle(0x%04x) start_port(%02d), num_entries(%d)\n",
+	    __func__, le16_to_cpu(event_data->SwitchDevHandle),
+	    le16_to_cpu(event_data->EnclosureHandle),
+	    event_data->StartPortNum, event_data->NumEntries);
+	for (i = 0; i < event_data->NumEntries; i++) {
+		handle =
+		    le16_to_cpu(event_data->PortEntry[i].AttachedDevHandle);
+		if (!handle)
+			continue;
+		port_number = event_data->StartPortNum + i;
+		reason_code = event_data->PortEntry[i].PortStatus;
+		switch (reason_code) {
+		case MPI3_EVENT_PCIE_TOPO_PS_NOT_RESPONDING:
+			status_str = "target remove";
+			break;
+		case MPI3_EVENT_PCIE_TOPO_PS_DELAY_NOT_RESPONDING:
+			status_str = "delay target remove";
+			break;
+		case MPI3_EVENT_PCIE_TOPO_PS_PORT_CHANGED:
+			status_str = "link status change";
+			break;
+		case MPI3_EVENT_PCIE_TOPO_PS_NO_CHANGE:
+			status_str = "link status no change";
+			break;
+		case MPI3_EVENT_PCIE_TOPO_PS_RESPONDING:
+			status_str = "target responding";
+			break;
+		default:
+			status_str = "unknown";
+			break;
+		}
+		link_rate = event_data->PortEntry[i].CurrentPortInfo &
+		    MPI3_EVENT_PCIE_TOPO_PI_RATE_MASK;
+		prev_link_rate = event_data->PortEntry[i].PreviousPortInfo &
+		    MPI3_EVENT_PCIE_TOPO_PI_RATE_MASK;
+		ioc_info(mrioc,
+		    "%s :\tport(%02d), attached_handle(0x%04x): %s: link rate: new(0x%02x), old(0x%02x)\n",
+		    __func__, port_number, handle, status_str, link_rate,
+		    prev_link_rate);
+	}
+}
 /**
  * mpi3mr_pcietopochg_evt_bh - PCIeTopologyChange evt bottomhalf
  * @mrioc: Adapter instance reference
@@ -1071,6 +1233,8 @@ static void mpi3mr_pcietopochg_evt_bh(struct mpi3mr_ioc *mrioc,
 	u8 reason_code;
 	struct mpi3mr_tgt_dev *tgtdev = NULL;
 
+	mpi3mr_pcietopochg_evt_debug(mrioc, event_data);
+
 	for (i = 0; i < event_data->NumEntries; i++) {
 		handle =
 		    le16_to_cpu(event_data->PortEntry[i].AttachedDevHandle);
-- 
2.18.1


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4212 bytes --]

  parent reply	other threads:[~2021-04-07  2:05 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  2:04 [PATCH v2 00/24] Introducing mpi3mr driver Kashyap Desai
2021-04-07  2:04 ` [PATCH v2 01/24] mpi3mr: add mpi30 Rev-R headers and Kconfig Kashyap Desai
2021-04-15 10:30   ` Tomas Henzl
2021-04-15 20:31   ` Bart Van Assche
2021-04-16 10:53     ` Kashyap Desai
2021-04-16 15:40       ` Bart Van Assche
2021-04-19 10:20         ` Kashyap Desai
2021-04-20  6:33           ` Christoph Hellwig
2021-04-23 13:18             ` Kashyap Desai
2021-04-07  2:04 ` [PATCH v2 02/24] mpi3mr: base driver code Kashyap Desai
2021-04-07  4:17   ` kernel test robot
2021-04-07  4:17     ` kernel test robot
2021-04-07  4:33   ` kernel test robot
2021-04-07  4:33     ` kernel test robot
2021-04-07  2:04 ` [PATCH v2 03/24] mpi3mr: create operational request and reply queue pair Kashyap Desai
2021-04-15 10:35   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 04/24] mpi3mr: add support of queue command processing Kashyap Desai
2021-04-15 10:36   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 05/24] mpi3mr: add support of internal watchdog thread Kashyap Desai
2021-04-15 10:37   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 06/24] mpi3mr: add support of event handling part-1 Kashyap Desai
2021-04-15 10:40   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 07/24] mpi3mr: add support of event handling pcie devices part-2 Kashyap Desai
2021-04-15 11:10   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 08/24] mpi3mr: add support of event handling part-3 Kashyap Desai
2021-04-15 11:11   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 09/24] mpi3mr: add support for recovering controller Kashyap Desai
2021-04-15 11:21   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 10/24] mpi3mr: add support of timestamp sync with firmware Kashyap Desai
2021-04-15 11:22   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 11/24] mpi3mr: print ioc info for debugging Kashyap Desai
2021-04-15 11:55   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 12/24] mpi3mr: add bios_param shost template hook Kashyap Desai
2021-04-15 11:56   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 13/24] mpi3mr: implement scsi error handler hooks Kashyap Desai
2021-04-07  2:04 ` [PATCH v2 14/24] mpi3mr: add change queue depth support Kashyap Desai
2021-04-15 12:16   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 15/24] mpi3mr: allow certain commands during pci-remove hook Kashyap Desai
2021-04-15 12:19   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 16/24] mpi3mr: hardware workaround for UNMAP commands to nvme drives Kashyap Desai
2021-04-15 12:20   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 17/24] mpi3mr: add support of threaded isr Kashyap Desai
2021-04-15 12:22   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 18/24] mpi3mr: add complete support of soft reset Kashyap Desai
2021-04-15 12:32   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 19/24] mpi3mr: print pending host ios for debug Kashyap Desai
2021-04-15 12:43   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 20/24] mpi3mr: wait for pending IO completions upon detection of VD IO timeout Kashyap Desai
2021-04-15 12:45   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 21/24] mpi3mr: add support of PM suspend and resume Kashyap Desai
2021-04-15 12:46   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 22/24] mpi3mr: add support of DSN secure fw check Kashyap Desai
2021-04-15 12:48   ` Tomas Henzl
2021-04-07  2:04 ` [PATCH v2 23/24] mpi3mr: add eedp dif dix support Kashyap Desai
2021-04-15 12:50   ` Tomas Henzl
2021-04-07  2:04 ` Kashyap Desai [this message]
2021-04-15 12:52   ` [PATCH v2 24/24] mpi3mr: add event handling debug prints Tomas Henzl

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=20210407020451.924822-25-kashyap.desai@broadcom.com \
    --to=kashyap.desai@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sathya.prakash@broadcom.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.