Re: [PATCH V7 0/5] virtio-scsi multiqueue

2013-04-05 Thread Wanlong Gao
On 03/28/2013 10:22 AM, Wanlong Gao wrote:
> On 03/23/2013 07:28 PM, Wanlong Gao wrote:
>> This series implements virtio-scsi queue steering, which gives
>> performance improvements of up to 50% (measured both with QEMU and
>> tcm_vhost backends).
>>
>> This version rebased on Rusty's virtio ring rework patches, which
>> has already gone into virtio-next today.
>> We hope this can go into virtio-next together with the virtio ring
>> rework pathes.
>>
>> V7: respin to fix the patch apply error
>>
>> V6: rework "redo allocation of target data" (James)
>> fix comments (Venkatesh)
>> rebase to virtio-next
>>
>> V5: improving the grammar of 1/5 (Paolo)
>> move the dropping of sg_elems to 'virtio-scsi: use virtqueue_add_sgs for 
>> command buffers'. (Asias)
>>
>> V4: rebase on virtio ring rework patches (rusty's pending-rebases branch)
>>
>> V3 and be found 
>> http://marc.info/?l=linux-virtualization&m=136067440717154&w=2
>>
>>
>> It would probably be easier to get it in via Rusty's tree
>> because of the prerequisites.  James, can we get your Acked-by?
> 
> James, any thoughts for this version?

Ping James


> 
> Thanks,
> Wanlong Gao
> 
>>
>> Paolo Bonzini (3):
>>   virtio-scsi: pass struct virtio_scsi to virtqueue completion function
>>   virtio-scsi: push vq lock/unlock into virtscsi_vq_done
>>   virtio-scsi: introduce multiqueue support
>>
>> Wanlong Gao (2):
>>   virtio-scsi: redo allocation of target data
>>   virtio-scsi: reset virtqueue affinity when doing cpu hotplug
>>
>>  drivers/scsi/virtio_scsi.c | 387 
>> -
>>  1 file changed, 309 insertions(+), 78 deletions(-)
>>
> 
> 

--
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/5] qla4xxx: Restrict logout from boot target session using session id

2013-04-05 Thread vikas . chaudhary
From: Adheer Chandravanshi 

Signed-off-by: Adheer Chandravanshi 
Signed-off-by: Vikas Chaudhary 
---
 drivers/scsi/qla4xxx/ql4_os.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 5f7a2bc..f82efcb 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5916,6 +5916,14 @@ static int qla4xxx_sysfs_ddb_logout_sid(struct 
iscsi_cls_session *cls_sess)
goto exit_ddb_logout;
}
 
+   if (test_bit(DF_BOOT_TGT, &ddb_entry->flags)) {
+   ql4_printk(KERN_ERR, ha,
+  "%s: Logout from boot target entry is not 
permitted.\n",
+  __func__);
+   ret = -EPERM;
+   goto exit_ddb_logout;
+   }
+
options = LOGOUT_OPTION_CLOSE_SESSION;
if (qla4xxx_session_logout_ddb(ha, ddb_entry, options) == QLA_ERROR) {
ql4_printk(KERN_ERR, ha, "%s: Logout failed\n", __func__);
-- 
1.8.2.GIT

--
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 0/5] qla4xxx: Updates for scsi "misc" branch

2013-04-05 Thread vikas . chaudhary
From: Vikas Chaudhary 

James,
 
Please apply the following patches to the scsi tree at your earliest
convenience.

Adheer Chandravanshi (3):
  qla4xxx: Use correct flash ddb offset for ISP40XX
  qla4xxx: Restrict logout from boot target session using session id
  qla4xxx: Use correct value for max flash node entries

Vikas Chaudhary (2):
  qla4xxx: Added print statements to display AENs
  qla4xxx: Update driver version to 5.03.00-k8

Thanks,
Vikas.
--
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/5] qla4xxx: Use correct value for max flash node entries

2013-04-05 Thread vikas . chaudhary
From: Adheer Chandravanshi 

Use correct value for max flash node entries supported
based on adapter type.

Signed-off-by: Adheer Chandravanshi 
Signed-off-by: Vikas Chaudhary 
---
 drivers/scsi/qla4xxx/ql4_os.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index f82efcb..a47f999 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -5587,7 +5587,7 @@ static int qla4xxx_sysfs_ddb_add(struct Scsi_Host *shost, 
const char *buf,
goto exit_ddb_add;
}
 
-   max_ddbs =  is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX :
+   max_ddbs =  is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES :
 MAX_DEV_DB_ENTRIES;
 
fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
@@ -6707,7 +6707,7 @@ static int qla4xxx_sysfs_ddb_export(struct scsi_qla_host 
*ha)
return -ENOMEM;
}
 
-   max_ddbs =  is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX :
+   max_ddbs =  is_qla40XX(ha) ? MAX_PRST_DEV_DB_ENTRIES :
 MAX_DEV_DB_ENTRIES;
 
for (idx = 0; idx < max_ddbs; idx++) {
-- 
1.8.2.GIT

--
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/5] qla4xxx: Added print statements to display AENs

2013-04-05 Thread vikas . chaudhary
From: Vikas Chaudhary 

Added print statements for following AENs:
1. MBOX_ASTS_INITIALIZATION_FAILED
2. MBOX_ASTS_SYSTEM_WARNING_EVENT
3. MBOX_ASTS_DCBX_CONF_CHANGE
4. MBOX_ASTS_IPV6_DEFAULT_ROUTER_CHANGED

Signed-off-by: Vikas Chaudhary 
---
 drivers/scsi/qla4xxx/ql4_fw.h  |  4 
 drivers/scsi/qla4xxx/ql4_isr.c | 37 +
 2 files changed, 41 insertions(+)

diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 5945829..c7b8892 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -493,12 +493,16 @@ struct qla_flt_region {
 #define MBOX_ASTS_SUBNET_STATE_CHANGE  0x8027
 #define MBOX_ASTS_RESPONSE_QUEUE_FULL  0x8028
 #define MBOX_ASTS_IP_ADDR_STATE_CHANGED0x8029
+#define MBOX_ASTS_IPV6_DEFAULT_ROUTER_CHANGED  0x802A
 #define MBOX_ASTS_IPV6_PREFIX_EXPIRED  0x802B
 #define MBOX_ASTS_IPV6_ND_PREFIX_IGNORED   0x802C
 #define MBOX_ASTS_IPV6_LCL_PREFIX_IGNORED  0x802D
 #define MBOX_ASTS_ICMPV6_ERROR_MSG_RCVD0x802E
+#define MBOX_ASTS_INITIALIZATION_FAILED0x8031
+#define MBOX_ASTS_SYSTEM_WARNING_EVENT 0x8036
 #define MBOX_ASTS_IDC_COMPLETE 0x8100
 #define MBOX_ASTS_IDC_REQUEST_NOTIFICATION 0x8101
+#define MBOX_ASTS_DCBX_CONF_CHANGE 0x8110
 #define MBOX_ASTS_TXSCVR_INSERTED  0x8130
 #define MBOX_ASTS_TXSCVR_REMOVED   0x8131
 
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 7bef448..482287f 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -875,6 +875,43 @@ static void qla4xxx_isr_decode_mailbox(struct 
scsi_qla_host * ha,
}
break;
 
+   case MBOX_ASTS_IPV6_DEFAULT_ROUTER_CHANGED:
+   DEBUG2(ql4_printk(KERN_INFO, ha,
+ "scsi%ld: AEN %04x, mbox_sts[1]=%08x, 
mbox_sts[2]=%08x, mbox_sts[3]=%08x, mbox_sts[4]=%08x mbox_sts[5]=%08x\n",
+ ha->host_no, mbox_sts[0], mbox_sts[1],
+ mbox_sts[2], mbox_sts[3], mbox_sts[4],
+ mbox_sts[5]));
+   DEBUG2(ql4_printk(KERN_INFO, ha,
+ "scsi%ld: AEN %04x Received IPv6 
default router changed notification\n",
+ ha->host_no, mbox_sts[0]));
+   break;
+
+   case MBOX_ASTS_INITIALIZATION_FAILED:
+   DEBUG2(ql4_printk(KERN_INFO, ha,
+ "scsi%ld: AEN %04x, 
mbox_sts[3]=%08x\n",
+ ha->host_no, mbox_sts[0],
+ mbox_sts[3]));
+   break;
+
+   case MBOX_ASTS_SYSTEM_WARNING_EVENT:
+   DEBUG2(ql4_printk(KERN_WARNING, ha,
+ "scsi%ld: AEN %04x, mbox_sts[1]=%08x, 
mbox_sts[2]=%08x, mbox_sts[3]=%08x, mbox_sts[4]=%08x mbox_sts[5]=%08x\n",
+ ha->host_no, mbox_sts[0], mbox_sts[1],
+ mbox_sts[2], mbox_sts[3], mbox_sts[4],
+ mbox_sts[5]));
+   break;
+
+   case MBOX_ASTS_DCBX_CONF_CHANGE:
+   DEBUG2(ql4_printk(KERN_INFO, ha,
+ "scsi%ld: AEN %04x, mbox_sts[1]=%08x, 
mbox_sts[2]=%08x, mbox_sts[3]=%08x, mbox_sts[4]=%08x mbox_sts[5]=%08x\n",
+ ha->host_no, mbox_sts[0], mbox_sts[1],
+ mbox_sts[2], mbox_sts[3], mbox_sts[4],
+ mbox_sts[5]));
+   DEBUG2(ql4_printk(KERN_INFO, ha,
+ "scsi%ld: AEN %04x Received DCBX 
configuration changed notification\n",
+ ha->host_no, mbox_sts[0]));
+   break;
+
default:
DEBUG2(printk(KERN_WARNING
  "scsi%ld: AEN %04x UNKNOWN\n",
-- 
1.8.2.GIT

--
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 1/5] qla4xxx: Use correct flash ddb offset for ISP40XX

2013-04-05 Thread vikas . chaudhary
From: Adheer Chandravanshi 

Use correct flash ddb offset to add and delete flash target
entries for ISP40XX

Signed-off-by: Adheer Chandravanshi 
Signed-off-by: Vikas Chaudhary 
---
 drivers/scsi/qla4xxx/ql4_mbx.c |  7 --
 drivers/scsi/qla4xxx/ql4_os.c  | 57 --
 2 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index 8985997..a501bea 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -1421,7 +1421,7 @@ int qla4xxx_flashdb_by_index(struct scsi_qla_host *ha,
 struct dev_db_entry *fw_ddb_entry,
 dma_addr_t fw_ddb_entry_dma, uint16_t ddb_index)
 {
-   uint32_t dev_db_start_offset = FLASH_OFFSET_DB_INFO;
+   uint32_t dev_db_start_offset;
uint32_t dev_db_end_offset;
int status = QLA_ERROR;
 
@@ -1429,6 +1429,7 @@ int qla4xxx_flashdb_by_index(struct scsi_qla_host *ha,
 
if (is_qla40XX(ha)) {
dev_db_start_offset = FLASH_OFFSET_DB_INFO;
+   dev_db_end_offset = FLASH_OFFSET_DB_END;
} else {
dev_db_start_offset = FLASH_RAW_ACCESS_ADDR +
  (ha->hw.flt_region_ddb << 2);
@@ -1437,9 +1438,11 @@ int qla4xxx_flashdb_by_index(struct scsi_qla_host *ha,
 */
if (ha->port_num == 1)
dev_db_start_offset += (ha->hw.flt_ddb_size / 2);
+
+   dev_db_end_offset = dev_db_start_offset +
+   (ha->hw.flt_ddb_size / 2);
}
 
-   dev_db_end_offset = dev_db_start_offset + (ha->hw.flt_ddb_size / 2);
dev_db_start_offset += (ddb_index * sizeof(*fw_ddb_entry));
 
if (dev_db_start_offset > dev_db_end_offset) {
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 95a951c..5f7a2bc 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -6582,6 +6582,8 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
struct dev_db_entry *fw_ddb_entry = NULL;
dma_addr_t fw_ddb_entry_dma;
uint16_t *ddb_cookie = NULL;
+   size_t ddb_size;
+   void *pddb = NULL;
int target_id;
int rc = 0;
 
@@ -6601,18 +6603,12 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
if (fnode_sess->flash_state == DEV_DB_NON_PERSISTENT)
goto sysfs_ddb_del;
 
-   ddb_cookie = dma_alloc_coherent(&ha->pdev->dev, sizeof(*ddb_cookie),
-   &fw_ddb_entry_dma, GFP_KERNEL);
-   if (!ddb_cookie) {
-   rc = -ENOMEM;
-   DEBUG2(ql4_printk(KERN_ERR, ha,
- "%s: Unable to allocate dma buffer\n",
- __func__));
-   goto exit_ddb_del;
-   }
-
if (is_qla40XX(ha)) {
dev_db_start_offset = FLASH_OFFSET_DB_INFO;
+   dev_db_end_offset = FLASH_OFFSET_DB_END;
+   dev_db_start_offset += (fnode_sess->target_id *
+  sizeof(*fw_ddb_entry));
+   ddb_size = sizeof(*fw_ddb_entry);
} else {
dev_db_start_offset = FLASH_RAW_ACCESS_ADDR +
  (ha->hw.flt_region_ddb << 2);
@@ -6621,12 +6617,17 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
 */
if (ha->port_num == 1)
dev_db_start_offset += (ha->hw.flt_ddb_size / 2);
-   }
 
-   dev_db_end_offset = dev_db_start_offset + (ha->hw.flt_ddb_size / 2);
-   dev_db_start_offset += (fnode_sess->target_id * sizeof(*fw_ddb_entry));
-   dev_db_start_offset += (void *)&(fw_ddb_entry->cookie) -
-  (void *)fw_ddb_entry;
+   dev_db_end_offset = dev_db_start_offset +
+   (ha->hw.flt_ddb_size / 2);
+
+   dev_db_start_offset += (fnode_sess->target_id *
+  sizeof(*fw_ddb_entry));
+   dev_db_start_offset += (void *)&(fw_ddb_entry->cookie) -
+  (void *)fw_ddb_entry;
+
+   ddb_size = sizeof(*ddb_cookie);
+   }
 
DEBUG2(ql4_printk(KERN_ERR, ha, "%s: start offset=%u, end offset=%u\n",
  __func__, dev_db_start_offset, dev_db_end_offset));
@@ -6638,10 +6639,28 @@ static int qla4xxx_sysfs_ddb_delete(struct 
iscsi_bus_flash_session *fnode_sess)
goto exit_ddb_del;
}
 
+   pddb = dma_alloc_coherent(&ha->pdev->dev, ddb_size,
+ &fw_ddb_entry_dma, GFP_KERNEL);
+   if (!pddb) {
+   rc = -ENOMEM;
+   DEBUG2(ql4_printk(KERN_ERR, ha,
+ "%s: Unab

[PATCH 5/5] qla4xxx: Update driver version to 5.03.00-k8

2013-04-05 Thread vikas . chaudhary
From: Vikas Chaudhary 

Signed-off-by: Vikas Chaudhary 
---
 drivers/scsi/qla4xxx/ql4_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_version.h 
b/drivers/scsi/qla4xxx/ql4_version.h
index 18ad425..83e0fec 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,4 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION "5.03.00-k7"
+#define QLA4XXX_DRIVER_VERSION "5.03.00-k8"
-- 
1.8.2.GIT

--
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] [SCSI] sd: Do not return success from init_sd if DIF mempool allocation fails

2013-04-05 Thread Ewan Milne
On Thu, 2013-02-14 at 11:36 -0500, Ewan D. Milne wrote:
> From: "Ewan D. Milne" 
> 
> init_sd() was returning 0 if sd_cdb_cache or sd_cdb_pool could
> not be allocated.  Return -ENOMEM instead, since the sd_disk_class
> and the blkdevs will be unregistered if this happens.
> 
> Signed-off-by: Ewan D. Milne 
> ---
>  drivers/scsi/sd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 8551f3e..4943a4f 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2931,12 +2931,14 @@ static int __init init_sd(void)
>0, 0, NULL);
>   if (!sd_cdb_cache) {
>   printk(KERN_ERR "sd: can't init extended cdb cache\n");
> + err = -ENOMEM;
>   goto err_out_class;
>   }
>  
>   sd_cdb_pool = mempool_create_slab_pool(SD_MEMPOOL_SIZE, sd_cdb_cache);
>   if (!sd_cdb_pool) {
>   printk(KERN_ERR "sd: can't init extended cdb pool\n");
> + err = -ENOMEM;
>   goto err_out_cache;
>   }
>  

Would someone mind looking at this patch and ACKing it if you
feel it is appropriate?

Thanks.

-Ewan D. Milne 


--
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] scsi_transport_fc: Make 'port_state' writeable

2013-04-05 Thread James Smart
I understand your points. But you will need to contact the different LLD 
maintainers to ensure receiving a devloss_tmo_callbk() on an rport they 
had not called fc_remote_port_delete() for.  I know there's work on my 
side to validate it's ok.  First glance was ok, but..


-- james s


On 4/4/2013 2:26 AM, Hannes Reinecke wrote:

On 04/01/2013 11:06 PM, James Smart wrote:

I think lpfc survives your rport state change as : part of the lld
behavior on the callback, to clean up reference counts, is to abort
all i/o that is outstanding to the rport.   So the ref checking not
only protects lpfc from prematurely freeing a structure (my real
concern), but also just happens to abort all i/o.  We got lucky.

I still believe the I_T_nexus reset is the right way to solve this.


Yes, but this would be an even more intrusive patch.
And we would need to implement yet another callback into the LLDDs
which need to be implemented there, too.

But for this to make any sense we would need to revamp the scsi
error handler, as the current problem is that error recovery takes
too long. Adding yet another callback will make the escalation chain
even longer.

So yeah, in the long run I_T nexus reset is the correct way of doing
things, but in the short term I would opt to make port_state
writeable to simulate an I_T nexus reset.

Cheers,

Hannes


--
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/4] scsi: 64-bit LUN support

2013-04-05 Thread James Smart


On 4/4/2013 6:17 AM, Hannes Reinecke wrote:

On 03/31/2013 07:44 PM, Tomas Henzl wrote:

What we can do is to decode the LUN and compare it to max_lun provided by the 
driver,
I think that sg_luns is able to do that, so what is needed is just to follow 
the SAM.

I have seen reports of problem on three different drivers connected to various
external storage, all of them having the same basic reason - the driver sets a 
max_lun
and then LUN comes encoded with a newer addressing method and something like 
this is shown
'kernel: scsi: host 2 channel 0 id 2 lun16643 has a LUN larger than allowed by 
the host adapter'

Decoding the real LUN value would fix this problem, by decoding is only meant 
the use in
scsi_report_lun_scan. The LUN would be stored exactly the same way as it is now.
I know we can patch the certain drivers too, but when max_lun were  what the 
name says
- max LU number, it would fix my problem very easy.


Errm.

No. Decoding LUNs is _evil_. It has only a relevance on the target,
and even then it might choose to ignore it.
So we cannot try to out-guess the target here.

The error you're reporting is that lpfc is setting max_luns to
'255', which of course is less than 16643. Increasing max_luns on
lpfc to '0x' will fix your problem; nothing to do with 64-bit
LUNs ...



The reason lpfc set max_luns to 255 is due to the midlayer using 
max_luns as a (SCSI-2 device) max sequential scan loop top value, not 
necessarily as a max lun # as what's now in the report luns scan loop. 
When we were attached to jbods (loop, etc) - we saw 2 problems: our scan 
time dramatically increased (several minutes based on a 16k max_lun 
value); and as the jbod only decoded 8 bits - it happened to respond 
successfully to any lun value where the lower 8-bits were 0, meaning 
lots of midlayer "ghost" devices were created when in reality there was 
only 1 lun present.Changing the max_luns value is fine as long as 
you know what's attached.


-- james s

--
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] [PATCH] scsi-dh-emc: fix activate vs set_params race

2013-04-05 Thread Mikulas Patocka


On Thu, 4 Apr 2013, Laurence Oberman wrote:

> I can test it. I have a clarion Cx3
> Will get to it next week, traveling tomorrow
> Laurence
> 
> Sent from my iPhone

OK.

So, enable most debug options in kernel configuration and try the patch.

Mikulas

> On Apr 4, 2013, at 7:11 PM, Mike Christie  wrote:
> 
> > On 04/02/2013 07:09 PM, Mikulas Patocka wrote:
> >> Hi
> >> 
> >> This fixes a possible race in scsi_dh_emc. It is untested because I don't 
> >> have the hardware. It could happen when we reload a multipath device and 
> >> path failure happens at the same time.
> > 
> > 
> > I think this patch is ok. I do not have the hw to test it anymore.
> > 
> > If you wanted to test just to make sure it is safe you should bug Rob
> > Evers. He can help you find a machine in the westford lab that has it
> > --
> > 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: [OT] LDD3 Query

2013-04-05 Thread Greg KH
On Fri, Apr 05, 2013 at 12:17:54PM +0530, Vijay Chauhan wrote:
> Hi,
> 
> I am new to Linux Device Driver and reading LDD3.
> 
> It mentions that the disadvantage of dynamic major number allocation
> is that you can’t create the device nodes in
> advance, because the major number assigned to your module will vary.

That's extremely out of date, all distros now use udev (or mdev) and as
such, dynamic major/minor are fine to use, and recommended.

> To solve this problem, it says that create a script to invoke insmod
> and after calling insmod, reads /proc/devices in order to create the
> special file(s).

Not needed anymore, udev handles this for you.

Hope this helps,

greg k-h
--
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 01/18] be2iscsi: Fix lack of uninitialize pattern to FW

2013-04-05 Thread Jayamohan Kallickal
This patch sends uninitialize pattern to FW during driver unload
which is expected by FW for cleanup

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |   51 +++
 drivers/scsi/be2iscsi/be_cmds.h |1 +
 drivers/scsi/be2iscsi/be_main.c |1 +
 3 files changed, 53 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 5c87768..0b44cc9 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -732,6 +732,16 @@ int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl,
return status;
 }
 
+/**
+ * be_cmd_fw_initialize()- Initialize FW
+ * @ctrl: Pointer to function control structure
+ *
+ * Send FW initialize pattern for the function.
+ *
+ * return
+ * Success: 0
+ * Failure: Non-Zero value
+ **/
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl)
 {
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
@@ -762,6 +772,47 @@ int be_cmd_fw_initialize(struct be_ctrl_info *ctrl)
return status;
 }
 
+/**
+ * be_cmd_fw_uninit()- Uinitialize FW
+ * @ctrl: Pointer to function control structure
+ *
+ * Send FW uninitialize pattern for the function
+ *
+ * return
+ * Success: 0
+ * Failure: Non-Zero value
+ **/
+int be_cmd_fw_uninit(struct be_ctrl_info *ctrl)
+{
+   struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
+   struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
+   int status;
+   u8 *endian_check;
+
+   spin_lock(&ctrl->mbox_lock);
+   memset(wrb, 0, sizeof(*wrb));
+
+   endian_check = (u8 *) wrb;
+   *endian_check++ = 0xFF;
+   *endian_check++ = 0xAA;
+   *endian_check++ = 0xBB;
+   *endian_check++ = 0xFF;
+   *endian_check++ = 0xFF;
+   *endian_check++ = 0xCC;
+   *endian_check++ = 0xDD;
+   *endian_check = 0xFF;
+
+   be_dws_cpu_to_le(wrb, sizeof(*wrb));
+
+   status = be_mbox_notify(ctrl);
+   if (status)
+   beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
+   "BC_%d : be_cmd_fw_uninit Failed\n");
+
+   spin_unlock(&ctrl->mbox_lock);
+   return status;
+}
+
 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
  struct be_queue_info *cq, struct be_queue_info *eq,
  bool sol_evts, bool no_delay, int coalesce_wm)
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 23397d5..0f8c920 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -697,6 +697,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint32_t tag, struct be_mcc_wrb **wrb, void *cmd_va);
 /*ISCSI Functuions */
 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl);
+int be_cmd_fw_uninit(struct be_ctrl_info *ctrl);
 
 struct be_mcc_wrb *wrb_from_mbox(struct be_dma_mem *mbox_mem);
 struct be_mcc_wrb *wrb_from_mccq(struct beiscsi_hba *phba);
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 4e2733d..3fb997f 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3430,6 +3430,7 @@ static void hwi_cleanup(struct beiscsi_hba *phba)
beiscsi_cmd_q_destroy(ctrl, q, QTYPE_EQ);
}
be_mcc_queues_destroy(phba);
+   be_cmd_fw_uninit(ctrl);
 }
 
 static int be_mcc_queues_create(struct beiscsi_hba *phba,
-- 
1.7.10.4

--
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 02/18] be2iscsi: Fix returning Failure when MBX fails with Insufficient buffer error

2013-04-05 Thread Jayamohan Kallickal
 When MBX command fails with insufficent buffer, check for the
 response lenght returned. Return success if response length
 is non-zero value which indicates valid data.

Signed-off-by: Minh Tran 
Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |   13 +
 drivers/scsi/be2iscsi/be_cmds.h |4 
 2 files changed, 17 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 0b44cc9..3ad95c7 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -155,6 +155,7 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
uint16_t status = 0, addl_status = 0, wrb_num = 0;
struct be_mcc_wrb *temp_wrb;
struct be_cmd_req_hdr *ioctl_hdr;
+   struct be_cmd_resp_hdr *ioctl_resp_hdr;
struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;
 
if (beiscsi_error(phba))
@@ -204,6 +205,12 @@ int beiscsi_mccq_compl(struct beiscsi_hba *phba,
ioctl_hdr->subsystem,
ioctl_hdr->opcode,
status, addl_status);
+
+   if (status == MCC_STATUS_INSUFFICIENT_BUFFER) {
+   ioctl_resp_hdr = (struct be_cmd_resp_hdr *) ioctl_hdr;
+   if (ioctl_resp_hdr->response_length)
+   goto release_mcc_tag;
+   }
rc = -EAGAIN;
}
 
@@ -267,6 +274,7 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
struct be_cmd_req_hdr *hdr = embedded_payload(wrb);
+   struct be_cmd_resp_hdr *resp_hdr;
 
be_dws_le_to_cpu(compl, 4);
 
@@ -284,6 +292,11 @@ static int be_mcc_compl_process(struct be_ctrl_info *ctrl,
hdr->subsystem, hdr->opcode,
compl_status, extd_status);
 
+   if (compl_status == MCC_STATUS_INSUFFICIENT_BUFFER) {
+   resp_hdr = (struct be_cmd_resp_hdr *) hdr;
+   if (resp_hdr->response_length)
+   return 0;
+   }
return -EBUSY;
}
return 0;
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 0f8c920..a338625 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -52,6 +52,10 @@ struct be_mcc_wrb {
 
 /* Completion Status */
 #define MCC_STATUS_SUCCESS 0x0
+#define MCC_STATUS_FAILED 0x1
+#define MCC_STATUS_ILLEGAL_REQUEST 0x2
+#define MCC_STATUS_ILLEGAL_FIELD 0x3
+#define MCC_STATUS_INSUFFICIENT_BUFFER 0x4
 
 #define CQE_STATUS_COMPL_MASK 0x
 #define CQE_STATUS_COMPL_SHIFT 0   /* bits 0 - 15 */
-- 
1.7.10.4

--
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 03/18] be2iscsi: Fix MBX Command issues

2013-04-05 Thread Jayamohan Kallickal
 - Check Ready Bit before posting the BMBX Hi Address
 - Fix the parameters passed to beiscsi_mccq_compl
   in beiscsi_open_conn()
 - Fix tag value check in beiscsi_ep_connect.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c  |   10 +-
 drivers/scsi/be2iscsi/be_iscsi.c |7 +++
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 3ad95c7..dfbe7e4 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -492,7 +492,7 @@ static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl)
 {
void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET;
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
-   int wait = 0;
+   uint32_t wait = 0;
u32 ready;
 
do {
@@ -540,6 +540,10 @@ int be_mbox_notify(struct be_ctrl_info *ctrl)
struct be_mcc_compl *compl = &mbox->compl;
struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
 
+   status = be_mbox_db_ready_wait(ctrl);
+   if (status)
+   return status;
+
val &= ~MPU_MAILBOX_DB_RDY_MASK;
val |= MPU_MAILBOX_DB_HI_MASK;
val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
@@ -593,6 +597,10 @@ static int be_mbox_notify_wait(struct beiscsi_hba *phba)
struct be_mcc_compl *compl = &mbox->compl;
struct be_ctrl_info *ctrl = &phba->ctrl;
 
+   status = be_mbox_db_ready_wait(ctrl);
+   if (status)
+   return status;
+
val |= MPU_MAILBOX_DB_HI_MASK;
/* at bits 2 - 31 place mbox dma addr msb bits 34 - 63 */
val |= (upper_32_bits(mbox_mem->dma) >> 2) << 2;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 214d691..1097fa2 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1009,7 +1009,6 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 {
struct beiscsi_endpoint *beiscsi_ep = ep->dd_data;
struct beiscsi_hba *phba = beiscsi_ep->phba;
-   struct be_mcc_wrb *wrb;
struct tcp_connect_and_offload_out *ptcpcnct_out;
struct be_dma_mem nonemb_cmd;
unsigned int tag;
@@ -1055,7 +1054,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in);
memset(nonemb_cmd.va, 0, nonemb_cmd.size);
tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
-   if (!tag) {
+   if (tag <= 0) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
"BS_%d : mgmt_open_connection Failed for cid=%d\n",
beiscsi_ep->ep_cid);
@@ -1066,7 +1065,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
return -EAGAIN;
}
 
-   ret = beiscsi_mccq_compl(phba, tag, &wrb, NULL);
+   ret = beiscsi_mccq_compl(phba, tag, NULL, nonemb_cmd.va);
if (ret) {
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX,
@@ -1077,7 +1076,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
goto free_ep;
}
 
-   ptcpcnct_out = embedded_payload(wrb);
+   ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va;
beiscsi_ep = ep->dd_data;
beiscsi_ep->fw_handle = ptcpcnct_out->connection_handle;
beiscsi_ep->cid_vld = 1;
-- 
1.7.10.4

--
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 04/18] be2iscsi: Fix MSIX support in SKH-R to 32

2013-04-05 Thread Jayamohan Kallickal
This patch limits the max number of msix vectors to 32.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c |1 +
 drivers/scsi/be2iscsi/be_main.h |2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 3fb997f..72e4052 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4835,6 +4835,7 @@ static int beiscsi_dev_probe(struct pci_dev *pcidev,
case OC_SKH_ID1:
phba->generation = BE_GEN4;
phba->iotask_fn = beiscsi_iotask_v2;
+   break;
default:
phba->generation = 0;
}
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 5946577..e53d087 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -66,7 +66,7 @@
 
 #define MAX_CPUS   64
 #define BEISCSI_MAX_NUM_CPUS   7
-#define OC_SKH_MAX_NUM_CPUS63
+#define OC_SKH_MAX_NUM_CPUS31
 
 
 #define BEISCSI_SGLIST_ELEMENTS30
-- 
1.7.10.4

--
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 05/18] be2iscsi: Fix freeing CXN specific driver resources.

2013-04-05 Thread Jayamohan Kallickal
 Free CXN specific resource held by driver when login redirection
 or connection retry happens. Login redirection was failing
 because WRB/SGL were not allocated from the CID on which
 doorbell was rung.

Fixed the issue raised by MikeC

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |   15 +
 drivers/scsi/be2iscsi/be_main.c  |   68 ++
 drivers/scsi/be2iscsi/be_main.h  |1 +
 3 files changed, 62 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 1097fa2..a4eb610 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -990,9 +990,24 @@ static void beiscsi_put_cid(struct beiscsi_hba *phba, 
unsigned short cid)
 static void beiscsi_free_ep(struct beiscsi_endpoint *beiscsi_ep)
 {
struct beiscsi_hba *phba = beiscsi_ep->phba;
+   struct beiscsi_conn *beiscsi_conn;
 
beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
beiscsi_ep->phba = NULL;
+
+   /**
+* Check if any connection resource allocated by driver
+* is to be freed.This case occurs when target redirection
+* or connection retry is done.
+**/
+   if (!beiscsi_ep->conn)
+   return;
+
+   beiscsi_conn = beiscsi_ep->conn;
+   if (beiscsi_conn->login_in_progress) {
+   beiscsi_free_mgmt_task_handles(beiscsi_conn);
+   beiscsi_conn->login_in_progress = 0;
+   }
 }
 
 /**
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 72e4052..75d7186 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4066,6 +4066,49 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
 }
 
 /**
+ * beiscsi_free_mgmt_task_handles()- Free driver CXN resources
+ * @beiscsi_conn: ptr to the conn to be cleaned up
+ *
+ * Free driver mgmt resources binded to CXN.
+ **/
+void
+beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn)
+{
+   struct beiscsi_io_task *io_task;
+   struct beiscsi_hba *phba = beiscsi_conn->phba;
+   struct hwi_wrb_context *pwrb_context;
+   struct hwi_controller *phwi_ctrlr;
+
+   phwi_ctrlr = phba->phwi_ctrlr;
+   pwrb_context = &phwi_ctrlr->wrb_context
+  [beiscsi_conn->beiscsi_conn_cid
+  - phba->fw_config.iscsi_cid_start];
+   io_task = beiscsi_conn->task->dd_data;
+
+   if (io_task->pwrb_handle) {
+   memset(io_task->pwrb_handle->pwrb, 0,
+  sizeof(struct iscsi_wrb));
+   free_wrb_handle(phba, pwrb_context,
+   io_task->pwrb_handle);
+   io_task->pwrb_handle = NULL;
+   }
+
+   if (io_task->psgl_handle) {
+   spin_lock_bh(&phba->mgmt_sgl_lock);
+   free_mgmt_sgl_handle(phba,
+io_task->psgl_handle);
+   spin_unlock_bh(&phba->mgmt_sgl_lock);
+   io_task->psgl_handle = NULL;
+   }
+
+   if (io_task->mtask_addr)
+   pci_unmap_single(phba->pcidev,
+io_task->mtask_addr,
+io_task->mtask_data_count,
+PCI_DMA_TODEVICE);
+}
+
+/**
  * beiscsi_cleanup_task()- Free driver resources of the task
  * @task: ptr to the iscsi task
  *
@@ -4104,27 +4147,8 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
io_task->psgl_handle = NULL;
}
} else {
-   if (!beiscsi_conn->login_in_progress) {
-   if (io_task->pwrb_handle) {
-   free_wrb_handle(phba, pwrb_context,
-   io_task->pwrb_handle);
-   io_task->pwrb_handle = NULL;
-   }
-   if (io_task->psgl_handle) {
-   spin_lock(&phba->mgmt_sgl_lock);
-   free_mgmt_sgl_handle(phba,
-io_task->psgl_handle);
-   spin_unlock(&phba->mgmt_sgl_lock);
-   io_task->psgl_handle = NULL;
-   }
-   if (io_task->mtask_addr) {
-   pci_unmap_single(phba->pcidev,
-io_task->mtask_addr,
-io_task->mtask_data_count,
-PCI_DMA_TODEVICE);
-   io_task->mtask_addr = 0;
-   }
-   }
+   if (!beiscsi_conn->login_in_progress)
+   beiscsi_free_mgmt_task_handles(beiscsi_conn);
}
 }
 
@@ -4237,6 +4261,7 @@ static int beiscsi_alloc_pdu(

[PATCH V2 06/18] be2iscsi: Fix MACRO for checking the adapter type

2013-04-05 Thread Jayamohan Kallickal
 Fixed the code flow based on the MACRO defined to check for
 adapter.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |   28 -
 drivers/scsi/be2iscsi/be_main.c |  123 ---
 drivers/scsi/be2iscsi/be_main.h |4 +-
 3 files changed, 79 insertions(+), 76 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index dfbe7e4..db6c50b 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -855,20 +855,7 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
OPCODE_COMMON_CQ_CREATE, sizeof(*req));
 
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
-   if (chip_skh_r(ctrl->pdev)) {
-   req->hdr.version = MBX_CMD_VER2;
-   req->page_size = 1;
-   AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
- ctxt, coalesce_wm);
-   AMAP_SET_BITS(struct amap_cq_context_v2, nodelay,
- ctxt, no_delay);
-   AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
- __ilog2_u32(cq->len / 256));
-   AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
-   AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
-   AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
-   AMAP_SET_BITS(struct amap_cq_context_v2, armed, ctxt, 1);
-   } else {
+   if (is_chip_be2_be3r(phba)) {
AMAP_SET_BITS(struct amap_cq_context, coalescwm,
  ctxt, coalesce_wm);
AMAP_SET_BITS(struct amap_cq_context, nodelay, ctxt, no_delay);
@@ -881,6 +868,19 @@ int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl,
AMAP_SET_BITS(struct amap_cq_context, armed, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context, func, ctxt,
  PCI_FUNC(ctrl->pdev->devfn));
+   } else {
+   req->hdr.version = MBX_CMD_VER2;
+   req->page_size = 1;
+   AMAP_SET_BITS(struct amap_cq_context_v2, coalescwm,
+ ctxt, coalesce_wm);
+   AMAP_SET_BITS(struct amap_cq_context_v2, nodelay,
+ ctxt, no_delay);
+   AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
+ __ilog2_u32(cq->len / 256));
+   AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
+   AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
+   AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
+   AMAP_SET_BITS(struct amap_cq_context_v2, armed, ctxt, 1);
}
 
be_dws_cpu_to_le(ctxt, sizeof(req->context));
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 75d7186..6be5e29 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1368,15 +1368,15 @@ hwi_complete_drvr_msgs(struct beiscsi_conn 
*beiscsi_conn,
uint16_t wrb_index, cid;
 
phwi_ctrlr = phba->phwi_ctrlr;
-   if (chip_skh_r(phba->pcidev)) {
-   wrb_index = AMAP_GET_BITS(struct amap_it_dmsg_cqe_v2,
+   if (is_chip_be2_be3r(phba)) {
+   wrb_index = AMAP_GET_BITS(struct amap_it_dmsg_cqe,
  wrb_idx, psol);
-   cid = AMAP_GET_BITS(struct amap_it_dmsg_cqe_v2,
+   cid = AMAP_GET_BITS(struct amap_it_dmsg_cqe,
cid, psol);
} else {
-   wrb_index = AMAP_GET_BITS(struct amap_it_dmsg_cqe,
+   wrb_index = AMAP_GET_BITS(struct amap_it_dmsg_cqe_v2,
  wrb_idx, psol);
-   cid = AMAP_GET_BITS(struct amap_it_dmsg_cqe,
+   cid = AMAP_GET_BITS(struct amap_it_dmsg_cqe_v2,
cid, psol);
}
 
@@ -1418,7 +1418,26 @@ static void adapter_get_sol_cqe(struct beiscsi_hba *phba,
struct sol_cqe *psol,
struct common_sol_cqe *csol_cqe)
 {
-   if (chip_skh_r(phba->pcidev)) {
+   if (is_chip_be2_be3r(phba)) {
+   csol_cqe->exp_cmdsn = AMAP_GET_BITS(struct amap_sol_cqe,
+   i_exp_cmd_sn, psol);
+   csol_cqe->res_cnt = AMAP_GET_BITS(struct amap_sol_cqe,
+ i_res_cnt, psol);
+   csol_cqe->cmd_wnd = AMAP_GET_BITS(struct amap_sol_cqe,
+ i_cmd_wnd, psol);
+   csol_cqe->wrb_index = AMAP_GET_BITS(struct amap_sol_cqe,
+   wrb_index, psol);
+   csol_cqe->cid = AMAP_GET_BITS(struct amap_sol_cqe,
+

[PATCH V2 07/18] be2iscsi: Fix support for DEFQ extension

2013-04-05 Thread Jayamohan Kallickal
 Fix support for DEFQ extension which will be used by latest
 adapters

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |   42 +--
 drivers/scsi/be2iscsi/be_cmds.h |   14 -
 2 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index db6c50b..4f3c93a 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -1021,6 +1021,7 @@ int be_cmd_create_default_pdu_queue(struct be_ctrl_info 
*ctrl,
struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem);
struct be_defq_create_req *req = embedded_payload(wrb);
struct be_dma_mem *q_mem = &dq->dma_mem;
+   struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev);
void *ctxt = &req->context;
int status;
 
@@ -1033,17 +1034,36 @@ int be_cmd_create_default_pdu_queue(struct be_ctrl_info 
*ctrl,
   OPCODE_COMMON_ISCSI_DEFQ_CREATE, sizeof(*req));
 
req->num_pages = PAGES_4K_SPANNED(q_mem->va, q_mem->size);
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, rx_pdid, ctxt, 0);
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, rx_pdid_valid, ctxt,
- 1);
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, pci_func_id, ctxt,
- PCI_FUNC(ctrl->pdev->devfn));
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, ring_size, ctxt,
- be_encoded_q_len(length / sizeof(struct phys_addr)));
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, default_buffer_size,
- ctxt, entry_size);
-   AMAP_SET_BITS(struct amap_be_default_pdu_context, cq_id_recv, ctxt,
- cq->id);
+
+   if (is_chip_be2_be3r(phba)) {
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ rx_pdid, ctxt, 0);
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ rx_pdid_valid, ctxt, 1);
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn));
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ ring_size, ctxt,
+ be_encoded_q_len(length /
+ sizeof(struct phys_addr)));
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ default_buffer_size, ctxt, entry_size);
+   AMAP_SET_BITS(struct amap_be_default_pdu_context,
+ cq_id_recv, ctxt, cq->id);
+   } else {
+   AMAP_SET_BITS(struct amap_default_pdu_context_ext,
+ rx_pdid, ctxt, 0);
+   AMAP_SET_BITS(struct amap_default_pdu_context_ext,
+ rx_pdid_valid, ctxt, 1);
+   AMAP_SET_BITS(struct amap_default_pdu_context_ext,
+ ring_size, ctxt,
+ be_encoded_q_len(length /
+ sizeof(struct phys_addr)));
+   AMAP_SET_BITS(struct amap_default_pdu_context_ext,
+ default_buffer_size, ctxt, entry_size);
+   AMAP_SET_BITS(struct amap_default_pdu_context_ext,
+ cq_id_recv, ctxt, cq->id);
+   }
 
be_dws_cpu_to_le(ctxt, sizeof(req->context));
 
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index a338625..9b64b36 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -756,6 +756,18 @@ struct amap_be_default_pdu_context {
u8 rsvd4[32];   /* dword 3 */
 } __packed;
 
+struct amap_default_pdu_context_ext {
+   u8 rsvd0[16];   /* dword 0 */
+   u8 ring_size[4];/* dword 0 */
+   u8 rsvd1[12];   /* dword 0 */
+   u8 rsvd2[22];   /* dword 1 */
+   u8 rx_pdid[9];  /* dword 1 */
+   u8 rx_pdid_valid;   /* dword 1 */
+   u8 default_buffer_size[16]; /* dword 2 */
+   u8 cq_id_recv[16];  /* dword 2 */
+   u8 rsvd3[32];   /* dword 3 */
+} __packed;
+
 struct be_defq_create_req {
struct be_cmd_req_hdr hdr;
u16 num_pages;
@@ -901,7 +913,7 @@ struct amap_it_dmsg_cqe_v2 {
  * stack to notify the
  * controller of a posted Work Request Block
  */
-#define DB_WRB_POST_CID_MASK   0x3FF   /* bits 0 - 9 */
+#define DB_WRB_POST_CID_MASK   0x  /* bits 0 - 16 */
 #define DB_DEF_PDU_WRB_INDEX_MASK  0xFF/* bits 0 - 9 */
 
 #define DB_DEF_PDU_WRB_INDEX_SHIFT 16
-- 
1.7.10.4

--
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 08/18] be2iscsi: Fix displaying the FW Version from driver.

2013-04-05 Thread Jayamohan Kallickal
 The mgmt_hba_attributes structure declared was not proper and
 because of that the FW response returned for the MBX_CMD was not
 matching. This issue went unnoticed as mgmt_hba_attribs structure
 members were never used in the code path.

 This fix of displaying the FW version had to change the mgmt_hba_attrib
 structure also. The latest driver will also work with the older FW as
 the issue was in the driver declaration.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c |2 ++
 drivers/scsi/be2iscsi/be_main.h |2 ++
 drivers/scsi/be2iscsi/be_mgmt.c |   21 +
 drivers/scsi/be2iscsi/be_mgmt.h |   30 +-
 4 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 6be5e29..adc662d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -153,10 +153,12 @@ BEISCSI_RW_ATTR(log_enable, 0x00,
 
 DEVICE_ATTR(beiscsi_drvr_ver, S_IRUGO, beiscsi_drvr_ver_disp, NULL);
 DEVICE_ATTR(beiscsi_adapter_family, S_IRUGO, beiscsi_adap_family_disp, NULL);
+DEVICE_ATTR(beiscsi_fw_ver, S_IRUGO, beiscsi_fw_ver_disp, NULL);
 struct device_attribute *beiscsi_attrs[] = {
&dev_attr_beiscsi_log_enable,
&dev_attr_beiscsi_drvr_ver,
&dev_attr_beiscsi_adapter_family,
+   &dev_attr_beiscsi_fw_ver,
NULL,
 };
 
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 77b13c3..3c5df92 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -68,6 +68,7 @@
 #define BEISCSI_MAX_NUM_CPUS   7
 #define OC_SKH_MAX_NUM_CPUS31
 
+#define BEISCSI_VER_STRLEN 32
 
 #define BEISCSI_SGLIST_ELEMENTS30
 
@@ -341,6 +342,7 @@ struct beiscsi_hba {
struct delayed_work beiscsi_hw_check_task;
 
u8 mac_address[ETH_ALEN];
+   char fw_ver_str[BEISCSI_VER_STRLEN];
char wq_name[20];
struct workqueue_struct *wq;/* The actuak work queue */
struct be_ctrl_info ctrl;
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index a6c2fe4..7fe8595 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -368,6 +368,8 @@ int mgmt_check_supported_fw(struct be_ctrl_info *ctrl,
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT,
"BM_%d : phba->fw_config.iscsi_features = %d\n",
phba->fw_config.iscsi_features);
+   memcpy(phba->fw_ver_str, resp->params.hba_attribs.
+  firmware_version_string, BEISCSI_VER_STRLEN);
} else
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT,
"BG_%d :  Failed in mgmt_check_supported_fw\n");
@@ -1260,6 +1262,25 @@ beiscsi_drvr_ver_disp(struct device *dev, struct 
device_attribute *attr,
 }
 
 /**
+ * beiscsi_fw_ver_disp()- Display Firmware Version
+ * @dev: ptr to device not used.
+ * @attr: device attribute, not used.
+ * @buf: contains formatted text Firmware version
+ *
+ * return
+ * size of the formatted string
+ **/
+ssize_t
+beiscsi_fw_ver_disp(struct device *dev, struct device_attribute *attr,
+char *buf)
+{
+   struct Scsi_Host *shost = class_to_shost(dev);
+   struct beiscsi_hba *phba = iscsi_host_priv(shost);
+
+   return snprintf(buf, PAGE_SIZE, "%s\n", phba->fw_ver_str);
+}
+
+/**
  * beiscsi_adap_family_disp()- Display adapter family.
  * @dev: ptr to device to get priv structure
  * @attr: device attribute, not used.
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 2e4968a..00f3a4f 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -156,25 +156,25 @@ union invalidate_commands_params {
 } __packed;
 
 struct mgmt_hba_attributes {
-   u8 flashrom_version_string[32];
-   u8 manufacturer_name[32];
+   u8 flashrom_version_string[BEISCSI_VER_STRLEN];
+   u8 manufacturer_name[BEISCSI_VER_STRLEN];
u32 supported_modes;
u8 seeprom_version_lo;
u8 seeprom_version_hi;
u8 rsvd0[2];
u32 fw_cmd_data_struct_version;
u32 ep_fw_data_struct_version;
-   u32 future_reserved[12];
+   u8 ncsi_version_string[12];
u32 default_extended_timeout;
-   u8 controller_model_number[32];
+   u8 controller_model_number[BEISCSI_VER_STRLEN];
u8 controller_description[64];
-   u8 controller_serial_number[32];
-   u8 ip_version_string[32];
-   u8 firmware_version_string[32];
-   u8 bios_version_string[32];
-   u8 redboot_version_string[32];
-   u8 driver_version_string[32];
-   u8 fw_on_flash_version_string[32];
+   u8 controller_serial_number[BEISCSI_VER_STRLEN];
+   u8 ip_version_string[BEISCSI_VER_STRLEN];
+   u8 firmware_version_string[BEISCSI_VER_STRLEN];
+   u8 bios_version_string

[PATCH V2 09/18] be2iscsi: Fix displaying the Active Session Count from driver

2013-04-05 Thread Jayamohan Kallickal
This patch fixes the displaying of number of active
sessions in use.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c |2 ++
 drivers/scsi/be2iscsi/be_mgmt.c |   20 
 drivers/scsi/be2iscsi/be_mgmt.h |3 +++
 3 files changed, 25 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index adc662d..ff89b4c 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -154,11 +154,13 @@ BEISCSI_RW_ATTR(log_enable, 0x00,
 DEVICE_ATTR(beiscsi_drvr_ver, S_IRUGO, beiscsi_drvr_ver_disp, NULL);
 DEVICE_ATTR(beiscsi_adapter_family, S_IRUGO, beiscsi_adap_family_disp, NULL);
 DEVICE_ATTR(beiscsi_fw_ver, S_IRUGO, beiscsi_fw_ver_disp, NULL);
+DEVICE_ATTR(beiscsi_active_cid_count, S_IRUGO, beiscsi_active_cid_disp, NULL);
 struct device_attribute *beiscsi_attrs[] = {
&dev_attr_beiscsi_log_enable,
&dev_attr_beiscsi_drvr_ver,
&dev_attr_beiscsi_adapter_family,
&dev_attr_beiscsi_fw_ver,
+   &dev_attr_beiscsi_active_cid_count,
NULL,
 };
 
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 7fe8595..8662f73 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1281,6 +1281,26 @@ beiscsi_fw_ver_disp(struct device *dev, struct 
device_attribute *attr,
 }
 
 /**
+ * beiscsi_active_cid_disp()- Display Sessions Active
+ * @dev: ptr to device not used.
+ * @attr: device attribute, not used.
+ * @buf: contains formatted text Session Count
+ *
+ * return
+ * size of the formatted string
+ **/
+ssize_t
+beiscsi_active_cid_disp(struct device *dev, struct device_attribute *attr,
+char *buf)
+{
+   struct Scsi_Host *shost = class_to_shost(dev);
+   struct beiscsi_hba *phba = iscsi_host_priv(shost);
+
+   return snprintf(buf, PAGE_SIZE, "%d\n",
+  (phba->params.cxns_per_ctrl - phba->avlbl_cids));
+}
+
+/**
  * beiscsi_adap_family_disp()- Display adapter family.
  * @dev: ptr to device to get priv structure
  * @attr: device attribute, not used.
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 00f3a4f..4c7e0a2 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -315,6 +315,9 @@ ssize_t beiscsi_drvr_ver_disp(struct device *dev,
 ssize_t beiscsi_fw_ver_disp(struct device *dev,
 struct device_attribute *attr, char *buf);
 
+ssize_t beiscsi_active_cid_disp(struct device *dev,
+struct device_attribute *attr, char *buf);
+
 ssize_t beiscsi_adap_family_disp(struct device *dev,
  struct device_attribute *attr, char *buf);
 
-- 
1.7.10.4

--
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 10/18] be2iscsi: Fix the Port Link Status issue

2013-04-05 Thread Jayamohan Kallickal
 Check the Logical Link status also as part of the port link status.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |   26 +++---
 drivers/scsi/be2iscsi/be_cmds.h |6 +-
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index 4f3c93a..efd29ab 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -348,30 +348,26 @@ static void be2iscsi_fail_session(struct 
iscsi_cls_session *cls_session)
 void beiscsi_async_link_state_process(struct beiscsi_hba *phba,
struct be_async_event_link_state *evt)
 {
-   switch (evt->port_link_status) {
-   case ASYNC_EVENT_LINK_DOWN:
+   if ((evt->port_link_status == ASYNC_EVENT_LINK_DOWN) ||
+   ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
+(evt->port_fault != BEISCSI_PHY_LINK_FAULT_NONE))) {
+   phba->state = BE_ADAPTER_LINK_DOWN;
+
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
-   "BC_%d : Link Down on Physical Port %d\n",
+   "BC_%d : Link Down on Port %d\n",
evt->physical_port);
 
-   phba->state |= BE_ADAPTER_LINK_DOWN;
iscsi_host_for_each_session(phba->shost,
be2iscsi_fail_session);
-   break;
-   case ASYNC_EVENT_LINK_UP:
+   } else if ((evt->port_link_status & ASYNC_EVENT_LINK_UP) ||
+   ((evt->port_link_status & ASYNC_EVENT_LOGICAL) &&
+(evt->port_fault == BEISCSI_PHY_LINK_FAULT_NONE))) {
phba->state = BE_ADAPTER_UP;
+
beiscsi_log(phba, KERN_ERR,
BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
-   "BC_%d : Link UP on Physical Port %d\n",
-   evt->physical_port);
-   break;
-   default:
-   beiscsi_log(phba, KERN_ERR,
-   BEISCSI_LOG_CONFIG | BEISCSI_LOG_INIT,
-   "BC_%d : Unexpected Async Notification %d on"
-   "Physical Port %d\n",
-   evt->port_link_status,
+   "BC_%d : Link UP on Port %d\n",
evt->physical_port);
}
 }
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 9b64b36..97871cc 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -122,7 +122,8 @@ struct be_async_event_trailer {
 
 enum {
ASYNC_EVENT_LINK_DOWN = 0x0,
-   ASYNC_EVENT_LINK_UP = 0x1
+   ASYNC_EVENT_LINK_UP = 0x1,
+   ASYNC_EVENT_LOGICAL = 0x2
 };
 
 /**
@@ -134,6 +135,9 @@ struct be_async_event_link_state {
u8 port_link_status;
u8 port_duplex;
u8 port_speed;
+#define BEISCSI_PHY_LINK_FAULT_NONE0x00
+#define BEISCSI_PHY_LINK_FAULT_LOCAL   0x01
+#define BEISCSI_PHY_LINK_FAULT_REMOTE  0x02
u8 port_fault;
u8 rsvd0[7];
struct be_async_event_trailer trailer;
-- 
1.7.10.4

--
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 11/18] be2iscsi : Fix the NOP-In handling code path

2013-04-05 Thread Jayamohan Kallickal
 When target send a NOP-IN with valid TTT, driver issues a NOP-OUT
 and the task was not freed from driver. The task list available for
 the session used to run out, and as no more task list were available
 no more iSCSI commands were exchanged on that session.
 This patches fixed the issue, by calling iscsi_put_task.

Signed-off-by: Minh Tran 
Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |3 ++-
 drivers/scsi/be2iscsi/be_main.c  |   21 -
 drivers/scsi/be2iscsi/be_main.h  |3 ++-
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a4eb610..118089f 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1005,7 +1005,8 @@ static void beiscsi_free_ep(struct beiscsi_endpoint 
*beiscsi_ep)
 
beiscsi_conn = beiscsi_ep->conn;
if (beiscsi_conn->login_in_progress) {
-   beiscsi_free_mgmt_task_handles(beiscsi_conn);
+   beiscsi_free_mgmt_task_handles(beiscsi_conn,
+  beiscsi_conn->task);
beiscsi_conn->login_in_progress = 0;
}
 }
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index ff89b4c..a60a43d 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1367,8 +1367,6 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
struct hwi_controller *phwi_ctrlr;
struct iscsi_task *task;
struct beiscsi_io_task *io_task;
-   struct iscsi_conn *conn = beiscsi_conn->conn;
-   struct iscsi_session *session = conn->session;
uint16_t wrb_index, cid;
 
phwi_ctrlr = phba->phwi_ctrlr;
@@ -1390,12 +1388,8 @@ hwi_complete_drvr_msgs(struct beiscsi_conn *beiscsi_conn,
task = pwrb_handle->pio_handle;
 
io_task = task->dd_data;
-   spin_lock_bh(&phba->mgmt_sgl_lock);
-   free_mgmt_sgl_handle(phba, io_task->psgl_handle);
-   spin_unlock_bh(&phba->mgmt_sgl_lock);
-   spin_lock_bh(&session->lock);
-   free_wrb_handle(phba, pwrb_context, pwrb_handle);
-   spin_unlock_bh(&session->lock);
+   memset(io_task->pwrb_handle->pwrb, 0, sizeof(struct iscsi_wrb));
+   iscsi_put_task(task);
 }
 
 static void
@@ -4073,11 +4067,13 @@ static void beiscsi_clean_port(struct beiscsi_hba *phba)
 /**
  * beiscsi_free_mgmt_task_handles()- Free driver CXN resources
  * @beiscsi_conn: ptr to the conn to be cleaned up
+ * @task: ptr to iscsi_task resource to be freed.
  *
  * Free driver mgmt resources binded to CXN.
  **/
 void
-beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn)
+beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn,
+   struct iscsi_task *task)
 {
struct beiscsi_io_task *io_task;
struct beiscsi_hba *phba = beiscsi_conn->phba;
@@ -4088,7 +4084,7 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn 
*beiscsi_conn)
pwrb_context = &phwi_ctrlr->wrb_context
   [beiscsi_conn->beiscsi_conn_cid
   - phba->fw_config.iscsi_cid_start];
-   io_task = beiscsi_conn->task->dd_data;
+   io_task = task->dd_data;
 
if (io_task->pwrb_handle) {
memset(io_task->pwrb_handle->pwrb, 0,
@@ -4102,8 +4098,8 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn 
*beiscsi_conn)
spin_lock_bh(&phba->mgmt_sgl_lock);
free_mgmt_sgl_handle(phba,
 io_task->psgl_handle);
-   spin_unlock_bh(&phba->mgmt_sgl_lock);
io_task->psgl_handle = NULL;
+   spin_unlock_bh(&phba->mgmt_sgl_lock);
}
 
if (io_task->mtask_addr)
@@ -4153,7 +4149,7 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
}
} else {
if (!beiscsi_conn->login_in_progress)
-   beiscsi_free_mgmt_task_handles(beiscsi_conn);
+   beiscsi_free_mgmt_task_handles(beiscsi_conn, task);
}
 }
 
@@ -4381,7 +4377,6 @@ int beiscsi_iotask_v2(struct iscsi_task *task, struct 
scatterlist *sg,
unsigned int doorbell = 0;
 
pwrb = io_task->pwrb_handle->pwrb;
-   memset(pwrb, 0, sizeof(*pwrb));
 
io_task->cmd_bhs->iscsi_hdr.exp_statsn = 0;
io_task->bhs_len = sizeof(struct be_cmd_bhs);
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 3c5df92..ac4ef34 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -753,7 +753,8 @@ void
 free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle);
 
 void beiscsi_process_all_cqs(struct work_struct *work);
-void beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn);
+void beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn,
+   

[PATCH V2 12/18] be2iscsi: Fix dynamic CID allocation Mechanism in driver

2013-04-05 Thread Jayamohan Kallickal
 Number of CID assigned to a function from adapter can be dynamic. The CID count
 for each function was fixed number before. Code Fix done so that adapters with
 fixed/dynamic CID count will work with the driver.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |   38 +-
 drivers/scsi/be2iscsi/be_main.c  |  150 +++---
 drivers/scsi/be2iscsi/be_main.h  |   15 ++--
 3 files changed, 133 insertions(+), 70 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 118089f..49cc2f6 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -161,7 +161,9 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,
struct beiscsi_conn *beiscsi_conn,
unsigned int cid)
 {
-   if (phba->conn_table[cid]) {
+   uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
+
+   if (phba->conn_table[cri_index]) {
beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
"BS_%d : Connection table already occupied. 
Detected clash\n");
 
@@ -169,9 +171,9 @@ static int beiscsi_bindconn_cid(struct beiscsi_hba *phba,
} else {
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
"BS_%d : phba->conn_table[%d]=%p(beiscsi_conn)\n",
-   cid, beiscsi_conn);
+   cri_index, beiscsi_conn);
 
-   phba->conn_table[cid] = beiscsi_conn;
+   phba->conn_table[cri_index] = beiscsi_conn;
}
return 0;
 }
@@ -994,6 +996,8 @@ static void beiscsi_free_ep(struct beiscsi_endpoint 
*beiscsi_ep)
 
beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
beiscsi_ep->phba = NULL;
+   phba->ep_array[BE_GET_CRI_FROM_CID
+  (beiscsi_ep->ep_cid)] = NULL;
 
/**
 * Check if any connection resource allocated by driver
@@ -1044,15 +1048,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
"BS_%d : In beiscsi_open_conn, ep_cid=%d\n",
beiscsi_ep->ep_cid);
 
-   phba->ep_array[beiscsi_ep->ep_cid -
-  phba->fw_config.iscsi_cid_start] = ep;
-   if (beiscsi_ep->ep_cid > (phba->fw_config.iscsi_cid_start +
- phba->params.cxns_per_ctrl * 2)) {
-
-   beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
-   "BS_%d : Failed in allocate iscsi cid\n");
-   goto free_ep;
-   }
+   phba->ep_array[BE_GET_CRI_FROM_CID
+  (beiscsi_ep->ep_cid)] = ep;
 
beiscsi_ep->cid_vld = 0;
nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
@@ -1064,7 +1061,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
"BS_%d : Failed to allocate memory for"
" mgmt_open_connection\n");
 
-   beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
+   beiscsi_free_ep(beiscsi_ep);
return -ENOMEM;
}
nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in);
@@ -1075,9 +1072,9 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
"BS_%d : mgmt_open_connection Failed for cid=%d\n",
beiscsi_ep->ep_cid);
 
-   beiscsi_put_cid(phba, beiscsi_ep->ep_cid);
pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
nonemb_cmd.va, nonemb_cmd.dma);
+   beiscsi_free_ep(beiscsi_ep);
return -EAGAIN;
}
 
@@ -1089,7 +1086,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
 
pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
nonemb_cmd.va, nonemb_cmd.dma);
-   goto free_ep;
+   beiscsi_free_ep(beiscsi_ep);
+   return -EBUSY;
}
 
ptcpcnct_out = (struct tcp_connect_and_offload_out *)nonemb_cmd.va;
@@ -1102,10 +1100,6 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size,
nonemb_cmd.va, nonemb_cmd.dma);
return 0;
-
-free_ep:
-   beiscsi_free_ep(beiscsi_ep);
-   return -EBUSY;
 }
 
 /**
@@ -1216,8 +1210,10 @@ static int beiscsi_close_conn(struct  beiscsi_endpoint 
*beiscsi_ep, int flag)
 static int beiscsi_unbind_conn_to_cid(struct beiscsi_hba *phba,
  unsigned int cid)
 {
-   if (phba->conn_table[cid])
-   phba->conn_table[cid] = NULL;
+   uint16_t cri_index = BE_GET_CRI_FROM_CID(cid);
+
+   if (phba->conn_table[cri_index])
+   phba->conn_table[cri_index] = NULL;
else {
beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
   

[PATCH V2 13/18] be2iscsi: Fix checking Adapter state while establishing CXN

2013-04-05 Thread Jayamohan Kallickal
 Before tyring to establish a CXN with the target, check if the adapter is in
 a stable state

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_iscsi.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 49cc2f6..531d4a6 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1128,6 +1128,13 @@ beiscsi_ep_connect(struct Scsi_Host *shost, struct 
sockaddr *dst_addr,
return ERR_PTR(ret);
}
 
+   if (beiscsi_error(phba)) {
+   ret = -EIO;
+   beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
+   "BS_%d : The FW state Not Stable!!!\n");
+   return ERR_PTR(ret);
+   }
+
if (phba->state != BE_ADAPTER_UP) {
ret = -EBUSY;
beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_CONFIG,
-- 
1.7.10.4

--
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 15/18] be2iscsi: Fix the session cleanup when reboot/shutdown happens

2013-04-05 Thread Jayamohan Kallickal
 During reboot/shutdown cycle, the active sessions were not updated.
 In iSCSI Boot case, the boot session was alive and this fix informs
 that the machine is going down, so no more ops happens on that session.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_cmds.c |2 +-
 drivers/scsi/be2iscsi/be_cmds.h |3 +++
 drivers/scsi/be2iscsi/be_main.c |1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index e66aa7c..a3bfc1d 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -340,7 +340,7 @@ static struct be_mcc_compl *be_mcc_compl_get(struct 
beiscsi_hba *phba)
return NULL;
 }
 
-static void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
+void be2iscsi_fail_session(struct iscsi_cls_session *cls_session)
 {
iscsi_session_failure(cls_session->dd_data, ISCSI_ERR_CONN_FAILED);
 }
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 9907308..2288625 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -18,6 +18,7 @@
 #ifndef BEISCSI_CMDS_H
 #define BEISCSI_CMDS_H
 
+#include 
 /**
  * The driver sends configuration and managements command requests to the
  * firmware in the BE. These requests are communicated to the processor
@@ -735,6 +736,8 @@ int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, struct 
be_dma_mem *q_mem,
 
 bool is_link_state_evt(u32 trailer);
 
+void be2iscsi_fail_session(struct iscsi_cls_session *cls_session);
+
 /* Configuration Functions */
 int be_cmd_set_vlan(struct beiscsi_hba *phba, uint16_t vlan_tag);
 
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 228d331..672fdf6 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -4841,6 +4841,7 @@ static void beiscsi_shutdown(struct pci_dev *pcidev)
return;
}
 
+   iscsi_host_for_each_session(phba->shost, be2iscsi_fail_session);
beiscsi_quiesce(phba);
pci_disable_device(pcidev);
 }
-- 
1.7.10.4

--
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 14/18] be2scsi: Fix the copyright information

2013-04-05 Thread Jayamohan Kallickal
This patch fixes the copyright information in all files

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be.h   |2 +-
 drivers/scsi/be2iscsi/be_cmds.c  |2 +-
 drivers/scsi/be2iscsi/be_cmds.h  |2 +-
 drivers/scsi/be2iscsi/be_iscsi.c |2 +-
 drivers/scsi/be2iscsi/be_iscsi.h |2 +-
 drivers/scsi/be2iscsi/be_main.c  |2 +-
 drivers/scsi/be2iscsi/be_main.h  |2 +-
 drivers/scsi/be2iscsi/be_mgmt.c  |2 +-
 drivers/scsi/be2iscsi/be_mgmt.h  |2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be.h b/drivers/scsi/be2iscsi/be.h
index f1733df..777e7c0 100644
--- a/drivers/scsi/be2iscsi/be.h
+++ b/drivers/scsi/be2iscsi/be.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_cmds.c b/drivers/scsi/be2iscsi/be_cmds.c
index efd29ab..e66aa7c 100644
--- a/drivers/scsi/be2iscsi/be_cmds.c
+++ b/drivers/scsi/be2iscsi/be_cmds.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index 97871cc..9907308 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index 531d4a6..09265ec 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_iscsi.h b/drivers/scsi/be2iscsi/be_iscsi.h
index 38eab72..31ddc84 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.h
+++ b/drivers/scsi/be2iscsi/be_iscsi.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 01439a5..228d331 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 6d83ad8..23be676 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 8662f73..a601597 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
diff --git a/drivers/scsi/be2iscsi/be_mgmt.h b/drivers/scsi/be2iscsi/be_mgmt.h
index 4c7e0a2..04af7e7 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.h
+++ b/drivers/scsi/be2iscsi/be_mgmt.h
@@ -1,5 +1,5 @@
 /**
- * Copyright (C) 2005 - 2012 Emulex
+ * Copyright (C) 2005 - 2013 Emulex
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
-- 
1.7.10.4

--
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 16/18] be2iscsi: Fix possible reentrancy issue in be_iopoll

2013-04-05 Thread Jayamohan Kallickal
From: Shlomo Pongratz 

 The driver creates "NAPI" context per core which is fine,
 however the above routine declares the ret variable as static!
 Thus there is only one instance of this variable!
 When this routine is called from more than one thread of execution,
 than the result is unpredictable.

 static unsigned int ret;
 .

 ret = beiscsi_process_cq(pbe_eq);
 

[PATCH V2 17/18] be2iscsi: Fix issue in passing the exp_cmdsn and max_cmdsn

2013-04-05 Thread Jayamohan Kallickal
 Command Window value from the CQE was used to calculate the
 max_cmdsn for that session.The command window value extracted
 for SKH-R adapter was not proper. The value was extracted from
 BE adapter completion event. Fixed the issue by getting the
 cmd_wnd value from SKH-R CQE.

 The exp_cmdsn and max_cmdsn values were not converted to BE format
 before calling the __iscsi_complete_pdu(). Fixed the issue of converting
 to BE format.

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.c |   17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index 39ac051..77c6fe4 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -1326,8 +1326,9 @@ be_complete_logout(struct beiscsi_conn *beiscsi_conn,
hdr->t2retain = 0;
hdr->flags = csol_cqe->i_flags;
hdr->response = csol_cqe->i_resp;
-   hdr->exp_cmdsn = csol_cqe->exp_cmdsn;
-   hdr->max_cmdsn = (csol_cqe->exp_cmdsn + csol_cqe->cmd_wnd - 1);
+   hdr->exp_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn);
+   hdr->max_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn +
+csol_cqe->cmd_wnd - 1);
 
hdr->dlength[0] = 0;
hdr->dlength[1] = 0;
@@ -1350,9 +1351,9 @@ be_complete_tmf(struct beiscsi_conn *beiscsi_conn,
hdr->opcode = ISCSI_OP_SCSI_TMFUNC_RSP;
hdr->flags = csol_cqe->i_flags;
hdr->response = csol_cqe->i_resp;
-   hdr->exp_cmdsn = csol_cqe->exp_cmdsn;
-   hdr->max_cmdsn = (csol_cqe->exp_cmdsn +
- csol_cqe->cmd_wnd - 1);
+   hdr->exp_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn);
+   hdr->max_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn +
+csol_cqe->cmd_wnd - 1);
 
hdr->itt = io_task->libiscsi_itt;
__iscsi_complete_pdu(conn, (struct iscsi_hdr *)hdr, NULL, 0);
@@ -1404,8 +1405,8 @@ be_complete_nopin_resp(struct beiscsi_conn *beiscsi_conn,
hdr = (struct iscsi_nopin *)task->hdr;
hdr->flags = csol_cqe->i_flags;
hdr->exp_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn);
-   hdr->max_cmdsn = be32_to_cpu(hdr->exp_cmdsn +
-csol_cqe->cmd_wnd - 1);
+   hdr->max_cmdsn = cpu_to_be32(csol_cqe->exp_cmdsn +
+csol_cqe->cmd_wnd - 1);
 
hdr->opcode = ISCSI_OP_NOOP_IN;
hdr->itt = io_task->libiscsi_itt;
@@ -1446,7 +1447,7 @@ static void adapter_get_sol_cqe(struct beiscsi_hba *phba,
  cid, psol);
csol_cqe->hw_sts = AMAP_GET_BITS(struct amap_sol_cqe_v2,
 hw_sts, psol);
-   csol_cqe->cmd_wnd = AMAP_GET_BITS(struct amap_sol_cqe,
+   csol_cqe->cmd_wnd = AMAP_GET_BITS(struct amap_sol_cqe_v2,
  i_cmd_wnd, psol);
if (AMAP_GET_BITS(struct amap_sol_cqe_v2,
  cmd_cmpl, psol))
-- 
1.7.10.4

--
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 18/18] be2iscsi: Bump the driver version

2013-04-05 Thread Jayamohan Kallickal
  This patch bumps the version number

Signed-off-by: John Soni Jose 
Signed-off-by: Jayamohan Kallickal 
---
 drivers/scsi/be2iscsi/be_main.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/be2iscsi/be_main.h b/drivers/scsi/be2iscsi/be_main.h
index 23be676..2c06ef3 100644
--- a/drivers/scsi/be2iscsi/be_main.h
+++ b/drivers/scsi/be2iscsi/be_main.h
@@ -36,7 +36,7 @@
 
 #include "be.h"
 #define DRV_NAME   "be2iscsi"
-#define BUILD_STR  "10.0.272.0"
+#define BUILD_STR  "10.0.467.0"
 #define BE_NAME"Emulex OneConnect" \
"Open-iSCSI Driver version" BUILD_STR
 #define DRV_DESC   BE_NAME " " "Driver"
-- 
1.7.10.4

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


be2iscsi: Patchset for be2iscsi

2013-04-05 Thread Jayamohan Kallickal

Hi James

These patches contains updates for the be2iscsi driver
cut against scsi.git, branch "misc"

This set of patches fixes the issue MikeC commented on.

This patchset consolidates  earlier patchset submitted on 11 Mar 
along with a reentrancy issue fix from Shlomo Pongratz

Also, there are three new patches - patch 15,16 and 17

The patcheset for 10.0.467.0 includes
- Fix lack of uninitialize pattern to FW
- Fix returning Failure when MBX has insufficient Buffer
- Fix MBX Command issues
- Fix MSIx support in SKH R to 32
- Fix freeing CXN specific driver resources
- Fix MACRO for checking the adapter type
- Fix support for DEFQ extension
- Fix displaying the FW Version from driver
- ix displaying the Active Session Count from driver
- Fix the Port Link Status issue
- Fix the NOP In handling code path
- Fix dynamic CID allocation Mechanism in driver
- Fix checking Adapter state while establish a connection
- Fix the copyright Information
- Fix the session cleanup when reboot or shutdown happens
- Fix possible reentrancy issue in be_iopoll
Acking patch by Shlomo Pongratz
- Fix issue in passing the exp_cmdsn and  max_cmdsn
- Bump the driver version

Thanks
Jay

Signed-off-by: Jayamohan Kallickal 
---
--
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