Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

2015-06-25 Thread Tomas Henzl
On 06/25/2015 06:54 PM, Rajinikanth Pandurangan wrote:
> Hello Tomas,
> 
> Please see my response below.
> 
> Thanks,
> -Raj P.
> 
> -Original Message-
> From: Tomas Henzl [mailto:the...@redhat.com] 
> Sent: Thursday, June 25, 2015 8:43 AM
> To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
> linux-scsi@vger.kernel.org
> Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
> Leubner; Murthy Bhat
> Subject: Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support
> 
> On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote:
>> From: Rajinikanth Pandurangan 
>>
>> Description:
>>  * .suspend() and .resume() routines implemented in the driver
>>  * aac_release_resources() initiates firmware shutdown
>>  * aac_acquire_resources re-initializes the host interface
>>
>> Signed-off-by: Rajinikanth Pandurangan 
>> 
>> ---
>>  drivers/scsi/aacraid/aacraid.h  |   5 ++
>>  drivers/scsi/aacraid/comminit.c | 154 
>> 
>>  drivers/scsi/aacraid/linit.c| 147 ++
>>  drivers/scsi/aacraid/rx.c   |   1 +
>>  drivers/scsi/aacraid/sa.c   |   1 +
>>  drivers/scsi/aacraid/src.c  |   2 +
>>  6 files changed, 232 insertions(+), 78 deletions(-)
>>
>> diff --git a/drivers/scsi/aacraid/aacraid.h 
>> b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644
>> --- a/drivers/scsi/aacraid/aacraid.h
>> +++ b/drivers/scsi/aacraid/aacraid.h
>> @@ -547,6 +547,7 @@ struct adapter_ops
>>  int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
>> p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, 
>> u32 *r4);
>>  int  (*adapter_check_health)(struct aac_dev *dev);
>>  int  (*adapter_restart)(struct aac_dev *dev, int bled);
>> +void (*adapter_start)(struct aac_dev *dev);
>>  /* Transport operations */
>>  int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
>>  irq_handler_t adapter_intr;
>> @@ -1247,6 +1248,9 @@ struct aac_dev
>>  #define aac_adapter_restart(dev,bled) \
>>  (dev)->a_ops.adapter_restart(dev,bled)
>>  
>> +#define aac_adapter_start(dev) \
>> +((dev)->a_ops.adapter_start(dev))
>> +
>>  #define aac_adapter_ioremap(dev, size) \
>>  (dev)->a_ops.adapter_ioremap(dev, size)
>>  
>> @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);  int 
>> aac_src_init(struct aac_dev *dev);  int aac_srcv_init(struct aac_dev 
>> *dev);  int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, 
>> struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long 
>> *nonotify);
>> +void aac_define_int_mode(struct aac_dev *dev);
>>  unsigned int aac_response_normal(struct aac_queue * q);  unsigned int 
>> aac_command_normal(struct aac_queue * q);  unsigned int 
>> aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git 
>> a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c 
>> index 45db84a..e0a76d5 100644
>> --- a/drivers/scsi/aacraid/comminit.c
>> +++ b/drivers/scsi/aacraid/comminit.c
>> @@ -43,8 +43,6 @@
>>  
>>  #include "aacraid.h"
>>  
>> -static void aac_define_int_mode(struct aac_dev *dev);
>> -
>>  struct aac_common aac_config = {
>>  .irq_mod = 1
>>  };
>> @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
>>  return 0;
>>  }
>>  
>> +void aac_define_int_mode(struct aac_dev *dev) {
>> +int i, msi_count;
>> +
>> +msi_count = i = 0;
>> +/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
>> +if (dev->max_msix == 0 ||
>> +dev->pdev->device == PMC_DEVICE_S6 ||
>> +dev->sync_mode) {
>> +dev->max_msix = 1;
>> +dev->vector_cap =
>> +dev->scsi_host_ptr->can_queue +
>> +AAC_NUM_MGT_FIB;
>> +return;
>> +}
>> +
>> +/* Don't bother allocating more MSI-X vectors than cpus */
>> +msi_count = min(dev->max_msix,
>> +(unsigned int)num_online_cpus());
>> +
>> +dev->max_msix = msi_count;
>> +
>> +if (msi_count > AAC_MAX_MSIX)
>> +msi_count = AAC_MAX_MSIX;
>> +
>> +for (i = 0; i < msi_count; i++)
>> +dev->msixentry[i].entry = i;
>> +
>> +if (msi_count > 1 &&
>> +pci_find_capability(de

RE: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

2015-06-25 Thread Rajinikanth Pandurangan
Hello Tomas,

Please see my response below.

Thanks,
-Raj P.

-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Thursday, June 25, 2015 8:43 AM
To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat
Subject: Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
>   * .suspend() and .resume() routines implemented in the driver
>   * aac_release_resources() initiates firmware shutdown
>   * aac_acquire_resources re-initializes the host interface
> 
> Signed-off-by: Rajinikanth Pandurangan 
> 
> ---
>  drivers/scsi/aacraid/aacraid.h  |   5 ++
>  drivers/scsi/aacraid/comminit.c | 154 
> 
>  drivers/scsi/aacraid/linit.c| 147 ++
>  drivers/scsi/aacraid/rx.c   |   1 +
>  drivers/scsi/aacraid/sa.c   |   1 +
>  drivers/scsi/aacraid/src.c  |   2 +
>  6 files changed, 232 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h 
> b/drivers/scsi/aacraid/aacraid.h index 40fe65c..62b0999 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -547,6 +547,7 @@ struct adapter_ops
>   int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
> p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, 
> u32 *r4);
>   int  (*adapter_check_health)(struct aac_dev *dev);
>   int  (*adapter_restart)(struct aac_dev *dev, int bled);
> + void (*adapter_start)(struct aac_dev *dev);
>   /* Transport operations */
>   int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
>   irq_handler_t adapter_intr;
> @@ -1247,6 +1248,9 @@ struct aac_dev
>  #define aac_adapter_restart(dev,bled) \
>   (dev)->a_ops.adapter_restart(dev,bled)
>  
> +#define aac_adapter_start(dev) \
> + ((dev)->a_ops.adapter_start(dev))
> +
>  #define aac_adapter_ioremap(dev, size) \
>   (dev)->a_ops.adapter_ioremap(dev, size)
>  
> @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);  int 
> aac_src_init(struct aac_dev *dev);  int aac_srcv_init(struct aac_dev 
> *dev);  int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, 
> struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long 
> *nonotify);
> +void aac_define_int_mode(struct aac_dev *dev);
>  unsigned int aac_response_normal(struct aac_queue * q);  unsigned int 
> aac_command_normal(struct aac_queue * q);  unsigned int 
> aac_intr_normal(struct aac_dev *dev, u32 Index, diff --git 
> a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c 
> index 45db84a..e0a76d5 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -43,8 +43,6 @@
>  
>  #include "aacraid.h"
>  
> -static void aac_define_int_mode(struct aac_dev *dev);
> -
>  struct aac_common aac_config = {
>   .irq_mod = 1
>  };
> @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
>   return 0;
>  }
>  
> +void aac_define_int_mode(struct aac_dev *dev) {
> + int i, msi_count;
> +
> + msi_count = i = 0;
> + /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
> + if (dev->max_msix == 0 ||
> + dev->pdev->device == PMC_DEVICE_S6 ||
> + dev->sync_mode) {
> + dev->max_msix = 1;
> + dev->vector_cap =
> + dev->scsi_host_ptr->can_queue +
> + AAC_NUM_MGT_FIB;
> + return;
> + }
> +
> + /* Don't bother allocating more MSI-X vectors than cpus */
> + msi_count = min(dev->max_msix,
> + (unsigned int)num_online_cpus());
> +
> + dev->max_msix = msi_count;
> +
> + if (msi_count > AAC_MAX_MSIX)
> + msi_count = AAC_MAX_MSIX;
> +
> + for (i = 0; i < msi_count; i++)
> + dev->msixentry[i].entry = i;
> +
> + if (msi_count > 1 &&
> + pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> + i = pci_enable_msix_exact(dev->pdev,
> + dev->msixentry,
> + msi_count);
> +  /* Che
Hi,
pci_enable_msix_exact returns either an error value or 0.
Maybe what you wanted is pci_enable_msix_range (, 1, msi_count);

Please do not make silent changes like this, without describing it - it looks 
like only a whole code block was moved.
Also there is

Re: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

2015-06-25 Thread Tomas Henzl
On 06/11/2015 03:42 AM, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
>   * .suspend() and .resume() routines implemented in the driver
>   * aac_release_resources() initiates firmware shutdown
>   * aac_acquire_resources re-initializes the host interface
> 
> Signed-off-by: Rajinikanth Pandurangan 
> ---
>  drivers/scsi/aacraid/aacraid.h  |   5 ++
>  drivers/scsi/aacraid/comminit.c | 154 
> 
>  drivers/scsi/aacraid/linit.c| 147 ++
>  drivers/scsi/aacraid/rx.c   |   1 +
>  drivers/scsi/aacraid/sa.c   |   1 +
>  drivers/scsi/aacraid/src.c  |   2 +
>  6 files changed, 232 insertions(+), 78 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
> index 40fe65c..62b0999 100644
> --- a/drivers/scsi/aacraid/aacraid.h
> +++ b/drivers/scsi/aacraid/aacraid.h
> @@ -547,6 +547,7 @@ struct adapter_ops
>   int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
> p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, 
> u32 *r4);
>   int  (*adapter_check_health)(struct aac_dev *dev);
>   int  (*adapter_restart)(struct aac_dev *dev, int bled);
> + void (*adapter_start)(struct aac_dev *dev);
>   /* Transport operations */
>   int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
>   irq_handler_t adapter_intr;
> @@ -1247,6 +1248,9 @@ struct aac_dev
>  #define aac_adapter_restart(dev,bled) \
>   (dev)->a_ops.adapter_restart(dev,bled)
>  
> +#define aac_adapter_start(dev) \
> + ((dev)->a_ops.adapter_start(dev))
> +
>  #define aac_adapter_ioremap(dev, size) \
>   (dev)->a_ops.adapter_ioremap(dev, size)
>  
> @@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
>  int aac_src_init(struct aac_dev *dev);
>  int aac_srcv_init(struct aac_dev *dev);
>  int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib 
> * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
> +void aac_define_int_mode(struct aac_dev *dev);
>  unsigned int aac_response_normal(struct aac_queue * q);
>  unsigned int aac_command_normal(struct aac_queue * q);
>  unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index 45db84a..e0a76d5 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -43,8 +43,6 @@
>  
>  #include "aacraid.h"
>  
> -static void aac_define_int_mode(struct aac_dev *dev);
> -
>  struct aac_common aac_config = {
>   .irq_mod = 1
>  };
> @@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
>   return 0;
>  }
>  
> +void aac_define_int_mode(struct aac_dev *dev)
> +{
> + int i, msi_count;
> +
> + msi_count = i = 0;
> + /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
> + if (dev->max_msix == 0 ||
> + dev->pdev->device == PMC_DEVICE_S6 ||
> + dev->sync_mode) {
> + dev->max_msix = 1;
> + dev->vector_cap =
> + dev->scsi_host_ptr->can_queue +
> + AAC_NUM_MGT_FIB;
> + return;
> + }
> +
> + /* Don't bother allocating more MSI-X vectors than cpus */
> + msi_count = min(dev->max_msix,
> + (unsigned int)num_online_cpus());
> +
> + dev->max_msix = msi_count;
> +
> + if (msi_count > AAC_MAX_MSIX)
> + msi_count = AAC_MAX_MSIX;
> +
> + for (i = 0; i < msi_count; i++)
> + dev->msixentry[i].entry = i;
> +
> + if (msi_count > 1 &&
> + pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> + i = pci_enable_msix_exact(dev->pdev,
> + dev->msixentry,
> + msi_count);
> +  /* Che
Hi,
pci_enable_msix_exact returns either an error value or 0.
Maybe what you wanted is pci_enable_msix_range (, 1, msi_count);

Please do not make silent changes like this,
without describing it - it looks like only a whole code
block was moved.
Also there is a rule which should be followed, that is that
every single functional change need it's own patch.

When you send a new version of any patch add a description
what is new in that newer version.

Cheers,
Tomas

ck how many MSIX vectors are allocated */
> + if (i >= 0) {
> + dev->msi_enabled = 1;
> + if (i) {
> + msi_count = i;
> + if (pci_enable_msix_exact(dev->pdev,
> + dev->msixentry,
> + msi_count)) {
> + dev->msi_enabled = 0;
> + printk(KERN_ERR "%s%d: MSIX not 
> supported!! Will try MSI 0x%x.\n",
> + dev->name, dev->id, i);

RE: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara 


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

From: Rajinikanth Pandurangan 

Description:
* .suspend() and .resume() routines implemented in the driver
* aac_release_resources() initiates firmware shutdown
* aac_acquire_resources re-initializes the host interface

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 
 drivers/scsi/aacraid/linit.c| 147 ++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
int  (*adapter_restart)(struct aac_dev *dev, int bled);
+   void (*adapter_start)(struct aac_dev *dev);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
(dev)->a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+   ((dev)->a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
(dev)->a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);  int 
aac_src_init(struct aac_dev *dev);  int aac_srcv_init(struct aac_dev *dev);  
int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * 
hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);  unsigned int 
aac_command_normal(struct aac_queue * q);  unsigned int aac_intr_normal(struct 
aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c 
b/drivers/scsi/aacraid/comminit.c index 45db84a..e0a76d5 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include "aacraid.h"
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev) {
+   int i, msi_count;
+
+   msi_count = i = 0;
+   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+   if (dev->max_msix == 0 ||
+   dev->pdev->device == PMC_DEVICE_S6 ||
+   dev->sync_mode) {
+   dev->max_msix = 1;
+   dev->vector_cap =
+   dev->scsi_host_ptr->can_queue +
+   AAC_NUM_MGT_FIB;
+   return;
+   }
+
+   /* Don't bother allocating more MSI-X vectors than cpus */
+   msi_count = min(dev->max_msix,
+   (unsigned int)num_online_cpus());
+
+   dev->max_msix = msi_count;
+
+   if (msi_count > AAC_MAX_MSIX)
+   msi_count = AAC_MAX_MSIX;
+
+   for (i = 0; i < msi_count; i++)
+   dev->msixentry[i].entry = i;
+
+   if (msi_count > 1 &&
+   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
+   i = pci_enable_msix_exact(dev->pdev,
+   dev->msixentry,
+   msi_count);
+/* Check how many MSIX vectors are allocated */
+   if (i >= 0) {
+   dev->msi_enabled = 1;
+   if (i) {
+   msi_count = i;
+   if (pci_enable_msix_exact(dev->pdev,
+   dev->msixentry,
+   msi_count)) {
+   dev->msi_enabled = 0;
+   printk(KERN_ERR "%s%d: MSIX not 
supported!! Will try MSI 0x%x.\n",
+   dev->name, dev->id, i);
+   }
+   }
+   } else {
+   dev->msi_enabled = 0;
+   

[Patch V2 2/9] [SCSI] aacraid: Add Power Management support

2015-06-10 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
* .suspend() and .resume() routines implemented in the driver
* aac_release_resources() initiates firmware shutdown
* aac_acquire_resources re-initializes the host interface

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 
 drivers/scsi/aacraid/linit.c| 147 ++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
int  (*adapter_restart)(struct aac_dev *dev, int bled);
+   void (*adapter_start)(struct aac_dev *dev);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
(dev)->a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+   ((dev)->a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
(dev)->a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
 int aac_src_init(struct aac_dev *dev);
 int aac_srcv_init(struct aac_dev *dev);
 int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * 
hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);
 unsigned int aac_command_normal(struct aac_queue * q);
 unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45db84a..e0a76d5 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include "aacraid.h"
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev)
+{
+   int i, msi_count;
+
+   msi_count = i = 0;
+   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+   if (dev->max_msix == 0 ||
+   dev->pdev->device == PMC_DEVICE_S6 ||
+   dev->sync_mode) {
+   dev->max_msix = 1;
+   dev->vector_cap =
+   dev->scsi_host_ptr->can_queue +
+   AAC_NUM_MGT_FIB;
+   return;
+   }
+
+   /* Don't bother allocating more MSI-X vectors than cpus */
+   msi_count = min(dev->max_msix,
+   (unsigned int)num_online_cpus());
+
+   dev->max_msix = msi_count;
+
+   if (msi_count > AAC_MAX_MSIX)
+   msi_count = AAC_MAX_MSIX;
+
+   for (i = 0; i < msi_count; i++)
+   dev->msixentry[i].entry = i;
+
+   if (msi_count > 1 &&
+   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
+   i = pci_enable_msix_exact(dev->pdev,
+   dev->msixentry,
+   msi_count);
+/* Check how many MSIX vectors are allocated */
+   if (i >= 0) {
+   dev->msi_enabled = 1;
+   if (i) {
+   msi_count = i;
+   if (pci_enable_msix_exact(dev->pdev,
+   dev->msixentry,
+   msi_count)) {
+   dev->msi_enabled = 0;
+   printk(KERN_ERR "%s%d: MSIX not 
supported!! Will try MSI 0x%x.\n",
+   dev->name, dev->id, i);
+   }
+   }
+   } else {
+   dev->msi_enabled = 0;
+   printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
MSI 0x%x.\n",
+   dev->name, dev->id, i);
+   }
+   }
+
+   if (!dev->msi_enabled) {
+   msi_count = 1;
+   i = pci_enable_msi(dev->pdev);
+
+   if (!i) {
+   dev->msi_enabled = 1;
+   dev->msi = 1;
+   } else {
+   printk(KERN_ERR "%s%d: MSI not supported!! Will try 
INTx 0x%x.\n",
+