From: Raghava Aditya Renukunta <[email protected]>

During EEH recovery number of online CPU's might change thereby changing
the number of MSIx vectors. Since each fib is allocated to a vector,
changes in the number of vectors causes fib to be sent thru invalid
vectors.In addition the correct number of MSIx vectors is not
updated in the INIT struct sent to the controller, when it is
reinitialized.

Fixed by reassigning vectors to fibs based on the updated number of MSIx
vectors and updating the INIT structure before sending to controller.

Signed-off-by: Raghava Aditya Renukunta <[email protected]>
---
 drivers/scsi/aacraid/linit.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 0147210..f88f1132 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1355,6 +1355,7 @@ static int aac_acquire_resources(struct aac_dev *dev)
        int i, j;
        int instance = dev->id;
        const char *name = dev->name;
+       int vector = 0;
        unsigned long status;
        /*
         *      First clear out all interrupts.  Then enable the one's that we
@@ -1409,9 +1410,31 @@ static int aac_acquire_resources(struct aac_dev *dev)
        }
 
        aac_adapter_enable_int(dev);
+       /*max msix may change  after EEH
+        * Re-assign vectors to fibs
+        */
+        for (i = 0;
+               i < (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);
+               i++) {
+               if ((dev->max_msix == 1) ||
+                  (i > ((dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB - 1)
+                       - dev->vector_cap))) {
+                       dev->fibs[i].vector_no = 0;
+               } else {
+                       dev->fibs[i].vector_no = vector;
+                       vector++;
+                       if (vector == dev->max_msix)
+                               vector = 1;
+               }
+       }
 
-       if (!dev->sync_mode)
+       if (!dev->sync_mode) {
+               /* After EEH recovery or suspend resume, max_msix count
+                * may change, therfore updating in init as well.
+                */
                aac_adapter_start(dev);
+               dev->init->Sa_MSIXVectors = cpu_to_le32(dev->max_msix);
+       }
        return 0;
 
 error_iounmap:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to