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