orgads / rpms / kernel

Forked from rpms/kernel 3 years ago
Clone
24d93b
From bd2314e40123381058f15b3ae49616d1cccb4f44 Mon Sep 17 00:00:00 2001
24d93b
From: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
24d93b
Date: Wed, 26 Oct 2016 13:34:38 +0530
24d93b
Subject: [PATCH 07/11] scsi: mpt3sas: Increased/Additional MSIX support for
24d93b
 SAS35 devices.
24d93b
24d93b
For SAS35 devices MSIX vectors are inceased to 128 from 96. To support this
24d93b
Reply post host index register count is increased to 16. Also variable
24d93b
msix96_vector is replaced with combined_reply_queue and variable
24d93b
combined_reply_index_count is added to set different values for SAS3 and
24d93b
SAS35 devices.
24d93b
24d93b
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
24d93b
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
24d93b
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
24d93b
Reviewed-by: Hannes Reinecke <hare@suse.com>
24d93b
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
24d93b
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
24d93b
---
24d93b
 drivers/scsi/mpt3sas/mpt3sas_base.c  | 14 +++++++-------
24d93b
 drivers/scsi/mpt3sas/mpt3sas_base.h  |  8 +++++---
24d93b
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 11 +++++++++--
24d93b
 3 files changed, 21 insertions(+), 12 deletions(-)
24d93b
24d93b
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
index ac87e12..b26fa23 100644
24d93b
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
@@ -1079,7 +1079,7 @@ _base_interrupt(int irq, void *bus_id)
24d93b
 	 * new reply host index value in ReplyPostIndex Field and msix_index
24d93b
 	 * value in MSIxIndex field.
24d93b
 	 */
24d93b
-	if (ioc->msix96_vector)
24d93b
+	if (ioc->combined_reply_queue)
24d93b
 		writel(reply_q->reply_post_host_index | ((msix_index  & 7) <<
24d93b
 			MPI2_RPHI_MSIX_INDEX_SHIFT),
24d93b
 			ioc->replyPostRegisterIndex[msix_index/8]);
24d93b
@@ -2053,7 +2053,7 @@ mpt3sas_base_unmap_resources(struct MPT3SAS_ADAPTER *ioc)
24d93b
 	_base_free_irq(ioc);
24d93b
 	_base_disable_msix(ioc);
24d93b
 
24d93b
-	if (ioc->msix96_vector) {
24d93b
+	if (ioc->combined_reply_queue) {
24d93b
 		kfree(ioc->replyPostRegisterIndex);
24d93b
 		ioc->replyPostRegisterIndex = NULL;
24d93b
 	}
24d93b
@@ -2163,7 +2163,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
24d93b
 	/* Use the Combined reply queue feature only for SAS3 C0 & higher
24d93b
 	 * revision HBAs and also only when reply queue count is greater than 8
24d93b
 	 */
24d93b
-	if (ioc->msix96_vector && ioc->reply_queue_count > 8) {
24d93b
+	if (ioc->combined_reply_queue && ioc->reply_queue_count > 8) {
24d93b
 		/* Determine the Supplemental Reply Post Host Index Registers
24d93b
 		 * Addresse. Supplemental Reply Post Host Index Registers
24d93b
 		 * starts at offset MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET and
24d93b
@@ -2171,7 +2171,7 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
24d93b
 		 * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET from previous one.
24d93b
 		 */
24d93b
 		ioc->replyPostRegisterIndex = kcalloc(
24d93b
-		     MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT,
24d93b
+		     ioc->combined_reply_index_count,
24d93b
 		     sizeof(resource_size_t *), GFP_KERNEL);
24d93b
 		if (!ioc->replyPostRegisterIndex) {
24d93b
 			dfailprintk(ioc, printk(MPT3SAS_FMT
24d93b
@@ -2181,14 +2181,14 @@ mpt3sas_base_map_resources(struct MPT3SAS_ADAPTER *ioc)
24d93b
 			goto out_fail;
24d93b
 		}
24d93b
 
24d93b
-		for (i = 0; i < MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT; i++) {
24d93b
+		for (i = 0; i < ioc->combined_reply_index_count; i++) {
24d93b
 			ioc->replyPostRegisterIndex[i] = (resource_size_t *)
24d93b
 			     ((u8 *)&ioc->chip->Doorbell +
24d93b
 			     MPI25_SUP_REPLY_POST_HOST_INDEX_OFFSET +
24d93b
 			     (i * MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET));
24d93b
 		}
24d93b
 	} else
24d93b
-		ioc->msix96_vector = 0;
24d93b
+		ioc->combined_reply_queue = 0;
24d93b
 
24d93b
 	list_for_each_entry(reply_q, &ioc->reply_queue_list, list)
24d93b
 		pr_info(MPT3SAS_FMT "%s: IRQ %d\n",
24d93b
@@ -5161,7 +5161,7 @@ _base_make_ioc_operational(struct MPT3SAS_ADAPTER *ioc, int sleep_flag)
24d93b
 
24d93b
 	/* initialize reply post host index */
24d93b
 	list_for_each_entry(reply_q, &ioc->reply_queue_list, list) {
24d93b
-		if (ioc->msix96_vector)
24d93b
+		if (ioc->combined_reply_queue)
24d93b
 			writel((reply_q->msix_index & 7)<<
24d93b
 			   MPI2_RPHI_MSIX_INDEX_SHIFT,
24d93b
 			   ioc->replyPostRegisterIndex[reply_q->msix_index/8]);
24d93b
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
24d93b
index c3a39e8..240c360 100644
24d93b
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
24d93b
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
24d93b
@@ -304,8 +304,9 @@
24d93b
  * There are twelve Supplemental Reply Post Host Index Registers
24d93b
  * and each register is at offset 0x10 bytes from the previous one.
24d93b
  */
24d93b
-#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT 12
24d93b
-#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET (0x10)
24d93b
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3	12
24d93b
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G35	16
24d93b
+#define MPT3_SUP_REPLY_POST_HOST_INDEX_REG_OFFSET	(0x10)
24d93b
 
24d93b
 /* OEM Identifiers */
24d93b
 #define MFG10_OEM_ID_INVALID                   (0x00000000)
24d93b
@@ -1172,7 +1173,8 @@ struct MPT3SAS_ADAPTER {
24d93b
 	u8		reply_queue_count;
24d93b
 	struct list_head reply_queue_list;
24d93b
 
24d93b
-	u8		msix96_vector;
24d93b
+	u8		combined_reply_queue;
24d93b
+	u8		combined_reply_index_count;
24d93b
 	/* reply post register index */
24d93b
 	resource_size_t	**replyPostRegisterIndex;
24d93b
 
24d93b
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
24d93b
index eaef45c..980c69d 100644
24d93b
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
24d93b
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
24d93b
@@ -8797,8 +8797,15 @@ _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
24d93b
 		}
24d93b
 		if ((ioc->hba_mpi_version_belonged == MPI25_VERSION &&
24d93b
 			pdev->revision >= SAS3_PCI_DEVICE_C0_REVISION) ||
24d93b
-			(ioc->hba_mpi_version_belonged == MPI26_VERSION))
24d93b
-			ioc->msix96_vector = 1;
24d93b
+			(ioc->hba_mpi_version_belonged == MPI26_VERSION)) {
24d93b
+			ioc->combined_reply_queue = 1;
24d93b
+			if (ioc->is_gen35_ioc)
24d93b
+				ioc->combined_reply_index_count =
24d93b
+				 MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G35;
24d93b
+			else
24d93b
+				ioc->combined_reply_index_count =
24d93b
+				 MPT3_SUP_REPLY_POST_HOST_INDEX_REG_COUNT_G3;
24d93b
+		}
24d93b
 		break;
24d93b
 	default:
24d93b
 		return -ENODEV;
24d93b
-- 
24d93b
1.8.3.1
24d93b