[PATCH] lpfc: Use && instead of & for boolean expression

2015-07-22 Thread Sebastian Herbszt
Use logical instead of bitwise AND.

Signed-off-by: Sebastian Herbszt 
---

diff -urp a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2015-07-05 22:18:43.933739150 +0200
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2015-07-22 10:31:14.240209475 +0200
@@ -701,7 +701,7 @@ lpfc_work_done(struct lpfc_hba *phba)
HA_RXMASK));
}
}
-   if ((phba->sli_rev == LPFC_SLI_REV4) &
+   if ((phba->sli_rev == LPFC_SLI_REV4) &&
 (!list_empty(&pring->txq)))
lpfc_drain_txq(phba);
/*
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-07-22 Thread Tomas Henzl
On 21.7.2015 19:59, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
> As pci_enable_msix() deprecated, replaced with pci_enable_msix_range()
> 
> V3 Reviewed/commented by:
>   Tomas Henzl 
> 
> Changes from V3:
>   Uses pci_enable_msix_range() instead of pci_enable_msix_exact()
> based on review comment.
> 
> Signed-off-by: Rajinikanth Pandurangan 
> ---
>  drivers/scsi/aacraid/comminit.c | 20 ++--
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
> index b4b6088..3ba6e97 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
>  
>  void aac_define_int_mode(struct aac_dev *dev)
>  {
> - int i, msi_count;
> + int i, msi_count, min_msix;
>  
>   msi_count = i = 0;
>   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
> @@ -366,22 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
>  
>   if (msi_count > 1 &&
>   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> - i = pci_enable_msix(dev->pdev,
> + min_msix = 8;
That^ will make the pci-enable function fail on boxes with less than
eight num-online-cpus

-tm

> + i = pci_enable_msix_range(dev->pdev,
>   dev->msixentry,
> + min_msix,
>   msi_count);
> -  /* Check how many MSIX vectors are allocated */
> - if (i >= 0) {
> + if (i > 0) {
>   dev->msi_enabled = 1;
> - if (i) {
> - msi_count = i;
> - if (pci_enable_msix(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);
> - }
> - }
> + msi_count = i;
>   } else {
>   dev->msi_enabled = 0;
>   printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
> MSI 0x%x.\n",
> 

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


RE: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-07-22 Thread Rajinikanth Pandurangan
Hello Tomas,

Yes, in case of failure, we'll fall into msi.

Thanks,
-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Wednesday, July 22, 2015 6:56 AM
To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh Rajashekhara; Achim 
Leubner; Murthy Bhat
Subject: Re: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with 
pci_enable_msix_range()

On 21.7.2015 19:59, rajinikanth.panduran...@pmcs.com wrote:
> From: Rajinikanth Pandurangan 
> 
> Description:
> As pci_enable_msix() deprecated, replaced with 
> pci_enable_msix_range()
> 
> V3 Reviewed/commented by:
>   Tomas Henzl 
> 
> Changes from V3:
>   Uses pci_enable_msix_range() instead of pci_enable_msix_exact() based 
> on review comment.
> 
> Signed-off-by: Rajinikanth Pandurangan 
> 
> ---
>  drivers/scsi/aacraid/comminit.c | 20 ++--
>  1 file changed, 6 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/scsi/aacraid/comminit.c 
> b/drivers/scsi/aacraid/comminit.c index b4b6088..3ba6e97 100644
> --- a/drivers/scsi/aacraid/comminit.c
> +++ b/drivers/scsi/aacraid/comminit.c
> @@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
>  
>  void aac_define_int_mode(struct aac_dev *dev)  {
> - int i, msi_count;
> + int i, msi_count, min_msix;
>  
>   msi_count = i = 0;
>   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ @@ -366,22 
> +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
>  
>   if (msi_count > 1 &&
>   pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
> - i = pci_enable_msix(dev->pdev,
> + min_msix = 8;
That^ will make the pci-enable function fail on boxes with less than eight 
num-online-cpus

-tm

> + i = pci_enable_msix_range(dev->pdev,
>   dev->msixentry,
> + min_msix,
>   msi_count);
> -  /* Check how many MSIX vectors are allocated */
> - if (i >= 0) {
> + if (i > 0) {
>   dev->msi_enabled = 1;
> - if (i) {
> - msi_count = i;
> - if (pci_enable_msix(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);
> - }
> - }
> + msi_count = i;
>   } else {
>   dev->msi_enabled = 0;
>   printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
> MSI 0x%x.\n",
> 

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


Re: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-07-22 Thread Tomas Henzl
On 22.7.2015 16:55, Rajinikanth Pandurangan wrote:
> Hello Tomas,
> 
> Yes, in case of failure, we'll fall into msi.
Well ok, if you want support msi-x mode only with exactly 8 msi-x
lines, that's fine...

But because it creates another functional change - (before this patch
also values lower than eight were allowed please split this patch into
two parts. One for replacing pci_enable_msix() with
pci_enable_msix_range() and the other for setting a hard limit to
8 msi-x lines.

-tm

> 
> Thanks,
> -Original Message-
> From: Tomas Henzl [mailto:the...@redhat.com] 
> Sent: Wednesday, July 22, 2015 6:56 AM
> To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
> linux-scsi@vger.kernel.org
> Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh Rajashekhara; Achim 
> Leubner; Murthy Bhat
> Subject: Re: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with 
> pci_enable_msix_range()
> 
> On 21.7.2015 19:59, rajinikanth.panduran...@pmcs.com wrote:
>> From: Rajinikanth Pandurangan 
>>
>> Description:
>> As pci_enable_msix() deprecated, replaced with 
>> pci_enable_msix_range()
>>
>> V3 Reviewed/commented by:
>>  Tomas Henzl 
>>
>> Changes from V3:
>>  Uses pci_enable_msix_range() instead of pci_enable_msix_exact() based 
>> on review comment.
>>
>> Signed-off-by: Rajinikanth Pandurangan 
>> 
>> ---
>>  drivers/scsi/aacraid/comminit.c | 20 ++--
>>  1 file changed, 6 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/scsi/aacraid/comminit.c 
>> b/drivers/scsi/aacraid/comminit.c index b4b6088..3ba6e97 100644
>> --- a/drivers/scsi/aacraid/comminit.c
>> +++ b/drivers/scsi/aacraid/comminit.c
>> @@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
>>  
>>  void aac_define_int_mode(struct aac_dev *dev)  {
>> -int i, msi_count;
>> +int i, msi_count, min_msix;
>>  
>>  msi_count = i = 0;
>>  /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ @@ -366,22 
>> +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
>>  
>>  if (msi_count > 1 &&
>>  pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
>> -i = pci_enable_msix(dev->pdev,
>> +min_msix = 8;
> That^ will make the pci-enable function fail on boxes with less than eight 
> num-online-cpus
> 
> -tm
> 
>> +i = pci_enable_msix_range(dev->pdev,
>>  dev->msixentry,
>> +min_msix,
>>  msi_count);
>> - /* Check how many MSIX vectors are allocated */
>> -if (i >= 0) {
>> +if (i > 0) {
>>  dev->msi_enabled = 1;
>> -if (i) {
>> -msi_count = i;
>> -if (pci_enable_msix(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);
>> -}
>> -}
>> +msi_count = i;
>>  } else {
>>  dev->msi_enabled = 0;
>>  printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
>> MSI 0x%x.\n",
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 01/11] hpsa: Correct double unlock of mutex

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> Reported-by: Dan Carpenter 
> Reviewed-by: Scott Teel 
> Reviewed-by: Kevin Barnett 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas
> ---
>  drivers/scsi/hpsa.c |9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 1dafeb4..1d5f4fd 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -2749,11 +2749,10 @@ static int hpsa_do_reset(struct ctlr_info *h, struct 
> hpsa_scsi_dev_t *dev,
>   lockup_detected(h));
>  
>   if (unlikely(lockup_detected(h))) {
> - dev_warn(&h->pdev->dev,
> -  "Controller lockup detected during reset 
> wait\n");
> - mutex_unlock(&h->reset_mutex);
> - rc = -ENODEV;
> - }
> + dev_warn(&h->pdev->dev,
> +  "Controller lockup detected during reset wait\n");
> + rc = -ENODEV;
> + }
>  
>   if (unlikely(rc))
>   atomic_set(&dev->reset_cmds_out, 0);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 02/11] hpsa: correct decode sense data

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> Reported-by: Dan Carpenter 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 

Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index 1d5f4fd..e9b2073 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -325,7 +325,7 @@ static int check_for_unit_attention(struct ctlr_info *h,
>  
>   decode_sense_data(c->err_info->SenseInfo, sense_len,
>   &sense_key, &asc, &ascq);
> - if (sense_key != UNIT_ATTENTION || asc == -1)
> + if (sense_key != UNIT_ATTENTION || asc == 0xff)
>   return 0;
>  
>   switch (asc) {
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 03/11] hpsa: correct static checker warnings on driver init cleanup

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> Reported-by: Dan Carpenter 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index e9b2073..6b083af 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -8053,7 +8053,7 @@ reinit_after_soft_reset:
>   rc = hpsa_kdump_soft_reset(h);
>   if (rc)
>   /* Neither hard nor soft reset worked, we're hosed. */
> - goto clean9;
> + goto clean7;
>  
>   dev_info(&h->pdev->dev, "Board READY.\n");
>   dev_info(&h->pdev->dev,
> @@ -8099,8 +8099,6 @@ reinit_after_soft_reset:
>   h->heartbeat_sample_interval);
>   return 0;
>  
> -clean9: /* wq, sh, perf, sg, cmd, irq, shost, pci, lu, aer/h */
> - kfree(h->hba_inquiry_data);
>  clean7: /* perf, sg, cmd, irq, shost, pci, lu, aer/h */
>   hpsa_free_performant_mode(h);
>   h->access.set_intr_mask(h, HPSA_INTR_OFF);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 05/11] hpsa: add sysfs entry path_info to show box and bay information

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> From: Joe Handzik 
> 
> host no, bus, target, lun, scsi_device_type
> for hba mode add: box and bay information
> 
> report if the path is active/inactive
> 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |  122 
> +++
>  drivers/scsi/hpsa.h |5 ++
>  2 files changed, 127 insertions(+)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index eaa35bd..f64a2c7 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -264,6 +264,7 @@ static int hpsa_scsi_ioaccel_queue_command(struct 
> ctlr_info *h,
>  static void hpsa_command_resubmit_worker(struct work_struct *work);
>  static u32 lockup_detected(struct ctlr_info *h);
>  static int detect_controller_lockup(struct ctlr_info *h);
> +static int is_ext_target(struct ctlr_info *h, struct hpsa_scsi_dev_t 
> *device);
>  
>  static inline struct ctlr_info *sdev_to_hba(struct scsi_device *sdev)
>  {
> @@ -714,12 +715,106 @@ static ssize_t 
> host_show_hp_ssd_smart_path_enabled(struct device *dev,
>   return snprintf(buf, 20, "%d\n", offload_enabled);
>  }
>  
> +#define MAX_PATHS 8
> +#define PATH_STRING_LEN 50
> +
> +static ssize_t path_info_show(struct device *dev,
> +  struct device_attribute *attr, char *buf)
> +{
> + struct ctlr_info *h;
> + struct scsi_device *sdev;
> + struct hpsa_scsi_dev_t *hdev;
> + unsigned long flags;
> + int i;
> + int output_len = 0;
> + u8 box;
> + u8 bay;
> + u8 path_map_index = 0;
> + char *active;
> + unsigned char phys_connector[2];
> + unsigned char path[MAX_PATHS][PATH_STRING_LEN];
> +
> + memset(path, 0, MAX_PATHS * PATH_STRING_LEN);
> + sdev = to_scsi_device(dev);
> + h = sdev_to_hba(sdev);
> + spin_lock_irqsave(&h->devlock, flags);
> + hdev = sdev->hostdata;
> + if (!hdev) {
> + spin_unlock_irqrestore(&h->devlock, flags);
> + return -ENODEV;
> + }
> +
> + bay = hdev->bay;
> + for (i = 0; i < MAX_PATHS; i++) {
> + path_map_index = 1< + if (i == hdev->active_path_index)
> + active = "Active";
> + else if (hdev->path_map & path_map_index)
> + active = "Inactive";
> + else
> + continue;
> +
> + output_len = snprintf(path[i],
> + PATH_STRING_LEN, "[%d:%d:%d:%d] %20.20s ",
> + h->scsi_host->host_no,
> + hdev->bus, hdev->target, hdev->lun,
> + scsi_device_type(hdev->devtype));
> +
> + if (is_ext_target(h, hdev) ||
> + (hdev->devtype == TYPE_RAID) ||
> + is_logical_dev_addr_mode(hdev->scsi3addr)) {
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN, "%s\n",
> + active);
> + continue;
> + }
> +
> + box = hdev->box[i];
> + memcpy(&phys_connector, &hdev->phys_connector[i],
> + sizeof(phys_connector));
> + if (phys_connector[0] < '0')
> + phys_connector[0] = '0';
> + if (phys_connector[1] < '0')
> + phys_connector[1] = '0';
> + if (hdev->phys_connector[i] > 0)
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN,
> + "PORT: %.2s ",
> + phys_connector);
> + if (hdev->devtype == TYPE_DISK && h->hba_mode_enabled) {
> + if (box == 0 || box == 0xFF) {
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN,
> + "BAY: %hhu %s\n",
> + bay, active);
> + } else {
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN,
> + "BOX: %hhu BAY: %hhu %s\n",
> + box, bay, active);
> + }
> + } else if (box != 0 && box != 0xFF) {
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN, "BOX: %hhu %s\n",
> + box, active);
> + } else
> + output_len += snprintf(path[i] + output_len,
> + PATH_STRING_LEN, "%s\n", active);
> + }
> +
> + spin_unlock_irqrestore(&h->devlock, flags);
> + return snprintf(buf, output_len+1, "%s%s%s%s%s%s%s

Re: [PATCH 07/11] hpsa: add in new controllers

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |   10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index f34978d..20c29e5 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -129,6 +129,11 @@ static const struct pci_device_id hpsa_pci_device_id[] = 
> {
>   {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CD},
>   {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSI, 0x103C, 0x21CE},
>   {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0580},
> + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0581},
> + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0582},
> + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0583},
> + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0584},
> + {PCI_VENDOR_ID_ADAPTEC2, 0x0290, 0x9005, 0x0585},
>   {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0076},
>   {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x0087},
>   {PCI_VENDOR_ID_HP_3PAR, 0x0075, 0x1590, 0x007D},
> @@ -187,6 +192,11 @@ static struct board_type products[] = {
>   {0x21CD103C, "Smart Array", &SA5_access},
>   {0x21CE103C, "Smart HBA", &SA5_access},
>   {0x05809005, "SmartHBA-SA", &SA5_access},
> + {0x05819005, "SmartHBA-SA 8i", &SA5_access},
> + {0x05829005, "SmartHBA-SA 8i8e", &SA5_access},
> + {0x05839005, "SmartHBA-SA 8e", &SA5_access},
> + {0x05849005, "SmartHBA-SA 16i", &SA5_access},
> + {0x05859005, "SmartHBA-SA 4i4e", &SA5_access},
>   {0x00761590, "HP Storage P1224 Array Controller", &SA5_access},
>   {0x00871590, "HP Storage P1224e Array Controller", &SA5_access},
>   {0x007D1590, "HP Storage P1228 Array Controller", &SA5_access},
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 06/11] hpsa: cleanup update scsi devices

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:12, Don Brace wrote:
> showing that tables have been updated unnecessarily.
> 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index f64a2c7..f34978d 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -1379,8 +1379,9 @@ static inline int device_updated(struct hpsa_scsi_dev_t 
> *dev1,
>   return 1;
>   if (dev1->offload_enabled != dev2->offload_enabled)
>   return 1;
> - if (dev1->queue_depth != dev2->queue_depth)
> - return 1;
> + if (!is_logical_dev_addr_mode(dev1->scsi3addr))
> + if (dev1->queue_depth != dev2->queue_depth)
> + return 1;
>   return 0;
>  }
>  
> @@ -3889,7 +3890,6 @@ static void hpsa_update_scsi_devices(struct ctlr_info 
> *h, int hostno)
>   else if (!(h->transMethod & CFGTBL_Trans_io_accel1 ||
>   h->transMethod & CFGTBL_Trans_io_accel2))
>   break;
> -
>   hpsa_get_ioaccel_drive_info(h, this_device,
>   lunaddrbytes, id_phys);
>   hpsa_get_path_info(this_device, lunaddrbytes, id_phys);
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 11/11] hpsa: fix rmmod issues

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:13, Don Brace wrote:
> The driver is calling hpsa_shutdown before calling scsi_remove_host.
> hpsa_shutdown is disabling interrupts.
> 
> scsi_remove_host can trigger I/O operations, such as
> SYNCHRONIZE CACHE when multipath is enabled which hang the system.
> 
> Call scsi_remove_host before calling hpsa_shutdown.
> 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

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


Re: [PATCH 09/11] hpsa: add in new offline mode

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:13, Don Brace wrote:
> From: Scott Benesh 
> 
> prevent adding volumes that are not available.
> 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Reviewed-by: Justin Lindley 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

> ---
>  drivers/scsi/hpsa.c |   15 +++
>  drivers/scsi/hpsa_cmd.h |1 +
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index df85f89..c72e900 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -1481,17 +1481,23 @@ static void hpsa_show_volume_status(struct ctlr_info 
> *h,
>   h->scsi_host->host_no,
>   sd->bus, sd->target, sd->lun);
>   break;
> + case HPSA_LV_NOT_AVAILABLE:
> + dev_info(&h->pdev->dev,
> + "C%d:B%d:T%d:L%d Volume is waiting for transforming 
> volume.\n",
> + h->scsi_host->host_no,
> + sd->bus, sd->target, sd->lun);
> + break;
>   case HPSA_LV_UNDERGOING_RPI:
>   dev_info(&h->pdev->dev,
> - "C%d:B%d:T%d:L%d Volume is undergoing rapid parity 
> initialization process.\n",
> + "C%d:B%d:T%d:L%d Volume is undergoing rapid parity 
> init.\n",
>   h->scsi_host->host_no,
>   sd->bus, sd->target, sd->lun);
>   break;
>   case HPSA_LV_PENDING_RPI:
>   dev_info(&h->pdev->dev,
> - "C%d:B%d:T%d:L%d Volume is queued for rapid 
> parity initialization process.\n",
> - h->scsi_host->host_no,
> - sd->bus, sd->target, sd->lun);
> + "C%d:B%d:T%d:L%d Volume is queued for rapid parity 
> initialization process.\n",
> + h->scsi_host->host_no,
> + sd->bus, sd->target, sd->lun);
>   break;
>   case HPSA_LV_ENCRYPTED_NO_KEY:
>   dev_info(&h->pdev->dev,
> @@ -3262,6 +3268,7 @@ static int hpsa_volume_offline(struct ctlr_info *h,
>   /* Keep volume offline in certain cases: */
>   switch (ldstat) {
>   case HPSA_LV_UNDERGOING_ERASE:
> + case HPSA_LV_NOT_AVAILABLE:
>   case HPSA_LV_UNDERGOING_RPI:
>   case HPSA_LV_PENDING_RPI:
>   case HPSA_LV_ENCRYPTED_NO_KEY:
> diff --git a/drivers/scsi/hpsa_cmd.h b/drivers/scsi/hpsa_cmd.h
> index 1a98bbe..47c756b 100644
> --- a/drivers/scsi/hpsa_cmd.h
> +++ b/drivers/scsi/hpsa_cmd.h
> @@ -164,6 +164,7 @@
>  /* Logical volume states */
>  #define HPSA_VPD_LV_STATUS_UNSUPPORTED   0xff
>  #define HPSA_LV_OK  0x0
> +#define HPSA_LV_NOT_AVAILABLE0x0b
>  #define HPSA_LV_UNDERGOING_ERASE 0x0F
>  #define HPSA_LV_UNDERGOING_RPI   0x12
>  #define HPSA_LV_PENDING_RPI  0x13
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH 10/11] hpsa: fix issues with multilun devices

2015-07-22 Thread Tomas Henzl
On 18.7.2015 18:13, Don Brace wrote:
> From: shane.seymour 
> 
> A regression was introduced into the hpsa driver a while back so
> non-zero LUNs of multi-LUN devices may no longer be presented via
> a SAS based Smart Array. I have not done a bisection to discover
> the change that caused it.
> 
> The CISS firmware specification (available on sourceforge)
> defines an 8 byte lunid that describes devices that the Smart
> Array can see/present to the system. The current code in the hpsa
> driver attempts to find matches for non-zero LUNs with LUN 0 for
> a bus/target by zeroing out byte 4 of the lunid and find a match.
> 
> This method is sufficient for SCSI based Smart Arrays because
> byte 5 is always 0. For SAS based Smart arrays byte 5 of the
> lunid contains the path number for a multipath device and
> either one or two bits (the documentation does not define how
> many bits are used but it appears it may be one only) that
> indicate if the given path number in byte 5 must always be
> used to access that device. Byte 5 may not always be zero.
> 
> The following are lunids (spaces added for clarity) for a
> MSL2024 single drive library connected via a H241 Smart Array:
> 
> 00 00 00 00 01 00 00 01 (changer)
> 00 00 00 00 00 80 00 01 (tape)
> 
> In the 4th byte (counting from 0) you can see that the tape
> is LUN 0 and the changer is LUN 1. The 0x80 set in the 5th byte
> for the tape drive means the driver should force access to
> path 0 (the library in this case was connected to one path only
> anyway).
> 
> After the changes we can see the following in the dmesg output:
> 
> scsi 0:3:0:0: RAID  HP   H241 1.18 \
> PQ: 0 ANSI: 5
> scsi 0:2:0:0: Sequential-Access HP   Ultrium 6-SCSI   354W \
> PQ: 0 ANSI: 6
> scsi 0:2:0:1: Medium ChangerHP   MSL G3 Series8.70 \
> PQ: 0 ANSI: 5
> 
> Showing that the changer is correctly identified as LUN 1 of
> bus 2 target 0. Before the change the changer device is not seen.
> 
> Suggested-by: shane.seymour 
> Reviewed-by: Kevin Barnett 
> Reviewed-by: Scott Teel 
> Signed-off-by: Don Brace 
Reviewed-by: Tomas Henzl 

Tomas

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


Re: [PATCH] lpfc: Use && instead of & for boolean expression

2015-07-22 Thread James Smart

Reviewed-by: James Smart 

Thanks

-- james


On 7/22/2015 4:53 AM, Sebastian Herbszt wrote:

Use logical instead of bitwise AND.

Signed-off-by: Sebastian Herbszt 
---

diff -urp a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2015-07-05 22:18:43.933739150 +0200
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2015-07-22 10:31:14.240209475 +0200
@@ -701,7 +701,7 @@ lpfc_work_done(struct lpfc_hba *phba)
HA_RXMASK));
}
}
-   if ((phba->sli_rev == LPFC_SLI_REV4) &
+   if ((phba->sli_rev == LPFC_SLI_REV4) &&
 (!list_empty(&pring->txq)))
lpfc_drain_txq(phba);
/*


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


RE: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-07-22 Thread Rajinikanth Pandurangan
Ok. will follow-up with new patch. We probably lower it to 4 instead of 8 :).

Thanks,

-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Wednesday, July 22, 2015 8:10 AM
To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh Rajashekhara; Achim 
Leubner; Murthy Bhat
Subject: Re: [PATCH V4 10/10] [SCSI] aacraid: Replace pci_enable_msix() with 
pci_enable_msix_range()

On 22.7.2015 16:55, Rajinikanth Pandurangan wrote:
> Hello Tomas,
> 
> Yes, in case of failure, we'll fall into msi.
Well ok, if you want support msi-x mode only with exactly 8 msi-x lines, that's 
fine...

But because it creates another functional change - (before this patch also 
values lower than eight were allowed please split this patch into two parts. 
One for replacing pci_enable_msix() with
pci_enable_msix_range() and the other for setting a hard limit to
8 msi-x lines.

-tm

> 
> Thanks,
> -Original Message-
> From: Tomas Henzl [mailto:the...@redhat.com]
> Sent: Wednesday, July 22, 2015 6:56 AM
> To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
> linux-scsi@vger.kernel.org
> Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh 
> Rajashekhara; Achim Leubner; Murthy Bhat
> Subject: Re: [PATCH V4 10/10] [SCSI] aacraid: Replace 
> pci_enable_msix() with pci_enable_msix_range()
> 
> On 21.7.2015 19:59, rajinikanth.panduran...@pmcs.com wrote:
>> From: Rajinikanth Pandurangan 
>>
>> Description:
>> As pci_enable_msix() deprecated, replaced with
>> pci_enable_msix_range()
>>
>> V3 Reviewed/commented by:
>>  Tomas Henzl 
>>
>> Changes from V3:
>>  Uses pci_enable_msix_range() instead of pci_enable_msix_exact() 
>> based on review comment.
>>
>> Signed-off-by: Rajinikanth Pandurangan 
>> 
>> ---
>>  drivers/scsi/aacraid/comminit.c | 20 ++--
>>  1 file changed, 6 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/scsi/aacraid/comminit.c 
>> b/drivers/scsi/aacraid/comminit.c index b4b6088..3ba6e97 100644
>> --- a/drivers/scsi/aacraid/comminit.c
>> +++ b/drivers/scsi/aacraid/comminit.c
>> @@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
>>  
>>  void aac_define_int_mode(struct aac_dev *dev)  {
>> -int i, msi_count;
>> +int i, msi_count, min_msix;
>>  
>>  msi_count = i = 0;
>>  /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ @@ -366,22
>> +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
>>  
>>  if (msi_count > 1 &&
>>  pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
>> -i = pci_enable_msix(dev->pdev,
>> +min_msix = 8;
> That^ will make the pci-enable function fail on boxes with less than 
> eight num-online-cpus
> 
> -tm
> 
>> +i = pci_enable_msix_range(dev->pdev,
>>  dev->msixentry,
>> +min_msix,
>>  msi_count);
>> - /* Check how many MSIX vectors are allocated */
>> -if (i >= 0) {
>> +if (i > 0) {
>>  dev->msi_enabled = 1;
>> -if (i) {
>> -msi_count = i;
>> -if (pci_enable_msix(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);
>> -}
>> -}
>> +msi_count = i;
>>  } else {
>>  dev->msi_enabled = 0;
>>  printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
>> MSI 
>> 0x%x.\n",
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" 
> in the body of a message to majord...@vger.kernel.org More majordomo 
> info at  http://vger.kernel.org/majordomo-info.html
> 

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


[PATCH V5 01/11] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
Driver sends the right size of the response buffer.

Changes from V2:
None

V2:
Reviewed-by: Johannes Thumshirn 
Reviewed-by: Tomas Henzl 
Reviewed-by: Mahesh Rajashekhara 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_name),
+ sizeof(struct aac_get_name_resp),
  FsaNormal,
  0, 1,
  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_serial),
+ sizeof(struct aac_get_serial_resp),
  FsaNormal,
  0, 1,
  (fib_callback) get_container_serial_callback,
-- 
1.9.3

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


[PATCH V5 03/11] [SCSI] aacraid: Change interrupt mode to MSI for series-6 controller

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
This change always sets MSI interrupt mode for series-6 controller.
Note: For series 6 family, MSIx is not supported.

Changes from V2:
Only Subject & description change.

Reviewed by:
 Tomas Henzl ,
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/src.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b147341..eb07b3d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
if (dev->comm_interface != AAC_COMM_MESSAGE_TYPE1)
goto error_iounmap;
 
-   dev->msi = aac_msi && !pci_enable_msi(dev->pdev);
+   dev->msi = !pci_enable_msi(dev->pdev);
 
dev->aac_msix[0].vector_no = 0;
dev->aac_msix[0].dev = dev;
-- 
1.9.3

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


[PATCH V5 02/11] [SCSI] aacraid: Add Power Management support

2015-07-22 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

Changes from V2:
Increased msleep(1) to msleep(20)
Reverted pci_enable_msix_exact() to pci_enable_msix() as this change
has moved into a separate patch.

Reviewed by:
Tomas Henzl ,
Mahesh Rajashekhara ,
Johannes Thumshirn ,
James Bottomley 

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..45a0a04 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(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(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);
+
+ 

[PATCH V5 00/11] [SCSI] aacraid: Patchset for aacraid driver version 41010

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

This patchset includes the following changes (bug fixes and new feature support)
specific to aacraid driver.

V5:
Splited patch 10 from V4 into 2
Added one more patch to request minimum 2 MSIx.

V4:
Updated code with pci_enable_msix_range instead of exact.

V3:
Increased msleep() time from 1 to 20.
Created new patch for pci_enable_msix() replacement.
Changed subject/description of patch 03.

Reviewed by:
Tomas Henzl ,
Mahesh Rajashekhara ,
Johannes Thumshirn ,
James Bottomley 

Rajinikanth Pandurangan (11):
  [SCSI] aacraid: Fix for logical device name and UID  not exposed
to the OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Change interrupt mode to MSI for series-6 
controller
  [SCSI] aacraid: Enable 64-bit write to controller register
  [SCSI] aacraid: Tune response path if IsFastPath bit set
  [SCSI] aacraid: Reset irq affinity hints before releasing irq
  [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from
suspend
  [SCSI] aacraid: Send commit-config to controller firmware
  [SCSI] aacraid: Update driver version
  [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()
  [SCSI] aacraid: Requests at least 2 MSIx in pci_enable_msix_range()

 drivers/scsi/aacraid/aachba.c   | 263 +---
 drivers/scsi/aacraid/aacraid.h  |  18 ++-
 drivers/scsi/aacraid/comminit.c | 147 +++---
 drivers/scsi/aacraid/commsup.c  | 113 -
 drivers/scsi/aacraid/linit.c| 159 +++-
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |  64 +++---
 8 files changed, 483 insertions(+), 283 deletions(-)

-- 
1.9.3

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


[PATCH V5 06/11] [SCSI] aacraid: Reset irq affinity hints before releasing irq

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
Reset irq affinity hints before releasing IRQ
Removed duplicate code of IRQ acquire/release

Changes from V2:
None

Reviewed by:
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 113 ++---
 drivers/scsi/aacraid/src.c |  48 ++---
 3 files changed, 88 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index e54f597..7b95227 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2110,6 +2110,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, 
unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER0x103
 #define AAC_OWNER_FIRMWARE 0x106
 
+int aac_acquire_irq(struct aac_dev *dev);
+void aac_free_irq(struct aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
 int aac_fib_setup(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 4da5749..a1f90fe 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 {
int index, quirks;
-   int retval, i;
+   int retval;
struct Scsi_Host *host;
struct scsi_device *dev;
struct scsi_cmnd *command;
struct scsi_cmnd *command_list;
int jafo = 0;
-   int cpu;
 
/*
 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int 
forced)
aac->comm_phys = 0;
kfree(aac->queues);
aac->queues = NULL;
-   cpu = cpumask_first(cpu_online_mask);
-   if (aac->pdev->device == PMC_DEVICE_S6 ||
-   aac->pdev->device == PMC_DEVICE_S7 ||
-   aac->pdev->device == PMC_DEVICE_S8 ||
-   aac->pdev->device == PMC_DEVICE_S9) {
-   if (aac->max_msix > 1) {
-   for (i = 0; i < aac->max_msix; i++) {
-   if (irq_set_affinity_hint(
-   aac->msixentry[i].vector,
-   NULL)) {
-   printk(KERN_ERR "%s%d: Failed to reset 
IRQ affinity for cpu %d\n",
-   aac->name,
-   aac->id,
-   cpu);
-   }
-   cpu = cpumask_next(cpu,
-   cpu_online_mask);
-   free_irq(aac->msixentry[i].vector,
-&(aac->aac_msix[i]));
-   }
-   pci_disable_msix(aac->pdev);
-   } else {
-   free_irq(aac->pdev->irq, &(aac->aac_msix[0]));
-   }
-   } else {
-   free_irq(aac->pdev->irq, aac);
-   }
-   if (aac->msi)
-   pci_disable_msi(aac->pdev);
+   aac_free_irq(aac);
kfree(aac->fsa_dev);
aac->fsa_dev = NULL;
quirks = aac_get_driver_ident(index)->quirks;
@@ -1978,3 +1949,83 @@ int aac_command_thread(void *data)
dev->aif_thread = 0;
return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev)
+{
+   int i;
+   int j;
+   int ret = 0;
+   int cpu;
+
+   cpu = cpumask_first(cpu_online_mask);
+   if (!dev->sync_mode && dev->msi_enabled && dev->max_msix > 1) {
+   for (i = 0; i < dev->max_msix; i++) {
+   dev->aac_msix[i].vector_no = i;
+   dev->aac_msix[i].dev = dev;
+   if (request_irq(dev->msixentry[i].vector,
+   dev->a_ops.adapter_intr,
+   0, "aacraid", &(dev->aac_msix[i]))) {
+   printk(KERN_ERR "%s%d: Failed to register IRQ 
for vector %d.\n",
+   dev->name, dev->id, i);
+   for (j = 0 ; j < i ; j++)
+   free_irq(dev->msixentry[j].vector,
+&(dev->aac_msix[j]));
+   pci_disable_msix(dev->pdev);
+   ret = -1;
+   }
+   if (irq_set_affinity_hint(dev->msixentry[i].vector,
+   get_cpu_mask(cpu))) {
+   printk(KERN_ERR "%s%d: Failed to set IRQ 
affinity for cpu %d\n",
+   dev->name, dev->id, cpu);
+   }
+   cpu = cpumask_next(cp

[PATCH V5 04/11] [SCSI] aacraid: Enable 64-bit write to controller register

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
If writeq() not supported, then do atomic two 32bit write

Changes from V2:
None

Reviewed by:
 Tomas Henzl ,
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aacraid.h  |  9 +
 drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c  | 12 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 62b0999..e54f597 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -844,6 +844,10 @@ struct src_registers {
&((AEP)->regs.src.bar0->CSR))
 #define src_writel(AEP, CSR, value)writel(value, \
&((AEP)->regs.src.bar0->CSR))
+#if defined(writeq)
+#definesrc_writeq(AEP, CSR, value) writeq(value, \
+   &((AEP)->regs.src.bar0->CSR))
+#endif
 
 #define SRC_ODR_SHIFT  12
 #define SRC_IDR_SHIFT  9
@@ -1163,6 +1167,11 @@ struct aac_dev
struct fsa_dev_info *fsa_dev;
struct task_struct  *thread;
int cardtype;
+   /*
+*This lock will protect the two 32-bit
+*writes to the Inbound Queue
+*/
+   spinlock_t  iq_lock;
 
/*
 *  The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45a0a04..b4b6088 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev->management_fib_count = 0;
spin_lock_init(&dev->manage_lock);
spin_lock_init(&dev->sync_lock);
+   spin_lock_init(&dev->iq_lock);
dev->max_fib_size = sizeof(struct hw_fib);
dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size
- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index eb07b3d..1409a0b 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
u32 fibsize;
dma_addr_t address;
struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+   unsigned long flags;
+#endif
+
u16 hdr_size = le16_to_cpu(fib->hw_fib_va->header.Size);
 
atomic_inc(&q->numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
return -EINVAL;
address |= fibsize;
}
-
+#if defined(writeq)
+   src_writeq(dev, MUnit.IQ_L, (u64)address);
+#else
+   spin_lock_irqsave(&fib->dev->iq_lock, flags);
src_writel(dev, MUnit.IQ_H, upper_32_bits(address) & 0x);
src_writel(dev, MUnit.IQ_L, address & 0x);
-
+   spin_unlock_irqrestore(&fib->dev->iq_lock, flags);
+#endif
return 0;
 }
 
-- 
1.9.3

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


[PATCH V5 09/11] [SCSI] aacraid: Update driver version

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 drivers/scsi/aacraid/linit.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 7b95227..73c3384 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 35dd849..3fabfa1 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -56,7 +56,7 @@
 
 #include "aacraid.h"
 
-#define AAC_DRIVER_VERSION "1.2-1"
+#define AAC_DRIVER_VERSION "1.2-2"
 #ifndef AAC_DRIVER_BRANCH
 #define AAC_DRIVER_BRANCH  ""
 #endif
-- 
1.9.3

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


[PATCH V5 05/11] [SCSI] aacraid: Tune response path if IsFastPath bit set

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
If 'IsFastPath' bit is set, then response path assumes no error
and skips error check.

Changes from V2:
None

Reviewed By:
 Tomas Henzl ,
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/aachba.c | 259 ++
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index fe59b00..864e9f6 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib 
* fibptr)
return;
 
BUG_ON(fibptr == NULL);
-
dev = fibptr->dev;
 
-   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+   scsi_dma_unmap(scsicmd);
 
+   /* expose physical device if expose_physicald flag is on */
+   if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
+ && expose_physicals > 0)
+   aac_expose_phy_device(scsicmd);
+
+   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
scsicmd->sense_buffer[0] = '\0';  /* Initialize sense valid flag to 
false */
 
if (fibptr->flags & FIB_CONTEXT_FLAG_FASTRESP) {
@@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct 
fib * fibptr)
 */
scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
   - le32_to_cpu(srbreply->data_xfer_length));
-   }
-
-   scsi_dma_unmap(scsicmd);
-
-   /* expose physical device if expose_physicald flag is on */
-   if (scsicmd->cmnd[0] == INQUIRY && !(scsicmd->cmnd[1] & 0x01)
- && expose_physicals > 0)
-   aac_expose_phy_device(scsicmd);
+   /*
+* First check the fib status
+*/
 
-   /*
-* First check the fib status
-*/
+   if (le32_to_cpu(srbreply->status) != ST_OK) {
+   int len;
 
-   if (le32_to_cpu(srbreply->status) != ST_OK){
-   int len;
-   printk(KERN_WARNING "aac_srb_callback: srb failed, status = 
%d\n", le32_to_cpu(srbreply->status));
-   len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
-   SCSI_SENSE_BUFFERSIZE);
-   scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8 | 
SAM_STAT_CHECK_CONDITION;
-   memcpy(scsicmd->sense_buffer, srbreply->sense_data, len);
-   }
+   printk(KERN_WARNING "aac_srb_callback: srb failed, 
status = %d\n", le32_to_cpu(srbreply->status));
+   len = min_t(u32, le32_to_cpu(srbreply->sense_data_size),
+   SCSI_SENSE_BUFFERSIZE);
+   scsicmd->result = DID_ERROR << 16
+   | COMMAND_COMPLETE << 8
+   | SAM_STAT_CHECK_CONDITION;
+   memcpy(scsicmd->sense_buffer,
+   srbreply->sense_data, len);
+   }
 
-   /*
-* Next check the srb status
-*/
-   switch( (le32_to_cpu(srbreply->srb_status))&0x3f){
-   case SRB_STATUS_ERROR_RECOVERY:
-   case SRB_STATUS_PENDING:
-   case SRB_STATUS_SUCCESS:
-   scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
-   break;
-   case SRB_STATUS_DATA_OVERRUN:
-   switch(scsicmd->cmnd[0]){
-   case  READ_6:
-   case  WRITE_6:
-   case  READ_10:
-   case  WRITE_10:
-   case  READ_12:
-   case  WRITE_12:
-   case  READ_16:
-   case  WRITE_16:
-   if (le32_to_cpu(srbreply->data_xfer_length) < 
scsicmd->underflow) {
-   printk(KERN_WARNING"aacraid: SCSI CMD 
underflow\n");
-   } else {
-   printk(KERN_WARNING"aacraid: SCSI CMD Data 
Overrun\n");
+   /*
+* Next check the srb status
+*/
+   switch ((le32_to_cpu(srbreply->srb_status))&0x3f) {
+   case SRB_STATUS_ERROR_RECOVERY:
+   case SRB_STATUS_PENDING:
+   case SRB_STATUS_SUCCESS:
+   scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8;
+   break;
+   case SRB_STATUS_DATA_OVERRUN:
+   switch (scsicmd->cmnd[0]) {
+   case  READ_6:
+   case  WRITE_6:
+   case  READ_10:
+   case  WRITE_10:
+   case  READ_12:
+   case  WRITE_12:
+   case  READ_16:
+   case  WRITE_16:
+   if (le32_to_cpu(srbr

[PATCH V5 10/11] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
As pci_enable_msix() deprecated, replaced with pci_enable_msix_range()

V4 Reviewed/commented by:
Tomas Henzl 

Changes from V4:
Changed to 1 as minimum msix range in pci_enable_msix_range()
to match with original code.

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/comminit.c | 20 ++--
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index b4b6088..a02cfb3 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
 
 void aac_define_int_mode(struct aac_dev *dev)
 {
-   int i, msi_count;
+   int i, msi_count, min_msix;
 
msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
@@ -366,22 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
 
if (msi_count > 1 &&
pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
-   i = pci_enable_msix(dev->pdev,
+   min_msix = 1;
+   i = pci_enable_msix_range(dev->pdev,
dev->msixentry,
+   min_msix,
msi_count);
-/* Check how many MSIX vectors are allocated */
-   if (i >= 0) {
+   if (i > 0) {
dev->msi_enabled = 1;
-   if (i) {
-   msi_count = i;
-   if (pci_enable_msix(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);
-   }
-   }
+   msi_count = i;
} else {
dev->msi_enabled = 0;
printk(KERN_ERR "%s%d: MSIX not supported!! Will try 
MSI 0x%x.\n",
-- 
1.9.3

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


[PATCH V5 08/11] [SCSI] aacraid: Send commit-config to controller firmware

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
Controller BIOS/UEFI driver used to send this request.  But for
IBM-Power system there is no BIOS/UEFI driver.  So this change is
required for IBM, otherwise controller will be read-only mode.

Changes from V2:
None

Reviewed by:
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/linit.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 3b6e5c6..35dd849 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1270,8 +1270,11 @@ static int aac_probe_one(struct pci_dev *pdev, const 
struct pci_device_id *id)
shost->max_channel = aac->maximum_num_channels;
else
shost->max_channel = 0;
-
+#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
+   aac_get_config_status(aac, 1);
+#else
aac_get_config_status(aac, 0);
+#endif
aac_get_containers(aac);
list_add(&aac->entry, insert);
 
-- 
1.9.3

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


[PATCH V5 07/11] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
Driver blocks ioctls once it received shutdown/suspend request during
suspend/hybernation. This patch unblocks ioctls on resume path.

Changes from V2:
None

Reviewed by:
 Mahesh Rajashekhara ,
 Johannes Thumshirn 

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/linit.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 37375cf..3b6e5c6 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1448,6 +1448,11 @@ static int aac_resume(struct pci_dev *pdev)
pci_set_master(pdev);
if (aac_acquire_resources(aac))
goto fail_device;
+   /*
+   * reset this flag to unblock ioctl() as it was set at
+   * aac_send_shutdown() to block ioctls from upperlayer
+   */
+   aac->adapter_shutdown = 0;
scsi_unblock_requests(shost);
 
return 0;
-- 
1.9.3

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


[PATCH V5 11/11] [SCSI] aacraid: Requests at least 2 MSIx in pci_enable_msix_range()

2015-07-22 Thread rajinikanth.pandurangan
From: Rajinikanth Pandurangan 

Description:
In MSIx mode, we need at least 2 vectors.

Changes from V4:
Newly created for V5 based on review comment.

Signed-off-by: Rajinikanth Pandurangan 
---
 drivers/scsi/aacraid/comminit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index a02cfb3..0e954e3 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -366,7 +366,7 @@ void aac_define_int_mode(struct aac_dev *dev)
 
if (msi_count > 1 &&
pci_find_capability(dev->pdev, PCI_CAP_ID_MSIX)) {
-   min_msix = 1;
+   min_msix = 2;
i = pci_enable_msix_range(dev->pdev,
dev->msixentry,
min_msix,
-- 
1.9.3

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


[Bug 101011] Kernel Oops when disconnecting a mounted ext4 usb stick

2015-07-22 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=101011

taz-...@latribu.com changed:

   What|Removed |Added

 CC||taz-...@latribu.com

--- Comment #5 from taz-...@latribu.com ---
Can also reproduce on a non-tainted kernel (4.1.2) on an old laptop:

jui 21 10:19:15 Aspire kernel: usb 3-3.3.4.1.1: USB disconnect, device number
15
jui 21 10:19:15 Aspire kernel: BUG: unable to handle kernel paging request at
34943000
jui 21 10:19:16 Aspire kernel: IP: [] __percpu_counter_add+0x1b/0xd0
jui 21 10:19:16 Aspire kernel: *pde =  
jui 21 10:19:17 Aspire kernel: Oops:  [#1] PREEMPT SMP 
jui 21 10:19:17 Aspire kernel: Modules linked in: joydev psmouse
snd_hda_codec_hdmi pcspkr serio_raw iTCO_wdt iTCO_vendor_support i2c_i801 evdev
mousedev mac_hid i915 snd_hda_codec_realtek snd_hda_codec_generic snd_hda_intel
ipw2200 snd_hda_controller snd_hda_codec drm_kms_helper 8139too libipw
snd_hda_core drm 8139cp lib80211 snd_hwdep cfg80211 snd_pcm pcmcia i2c_algo_bit
i2c_core mii rfkill snd_timer lpc_ich intel_agp yenta_socket intel_gtt agpgart
pcmcia_rsrc pcmcia_core snd rng_core soundcore thermal battery shpchp video ac
button acpi_cpufreq processor sch_fq_codel ip_tables x_tables ext4 crc16
mbcache jbd2 hid_generic usbhid hid uas usb_storage sr_mod cdrom sd_mod
ata_generic pata_acpi atkbd libps2 ata_piix libata scsi_mod ehci_pci uhci_hcd
ehci_hcd usbcore usb_common i8042 serio
jui 21 10:19:17 Aspire kernel: CPU: 0 PID: 616 Comm: umount Not tainted
4.1.2-2-ARCH #1
jui 21 10:19:17 Aspire kernel: Hardware name: Acer, inc. Aspire 1640Z   
/Lugano3 , BIOS 3A24 10/30/06
jui 21 10:19:17 Aspire kernel: task: f4183fc0 ti: f1a7c000 task.ti: f1a7c000
jui 21 10:19:17 Aspire kernel: EIP: 0060:[] EFLAGS: 00010082 CPU: 0
jui 21 10:19:17 Aspire kernel: EIP is at __percpu_counter_add+0x1b/0xd0
jui 21 10:19:17 Aspire kernel: EAX: c1cee508 EBX: c1cee508 ECX:  EDX:
0001
jui 21 10:19:17 Aspire kernel: ESI:  EDI:  EBP: f1a7de70 ESP:
f1a7de50
jui 21 10:19:17 Aspire kernel:  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
jui 21 10:19:17 Aspire kernel: CR0: 8005003b CR2: 34943000 CR3: 31aa CR4:
07d0
jui 21 10:19:17 Aspire kernel: Stack:
jui 21 10:19:17 Aspire kernel:  0285 0285 c166f540 0001 
c1cee4e8  f53a635c
jui 21 10:19:17 Aspire kernel:  f1a7de8c c1138904 0010 f6879660 f6879660
f53a635c f53a636c f1a7dea8
jui 21 10:19:18 Aspire kernel:  c11bd549  0282 f6879660 f521bc78
f2f5c400 f1a7deb8 c11bd6a3
jui 21 10:19:18 Aspire kernel: Call Trace:
jui 21 10:19:18 Aspire kernel:  [] account_page_dirtied+0x74/0x120
jui 21 10:19:18 Aspire kernel:  [] __set_page_dirty+0x39/0xb0
jui 21 10:19:19 Aspire kernel:  [] mark_buffer_dirty+0x53/0xd0
jui 21 10:19:19 Aspire kernel:  [] ext4_commit_super+0x158/0x230
[ext4]
jui 21 10:19:19 Aspire kernel:  [] ? mb_cache_shrink+0x55/0x250
[mbcache]
jui 21 10:19:19 Aspire kernel:  [] ext4_put_super+0xc7/0x320 [ext4]
jui 21 10:19:19 Aspire kernel:  [] ? dispose_list+0x32/0x40
jui 21 10:19:20 Aspire kernel:  [] ? evict_inodes+0xf2/0x110
jui 21 10:19:20 Aspire kernel:  [] generic_shutdown_super+0x64/0xe0
jui 21 10:19:20 Aspire kernel:  [] ? unregister_shrinker+0x40/0x50
jui 21 10:19:20 Aspire kernel:  [] kill_block_super+0x1f/0x70
jui 21 10:19:20 Aspire kernel:  [] deactivate_locked_super+0x3d/0x70
jui 21 10:19:21 Aspire kernel:  [] deactivate_super+0x57/0x60
jui 21 10:19:21 Aspire kernel:  [] cleanup_mnt+0x39/0x90
jui 21 10:19:21 Aspire kernel:  [] __cleanup_mnt+0x10/0x20
jui 21 10:19:21 Aspire kernel:  [] task_work_run+0xc9/0xe0
jui 21 10:19:21 Aspire kernel:  [] do_notify_resume+0x75/0x80
jui 21 10:19:22 Aspire kernel:  [] work_notifysig+0x30/0x37
jui 21 10:19:22 Aspire kernel: Code: 39 c7 77 de eb da 8d 76 00 8d bc 27 00 00
00 00 55 89 e5 57 56 53 89 c3 83 ec 14 89 55 ec 89 4d f0 64 ff 05 44 17 71 c1
8b 7b 14 <64> 8b 37 89 7d e0 89 f7 c1 ff 1f 01 d6 8b 55 08 11 cf 89 d1 c1
jui 21 10:19:22 Aspire kernel: EIP: [] __percpu_counter_add+0x1b/0xd0
SS:ESP 0068:f1a7de50
jui 21 10:19:22 Aspire kernel: CR2: 34943000
jui 21 10:19:22 Aspire kernel: ---[ end trace 4bafb307c38dbc3e ]---

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [for 4.1 PATCH resend] libsas: fix "sysfs group not found" warnings at port teardown time

2015-07-22 Thread James Bottomley
On Wed, 2015-06-17 at 23:22 -0400, Dan Williams wrote:
> Praveen reports:
> 
> After some debugging this is what I have found
> 
> sas_phye_loss_of_signal gets triggered on phy_event from mvsas
> sas_phye_loss_of_signal calls sas_deform_port
>  sas_deform_port posts a DISCE_DESTRUCT event 
> (sas_unregister_domain_devices-> sas_unregister_dev)
>  sas_deform_port calls sas_port_delete
>  sas_port_delete calls sas_port_delete_link
>  sysfs_remove_group: kobject 'port-X:Y'
>  sas_port_delete calls device_del
>  sysfs_remove_group: kobject 'port-X:Y'
> 
> sas_destruct_devices gets triggered for the destruct event 
> (DISCE_DESTRUCT)
> sas_destruct_devices calls sas_rphy_delete
> sas_rphy_delete calls scsi_remove_device
>  scsi_remove_device calls __scsi_remove_device
>  __scsi_remove_device calls bsg_unregister_queue
>  bsg_unregister_queue -> device_unregister -> 
> device_del -> sysfs_remove_group: kobject 'X:0:0:0'
> 
> Since X:0:0:0 falls under port-X:Y (which got deleted during
> sas_port_delete), this call results in the warning. All the later
> warnings in the dmesg output I sent earlier are trying to delete objects
> under port-X:Y. Since port-X:Y got recursively deleted, all these calls
> result in warnings. Since, the PHY and DISC events are processed in two
> different work queues (and one triggers the other), is there any way
> other than checking if the object exists in sysfs (in device_del) before
> deleting?
> 
> WARNING: CPU: 2 PID: 6 at fs/sysfs/group.c:219 device_del+0x40/0x1c0()
> sysfs group 818b97e0 not found for kobject '2:0:4:0'
> [..]
> CPU: 2 PID: 6 Comm: kworker/u8:0 Tainted: PW  O  
> 3.16.7-ckt9-logicube-ng.3 #1
> Hardware name: To be filled by O.E.M. To be filled by O.E.M./VT6085, BIOS 
> 4.6.5 01/23/2015
> Workqueue: scsi_wq_2 sas_destruct_devices [libsas]
>  0009 8151cd18 88011b35bcd8 810687b7
>  88011a661400 88011b35bd28 8800c6e5e968 88028810
>  8800c89f2c00 8106881c 81733b68 0028
> Call Trace:
>  [] ? dump_stack+0x41/0x51
>  [] ? warn_slowpath_common+0x77/0x90
>  [] ? warn_slowpath_fmt+0x4c/0x50
>  [] ? device_del+0x40/0x1c0
>  [] ? device_unregister+0x1a/0x70
>  [] ? bsg_unregister_queue+0x5e/0xb0
>  [] ? __scsi_remove_device+0xa9/0xd0 [scsi_mod]
> 
> It appears we've always been double deleting the devices below sas_port,
> but recent sysfs changes now exposes this problem.  Libsas should delete
> all the devices from rphy down before deleting the parent port.

There's a missing description of the fix here.

So we make the DISCE_DESTROY event delete the port as well as
all the underlying devices
?

> Cc: 
> Reported-by: Praveen Murali 
> Tested-by: Praveen Murali 
> Signed-off-by: Dan Williams 
> ---
>  drivers/scsi/libsas/sas_discover.c |6 +++---
>  drivers/scsi/libsas/sas_port.c |1 -
>  2 files changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_discover.c 
> b/drivers/scsi/libsas/sas_discover.c
> index 60de66252fa2..a4db770fe8b0 100644
> --- a/drivers/scsi/libsas/sas_discover.c
> +++ b/drivers/scsi/libsas/sas_discover.c
> @@ -362,11 +362,14 @@ static void sas_destruct_devices(struct work_struct 
> *work)
>   clear_bit(DISCE_DESTRUCT, &port->disc.pending);
>  
>   list_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) {
> + struct sas_port *sas_port = 
> dev_to_sas_port(dev->rphy->dev.parent);
> +

Do you need this? isn't what you've elaborately got here as sas_port,
simply port->port?  Assuming you don't NULL that out (see below) all
this goes away.

>   list_del_init(&dev->disco_list_node);
>  
>   sas_remove_children(&dev->rphy->dev);
>   sas_rphy_delete(dev->rphy);
>   sas_unregister_common_dev(port, dev);
> + sas_port_delete(sas_port);

So this becomes sas_port_delete(port->port);

>   }
>  }
>  
> @@ -400,9 +403,6 @@ void sas_unregister_domain_devices(struct asd_sas_port 
> *port, int gone)
>  
>   list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node)
>   sas_unregister_dev(port, dev);
> -
> - port->port->rphy = NULL;
> -

Why does this line need removing.  It's only used by ATA devices on an
expander, but it's logical that it removes the visibility of the device
being destroyed.

>  }
>  
>  void sas_device_set_phy(struct domain_device *dev, struct sas_port *port)
> diff --git a/drivers/scsi/libsas/sas_port.c b/drivers/scsi/libsas/sas_port.c
> index d3c5297c6c89..9a25ae3a52a4 100644
> --- a/drivers/scsi/libsas/sas_port.c
> +++ b/drivers/scsi/libsas/sas_

Re: [for 4.1 PATCH resend] libsas: fix "sysfs group not found" warnings at port teardown time

2015-07-22 Thread Dan Williams
On Wed, Jul 22, 2015 at 11:28 AM, James Bottomley
 wrote:
> On Wed, 2015-06-17 at 23:22 -0400, Dan Williams wrote:
>> Praveen reports:
>>
>> After some debugging this is what I have found
>>
>> sas_phye_loss_of_signal gets triggered on phy_event from mvsas
>> sas_phye_loss_of_signal calls sas_deform_port
>>  sas_deform_port posts a DISCE_DESTRUCT event 
>> (sas_unregister_domain_devices-> sas_unregister_dev)
>>  sas_deform_port calls sas_port_delete
>>  sas_port_delete calls sas_port_delete_link
>>  sysfs_remove_group: kobject 'port-X:Y'
>>  sas_port_delete calls device_del
>>  sysfs_remove_group: kobject 'port-X:Y'
>>
>> sas_destruct_devices gets triggered for the destruct event 
>> (DISCE_DESTRUCT)
>> sas_destruct_devices calls sas_rphy_delete
>> sas_rphy_delete calls scsi_remove_device
>>  scsi_remove_device calls __scsi_remove_device
>>  __scsi_remove_device calls bsg_unregister_queue
>>  bsg_unregister_queue -> device_unregister 
>> -> device_del -> sysfs_remove_group: kobject 'X:0:0:0'
>>
>> Since X:0:0:0 falls under port-X:Y (which got deleted during
>> sas_port_delete), this call results in the warning. All the later
>> warnings in the dmesg output I sent earlier are trying to delete objects
>> under port-X:Y. Since port-X:Y got recursively deleted, all these calls
>> result in warnings. Since, the PHY and DISC events are processed in two
>> different work queues (and one triggers the other), is there any way
>> other than checking if the object exists in sysfs (in device_del) before
>> deleting?
>>
>> WARNING: CPU: 2 PID: 6 at fs/sysfs/group.c:219 device_del+0x40/0x1c0()
>> sysfs group 818b97e0 not found for kobject '2:0:4:0'
>> [..]
>> CPU: 2 PID: 6 Comm: kworker/u8:0 Tainted: PW  O  
>> 3.16.7-ckt9-logicube-ng.3 #1
>> Hardware name: To be filled by O.E.M. To be filled by O.E.M./VT6085, 
>> BIOS 4.6.5 01/23/2015
>> Workqueue: scsi_wq_2 sas_destruct_devices [libsas]
>>  0009 8151cd18 88011b35bcd8 810687b7
>>  88011a661400 88011b35bd28 8800c6e5e968 88028810
>>  8800c89f2c00 8106881c 81733b68 0028
>> Call Trace:
>>  [] ? dump_stack+0x41/0x51
>>  [] ? warn_slowpath_common+0x77/0x90
>>  [] ? warn_slowpath_fmt+0x4c/0x50
>>  [] ? device_del+0x40/0x1c0
>>  [] ? device_unregister+0x1a/0x70
>>  [] ? bsg_unregister_queue+0x5e/0xb0
>>  [] ? __scsi_remove_device+0xa9/0xd0 [scsi_mod]
>>
>> It appears we've always been double deleting the devices below sas_port,
>> but recent sysfs changes now exposes this problem.  Libsas should delete
>> all the devices from rphy down before deleting the parent port.
>
> There's a missing description of the fix here.
>
> So we make the DISCE_DESTROY event delete the port as well as
> all the underlying devices
> ?

"We make DISCE_DESTROY responsible for deleting the child devices as
well as the port." == "Libsas should delete all the devices from rphy
down before deleting the parent port."

>> Cc: 
>> Reported-by: Praveen Murali 
>> Tested-by: Praveen Murali 
>> Signed-off-by: Dan Williams 
>> ---
>>  drivers/scsi/libsas/sas_discover.c |6 +++---
>>  drivers/scsi/libsas/sas_port.c |1 -
>>  2 files changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/scsi/libsas/sas_discover.c 
>> b/drivers/scsi/libsas/sas_discover.c
>> index 60de66252fa2..a4db770fe8b0 100644
>> --- a/drivers/scsi/libsas/sas_discover.c
>> +++ b/drivers/scsi/libsas/sas_discover.c
>> @@ -362,11 +362,14 @@ static void sas_destruct_devices(struct work_struct 
>> *work)
>>   clear_bit(DISCE_DESTRUCT, &port->disc.pending);
>>
>>   list_for_each_entry_safe(dev, n, &port->destroy_list, disco_list_node) 
>> {
>> + struct sas_port *sas_port = 
>> dev_to_sas_port(dev->rphy->dev.parent);
>> +
>
> Do you need this? isn't what you've elaborately got here as sas_port,
> simply port->port?

Yes, it's just an elaborate workaround since port->port is already torn down.

> Assuming you don't NULL that out (see below) all
> this goes away.

Not sure, I'd have to go look if libsas is prepared to have port->port
being valid for longer.

>
>>   list_del_init(&dev->disco_list_node);
>>
>>   sas_remove_children(&dev->rphy->dev);
>>   sas_rphy_delete(dev->rphy);
>>   sas_unregister_common_dev(port, dev);
>> + sas_port_delete(sas_port);
>
> So this becomes sas_port_delete(port->port);
>
>>   }
>>  }
>>
>> @@ -400,9 +403,6 @@ void sas_unregister_domain_devices(struct asd_sas_port 
>> *port, int gone)
>>
>>   list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node)
>>

[PATCH] target: improve unsupported opcode message

2015-07-22 Thread Spencer Baugh
From: Joern Engel 

Make the warning about unsupported SCSI opcode more useful:

 - Add in the initiator name so we know who's sending it.
 - Print the warning even for opcodes that spc_parse_cdb() knows about
   but that we don't handle.

Signed-off-by: Joern Engel 
Signed-off-by: Spencer Baugh 
---
 drivers/target/target_core_spc.c   | 3 ---
 drivers/target/target_core_transport.c | 5 +
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index b074443..87d4adb 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1405,9 +1405,6 @@ spc_parse_cdb(struct se_cmd *cmd, unsigned int *size)
}
break;
default:
-   pr_warn("TARGET_CORE[%s]: Unsupported SCSI Opcode"
-   " 0x%02x, sending CHECK_CONDITION.\n",
-   cmd->se_tfo->get_fabric_name(), cdb[0]);
return TCM_UNSUPPORTED_SCSI_OPCODE;
}
 
diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
index ce8574b..ac002a7 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1246,6 +1246,11 @@ target_setup_cmd_from_cdb(struct se_cmd *cmd, unsigned 
char *cdb)
}
 
ret = dev->transport->parse_cdb(cmd);
+   if (ret == TCM_UNSUPPORTED_SCSI_OPCODE)
+   pr_warn_ratelimited("%s/%s: Unsupported SCSI Opcode 0x%02x, 
sending CHECK_CONDITION.\n",
+   cmd->se_tfo->get_fabric_name(),
+   cmd->se_sess->se_node_acl->initiatorname,
+   cmd->t_task_cdb[0]);
if (ret)
return ret;
 
-- 
2.5.0.rc3

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


[PATCH] target: allow underflow/overflow for PR OUT etc. commands

2015-07-22 Thread Spencer Baugh
From: Roland Dreier 

It's not necessarily a fatal error if a command with a data-out phase
has a data length that differs from the transport data length (e.g.
PERSISTENT RESERVE OUT might have a parameter list length in the CDB
that's smaller than the FC_DL field), so allow these commands.  The
Windows compliance test sends them.

Signed-off-by: Roland Dreier 
Signed-off-by: Spencer Baugh 
---
 drivers/target/target_core_transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
index ac002a7..f6626bb 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -1087,9 +1087,9 @@ target_cmd_size_check(struct se_cmd *cmd, unsigned int 
size)
" 0x%02x\n", cmd->se_tfo->get_fabric_name(),
cmd->data_length, size, cmd->t_task_cdb[0]);
 
-   if (cmd->data_direction == DMA_TO_DEVICE) {
-   pr_err("Rejecting underflow/overflow"
-   " WRITE data\n");
+   if (cmd->data_direction == DMA_TO_DEVICE &&
+   cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) {
+   pr_err("Rejecting underflow/overflow WRITE data\n");
return TCM_INVALID_CDB_FIELD;
}
/*
-- 
2.5.0.rc3

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


[PATCH] target: respond to unknown initiators with sensible REPORT LUNS list length

2015-07-22 Thread Spencer Baugh
From: Roland Dreier 

Solaris seems to go beserk if we respond to REPORT LUNS with a
LUN LIST LENGTH of 0.

Signed-off-by: Roland Dreier 
Signed-off-by: Spencer Baugh 
---
 drivers/target/target_core_spc.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
index 87d4adb..d8a32e5 100644
--- a/drivers/target/target_core_spc.c
+++ b/drivers/target/target_core_spc.c
@@ -1241,6 +1241,13 @@ sense_reason_t spc_emulate_report_luns(struct se_cmd 
*cmd)
 * See SPC3 r07, page 159.
 */
 done:
+   /*
+* If no real LUNs are accessible, report an allocation length
+* of 1 LUN to account for virtual LUN 0.
+*/
+   if (lun_count == 0)
+   lun_count = 1;
+
lun_count *= 8;
buf[0] = ((lun_count >> 24) & 0xff);
buf[1] = ((lun_count >> 16) & 0xff);
-- 
2.5.0.rc3

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


[PATCH] target: Drop iSCSI use of mutex around max_cmd_sn increment

2015-07-22 Thread Spencer Baugh
From: Roland Dreier 

In a performance profile, taking a mutex in iscsit_increment_maxcmdsn()
shows up very high.  However taking a mutex around "sess->max_cmd_sn += 1"
seems pretty silly: we're not serializing against other contexts in
any useful way.

I did a quick audit and there don't appear to be any other places that
use max_cmd_sn within the mutex more than once, so this lock can't be
providing any useful serialization.

Signed-off-by: Roland Dreier 
Signed-off-by: Spencer Baugh 
---
 drivers/target/iscsi/iscsi_target.c  | 18 +-
 drivers/target/iscsi/iscsi_target_configfs.c |  4 ++--
 drivers/target/iscsi/iscsi_target_device.c   |  8 +++-
 drivers/target/iscsi/iscsi_target_login.c|  2 +-
 drivers/target/iscsi/iscsi_target_nego.c |  9 +++--
 drivers/target/iscsi/iscsi_target_tmr.c  |  2 +-
 drivers/target/iscsi/iscsi_target_util.c |  7 ---
 include/target/iscsi/iscsi_target_core.h |  2 +-
 8 files changed, 24 insertions(+), 28 deletions(-)

diff --git a/drivers/target/iscsi/iscsi_target.c 
b/drivers/target/iscsi/iscsi_target.c
index ebb1ece..635ec06c 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -2555,7 +2555,7 @@ static int iscsit_send_conn_drop_async_message(
cmd->stat_sn= conn->stat_sn++;
hdr->statsn = cpu_to_be32(cmd->stat_sn);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
hdr->async_event= ISCSI_ASYNC_MSG_DROPPING_CONNECTION;
hdr->param1 = cpu_to_be16(cmd->logout_cid);
hdr->param2 = 
cpu_to_be16(conn->sess->sess_ops->DefaultTime2Wait);
@@ -2627,7 +2627,7 @@ iscsit_build_datain_pdu(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn,
hdr->statsn = cpu_to_be32(0x);
 
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
hdr->datasn = cpu_to_be32(datain->data_sn);
hdr->offset = cpu_to_be32(datain->offset);
 
@@ -2838,7 +2838,7 @@ iscsit_build_logout_rsp(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn,
 
iscsit_increment_maxcmdsn(cmd, conn->sess);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
 
pr_debug("Built Logout Response ITT: 0x%08x StatSN:"
" 0x%08x Response: 0x%02x CID: %hu on CID: %hu\n",
@@ -2901,7 +2901,7 @@ iscsit_build_nopin_rsp(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn,
iscsit_increment_maxcmdsn(cmd, conn->sess);
 
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
 
pr_debug("Built NOPIN %s Response ITT: 0x%08x, TTT: 0x%08x,"
" StatSN: 0x%08x, Length %u\n", (nopout_response) ?
@@ -3048,7 +3048,7 @@ static int iscsit_send_r2t(
hdr->ttt= cpu_to_be32(r2t->targ_xfer_tag);
hdr->statsn = cpu_to_be32(conn->stat_sn);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
hdr->r2tsn  = cpu_to_be32(r2t->r2t_sn);
hdr->data_offset= cpu_to_be32(r2t->offset);
hdr->data_length= cpu_to_be32(r2t->xfer_len);
@@ -3201,7 +3201,7 @@ void iscsit_build_rsp_pdu(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn,
 
iscsit_increment_maxcmdsn(cmd, conn->sess);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
 
pr_debug("Built SCSI Response, ITT: 0x%08x, StatSN: 0x%08x,"
" Response: 0x%02x, SAM Status: 0x%02x, CID: %hu\n",
@@ -3320,7 +3320,7 @@ iscsit_build_task_mgt_rsp(struct iscsi_cmd *cmd, struct 
iscsi_conn *conn,
 
iscsit_increment_maxcmdsn(cmd, conn->sess);
hdr->exp_cmdsn  = cpu_to_be32(conn->sess->exp_cmd_sn);
-   hdr->max_cmdsn  = cpu_to_be32(conn->sess->max_cmd_sn);
+   hdr->max_cmdsn  = cpu_to_be32((u32) 
atomic_read(&conn->sess->max_cmd_sn));
 
pr_debug("Built Task Management Response ITT: 0x%08x,"
 

[PATCH] qla2xxx: remove unused rval

2015-07-22 Thread Spencer Baugh
From: Joern Engel 

We don't touch the return value of qla2x00_loop_resync in
qla2x00_do_dpc, so don't bother collecting it. Fixes a compiler warning.

Signed-off-by: Joern Engel 
Signed-off-by: Spencer Baugh 
---
 drivers/scsi/qla2xxx/qla_os.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a28815b..b9ee115 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4793,7 +4793,6 @@ qla2x00_disable_board_on_pci_error(struct work_struct 
*work)
 static int
 qla2x00_do_dpc(void *data)
 {
-   int rval;
scsi_qla_host_t *base_vha;
struct qla_hw_data *ha;
 
@@ -5025,7 +5024,7 @@ loop_resync_check:
if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE,
&base_vha->dpc_flags))) {
 
-   rval = qla2x00_loop_resync(base_vha);
+   qla2x00_loop_resync(base_vha);
 
clear_bit(LOOP_RESYNC_ACTIVE,
&base_vha->dpc_flags);
-- 
2.5.0.rc3

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


Re: [PATCH] qla2xxx: remove unused rval

2015-07-22 Thread Himanshu Madhani

On 7/22/15, 3:08 PM, "Spencer Baugh"  wrote:

>From: Joern Engel 
>
>We don't touch the return value of qla2x00_loop_resync in
>qla2x00_do_dpc, so don't bother collecting it. Fixes a compiler warning.
>
>Signed-off-by: Joern Engel 
>Signed-off-by: Spencer Baugh 
>---
> drivers/scsi/qla2xxx/qla_os.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
>index a28815b..b9ee115 100644
>--- a/drivers/scsi/qla2xxx/qla_os.c
>+++ b/drivers/scsi/qla2xxx/qla_os.c
>@@ -4793,7 +4793,6 @@ qla2x00_disable_board_on_pci_error(struct
>work_struct *work)
> static int
> qla2x00_do_dpc(void *data)
> {
>-  int rval;
>   scsi_qla_host_t *base_vha;
>   struct qla_hw_data *ha;
> 
>@@ -5025,7 +5024,7 @@ loop_resync_check:
>   if (!(test_and_set_bit(LOOP_RESYNC_ACTIVE,
>   &base_vha->dpc_flags))) {
> 
>-  rval = qla2x00_loop_resync(base_vha);
>+  qla2x00_loop_resync(base_vha);
> 
>   clear_bit(LOOP_RESYNC_ACTIVE,
>   &base_vha->dpc_flags);
>-- 
>2.5.0.rc3
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majord...@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/

Acked-by: Himanshu Madhani 


>

<>

RE: [PATCH] target: Drop iSCSI use of mutex around max_cmd_sn increment

2015-07-22 Thread Elliott, Robert (Server Storage)
> -Original Message-
> From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel-
> ow...@vger.kernel.org] On Behalf Of Spencer Baugh
> Sent: Wednesday, July 22, 2015 5:08 PM
> Subject: [PATCH] target: Drop iSCSI use of mutex around max_cmd_sn
> increment
...
> diff --git a/drivers/target/iscsi/iscsi_target_configfs.c
> b/drivers/target/iscsi/iscsi_target_configfs.c
> index c1898c8..29d5930 100644
> --- a/drivers/target/iscsi/iscsi_target_configfs.c
> +++ b/drivers/target/iscsi/iscsi_target_configfs.c
> @@ -706,8 +706,8 @@ static ssize_t lio_target_nacl_show_info(
>   rb += sprintf(page+rb, " 0x%08x   0x%08x   0x%08x   0x%08x"
>   "   0x%08x   0x%08x\n",
>   sess->cmdsn_window,
> - (sess->max_cmd_sn - sess->exp_cmd_sn) + 1,
> - sess->exp_cmd_sn, sess->max_cmd_sn,
> + ((u32) atomic_read(&sess->max_cmd_sn) - sess-
> >exp_cmd_sn) + 1,
> + sess->exp_cmd_sn, (u32) atomic_read(&sess->max_cmd_sn),
>   sess->init_task_tag, sess->targ_xfer_tag);
>   rb += sprintf(page+rb, "--[iSCSI"
>   " Connections]-\n");

Two calls to atomic_read could pick up different values; 
calling it once and using the same value twice would ensure
the arguments are consistent with each other.

> diff --git a/drivers/target/iscsi/iscsi_target_device.c
> b/drivers/target/iscsi/iscsi_target_device.c
> index 5fabcd3..a526904 100644
> --- a/drivers/target/iscsi/iscsi_target_device.c
> +++ b/drivers/target/iscsi/iscsi_target_device.c
...
> @@ -57,9 +57,7 @@ void iscsit_increment_maxcmdsn(struct iscsi_cmd *cmd,
> struct iscsi_session *sess
> 
>   cmd->maxcmdsn_inc = 1;
> 
> - mutex_lock(&sess->cmdsn_mutex);
> - sess->max_cmd_sn += 1;
> - pr_debug("Updated MaxCmdSN to 0x%08x\n", sess->max_cmd_sn);
> - mutex_unlock(&sess->cmdsn_mutex);
> + atomic_inc(&sess->max_cmd_sn);
> + pr_debug("Updated MaxCmdSN to 0x%08x\n", atomic_read(&sess-
> >max_cmd_sn));
>  }
>  EXPORT_SYMBOL(iscsit_increment_maxcmdsn);

If there is another change before the atomic_read, this would
print a value unrelated to the increment done by this thread. 
atomic_inc_return would provide the appropriate value to print.

---
Robert Elliott, HP Server Storage
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html