24d93b
From 79caef2412a36c3ed223be7e35395b41e99c6c4c 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:33 +0530
24d93b
Subject: [PATCH 02/11] scsi: mpt3sas: Fix for incorrect numbers for MSIX
24d93b
 vectors enabled when non RDPQ card is enumerated first.
24d93b
24d93b
No. of MSIX vectors supported = min (Total no. of CPU cores,
24d93b
MSIX vectors supported by card)
24d93b
24d93b
when RDPQ is disabled "max_msix_vectors" module parameter which was
24d93b
declared as global was set to '8' and hence if there are more than one card
24d93b
in system among which if RDPQ disabled card is enumerated first then only 8
24d93b
MSIX vectors was getting enabled for all the cards(including RDPQ enabled
24d93b
card,which can support more than 8 MSIX vectors).
24d93b
24d93b
Used local variable instead of global variable ,if RDPQ is disabled this
24d93b
local variable is set to '8' else it is set to "max_msix_vectors" (by
24d93b
default this is set to -1, whose value can be set by user during driver
24d93b
load time).So now regardless of whether RDPQ disabled card is enumerated
24d93b
first or RDPQ enabled card is enumerated first , MSIX vectors enabled
24d93b
depends on the cards capability.
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 | 12 +++++++-----
24d93b
 1 file changed, 7 insertions(+), 5 deletions(-)
24d93b
24d93b
diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
index c77c31c..2319db8 100644
24d93b
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
24d93b
@@ -1960,7 +1960,7 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
24d93b
 {
24d93b
 	struct msix_entry *entries, *a;
24d93b
 	int r;
24d93b
-	int i;
24d93b
+	int i, local_max_msix_vectors;
24d93b
 	u8 try_msix = 0;
24d93b
 
24d93b
 	if (msix_disable == -1 || msix_disable == 0)
24d93b
@@ -1980,13 +1980,15 @@ _base_enable_msix(struct MPT3SAS_ADAPTER *ioc)
24d93b
 	  ioc->cpu_count, max_msix_vectors);
24d93b
 
24d93b
 	if (!ioc->rdpq_array_enable && max_msix_vectors == -1)
24d93b
-		max_msix_vectors = 8;
24d93b
+		local_max_msix_vectors = 8;
24d93b
+	else
24d93b
+		local_max_msix_vectors = max_msix_vectors;
24d93b
 
24d93b
-	if (max_msix_vectors > 0) {
24d93b
-		ioc->reply_queue_count = min_t(int, max_msix_vectors,
24d93b
+	if (local_max_msix_vectors > 0) {
24d93b
+		ioc->reply_queue_count = min_t(int, local_max_msix_vectors,
24d93b
 			ioc->reply_queue_count);
24d93b
 		ioc->msix_vector_count = ioc->reply_queue_count;
24d93b
-	} else if (max_msix_vectors == 0)
24d93b
+	} else if (local_max_msix_vectors == 0)
24d93b
 		goto try_ioapic;
24d93b
 
24d93b
 	if (ioc->msix_vector_count < ioc->cpu_count)
24d93b
-- 
24d93b
1.8.3.1
24d93b