Re: [PATCH 0/2] target: 64-bit LUN support

2015-06-10 Thread Hannes Reinecke
On 06/10/2015 06:45 PM, Andy Grover wrote:
> On 06/09/2015 11:41 PM, Hannes Reinecke wrote:
>> Hi Nic,
>>
>> here's now the patchset for making LIO-target support 64-bit LUNs.
>> Pretty straightforward, plus an additional patch to remove the
>> now obsolete limitation on 256 LUNs per TPG. There had been a
>> comment in the header that REPORT LUN emulation would only support
>> up to one page in payload, but I couldn't find any evidence for
>> this in the code.
>>
>> As usual, comments and reviews are welcome.
> 
> Hi Hannes,
> 
> I think we also need to take care of how we report LUNs in spc.c
> spc_emulate_report_luns(). From reading SAM-5 4.7.7 (addressing
> methods) it looks like we're currently using the simple addressing
> format (address method = 0) and if we want to report more than 14
> bits we would need to report the luns with a different addressing
> format.
> 
> I'm wondering if this could be seen as a bug in int_to_scsilun, but
> in any case I hope you'll take a look and make sure we're ok?
> 
Actually, I've been thinking about this. Currently I'm not sure if
we should fully embrace this route; after all, 'scsilun_to_int' is
meant to be a conversion from the (abstract) LUN number into our
internal representation.
And as it's internal we're free to use whatever we like.

Where we need to fix up things is in reporting; whenever we display
LUN numbers to userspace (printk or sysfs-wise) we probably should
use the appropriate format.

I'll see if I can whip up a printk format for this.
Never liked the '%llu' format for LUNs anyway.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
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: [dm-devel] ALUA - rescan device capacity on zero sized block devices

2015-06-10 Thread Hannes Reinecke
On 06/10/2015 05:02 PM, Ewan Milne wrote:
> On Mon, 2015-04-20 at 07:58 +0200, Hannes Reinecke wrote:
>> On 04/19/2015 12:56 AM, Christophe Varoqui wrote:
>>> About five years ago, we faced a somewhat simular issue with
>>> Symmetrix arrays, where the replicated LU of a SRDF pair (R2) was
>>> flagged read-only by the kernel upon discovery. Splitting the pair
>>> with a symcli command  made the LU read-write from the array
>>> controller point of view, but the Linux kernel would not promote it
>>> read-write dynamically.
>>>
>>> I don't know if the Symmetrix array also use a unit attention to
>>> signal the change to the initiators. If it does, it might be worth
>>> trying to address both the 3par peer persistance and the Symmetrix
>>> SRDF situations.
>>>
>>> On the other hand, if the SRDF R2 rw promotion issue has been fixed
>>> since, the patch might give guidance about where/how to plug the
>>> 3par peer persistance ghost path rescans.
>>>
>> It's not only that; if you are faced with LUNs in standby even the
>> kernel wouldn't detect them properly.
>>
>> I'm currently debugging this issue and will have an update soon(-ish).
> 
> I have a patch set to have the kernel automatically rescan the device
> when the ALUA state changes to an ACTIVE state, if it couldn't read
> capacity when the device was initially probed.  I've had it for a while,
> but I haven't had *any* response from the vendor if it actually works
> with their product, so I haven't posted it to the list for review yet.
> 
Please hold off that patchset.

I've posted the ALUA update patchset a while ago, and are working on
including the suggestions from hch.

Please check if that patchset fixes the issue.

Additionally, I've got some patches for lio-target which will blank
out the READ CAPACITY command when in standby; with that one has an
easy testbed for this kind of issues.

> I did point out to them that the T10 spec does not *prohibit* supporting
> the READ CAPACITY command in the ALUA standby state, which would avoid
> the problem, and is what other vendors seem to do.  However, they then
> raised the issue that if the capacity changes in the standby state then
> they should be generating the capacity changed UA, etc and you can sort
> of see their point of why this gets complicated.
> 
Which is actually not true. The capacity did _not_ change, it's just
the command which isn't supported. If the command was supported and
would have reported a size of '0' in standby _then_ it would have
been a capacity change. But that's not the case here.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries & Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
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/10] qla2xxx: Fix indentation

2015-06-10 Thread Himanshu Madhani

On 6/4/15, 3:58 PM, "Bart Van Assche"  wrote:

>Detected by smatch.
>
>Signed-off-by: Bart Van Assche 
>Cc: Himanshu Madhani 
>Cc: Quinn Tran 
>Cc: Saurav Kashyap 
>---
> drivers/scsi/qla2xxx/qla_init.c |  2 +-
> drivers/scsi/qla2xxx/qla_iocb.c |  8 
> drivers/scsi/qla2xxx/qla_isr.c  |  4 ++--
> drivers/scsi/qla2xxx/qla_nx.c   |  2 +-
> drivers/scsi/qla2xxx/qla_nx2.c  | 13 ++---
> 5 files changed, 14 insertions(+), 15 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_init.c
>b/drivers/scsi/qla2xxx/qla_init.c
>index 33cb3f6..5a5ca43 100644
>--- a/drivers/scsi/qla2xxx/qla_init.c
>+++ b/drivers/scsi/qla2xxx/qla_init.c
>@@ -708,7 +708,7 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
>   if (rval != QLA_SUCCESS) {
>   ql_log(ql_log_warn, vha, 0x00d4,
>   "Unable to initialize ISP84XX.\n");
>-  qla84xx_put_chip(vha);
>+  qla84xx_put_chip(vha);
>   }
>   }
> 
>diff --git a/drivers/scsi/qla2xxx/qla_iocb.c
>b/drivers/scsi/qla2xxx/qla_iocb.c
>index 21d6f3f..524b5bc 100644
>--- a/drivers/scsi/qla2xxx/qla_iocb.c
>+++ b/drivers/scsi/qla2xxx/qla_iocb.c
>@@ -2763,10 +2763,10 @@ qla2x00_start_bidir(srb_t *sp, struct
>scsi_qla_host *vha, uint32_t tot_dsds)
>   handle = req->current_outstanding_cmd;
>   for (index = 1; index < req->num_outstanding_cmds; index++) {
>   handle++;
>-  if (handle == req->num_outstanding_cmds)
>-  handle = 1;
>-  if (!req->outstanding_cmds[handle])
>-  break;
>+  if (handle == req->num_outstanding_cmds)
>+  handle = 1;
>+  if (!req->outstanding_cmds[handle])
>+  break;
>   }
> 
>   if (index == req->num_outstanding_cmds) {
>diff --git a/drivers/scsi/qla2xxx/qla_isr.c
>b/drivers/scsi/qla2xxx/qla_isr.c
>index 79f6989..b70af1f 100644
>--- a/drivers/scsi/qla2xxx/qla_isr.c
>+++ b/drivers/scsi/qla2xxx/qla_isr.c
>@@ -1579,7 +1579,7 @@ qla24xx_tm_iocb_entry(scsi_qla_host_t *vha, struct
>req_que *req, void *tsk)
>   ql_log(ql_log_warn, fcport->vha, 0x503c,
>   "Async-%s error - hdl=%x response(%x).\n",
>   type, sp->handle, sts->data[3]);
>-  iocb->u.tmf.data = QLA_FUNCTION_FAILED;
>+  iocb->u.tmf.data = QLA_FUNCTION_FAILED;
>   }
>   }
> 
>@@ -1978,7 +1978,7 @@ qla25xx_process_bidir_status_iocb(scsi_qla_host_t
>*vha, void *pkt,
>   rval = EXT_STATUS_ERR;
>   break;
>   }
>-  bsg_job->reply->reply_payload_rcv_len = 0;
>+  bsg_job->reply->reply_payload_rcv_len = 0;
> 
> done:
>   /* Return the vendor specific reply to API */
>diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
>index b359a83..bb0ee7c 100644
>--- a/drivers/scsi/qla2xxx/qla_nx.c
>+++ b/drivers/scsi/qla2xxx/qla_nx.c
>@@ -1835,7 +1835,7 @@ qla82xx_set_product_offset(struct qla_hw_data *ha)
> 
>   ptab_desc = qla82xx_get_table_desc(unirom,
>QLA82XX_URI_DIR_SECT_PRODUCT_TBL);
>-   if (!ptab_desc)
>+  if (!ptab_desc)
>   return -1;
> 
>   entries = cpu_to_le32(ptab_desc->num_entries);
>diff --git a/drivers/scsi/qla2xxx/qla_nx2.c
>b/drivers/scsi/qla2xxx/qla_nx2.c
>index b8ceb82..007192d 100644
>--- a/drivers/scsi/qla2xxx/qla_nx2.c
>+++ b/drivers/scsi/qla2xxx/qla_nx2.c
>@@ -397,11 +397,11 @@ qla8044_idc_lock(struct qla_hw_data *ha)
>* has the lock, wait for 2secs
>* and retry
>*/
>-   ql_dbg(ql_dbg_p3p, vha, 0xb08a,
>-   "%s: IDC lock Recovery by %d "
>-   "failed, Retrying timeout\n", __func__,
>-   ha->portnum);
>-   timeout = 0;
>+  ql_dbg(ql_dbg_p3p, vha, 0xb08a,
>+ "%s: IDC lock Recovery by %d "
>+ "failed, Retrying timeout\n", __func__,
>+ ha->portnum);
>+  timeout = 0;
>   }
>   }
>   msleep(QLA8044_DRV_LOCK_MSLEEP);
>@@ -3138,8 +3138,7 @@ qla8044_minidump_process_rdmdio(struct
>scsi_qla_host *vha,
>   goto error;
> 
>   addr7 = addr2 - (4 * stride1);
>-  data = qla8044_ipmdio_rd_reg(vha, addr1, addr3,
>-  mask, addr7);
>+  data = qla8044_ipmdio_rd_reg(vha, addr1, addr3, mask, addr7);
>   if (data == -1)
>   goto error;
> 
>-- 
>2.1.4
>

Looks good.

Acked-by: Himanshu Madhani 


>

<>

Re: [PATCH 09/10] qla2xxx: Comment out unreachable code

2015-06-10 Thread Himanshu Madhani


On 6/4/15, 3:57 PM, "Bart Van Assche"  wrote:

>Comment out the code that is never reached in qla83xx_idc_unlock()
>and also in qlt_set_data_offset() to avoid that static source code
>analysis tools report warnings for this code.
>
>Signed-off-by: Bart Van Assche 
>Cc: Himanshu Madhani 
>Cc: Quinn Tran 
>Cc: Saurav Kashyap 
>---
> drivers/scsi/qla2xxx/qla_os.c |  7 ++-
> drivers/scsi/qla2xxx/qla_target.c | 16 +---
> 2 files changed, 15 insertions(+), 8 deletions(-)
>
>diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
>index 0ababd5..5a5166b 100644
>--- a/drivers/scsi/qla2xxx/qla_os.c
>+++ b/drivers/scsi/qla2xxx/qla_os.c
>@@ -4417,7 +4417,10 @@ retry_lock2:
> void
> qla83xx_idc_unlock(scsi_qla_host_t *base_vha, uint16_t requester_id)
> {
>-  uint16_t options = (requester_id << 15) | BIT_7, retry;
>+#if 0
>+  uint16_t options = (requester_id << 15) | BIT_7;
>+#endif
>+  uint16_t retry;
>   uint32_t data;
>   struct qla_hw_data *ha = base_vha->hw;
> 
>@@ -4453,6 +4456,7 @@ retry_unlock:
> 
>   return;
> 
>+#if 0
>   /* XXX: IDC-unlock implementation using access-control mbx */
>   retry = 0;
> retry_unlock2:
>@@ -4468,6 +4472,7 @@ retry_unlock2:
>   }
> 
>   return;
>+#endif
> }
> 
> int
>diff --git a/drivers/scsi/qla2xxx/qla_target.c
>b/drivers/scsi/qla2xxx/qla_target.c
>index 59a0897..22a91a3 100644
>--- a/drivers/scsi/qla2xxx/qla_target.c
>+++ b/drivers/scsi/qla2xxx/qla_target.c
>@@ -3699,6 +3699,14 @@ static int qlt_24xx_handle_els(struct
>scsi_qla_host *vha,
> 
> static int qlt_set_data_offset(struct qla_tgt_cmd *cmd, uint32_t offset)
> {
>+#if 1
>+  /*
>+   * FIXME: Reject non zero SRR relative offset until we can test
>+   * this code properly.
>+   */
>+  pr_debug("Rejecting non zero SRR rel_offs: %u\n", offset);
>+  return -1;
>+#else
>   struct scatterlist *sg, *sgp, *sg_srr, *sg_srr_start = NULL;
>   size_t first_offset = 0, rem_offset = offset, tmp = 0;
>   int i, sg_srr_cnt, bufflen = 0;
>@@ -3708,13 +3716,6 @@ static int qlt_set_data_offset(struct qla_tgt_cmd
>*cmd, uint32_t offset)
>   "cmd->sg_cnt: %u, direction: %d\n",
>   cmd, cmd->sg, cmd->sg_cnt, cmd->dma_data_direction);
> 
>-  /*
>-   * FIXME: Reject non zero SRR relative offset until we can test
>-   * this code properly.
>-   */
>-  pr_debug("Rejecting non zero SRR rel_offs: %u\n", offset);
>-  return -1;
>-
>   if (!cmd->sg || !cmd->sg_cnt) {
>   ql_dbg(ql_dbg_tgt, cmd->vha, 0xe055,
>   "Missing cmd->sg or zero cmd->sg_cnt in"
>@@ -3797,6 +3798,7 @@ static int qlt_set_data_offset(struct qla_tgt_cmd
>*cmd, uint32_t offset)
>   BUG();
> 
>   return 0;
>+#endif
> }
> 
> static inline int qlt_srr_adjust_data(struct qla_tgt_cmd *cmd,
>-- 
>2.1.4
>

Looks good. 

Acked-by: Himanshu Madhani 


>

<>

[Patch V2 9/9] [SCSI] aacraid: Update driver version

2015-06-10 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 3df0dfb..1627928 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 V2 8/9] [SCSI] aacraid: Send commit-config to controller firmware

2015-06-10 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.

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 1142c28..3df0dfb 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 V2 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq

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

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

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(cpu, cpu_online_mask);
+   }
+   } else {
+   dev->aac_

[Patch V2 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend

2015-06-10 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.

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 8020348..1142c28 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 V2 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set

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

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

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(srbreply->data_xfer_length)
+   < scsicmd->under

[Patch V2 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller

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

Description:
Enable MSI interrupt mode for series-6 controller.

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 V2 0/9] [SCSI] aacraid: Patchset for aacraid driver version 41010

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

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

V2:
* Removed IRQF_DISABLED
* Removed unwanted macro definition "sa_writeq"
* Replaced pci_enable_msix()with "pci_enable_msix_exact()"


Rajinikanth Pandurangan (9):
  [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Enable MSI interrupt 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

 drivers/scsi/aacraid/aachba.c   | 263 +---
 drivers/scsi/aacraid/aacraid.h  |  18 ++-
 drivers/scsi/aacraid/comminit.c | 155 ---
 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, 491 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 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",
+

[Patch V2 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

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

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

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 V2 4/9] [SCSI] aacraid: Enable 64-bit write to controller register

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

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

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 e0a76d5..e4ff47e 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 V2 0/9] [SCSI] aacraid: Patchset for aacraid driver version 41010

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

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

V2:
* Removed IRQF_DISABLED
* Removed unwanted macro definition "sa_writeq"
* Replaced pci_enable_msix()with "pci_enable_msix_exact()"


Rajinikanth Pandurangan (9):
  [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Enable MSI interrupt 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

 drivers/scsi/aacraid/aachba.c   | 263 +---
 drivers/scsi/aacraid/aacraid.h  |  18 ++-
 drivers/scsi/aacraid/comminit.c | 155 ---
 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, 491 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


Re: [PATCH 0/2] target: 64-bit LUN support

2015-06-10 Thread Andy Grover

On 06/09/2015 11:41 PM, Hannes Reinecke wrote:

Hi Nic,

here's now the patchset for making LIO-target support 64-bit LUNs.
Pretty straightforward, plus an additional patch to remove the
now obsolete limitation on 256 LUNs per TPG. There had been a
comment in the header that REPORT LUN emulation would only support
up to one page in payload, but I couldn't find any evidence for
this in the code.

As usual, comments and reviews are welcome.


Hi Hannes,

I think we also need to take care of how we report LUNs in spc.c 
spc_emulate_report_luns(). From reading SAM-5 4.7.7 (addressing methods) 
it looks like we're currently using the simple addressing format 
(address method = 0) and if we want to report more than 14 bits we would 
need to report the luns with a different addressing format.


I'm wondering if this could be seen as a bug in int_to_scsilun, but in 
any case I hope you'll take a look and make sure we're ok?


Thanks -- Regards -- Andy

--
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 2/9] qla2xxx: Enable target mode for ISP27XX

2015-06-10 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_attr.c   |2 +-
 drivers/scsi/qla2xxx/qla_def.h|8 
 drivers/scsi/qla2xxx/qla_init.c   |4 ++--
 drivers/scsi/qla2xxx/qla_mbx.c|7 ---
 drivers/scsi/qla2xxx/qla_os.c |1 +
 drivers/scsi/qla2xxx/qla_sup.c|2 +-
 drivers/scsi/qla2xxx/qla_target.c |2 +-
 7 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 82b92c4..437254e 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -738,7 +738,7 @@ qla2x00_sysfs_write_reset(struct file *filp, struct kobject 
*kobj,
ql_log(ql_log_info, vha, 0x706f,
"Issuing MPI reset.\n");
 
-   if (IS_QLA83XX(ha)) {
+   if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
uint32_t idc_control;
 
qla83xx_idc_lock(vha, 0);
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index e86201d..787f901 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3154,13 +3154,13 @@ struct qla_hw_data {
 /* Bit 21 of fw_attributes decides the MCTP capabilities */
 #define IS_MCTP_CAPABLE(ha)(IS_QLA2031(ha) && \
((ha)->fw_attributes_ext[0] & BIT_0))
-#define IS_PI_UNINIT_CAPABLE(ha)   (IS_QLA83XX(ha))
-#define IS_PI_IPGUARD_CAPABLE(ha)  (IS_QLA83XX(ha))
+#define IS_PI_UNINIT_CAPABLE(ha)   (IS_QLA83XX(ha) || IS_QLA27XX(ha))
+#define IS_PI_IPGUARD_CAPABLE(ha)  (IS_QLA83XX(ha) || IS_QLA27XX(ha))
 #define IS_PI_DIFB_DIX0_CAPABLE(ha)(0)
-#define IS_PI_SPLIT_DET_CAPABLE_HBA(ha)(IS_QLA83XX(ha))
+#define IS_PI_SPLIT_DET_CAPABLE_HBA(ha)(IS_QLA83XX(ha) || 
IS_QLA27XX(ha))
 #define IS_PI_SPLIT_DET_CAPABLE(ha)(IS_PI_SPLIT_DET_CAPABLE_HBA(ha) && \
 (((ha)->fw_attributes_h << 16 | (ha)->fw_attributes) & BIT_22))
-#define IS_ATIO_MSIX_CAPABLE(ha) (IS_QLA83XX(ha))
+#define IS_ATIO_MSIX_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha))
 #define IS_TGT_MODE_CAPABLE(ha)(ha->tgt.atio_q_length)
 #define IS_SHADOW_REG_CAPABLE(ha)  (IS_QLA27XX(ha))
 #define IS_DPORT_CAPABLE(ha)  (IS_QLA83XX(ha) || IS_QLA27XX(ha))
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3c1550a..6e6cce8 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1538,7 +1538,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
mem_size = (ha->fw_memory_size - 0x11000 + 1) *
sizeof(uint16_t);
} else if (IS_FWI2_CAPABLE(ha)) {
-   if (IS_QLA83XX(ha))
+   if (IS_QLA83XX(ha) || IS_QLA27XX(ha))
fixed_size = offsetof(struct qla83xx_fw_dump, ext_mem);
else if (IS_QLA81XX(ha))
fixed_size = offsetof(struct qla81xx_fw_dump, ext_mem);
@@ -1550,7 +1550,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vha)
mem_size = (ha->fw_memory_size - 0x10 + 1) *
sizeof(uint32_t);
if (ha->mqenable) {
-   if (!IS_QLA83XX(ha))
+   if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha))
mq_size = sizeof(struct qla2xxx_mq_chain);
/*
 * Allocate maximum buffer size for all queues.
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 02b1c1c..b2f713a 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2415,7 +2415,8 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *vha, uint16_t 
*cur_xchg_cnt,
*orig_iocb_cnt = mcp->mb[10];
if (vha->hw->flags.npiv_supported && max_npiv_vports)
*max_npiv_vports = mcp->mb[11];
-   if ((IS_QLA81XX(vha->hw) || IS_QLA83XX(vha->hw)) && max_fcfs)
+   if ((IS_QLA81XX(vha->hw) || IS_QLA83XX(vha->hw) ||
+   IS_QLA27XX(vha->hw)) && max_fcfs)
*max_fcfs = mcp->mb[12];
}
 
@@ -3898,7 +3899,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct 
rsp_que *rsp)
spin_lock_irqsave(&ha->hardware_lock, flags);
if (!(rsp->options & BIT_0)) {
WRT_REG_DWORD(rsp->rsp_q_out, 0);
-   if (!IS_QLA83XX(ha))
+   if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha))
WRT_REG_DWORD(rsp->rsp_q_in, 0);
}
 
@@ -5345,7 +5346,7 @@ qla83xx_restart_nic_firmware(scsi_qla_host_t *vha)
mbx_cmd_t *mcp = &mc;
struct qla_hw_data *ha = vha->hw;
 
-   if (!IS_QLA83XX(ha))
+   if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha))
return QLA_FUNCTION_FAILED;
 
ql_dbg(ql_dbg_mbx, vha, 0x1143, "Entered %s.\n", __func__);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/

[PATCH 0/9] qla2xxx: Patches for scsi "misc" branch.

2015-06-10 Thread Himanshu Madhani
Hi James,

Please apply the following patches to the scsi tree at your earliest
convenience for inclusion in the next mainline merge window.

Thanks,
Himanshu

Himanshu Madhani (3):
  qla2xxx: Enable target mode for ISP27XX
  qla2xxx: Remove msleep in qlt_send_term_exchange
  qla2xxx: Enable Target counters in DebugFS.

Kanoj Sarcar (1):
  qla2xxx: fix command initialization in target mode.

Quinn Tran (4):
  qla2xxx: Add flush after updating ATIOQ consumer index.
  qla2xxx: release request queue reservation.
  qla2xxx: adjust debug flags
  qla2xxx: Add FW resource count in DebugFS.

Saurav Kashyap (1):
  qla2xxx: Fix hardware lock/unlock issue causing kernel panic.

 drivers/scsi/qla2xxx/qla_attr.c|2 +-
 drivers/scsi/qla2xxx/qla_def.h |   36 ++---
 drivers/scsi/qla2xxx/qla_dfs.c |  106 
 drivers/scsi/qla2xxx/qla_gbl.h |3 +-
 drivers/scsi/qla2xxx/qla_init.c|   20 ---
 drivers/scsi/qla2xxx/qla_iocb.c|1 +
 drivers/scsi/qla2xxx/qla_mbx.c |   31 +--
 drivers/scsi/qla2xxx/qla_os.c  |1 +
 drivers/scsi/qla2xxx/qla_sup.c |2 +-
 drivers/scsi/qla2xxx/qla_target.c  |   60 -
 drivers/scsi/qla2xxx/qla_target.h  |3 +
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |9 ++-
 12 files changed, 208 insertions(+), 66 deletions(-)

-- 
1.7.7

--
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 3/9] qla2xxx: Add flush after updating ATIOQ consumer index.

2015-06-10 Thread Himanshu Madhani
From: Quinn Tran 

After updating the consumer index of ATIO Q, a read is
required to flush the write to the adapter register.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index c70754b..1f9a41a 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -5550,6 +5550,7 @@ qlt_24xx_process_atio_queue(struct scsi_qla_host *vha)
 
/* Adjust ring index */
WRT_REG_DWORD(ISP_ATIO_Q_OUT(vha), ha->tgt.atio_ring_index);
+   RD_REG_DWORD_RELAXED(ISP_ATIO_Q_OUT(vha));
 }
 
 void
-- 
1.7.7

--
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: lpfc: Fix rport leak.

2015-06-10 Thread Dan Carpenter
Hello James Smart,

This is a semi-automatic email about new static checker warnings.

The patch 466e840b7809: "lpfc: Fix rport leak." from May 21, 2015, 
leads to the following Smatch complaint:

drivers/scsi/lpfc/lpfc_hbadisc.c:3905 lpfc_register_remote_port()
 error: we previously assumed 'rdata' could be null (see line 3903)

drivers/scsi/lpfc/lpfc_hbadisc.c
  3902  ndlp->rport = NULL;
  3903  if (rdata && rdata->pnode == ndlp)
^
Patch introduces a new check.

  3904  lpfc_nlp_put(ndlp);
  3905  rdata->pnode = NULL;

Unchecked dereference.

  3906  /* drop reference for earlier registeration */
  3907  put_device(&rport->dev);

regards,
dan carpenter
--
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 9/9] qla2xxx: Add FW resource count in DebugFS.

2015-06-10 Thread Himanshu Madhani
From: Quinn Tran 

DebugFS now will show fw_resource_count node.

FW Resource count

Original TGT exchg count[0]
current TGT exchg count[0]
original Initiator Exchange count[2048]
Current Initiator Exchange count[2048]
Original IOCB count[2078]
Current IOCB count[2067]
MAX VP count[254]
MAX FCF count[0]

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |   13 +++--
 drivers/scsi/qla2xxx/qla_dfs.c |   50 
 drivers/scsi/qla2xxx/qla_gbl.h |3 +-
 drivers/scsi/qla2xxx/qla_init.c|   12 +++-
 drivers/scsi/qla2xxx/qla_mbx.c |   28 ---
 drivers/scsi/qla2xxx/qla_target.c  |4 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |2 +-
 7 files changed, 81 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index a87e42b..a47374d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2913,7 +2913,7 @@ struct qlt_hw_data {
 #define MAX_QFULL_CMDS_ALLOC   8192
 #define Q_FULL_THRESH_HOLD_PERCENT 90
 #define Q_FULL_THRESH_HOLD(ha) \
-   ((ha->fw_xcb_count/100) * Q_FULL_THRESH_HOLD_PERCENT)
+   ((ha->cur_fw_xcb_count/100) * Q_FULL_THRESH_HOLD_PERCENT)
 
 #define LEAK_EXCHG_THRESH_HOLD_PERCENT 75  /* 75 percent */
 
@@ -3273,8 +3273,14 @@ struct qla_hw_data {
 #define RISC_START_ADDRESS_2100 0x1000
 #define RISC_START_ADDRESS_2300 0x800
 #define RISC_START_ADDRESS_2400 0x10
-   uint16_tfw_xcb_count;
-   uint16_tfw_iocb_count;
+
+   uint16_torig_fw_tgt_xcb_count;
+   uint16_tcur_fw_tgt_xcb_count;
+   uint16_torig_fw_xcb_count;
+   uint16_tcur_fw_xcb_count;
+   uint16_torig_fw_iocb_count;
+   uint16_tcur_fw_iocb_count;
+   uint16_tfw_max_fcf_count;
 
uint32_tfw_shared_ram_start;
uint32_tfw_shared_ram_end;
@@ -3317,6 +3323,7 @@ struct qla_hw_data {
struct dentry *dfs_dir;
struct dentry *dfs_fce;
 struct dentry *dfs_tgt_counters;
+   struct dentry *dfs_fw_resource_cnt;
 
dma_addr_t  fce_dma;
void*fce;
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 2f50c08..597abbc 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -13,6 +13,43 @@ static struct dentry *qla2x00_dfs_root;
 static atomic_t qla2x00_dfs_root_count;
 
 static int
+qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
+{
+   struct scsi_qla_host *vha = s->private;
+   struct qla_hw_data *ha = vha->hw;
+
+   seq_puts(s, "FW Resource count\n\n");
+   seq_printf(s, "Original TGT exchg count[%d]\n",
+   ha->orig_fw_tgt_xcb_count);
+   seq_printf(s, "current TGT exchg count[%d]\n",
+   ha->cur_fw_tgt_xcb_count);
+   seq_printf(s, "original Initiator Exchange count[%d]\n",
+   ha->orig_fw_xcb_count);
+   seq_printf(s, "Current Initiator Exchange count[%d]\n",
+   ha->cur_fw_xcb_count);
+   seq_printf(s, "Original IOCB count[%d]\n", ha->orig_fw_iocb_count);
+   seq_printf(s, "Current IOCB count[%d]\n", ha->cur_fw_iocb_count);
+   seq_printf(s, "MAX VP count[%d]\n", ha->max_npiv_vports);
+   seq_printf(s, "MAX FCF count[%d]\n", ha->fw_max_fcf_count);
+
+   return 0;
+}
+
+static int
+qla_dfs_fw_resource_cnt_open(struct inode *inode, struct file *file)
+{
+   struct scsi_qla_host *vha = inode->i_private;
+   return single_open(file, qla_dfs_fw_resource_cnt_show, vha);
+}
+
+static const struct file_operations dfs_fw_resource_cnt_ops = {
+   .open   = qla_dfs_fw_resource_cnt_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
+static int
 qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
 {
 struct scsi_qla_host *vha = s->private;
@@ -188,6 +225,14 @@ create_dir:
atomic_inc(&qla2x00_dfs_root_count);
 
 create_nodes:
+   ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
+   S_IRUSR, ha->dfs_dir, vha, &dfs_fw_resource_cnt_ops);
+   if (!ha->dfs_fw_resource_cnt) {
+   ql_log(ql_log_warn, vha, 0x00fd,
+   "Unable to create debugFS fw_resource_count node.\n");
+   goto out;
+   }
+
ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
ha->dfs_dir, vha, &dfs_tgt_counters_ops);
if (!ha->dfs_tgt_counters) {
@@ -212,6 +257,11 @@ qla2x00_dfs_remove(scsi_qla_host_t *vha)
 {
struct qla_hw_data *ha = vha->hw;
 
+   if (ha->dfs_fw_resource_cnt) {
+   debugfs_remove(ha->dfs_fw_resource_cnt);
+   ha->dfs_fw_resource_cnt = NULL;
+   }
+
if (ha->dfs_tgt_counters) {
debugfs_remove(ha->dfs_tgt_counters);
ha->d

[PATCH 6/9] qla2xxx: Remove msleep in qlt_send_term_exchange

2015-06-10 Thread Himanshu Madhani
Remove unnecessary msleep from qlt_send_term_exchange as it
adds latency of 250 msec while sending terminate exchange to
an aborted task.

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_target.c |   13 +++--
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 2477602..b72cda6 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2715,7 +2715,7 @@ static int __qlt_send_term_exchange(struct scsi_qla_host 
*vha,
 static void qlt_send_term_exchange(struct scsi_qla_host *vha,
struct qla_tgt_cmd *cmd, struct atio_from_isp *atio, int ha_locked)
 {
-   unsigned long flags;
+   unsigned long flags = 0;
int rc;
 
if (qlt_issue_marker(vha, ha_locked) < 0)
@@ -2731,17 +2731,18 @@ static void qlt_send_term_exchange(struct scsi_qla_host 
*vha,
rc = __qlt_send_term_exchange(vha, cmd, atio);
if (rc == -ENOMEM)
qlt_alloc_qfull_cmd(vha, atio, 0, 0);
-   spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
 
 done:
if (cmd && ((cmd->state != QLA_TGT_STATE_ABORTED) ||
!cmd->cmd_sent_to_fw)) {
-   if (!ha_locked && !in_interrupt())
-   msleep(250); /* just in case */
-
-   qlt_unmap_sg(vha, cmd);
+   if (cmd->sg_mapped)
+   qlt_unmap_sg(vha, cmd);
vha->hw->tgt.tgt_ops->free_cmd(cmd);
}
+
+   if (!ha_locked)
+   spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
+
return;
 }
 
-- 
1.7.7

--
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 5/9] qla2xxx: adjust debug flags

2015-06-10 Thread Himanshu Madhani
From: Quinn Tran 

Adjust debug flag to match debug comment.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c  |7 ---
 drivers/scsi/qla2xxx/qla_target.h  |3 +++
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |3 +--
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 75eb042..2477602 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3015,7 +3015,7 @@ qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, 
struct qla_tgt_cmd *cmd)
dump_stack();
}
 
-   cmd->cmd_flags |= BIT_12;
+   cmd->cmd_flags |= BIT_17;
ha->tgt.tgt_ops->free_cmd(cmd);
 }
 
@@ -3177,7 +3177,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
 skip_term:
 
if (cmd->state == QLA_TGT_STATE_PROCESSED) {
-   ;
+   cmd->cmd_flags |= BIT_12;
} else if (cmd->state == QLA_TGT_STATE_NEED_DATA) {
int rx_status = 0;
 
@@ -3191,9 +3191,11 @@ skip_term:
ha->tgt.tgt_ops->handle_data(cmd);
return;
} else if (cmd->state == QLA_TGT_STATE_ABORTED) {
+   cmd->cmd_flags |= BIT_18;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e,
"Aborted command %p (tag %d) finished\n", cmd, cmd->tag);
} else {
+   cmd->cmd_flags |= BIT_19;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf05c,
"qla_target(%d): A command in state (%d) should "
"not return a CTIO complete\n", vha->vp_idx, cmd->state);
@@ -3205,7 +3207,6 @@ skip_term:
dump_stack();
}
 
-
ha->tgt.tgt_ops->free_cmd(cmd);
 }
 
diff --git a/drivers/scsi/qla2xxx/qla_target.h 
b/drivers/scsi/qla2xxx/qla_target.h
index 3320867..462edbc 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -962,6 +962,9 @@ struct qla_tgt_cmd {
 * BIT_14 - Back end data received/sent.
 * BIT_15 - SRR prepare ctio
 * BIT_16 - complete free
+* BIT_17 - flush - qlt_abort_cmd_on_host_reset
+* BIT_18 - completion w/abort status
+* BIT_19 - completion w/unknown status
 */
uint32_t cmd_flags;
 };
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c 
b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 5c9e680..e9893e7 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -489,7 +489,7 @@ static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd)
 {
struct qla_tgt_cmd *cmd = container_of(se_cmd,
struct qla_tgt_cmd, se_cmd);
-
+   cmd->cmd_flags |= BIT_3;
cmd->bufflen = se_cmd->data_length;
cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
 
@@ -674,7 +674,6 @@ static int tcm_qla2xxx_queue_data_in(struct se_cmd *se_cmd)
cmd->sg_cnt = se_cmd->t_data_nents;
cmd->sg = se_cmd->t_data_sg;
cmd->offset = 0;
-   cmd->cmd_flags |= BIT_3;
 
cmd->prot_sg_cnt = se_cmd->t_prot_nents;
cmd->prot_sg = se_cmd->t_prot_sg;
-- 
1.7.7

--
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 8/9] qla2xxx: Enable Target counters in DebugFS.

2015-06-10 Thread Himanshu Madhani
Following counters are added in target mode to help debugging efforts.

Target Counters

qla_core_sbt_cmd = 0
qla_core_ret_sta_ctio = 0
qla_core_ret_ctio = 0
core_qla_que_buf = 0
core_qla_snd_status = 0
core_qla_free_cmd = 0
num alloc iocb failed = 0
num term exchange sent = 0
num Q full sent = 0

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_def.h |   15 +
 drivers/scsi/qla2xxx/qla_dfs.c |   56 
 drivers/scsi/qla2xxx/qla_iocb.c|1 +
 drivers/scsi/qla2xxx/qla_target.c  |7 
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |4 ++
 5 files changed, 83 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 787f901..a87e42b 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3316,6 +3316,8 @@ struct qla_hw_data {
uint32_tchain_offset;
struct dentry *dfs_dir;
struct dentry *dfs_fce;
+struct dentry *dfs_tgt_counters;
+
dma_addr_t  fce_dma;
void*fce;
uint32_tfce_bufs;
@@ -3473,6 +3475,18 @@ struct qla_hw_data {
int allow_cna_fw_dump;
 };
 
+struct qla_tgt_counters {
+   uint64_t qla_core_sbt_cmd;
+   uint64_t core_qla_que_buf;
+   uint64_t qla_core_ret_ctio;
+   uint64_t core_qla_snd_status;
+   uint64_t qla_core_ret_sta_ctio;
+   uint64_t core_qla_free_cmd;
+   uint64_t num_q_full_sent;
+   uint64_t num_alloc_iocb_failed;
+   uint64_t num_term_xchg_sent;
+};
+
 /*
  * Qlogic scsi host structure
  */
@@ -3615,6 +3629,7 @@ typedef struct scsi_qla_host {
 
atomic_tvref_count;
struct qla8044_reset_template reset_tmplt;
+   struct qla_tgt_counters tgt_counters;
 } scsi_qla_host_t;
 
 #define SET_VP_IDX 1
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 15cf074..2f50c08 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -13,6 +13,48 @@ static struct dentry *qla2x00_dfs_root;
 static atomic_t qla2x00_dfs_root_count;
 
 static int
+qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
+{
+struct scsi_qla_host *vha = s->private;
+
+   seq_puts(s, "Target Counters\n");
+   seq_printf(s, "qla_core_sbt_cmd = %lld\n",
+   vha->tgt_counters.qla_core_sbt_cmd);
+   seq_printf(s, "qla_core_ret_sta_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_sta_ctio);
+   seq_printf(s, "qla_core_ret_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_ctio);
+   seq_printf(s, "core_qla_que_buf = %lld\n",
+   vha->tgt_counters.core_qla_que_buf);
+   seq_printf(s, "core_qla_snd_status = %lld\n",
+   vha->tgt_counters.core_qla_snd_status);
+   seq_printf(s, "core_qla_free_cmd = %lld\n",
+   vha->tgt_counters.core_qla_free_cmd);
+   seq_printf(s, "num alloc iocb failed = %lld\n",
+   vha->tgt_counters.num_alloc_iocb_failed);
+   seq_printf(s, "num term exchange sent = %lld\n",
+   vha->tgt_counters.num_term_xchg_sent);
+   seq_printf(s, "num Q full sent = %lld\n",
+   vha->tgt_counters.num_q_full_sent);
+
+   return 0;
+}
+
+static int
+qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
+{
+   struct scsi_qla_host *vha = inode->i_private;
+   return single_open(file, qla_dfs_tgt_counters_show, vha);
+}
+
+static const struct file_operations dfs_tgt_counters_ops = {
+   .open   = qla_dfs_tgt_counters_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
+static int
 qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 {
scsi_qla_host_t *vha = s->private;
@@ -146,6 +188,14 @@ create_dir:
atomic_inc(&qla2x00_dfs_root_count);
 
 create_nodes:
+   ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
+   ha->dfs_dir, vha, &dfs_tgt_counters_ops);
+   if (!ha->dfs_tgt_counters) {
+   ql_log(ql_log_warn, vha, 0x00fc,
+   "Unable to create debugFS tgt_counters node.\n");
+   goto out;
+   }
+
ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
&dfs_fce_ops);
if (!ha->dfs_fce) {
@@ -161,6 +211,12 @@ int
 qla2x00_dfs_remove(scsi_qla_host_t *vha)
 {
struct qla_hw_data *ha = vha->hw;
+
+   if (ha->dfs_tgt_counters) {
+   debugfs_remove(ha->dfs_tgt_counters);
+   ha->dfs_tgt_counters = NULL;
+   }
+
if (ha->dfs_fce) {
debugfs_remove(ha->dfs_fce);
ha->dfs_fce = NULL;
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index a1ab25f..333910e 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ 

[PATCH 1/9] qla2xxx: Fix hardware lock/unlock issue causing kernel panic.

2015-06-10 Thread Himanshu Madhani
From: Saurav Kashyap 

[ Upstream commit ef86cb2059a14b4024c7320999ee58e938873032 ]

This patch fixes a kernel panic for qla2xxx Target core
Module driver introduced by a fix in the qla2xxx initiator code.

Commit ef86cb2 ("qla2xxx: Mark port lost when we receive an RSCN for it.")
introduced the regression for qla2xxx Target driver.

Stack trace will have following signature

 ---  ---
[88081faa3cc8] _raw_spin_lock_irqsave at 815b1f03
[88081faa3cd0] qlt_fc_port_deleted at a096ccd0 [qla2xxx]
[88081faa3d20] qla2x00_schedule_rport_del at a0913831[qla2xxx]
[88081faa3d50] qla2x00_mark_device_lost at a09159c5[qla2xxx]
[88081faa3db0] qla2x00_async_event at a0938d59 [qla2xxx]
[88081faa3e30] qla24xx_msix_default at a093a326 [qla2xxx]
[88081faa3e90] handle_irq_event_percpu at 810a7b8d
[88081faa3ee0] handle_irq_event at 810a7d32
[88081faa3f10] handle_edge_irq at 810ab6b9
[88081faa3f30] handle_irq at 8100619c
[88081faa3f70] do_IRQ at 815b4b1c
 ---  ---

Cc: 
Signed-off-by: Saurav Kashyap 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c   |4 
 drivers/scsi/qla2xxx/qla_target.c |6 --
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 285cb20..3c1550a 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2924,6 +2924,7 @@ qla2x00_rport_del(void *data)
struct fc_rport *rport;
scsi_qla_host_t *vha = fcport->vha;
unsigned long flags;
+   unsigned long vha_flags;
 
spin_lock_irqsave(fcport->vha->host->host_lock, flags);
rport = fcport->drport ? fcport->drport: fcport->rport;
@@ -2935,7 +2936,9 @@ qla2x00_rport_del(void *data)
 * Release the target mode FC NEXUS in qla_target.c code
 * if target mod is enabled.
 */
+   spin_lock_irqsave(&vha->hw->hardware_lock, vha_flags);
qlt_fc_port_deleted(vha, fcport);
+   spin_unlock_irqrestore(&vha->hw->hardware_lock, vha_flags);
}
 }
 
@@ -3303,6 +3306,7 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t 
*fcport)
 * Create target mode FC NEXUS in qla_target.c if target mode is
 * enabled..
 */
+
qlt_fc_port_added(vha, fcport);
 
spin_lock_irqsave(fcport->vha->host->host_lock, flags);
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index fe8a8d1..ed39ed2 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -782,10 +782,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, 
fc_port_t *fcport)
 
 void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport)
 {
-   struct qla_hw_data *ha = vha->hw;
struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
struct qla_tgt_sess *sess;
-   unsigned long flags;
 
if (!vha->hw->tgt.tgt_ops)
return;
@@ -793,14 +791,11 @@ void qlt_fc_port_deleted(struct scsi_qla_host *vha, 
fc_port_t *fcport)
if (!tgt || (fcport->port_type != FCT_INITIATOR))
return;
 
-   spin_lock_irqsave(&ha->hardware_lock, flags);
if (tgt->tgt_stop) {
-   spin_unlock_irqrestore(&ha->hardware_lock, flags);
return;
}
sess = qlt_find_sess_by_port_name(tgt, fcport->port_name);
if (!sess) {
-   spin_unlock_irqrestore(&ha->hardware_lock, flags);
return;
}
 
@@ -808,7 +803,6 @@ void qlt_fc_port_deleted(struct scsi_qla_host *vha, 
fc_port_t *fcport)
 
sess->local = 1;
qlt_schedule_sess_for_deletion(sess, false);
-   spin_unlock_irqrestore(&ha->hardware_lock, flags);
 }
 
 static inline int test_tgt_sess_count(struct qla_tgt *tgt)
-- 
1.7.7

--
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 4/9] qla2xxx: release request queue reservation.

2015-06-10 Thread Himanshu Madhani
From: Quinn Tran 

Request IOCB queue element(s) is reserved during
good path IO.  Under error condition such as unable
to allocate IOCB handle condition, the IOCB count
that was reserved is not released.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c |   10 +++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 1f9a41a..75eb042 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2341,9 +2341,10 @@ int qlt_xmit_response(struct qla_tgt_cmd *cmd, int 
xmit_type,
res = qlt_build_ctio_crc2_pkt(&prm, vha);
else
res = qlt_24xx_build_ctio_pkt(&prm, vha);
-   if (unlikely(res != 0))
+   if (unlikely(res != 0)) {
+   vha->req->cnt += full_req_cnt;
goto out_unmap_unlock;
-
+   }
 
pkt = (struct ctio7_to_24xx *)prm.pkt;
 
@@ -2481,8 +2482,11 @@ int qlt_rdy_to_xfer(struct qla_tgt_cmd *cmd)
else
res = qlt_24xx_build_ctio_pkt(&prm, vha);
 
-   if (unlikely(res != 0))
+   if (unlikely(res != 0)) {
+   vha->req->cnt += prm.req_cnt;
goto out_unlock_free_unmap;
+   }
+
pkt = (struct ctio7_to_24xx *)prm.pkt;
pkt->u.status0.flags |= __constant_cpu_to_le16(CTIO7_FLAGS_DATA_OUT |
CTIO7_FLAGS_STATUS_MODE_0);
-- 
1.7.7

--
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 7/9] qla2xxx: fix command initialization in target mode.

2015-06-10 Thread Himanshu Madhani
From: Kanoj Sarcar 

Signed-off-by: Kanoj Sarcar 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_target.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index b72cda6..7c43cf8 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3347,6 +3347,11 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t 
*vha,
cmd->loop_id = sess->loop_id;
cmd->conf_compl_supported = sess->conf_compl_supported;
 
+   cmd->cmd_flags = 0;
+   cmd->jiffies_at_alloc = get_jiffies_64();
+
+   cmd->reset_count = vha->hw->chip_reset;
+
return cmd;
 }
 
@@ -3453,11 +3458,6 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host 
*vha,
return -ENOMEM;
}
 
-   cmd->cmd_flags = 0;
-   cmd->jiffies_at_alloc = get_jiffies_64();
-
-   cmd->reset_count = vha->hw->chip_reset;
-
cmd->cmd_in_wq = 1;
cmd->cmd_flags |= BIT_0;
INIT_WORK(&cmd->work, qlt_do_work);
-- 
1.7.7

--
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: lpfc: Add support for RDP ELS command.

2015-06-10 Thread Dan Carpenter
Hello James Smart,

The patch 86478875eb4d: "lpfc: Add support for RDP ELS command." from
May 21, 2015, leads to the following static checker warning:

drivers/scsi/lpfc/lpfc_mbox.c:2307 lpfc_mbx_cmpl_rdp_page_a2()
error: dereferencing freed memory 'mp'

drivers/scsi/lpfc/lpfc_mbox.c
  2279  void
  2280  lpfc_mbx_cmpl_rdp_page_a2(struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
  2281  {
  2282  struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) mbox->context1;
  2283  struct lpfc_rdp_context *rdp_context =
  2284  (struct lpfc_rdp_context *)(mbox->context2);
  2285  
  2286  if (bf_get(lpfc_mqe_status, &mbox->u.mqe))
  2287  goto error;
  2288  
  2289  lpfc_sli_bemem_bcopy(mp->virt, &rdp_context->page_a2,
  2290  DMP_SFF_PAGE_A2_SIZE);
  2291  
  2292  /* We don't need dma buffer for link stat. */
  2293  lpfc_mbuf_free(phba, mp->virt, mp->phys);
  2294  kfree(mp);

  2295  
  2296  memset(mbox, 0, sizeof(*mbox));
  2297  lpfc_read_lnk_stat(phba, mbox);
  2298  mbox->vport = rdp_context->ndlp->vport;
  2299  mbox->mbox_cmpl = lpfc_mbx_cmpl_rdp_link_stat;
  2300  mbox->context2 = (struct lpfc_rdp_context *) rdp_context;
  2301  if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT) == 
MBX_NOT_FINISHED)
  2302  goto error;
^^
  2303  
  2304  return;
  2305  
  2306  error:
  2307  lpfc_mbuf_free(phba, mp->virt, mp->phys);
 
  2308  kfree(mp);
^
  2309  lpfc_sli4_mbox_cmd_free(phba, mbox);
  2310  rdp_context->cmpl(phba, rdp_context, FAILURE);
  2311  }



regards,
dan carpenter
--
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: lpfc: Add support for ELS LCB.

2015-06-10 Thread Dan Carpenter
Hello James Smart,

The patch 8b017a30a313: "lpfc: Add support for ELS LCB." from May 21,
2015, leads to the following static checker warning:

drivers/scsi/lpfc/lpfc_els.c:5243 lpfc_els_rcv_lcb()
error: potential null dereference 'lcb_context'.  (kmalloc returns null)

drivers/scsi/lpfc/lpfc_els.c
  5205  if (phba->sli_rev < LPFC_SLI_REV4 ||
  5206  (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
  5207  LPFC_SLI_INTF_IF_TYPE_2)) {
  5208  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5209  goto rjt;
  5210  }
  5211  lcb_context = kmalloc(sizeof(struct lpfc_lcb_context), 
GFP_KERNEL);

^^
No check for allocation failure.

  5212  
  5213  if (phba->hba_flag & HBA_FCOE_MODE) {
  5214  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5215  goto rjt;
  5216  }
  5217  if (beacon->lcb_frequency == 0) {
  5218  rjt_err = LSRJT_CMD_UNSUPPORTED;
  5219  goto rjt;
  5220  }
  5221  if ((beacon->lcb_type != LPFC_LCB_GREEN) &&
  5222  (beacon->lcb_type != LPFC_LCB_AMBER)) {

Also:
drivers/scsi/lpfc/lpfc_els.c:5261 lpfc_els_rcv_lcb()
warn: possible memory leak of 'lcb_context'

regards,
dan carpenter
--
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: [dm-devel] ALUA - rescan device capacity on zero sized block devices

2015-06-10 Thread Ewan Milne
On Mon, 2015-04-20 at 07:58 +0200, Hannes Reinecke wrote:
> On 04/19/2015 12:56 AM, Christophe Varoqui wrote:
> > About five years ago, we faced a somewhat simular issue with
> > Symmetrix arrays, where the replicated LU of a SRDF pair (R2) was
> > flagged read-only by the kernel upon discovery. Splitting the pair
> > with a symcli command  made the LU read-write from the array
> > controller point of view, but the Linux kernel would not promote it
> > read-write dynamically.
> > 
> > I don't know if the Symmetrix array also use a unit attention to
> > signal the change to the initiators. If it does, it might be worth
> > trying to address both the 3par peer persistance and the Symmetrix
> > SRDF situations.
> > 
> > On the other hand, if the SRDF R2 rw promotion issue has been fixed
> > since, the patch might give guidance about where/how to plug the
> > 3par peer persistance ghost path rescans.
> > 
> It's not only that; if you are faced with LUNs in standby even the
> kernel wouldn't detect them properly.
> 
> I'm currently debugging this issue and will have an update soon(-ish).

I have a patch set to have the kernel automatically rescan the device
when the ALUA state changes to an ACTIVE state, if it couldn't read
capacity when the device was initially probed.  I've had it for a while,
but I haven't had *any* response from the vendor if it actually works
with their product, so I haven't posted it to the list for review yet.

I did point out to them that the T10 spec does not *prohibit* supporting
the READ CAPACITY command in the ALUA standby state, which would avoid
the problem, and is what other vendors seem to do.  However, they then
raised the issue that if the capacity changes in the standby state then
they should be generating the capacity changed UA, etc and you can sort
of see their point of why this gets complicated.

-Ewan

> 
> Cheers,
> 
> Hannes
> -- 
> Dr. Hannes Reinecke  zSeries & Storage
> h...@suse.de +49 911 74053 688
> SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
> GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
> HRB 21284 (AG Nürnberg)
> 
> --
> dm-devel mailing list
> dm-de...@redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel


--
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 v6] cxlflash: Base support for IBM CXL Flash Adapter

2015-06-10 Thread Brian King
Looks good.

Reviewed-by: Brian King 

-Brian

-- 
Brian King
Power Linux I/O
IBM Linux Technology Center


--
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] megaraid_sas : Pass driver version to firmware inside IOC init frame

2015-06-10 Thread Sumit.Saxena

Signed-off-by: Sumit Saxena 
---
 drivers/scsi/megaraid/megaraid_sas.h|   10 +++---
 drivers/scsi/megaraid/megaraid_sas_base.c   |   18 ++
 drivers/scsi/megaraid/megaraid_sas_fusion.c |7 +++
 3 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas.h 
b/drivers/scsi/megaraid/megaraid_sas.h
index 20c3754..5bd4d30 100644
--- a/drivers/scsi/megaraid/megaraid_sas.h
+++ b/drivers/scsi/megaraid/megaraid_sas.h
@@ -1038,6 +1038,7 @@ struct megasas_ctrl_info {
 #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
MEGASAS_MAX_DEV_PER_CHANNEL)
 
+#define MEGASAS_MAX_NAME32
 #define MEGASAS_MAX_SECTORS(2*1024)
 #define MEGASAS_MAX_SECTORS_IEEE   (2*128)
 #define MEGASAS_DBG_LVL1
@@ -1264,17 +1265,18 @@ struct megasas_init_frame {
__le32 pad_0;   /*0Ch */
 
__le16 flags;   /*10h */
-   __le16 reserved_3;  /*12h */
+   __le16 reserved_2;  /*12h */
__le32 data_xfer_len;   /*14h */
 
__le32 queue_info_new_phys_addr_lo; /*18h */
__le32 queue_info_new_phys_addr_hi; /*1Ch */
__le32 queue_info_old_phys_addr_lo; /*20h */
__le32 queue_info_old_phys_addr_hi; /*24h */
-   __le32 reserved_4[2];   /*28h */
+   __le32 driver_ver_lo;  /*28h */
+   __le32 driver_ver_hi;  /*2Ch */
__le32 system_info_lo;  /*30h */
__le32 system_info_hi;  /*34h */
-   __le32 reserved_5[2];   /*38h */
+   __le32 reserved_3[2];   /*38h */
 
 } __attribute__ ((packed));
 
@@ -1665,6 +1667,8 @@ struct megasas_instance {
dma_addr_t producer_h;
__le32 *consumer;
dma_addr_t consumer_h;
+   __le32 *verbuf;
+   dma_addr_t verbuf_h;
struct MR_DRV_SYSTEM_INFO *system_info_buf;
dma_addr_t system_info_h;
struct MR_LD_VF_AFFILIATION *vf_affiliation;
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index a022c39..6bfb3eb 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -4252,6 +4252,14 @@ megasas_issue_init_mfi(struct megasas_instance *instance)
 
init_frame->cmd = MFI_CMD_INIT;
init_frame->cmd_status = MFI_STAT_INVALID_STATUS;
+
+   if (instance->verbuf) {
+   snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, 
"%s\n",
+   MEGASAS_VERSION);
+   init_frame->driver_ver_lo = cpu_to_le32(instance->verbuf_h);
+   init_frame->driver_ver_hi = 0;
+   }
+
init_frame->queue_info_new_phys_addr_lo =
cpu_to_le32(lower_32_bits(initq_info_h));
init_frame->queue_info_new_phys_addr_hi =
@@ -5257,6 +5265,12 @@ static int megasas_probe_one(struct pci_dev *pdev,
break;
}
 
+   instance->verbuf = pci_alloc_consistent(pdev,
+   MEGASAS_MAX_NAME * sizeof(u32),
+   &instance->verbuf_h);
+   if (!instance->verbuf)
+   dev_info(&instance->pdev->dev, "Can't allocate version 
buffer\n");
+
instance->system_info_buf = pci_zalloc_consistent(pdev,
sizeof(struct MR_DRV_SYSTEM_INFO),
&instance->system_info_h);
@@ -5838,6 +5852,10 @@ static void megasas_detach_one(struct pci_dev *pdev)
pci_free_consistent(pdev, sizeof(struct MR_DRV_SYSTEM_INFO),
instance->system_info_buf, 
instance->system_info_h);
 
+   if (instance->verbuf)
+   pci_free_consistent(pdev, MEGASAS_MAX_NAME * sizeof(u32),
+   instance->verbuf, instance->verbuf_h);
+
scsi_host_put(host);
 
pci_disable_device(pdev);
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c 
b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 0637f42..359d605 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -671,6 +671,13 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
/* Convert capability to LE32 */
cpu_to_le32s((u32 *)&init_frame->driver_operations.mfi_capabilities);
 
+   if (instance->verbuf) {
+   snprintf((char *)instance->verbuf, strlen(MEGASAS_VERSION) + 2, 
"%s\n",
+   MEGASAS_VERSION);
+   init_frame->driver_ver_lo = cpu_to_le32(instance->verbuf_h);
+   init_frame->driver_ver_hi = 0;
+   }
+
sys_info = dmi_get_system_info(DMI_PRODUCT_UUID);
if (instance->system_info_buf && sys_info) {
memcpy(instance->system_info_buf->systemId, sys_info,
-- 
1.7.1

--

Re: [PATCH 0/2] target: 64-bit LUN support

2015-06-10 Thread Nicholas A. Bellinger
Hi Hannes,

On Wed, 2015-06-10 at 08:41 +0200, Hannes Reinecke wrote:
> Hi Nic,
> 
> here's now the patchset for making LIO-target support 64-bit LUNs.
> Pretty straightforward, plus an additional patch to remove the
> now obsolete limitation on 256 LUNs per TPG. There had been a
> comment in the header that REPORT LUN emulation would only support
> up to one page in payload, but I couldn't find any evidence for
> this in the code.
> 
> As usual, comments and reviews are welcome.
> 
> Patchset is relative to the 'for-next' branch of target-pending.
> 
> Hannes Reinecke (2):
>   target: use 64-bit LUNs
>   target: Remove TARGET_MAX_LUNS_PER_TRANSPORT
> 
>  drivers/target/iscsi/iscsi_target_tmr.c  |  4 +--
>  drivers/target/loopback/tcm_loop.c   |  4 +--
>  drivers/target/target_core_alua.c|  2 +-
>  drivers/target/target_core_configfs.c| 12 
>  drivers/target/target_core_device.c  | 39 ++---
>  drivers/target/target_core_fabric_configfs.c | 24 
>  drivers/target/target_core_internal.h| 10 +++
>  drivers/target/target_core_pr.c  | 43 
> ++--
>  drivers/target/target_core_pr.h  |  6 ++--
>  drivers/target/target_core_tpg.c | 13 ++---
>  drivers/target/target_core_transport.c   |  6 ++--
>  drivers/target/target_core_ua.c  |  8 +++---
>  drivers/target/target_core_ua.h  |  2 +-
>  drivers/xen/xen-scsiback.c   |  7 +++--
>  include/target/target_core_base.h| 22 +++---
>  include/target/target_core_fabric.h  | 10 +++
>  16 files changed, 90 insertions(+), 122 deletions(-)
> 

Looks good, applied to target-pending/for-next.

Thanks for rebasing this to the latest for-next btw, and dropping the
last remaining TARGET_MAX_LUNS_PER_TRANSPORT vestiges as well.  :)

--nab

--
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: [RFC 0/2] target: Add TFO->complete_irq queue_work bypass

2015-06-10 Thread Nicholas A. Bellinger
On Tue, 2015-06-09 at 09:19 +0200, Christoph Hellwig wrote:
> On Thu, Jun 04, 2015 at 12:06:09AM -0700, Nicholas A. Bellinger wrote:
> > So I've been using tcm_loop + RAMDISK backends for prototyping, but this
> > patch is intended for vhost-scsi so it can avoid the unnecessary
> > queue_work() context switch within target_complete_cmd() for all backend
> > driver types.
> > 
> > This is because vhost_work_queue() is just updating vhost_dev->work_list
> > and immediately wake_up_process() into a different vhost_worker()
> > process context.  For heavy small block workloads into fast IBLOCK
> > backends, avoiding this extra context switch should be a nice efficiency
> > win.
> 
> How about trying to merge the two workers instead?
> 

IIRC, vhost.c has a existing requirement for running completions within
a single kernel thread context for each vhost_dev context -> vhost-scsi
WWPN.

> > Perhaps tcm_loop LLD code should just be limited to RAMDISK here..?
> 
> I'd prefer to not do it especially for the loopback code, as that
> should serve as a simple example.

Fair enough.

> But before making further judgement I'd really like to see the numbers.
> 

Sure, will include some performance + context switch results for -v2.

> Note that something that might help much more is getting rid of
> the remaining irq or bh disabling spinlocks in the target core,
> as that tends to introduce a lot of additional latency.  Moving
> additional code to hardirq context is fairly diametrical to that
> design.

Within for-next RCU enabled target code, the three spinlocks who irq
disable from fast-path submit + completion path are:

* se_cmd->t_state_lock:

Used to update se_cmd->transport_state within target_complete_cmd() from
backend driver irq context, and when passing se_cmd ownership back to
fabric driver code via fast-path transport_cmd_check_stop() response
completion.

Still required while iblock backends are calling target_complete_cmd()
from irq context.
  
* se_device->execute_task_lock

Used for tracking device TMR tasks.  Completion path called from irq 
context in transport_cmd_check_stop() -> target_remove_from_state_list()
when passing se_cmd ownership back to fabric driver.

transport_generic_free_cmd() needs to obtain this lock during se_cmd
exception status too, if the failure occurs before se_cmd->execute_cmd()
submission happens.

* se_session->sess_cmd_lock

Originally required for tcm_qla2xxx, where qla_hw_data->hardware_lock
must be held while performing the initial per se_session shutdown of
outstanding + active se_cmd_list entries.  Other HW LLD fabric drivers
also need this when target-core is responsible for active I/O
shutdown.  

However, not all fabric drivers need to disable irq while acquiring this
specific lock.

--
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