Skip to contentSkip to conversation

mpt3sas driver Enhancements and

PATCH Superseded Chaitra P B 3 participants 8 messages Jan 19, 2017 – Jan 20, 2017

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover mpt3sas driver Enhancements and

Here is the change list:
Posting 4 patches for mpt3sas driver enhancement and defect fixes.
* Handle cable event for notifying degraded speed.
* Performance improvement for Crusader.
* Fix Firmware fault state 0x2100 during heavy 4K RR FIO stress test.
* Updated driver version to 15.100.00.00

Chaitra P B (4):
mpt3sas: Added print to notify cable running at a degraded
speed.
mpt3sas: Fix for Crusader to achieve product targets with SAS
devices.
mpt3sas: Fix Firmware fault state 0x2100 during heavy 4K RR FIO
stress test.
mpt3sas: Bump driver version to 15.100.00.00

 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |    2 +
 drivers/scsi/mpt3sas/mpt3sas_base.c  |   20 ++++++++++++++
 drivers/scsi/mpt3sas/mpt3sas_base.h  |    7 +++--
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |    4 ++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   47 +++++++++++++++++++++++++++++----
 5 files changed, 70 insertions(+), 10 deletions(-)
#1 lore raw

PATCH 1/4 mpt3sas: Added print to notify cable running at a degraded speed.

Driver processes the event MPI26_EVENT_ACTIVE_CABLE_DEGRADED when a cable is present and is running at a degraded speed (below the SAS3 12 Gb/s rate). Prints added
to inform the user that the cable is not running at optimal speed.

Suganath Prabu <[email protected]>

---
 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |    2 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   18 +++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpi/mpi2_ioc.h +2 -0
index 8bae305..af4be40 100644
@@ -624,6 +624,8 @@ typedef struct _MPI26_EVENT_DATA_ACTIVE_CABLE_EXCEPT {
 
 /* defines for ReasonCode field */
 #define MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER     (0x00)
+#define MPI26_EVENT_ACTIVE_CABLE_PRESENT                (0x01)
+#define MPI26_EVENT_ACTIVE_CABLE_DEGRADED               (0x02)
 
 /*Hard Reset Received Event data */
 
drivers/scsi/mpt3sas/mpt3sas_scsih.c +13 -5
index 75f3fce..5ffbfb1 100644
@@ -8028,15 +8028,23 @@ mpt3sas_scsih_event_callback(struct MPT3SAS_ADAPTER *ioc, u8 msix_index,
 	case MPI2_EVENT_ACTIVE_CABLE_EXCEPTION:
 		ActiveCableEventData =
 		    (Mpi26EventDataActiveCableExcept_t *) mpi_reply->EventData;
-		if (ActiveCableEventData->ReasonCode ==
-				MPI26_EVENT_ACTIVE_CABLE_INSUFFICIENT_POWER) {
+		switch (ActiveCableEventData->ReasonCode) {
+		case 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",
+			pr_info(" cannot be powered and devices connected to");
+			pr_info(" this active cable will not be seen. This");
+			pr_info(" cable requires %d mW of power",
 			    ActiveCableEventData->ActiveCablePowerRequirement);
+			break;
+
+		case MPI26_EVENT_ACTIVE_CABLE_DEGRADED:
+			pr_info(MPT3SAS_FMT "Currently a cable with ReceptacleID %d",
+			    ioc->name, ActiveCableEventData->ReceptacleID);
+			pr_info(" is not running at optimal speed(12 Gb/s)\n");
+			break;
 		}
+
 		break;
 
 	default: /* ignore the rest */
Signature · 1 line
1.7.1
#3 lore raw

PATCH 2/4 mpt3sas: Fix for Crusader to achieve product targets with SAS devices.

In reply to Chaitra P B

Small glitch/degraded performance in Crusader is improved with SAS drives by removing unnecessary spinlocks while clearing scsi command in drivers internal lookup table.

Suganath Prabu <[email protected]>

---
 drivers/scsi/mpt3sas/mpt3sas_base.c  |    1 +
 drivers/scsi/mpt3sas/mpt3sas_base.h  |    1 +
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |    4 +++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   29 ++++++++++++++++++++++++++++-
 4 files changed, 33 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +1 -0
index f00ef88..722fab9 100644
@@ -5522,6 +5522,7 @@ mpt3sas_base_attach(struct MPT3SAS_ADAPTER *ioc)
 		goto out_free_resources;
 
 	ioc->non_operational_loop = 0;
+	ioc->got_task_abort_from_ioctl = 0;
 	return 0;
 
  out_free_resources:
drivers/scsi/mpt3sas/mpt3sas_base.h +1 -0
index dcb33f4..83cfa16 100644
@@ -1000,6 +1000,7 @@ struct MPT3SAS_ADAPTER {
 	u8		broadcast_aen_busy;
 	u16		broadcast_aen_pending;
 	u8		shost_recovery;
+	u8		got_task_abort_from_ioctl;
 
 	struct mutex	reset_in_progress_mutex;
 	spinlock_t	ioc_reset_in_progress_lock;
drivers/scsi/mpt3sas/mpt3sas_ctl.c +3 -1
index 95f0f24..02fe1c4 100644
@@ -826,16 +826,18 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
 			"TASK_MGMT: handle(0x%04x), task_type(0x%02x)\n",
 			ioc->name,
 		    le16_to_cpu(tm_request->DevHandle), tm_request->TaskType));
-
+		ioc->got_task_abort_from_ioctl = 1;
 		if (tm_request->TaskType ==
 		    MPI2_SCSITASKMGMT_TASKTYPE_ABORT_TASK ||
 		    tm_request->TaskType ==
 		    MPI2_SCSITASKMGMT_TASKTYPE_QUERY_TASK) {
 			if (_ctl_set_task_mid(ioc, &karg, tm_request)) {
 				mpt3sas_base_free_smid(ioc, smid);
+				ioc->got_task_abort_from_ioctl = 0;
 				goto out;
 			}
 		}
+		ioc->got_task_abort_from_ioctl = 0;
 
 		if (test_bit(device_handle, ioc->device_remove_in_progress)) {
 			dtmprintk(ioc, pr_info(MPT3SAS_FMT
drivers/scsi/mpt3sas/mpt3sas_scsih.c +28 -1
index 5ffbfb1..b3f9f7a 100644
@@ -1096,6 +1096,27 @@ _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER *ioc, u16 smid)
 }
 
 /**
+ * _scsih_scsi_lookup_get_clear_without_lock - returns scmd entry without
+ *						holding any lock.
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * Returns the smid stored scmd pointer.
+ * Then will derefrence the stored scmd pointer.
+ */
+static inline struct scsi_cmnd *
+_scsih_scsi_lookup_get_clear_without_lock(struct MPT3SAS_ADAPTER *ioc,
+		u16 smid)
+{
+	struct scsi_cmnd *scmd;
+
+	scmd = ioc->scsi_lookup[smid - 1].scmd;
+	ioc->scsi_lookup[smid - 1].scmd = NULL;
+
+	return scmd;
+}
+
+/**
  * _scsih_scsi_lookup_find_by_scmd - scmd lookup
  * @ioc: per adapter object
  * @smid: system request message index
@@ -4659,7 +4680,13 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	unsigned long flags;
 
 	mpi_reply = mpt3sas_base_get_reply_virt_addr(ioc, reply);
-	scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
+
+	if (ioc->broadcast_aen_busy || ioc->pci_error_recovery ||
+			ioc->got_task_abort_from_ioctl)
+		scmd = _scsih_scsi_lookup_get_clear(ioc, smid);
+	else
+		scmd = _scsih_scsi_lookup_get_clear_without_lock(ioc, smid);
+
 	if (scmd == NULL)
 		return 1;
 
Signature · 1 line
1.7.1
#5 lore raw

PATCH 3/4 mpt3sas: Fix Firmware fault state 0x2100 during heavy 4K RR FIO stress test.

In reply to Chaitra P B

Due existence of loop in the IO path our HBA will receive heavy IOs and also as driver is not updating the Reply Post Host Index frequently, So there will be a high chance that our Firmware unable to find any free entry in the Reply Post Descriptor Queue (i.e. Queue overflow occurs) and can observe 0x2100 firmware fault.
So to fix this, we have defined a thresh hold value. After continuously processing this threshold number of reply descriptors driver will update the Reply Descriptor Host Index so that this threshold number of reply descriptors entries will be freed and these entries will be available for firmware and we won't observe this Firmware fault. We have defined this threshold value as 1/3rd of the hba queue depth.

Suganath Prabu <[email protected]>

---
 drivers/scsi/mpt3sas/mpt3sas_base.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +19 -0
index 722fab9..a3fe1fb 100644
@@ -1040,6 +1040,25 @@ _base_interrupt(int irq, void *bus_id)
 		    reply_q->reply_post_free[reply_q->reply_post_host_index].
 		    Default.ReplyFlags & MPI2_RPY_DESCRIPT_FLAGS_TYPE_MASK;
 		completed_cmds++;
+		/* Update the reply post host index after continuously
+		 * processing the threshold number of Reply Descriptors.
+		 * So that FW can find enough entries to post the Reply
+		 * Descriptors in the reply descriptor post queue.
+		 */
+		if (completed_cmds > ioc->hba_queue_depth/3) {
+			if (ioc->combined_reply_queue) {
+				writel(reply_q->reply_post_host_index |
+						((msix_index  & 7) <<
+						 MPI2_RPHI_MSIX_INDEX_SHIFT),
+				    ioc->replyPostRegisterIndex[msix_index/8]);
+			} else {
+				writel(reply_q->reply_post_host_index |
+						(msix_index <<
+						 MPI2_RPHI_MSIX_INDEX_SHIFT),
+						&ioc->chip->ReplyPostHostIndex);
+			}
+			completed_cmds = 1;
+		}
 		if (request_desript_type == MPI2_RPY_DESCRIPT_FLAGS_UNUSED)
 			goto out;
 		if (!reply_q->reply_post_host_index)
Signature · 1 line
1.7.1
#6 lore raw

PATCH 4/4 mpt3sas: Bump driver version to 15.100.00.00

In reply to Chaitra P B

Suganath Prabu <[email protected]>

---
 drivers/scsi/mpt3sas/mpt3sas_base.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.h +3 -3
index 83cfa16..4ab634f 100644
@@ -73,9 +73,9 @@
 #define MPT3SAS_DRIVER_NAME		"mpt3sas"
 #define MPT3SAS_AUTHOR "Avago Technologies <[email protected]>"
 #define MPT3SAS_DESCRIPTION	"LSI MPT Fusion SAS 3.0 Device Driver"
-#define MPT3SAS_DRIVER_VERSION		"14.101.00.00"
-#define MPT3SAS_MAJOR_VERSION		14
-#define MPT3SAS_MINOR_VERSION		101
+#define MPT3SAS_DRIVER_VERSION		"15.100.00.00"
+#define MPT3SAS_MAJOR_VERSION		15
+#define MPT3SAS_MINOR_VERSION		100
 #define MPT3SAS_BUILD_VERSION		0
 #define MPT3SAS_RELEASE_VERSION	00
 
Signature · 1 line
1.7.1
#4 lore raw

Re: [PATCH 2/4] mpt3sas: Fix for Crusader to achieve product targets with SAS devices.

In reply to Chaitra P B
Quoted 17 lines · Chaitra P B
drivers/scsi/mpt3sas/mpt3sas_scsih.c +9 -0
index 5ffbfb1..b3f9f7a 100644
@@ -1096,6 +1096,27 @@ _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER *ioc, u16 smid)
 }
 
 /**
+ * _scsih_scsi_lookup_get_clear_without_lock - returns scmd entry without
+ *						holding any lock.
+ * @ioc: per adapter object
+ * @smid: system request message index
+ *
+ * Returns the smid stored scmd pointer.
+ * Then will derefrence the stored scmd pointer.
+ */
+static inline struct scsi_cmnd *

drivers/scsi/mpt3sas/mpt3sas_scsih.c _scsih_scsi_lookup_get_clear(struct MPT3SAS_ADAPTER *ioc, u16 smid) · line 1117

Quoted 10 lines
drivers/scsi/mpt3sas/mpt3sas_scsih.c +10 -0
+_scsih_scsi_lookup_get_clear_without_lock(struct MPT3SAS_ADAPTER *ioc,
+		u16 smid)
+{
+	struct scsi_cmnd *scmd;
+
+	scmd = ioc->scsi_lookup[smid - 1].scmd;
+	ioc->scsi_lookup[smid - 1].scmd = NULL;
+
+	return scmd;
+}

Please make the following changes in the above code:
* Use swap() instead of open-coding it.
* Call _scsih_scsi_lookup_get_clear_without_lock() from _scsih_scsi_lookup_get_clear() to avoid code duplication.
* Fix the spelling of "dereference".

Thanks,

Bart.

Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] mpt3sas: Added print to notify cable running at a degraded speed.

In reply to Chaitra P B
Quoted 8 lines · Chaitra P B

Driver processes the event MPI26_EVENT_ACTIVE_CABLE_DEGRADED when a cable is present and is running at a degraded speed (below the SAS3 12 Gb/s rate). Prints added
to inform the user that the cable is not running at optimal speed.

Suganath Prabu <[email protected]>

Missing Signed-off-by for Suganath.

Quoted 4 lines
---
 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |    2 ++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   18 +++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

Otherwise,

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#7 lore raw
In reply to Chaitra P B
Quoted 17 lines · Chaitra P B

Here is the change list:
Posting 4 patches for mpt3sas driver enhancement and defect fixes.
* Handle cable event for notifying degraded speed.
* Performance improvement for Crusader.
* Fix Firmware fault state 0x2100 during heavy 4K RR FIO stress test.
* Updated driver version to 15.100.00.00

Chaitra P B (4):
mpt3sas: Added print to notify cable running at a degraded
speed.
mpt3sas: Fix for Crusader to achieve product targets with SAS
devices.
mpt3sas: Fix Firmware fault state 0x2100 during heavy 4K RR FIO
stress test.
mpt3sas: Bump driver version to 15.100.00.00

Quoted 6 lines
 drivers/scsi/mpt3sas/mpi/mpi2_ioc.h  |    2 +
 drivers/scsi/mpt3sas/mpt3sas_base.c  |   20 ++++++++++++++
 drivers/scsi/mpt3sas/mpt3sas_base.h  |    7 +++--
 drivers/scsi/mpt3sas/mpt3sas_ctl.c   |    4 ++-
 drivers/scsi/mpt3sas/mpt3sas_scsih.c |   47 +++++++++++++++++++++++++++++----
 5 files changed, 70 insertions(+), 10 deletions(-)

Please be sure you have appropriate Signed-off-by lines on all of your patches, thanks.

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850