b37f23
From 79caef2412a36c3ed223be7e35395b41e99c6c4c Mon Sep 17 00:00:00 2001
b37f23
From: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
b37f23
Date: Wed, 26 Oct 2016 13:34:33 +0530
b37f23
Subject: [PATCH 02/11] scsi: mpt3sas: Fix for incorrect numbers for MSIX
b37f23
 vectors enabled when non RDPQ card is enumerated first.
b37f23
b37f23
No. of MSIX vectors supported = min (Total no. of CPU cores,
b37f23
MSIX vectors supported by card)
b37f23
b37f23
when RDPQ is disabled "max_msix_vectors" module parameter which was
b37f23
declared as global was set to '8' and hence if there are more than one card
b37f23
in system among which if RDPQ disabled card is enumerated first then only 8
b37f23
MSIX vectors was getting enabled for all the cards(including RDPQ enabled
b37f23
card,which can support more than 8 MSIX vectors).
b37f23
b37f23
Used local variable instead of global variable ,if RDPQ is disabled this
b37f23
local variable is set to '8' else it is set to "max_msix_vectors" (by
b37f23
default this is set to -1, whose value can be set by user during driver
b37f23
load time).So now regardless of whether RDPQ disabled card is enumerated
b37f23
first or RDPQ enabled card is enumerated first , MSIX vectors enabled
b37f23
depends on the cards capability.
b37f23
b37f23
Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
b37f23
Signed-off-by: Sathya Prakash <sathya.prakash@broadcom.com>
b37f23
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
b37f23
Reviewed-by: Hannes Reinecke <hare@suse.com>
b37f23
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
b37f23
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
b37f23
---
b37f23
 drivers/scsi/mpt3sas/mpt3sas_base.c | 12 +++++++-----
b37f23
 1 file changed, 7 insertions(+), 5 deletions(-)
b37f23
b37f23
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
b37f23
index c77c31c..2319db8 100644
b37f23
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
b37f23
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
b37f23
@@ -1960,7 +1960,7 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
b37f23
 {
b37f23
 	struct msix_entry *entries, *a;
b37f23
 	int r;
b37f23
-	int i;
b37f23
+	int i, local_max_msix_vectors;
b37f23
 	u8 try_msix = 0;
b37f23
 
b37f23
 	if (msix_disable == -1 || msix_disable == 0)
b37f23
@@ -1980,13 +1980,15 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
b37f23
 	  ioc->cpu_count, max_msix_vectors);
b37f23
 
b37f23
 	if (!ioc->rdpq_array_enable && max_msix_vectors == -1)
b37f23
-		max_msix_vectors = 8;
b37f23
+		local_max_msix_vectors = 8;
b37f23
+	else
b37f23
+		local_max_msix_vectors = max_msix_vectors;
b37f23
 
b37f23
-	if (max_msix_vectors > 0) {
b37f23
-		ioc->reply_queue_count = min_t(int, max_msix_vectors,
b37f23
+	if (local_max_msix_vectors > 0) {
b37f23
+		ioc->reply_queue_count = min_t(int, local_max_msix_vectors,
b37f23
 			ioc->reply_queue_count);
b37f23
 		ioc->msix_vector_count = ioc->reply_queue_count;
b37f23
-	} else if (max_msix_vectors == 0)
b37f23
+	} else if (local_max_msix_vectors == 0)
b37f23
 		goto try_ioapic;
b37f23
 
b37f23
 	if (ioc->msix_vector_count < ioc->cpu_count)
b37f23
-- 
b37f23
1.8.3.1
b37f23