linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chaitra P B <chaitra.basappa@broadcom.com>
To: jejb@kernel.org, hch@infradead.org
Cc: martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	JBottomley@Parallels.com, Sathya.Prakash@broadcom.com,
	suganath-prabu.subramani@broadcom.com,
	linux-kernel@vger.kernel.org,
	Chaitra P B <chaitra.basappa@broadcom.com>
Subject: [PATCH 2/6] mpt3sas: Handle active cable exception event
Date: Fri,  6 May 2016 14:29:27 +0530	[thread overview]
Message-ID: <1462525171-6877-3-git-send-email-chaitra.basappa@broadcom.com> (raw)
In-Reply-To: <1462525171-6877-1-git-send-email-chaitra.basappa@broadcom.com>

In-order to handle this 'MPI2_EVENT_ACTIVE_CABLE_EXCEPTION' event,
driver need to follow below steps,
1. Unmask the 'MPI2_EVENT_ACTIVE_CABLE_EXCEPTION' event,
so that FW can notify this event to host driver.
2. After receiving this event, add this event to AEN event queue,
for notifying this event to applications.
3. Then Print below message in kernel logs if the event data's reason
code is zero,
"Currently an active cable with ReceptacleID <ID_Value> cannot be powered
and devices connected to this active cable will not be seen. This active
cable requires <PowerValue_in_mW> of power"

This event is only for Intruder/Cutlass HBAs.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |  5 +++++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 +++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index 8c44b9c..4e9142f 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -654,6 +654,9 @@ _base_display_event_data(struct MPT3SAS_ADAPTER *ioc,
 	case MPI2_EVENT_TEMP_THRESHOLD:
 		desc = "Temperature Threshold";
 		break;
+	case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION:
+		desc = "Active cable exception";
+		break;
 	}
 
 	if (!desc)
@@ -5424,6 +5427,8 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 	_base_unmask_events(ioc, MPI2_EVENT_IR_OPERATION_STATUS);
 	_base_unmask_events(ioc, MPI2_EVENT_LOG_ENTRY_ADDED);
 	_base_unmask_events(ioc, MPI2_EVENT_TEMP_THRESHOLD);
+	if (ioc->hba_mpi_version_belonged == MPI26_VERSION)
+		_base_unmask_events(ioc, MPI2_EVENT_ACTIVE_CABLE_EXCEPTION);
 
 	r = _base_make_ioc_operational(ioc, CAN_SLEEP);
 	if (r)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index e0e4920..221f8bf 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -7850,6 +7850,7 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
 	Mpi2EventNotificationReply_t *mpi_reply;
 	u16 event;
 	u16 sz;
+	Mpi26EventDataActiveCableExcept_t *ActiveCableEventData;
 
 	/* events turned off due to host reset or driver unloading */
 	if (ioc->remove_host || ioc->pci_error_recovery)
@@ -7962,6 +7963,18 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
 			(Mpi2EventDataTemperature_t *)
 			mpi_reply->EventData);
 		break;
+	case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION:
+		ActiveCableEventData =
+		    (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
+		if (ActiveCableEventData->ReasonCode ==
+				MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER)
+			pr_info(MPT3SAS_FMT "Currently an active cable with ReceptacleID %d",
+			    ioc->name, ActiveCableEventData->ReceptacleID);
+			pr_info("cannot be powered and devices connected to this active cable");
+			pr_info("will not be seen. This active cable");
+			pr_info("requires %d mW of power",
+			    ActiveCableEventData->ActiveCablePowerRequirement);
+		break;
 
 	default: /* ignore the rest */
 		return 1;
-- 
1.8.3.1

  parent reply	other threads:[~2016-05-06  8:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-06  8:59 [PATCH 0/6] mpt3sas: driver update to Phase12 Chaitra P B
2016-05-06  8:59 ` [PATCH 1/6] mpt3sas: Update MPI header to 2.00.42 Chaitra P B
2016-05-11 13:59   ` Tomas Henzl
2016-05-06  8:59 ` Chaitra P B [this message]
2016-05-11 14:00   ` [PATCH 2/6] mpt3sas: Handle active cable exception event Tomas Henzl
2016-05-06  8:59 ` [PATCH 3/6] mpt3sas: Fix initial Reference tag field for 4K PI drives Chaitra P B
2016-05-11 14:02   ` Tomas Henzl
2016-05-06  8:59 ` [PATCH 4/6] mpt3sas: Updating mpt3sas driver version to 13.100.00.00 Chaitra P B
2016-05-11 14:02   ` Tomas Henzl
2016-05-06  8:59 ` [PATCH 5/6] mpt3sas: Set maximum transfer length per IO to 4MB for VDs Chaitra P B
2016-05-11 14:03   ` Tomas Henzl
2016-05-06  8:59 ` [PATCH 6/6] mpt3sas: Used "synchronize_irq()"API to synchronize timed-out IO & TMs Chaitra P B
2016-05-10 13:11   ` Tomas Henzl
2016-05-11  3:53     ` Sreekanth Reddy
2016-05-11 14:04       ` Tomas Henzl
2016-05-11 20:15 ` [PATCH 0/6] mpt3sas: driver update to Phase12 Martin K. Petersen

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=1462525171-6877-3-git-send-email-chaitra.basappa@broadcom.com \
    --to=chaitra.basappa@broadcom.com \
    --cc=JBottomley@Parallels.com \
    --cc=Sathya.Prakash@broadcom.com \
    --cc=hch@infradead.org \
    --cc=jejb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=suganath-prabu.subramani@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).