Re: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA

2013-07-15 Thread Jack Wang
Hi Hans,
On 07/14/2013 10:45 AM, Hans Verkuil wrote:
> Hi Anand,
> 
> On 07/12/2013 03:14 PM, Anand Kumar Santhanam wrote:
>> Hans,
>>
>> I reviewed the code changes and I did not see major differences except
>> for the fact that in adaptec driver we have 64 interrupt handlers to
>> handle 64 MSI-X.
>> This was optimized in open src driver to use only 1 interrupt handler.
>> Can you pls make this change to the open src driver (i.e have multiple
>> interrupt handlers for multiple MSI-X) and check?
> 
> I've looked at this more closely, and I wonder whether there isn't a race 
> condition
> here. When an interrupt arrives you put the interrupt vector in 
> pm8001_ha->int_vector,
> then schedule the tasklet. But what if two interrupts with different vectors 
> arrive
> in quick succession before the tasklet got a chance to run? In that case the 
> tasklet
> will only see the second vector, not the first. Rather scary.
> 
> I have not actually seen any issues with this, but by definition race 
> conditions are
> hard to reproduce and I haven't done any serious testing with this card. For 
> now I
> will run with the quick and dirty msi.diff 
> (http://hverkuil.home.xs4all.nl/msi.diff).
> 
> I see two solutions: either use the 64 interrupt handlers as done in the 
> adaptec
> driver, or you can change int_vector into a u64 and use it as a bitmask to 
> record
> all interrupt vectors that have arrived.
Thanks for looking into this, I think second one is what we want, set
the bitmask when interrupt arrived and clear it when it's processed.

> 
> BTW, another difference between the linux kernel driver and the adaptec 
> version are
> several of the defines in pm8001_defs.h: e.g. MPI_QUEUE is 256 in the adaptec 
> driver,
> while it is 1024 in the kernel driver. There are other differences as well.
> 
Different value may reflect different performance character, but both
should works, there is no one for all setting.

> Are all the changes in the kernel correct? I would like to have a 
> confirmation of
> that before I am going to trust my data to this driver.
> 
> It clearly hasn't been tested with actual hardware :-(
> 
:_(

Thanks,
Jack

> Regards,
> 
>   Hans
> 

--
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] [SCSI] scsi_debug: silence GCC warning

2013-07-15 Thread Paul Bolle
Building scsi_debug.o triggers a GCC warning:
drivers/scsi/scsi_debug.c: In function ‘dif_verify’:
drivers/scsi/scsi_debug.c:1755:3: warning: ‘csum’ may be used uninitialized 
in this function [-Wmaybe-uninitialized]

This is a false positive, but if we make scsi_debug_guard a bool, we
supply GCC with enough information to determine that csum will not be
used uninitialized. It also allows for a minor cleanup.

Signed-off-by: Paul Bolle 
---
0) Compile tested only.

1) This warning is apparently introduced in v3.11-rc1 by commit beb40ea42b
("[SCSI] scsi_debug: reduce duplication between prot_verify_read and
prot_verify_write")

 drivers/scsi/scsi_debug.c | 15 +--
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index cb4fefa..98e6436 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -169,7 +169,7 @@ static int scsi_debug_dix = DEF_DIX;
 static int scsi_debug_dsense = DEF_D_SENSE;
 static int scsi_debug_every_nth = DEF_EVERY_NTH;
 static int scsi_debug_fake_rw = DEF_FAKE_RW;
-static int scsi_debug_guard = DEF_GUARD;
+static bool scsi_debug_guard = DEF_GUARD;
 static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED;
 static int scsi_debug_max_luns = DEF_MAX_LUNS;
 static int scsi_debug_max_queue = SCSI_DEBUG_CANQUEUE;
@@ -1736,10 +1736,10 @@ static u16 dif_compute_csum(const void *buf, int len)
u16 csum;
 
switch (scsi_debug_guard) {
-   case 1:
+   case true:
csum = ip_compute_csum(buf, len);
break;
-   case 0:
+   case false:
csum = cpu_to_be16(crc_t10dif(buf, len));
break;
}
@@ -2736,7 +2736,7 @@ module_param_named(dix, scsi_debug_dix, int, S_IRUGO);
 module_param_named(dsense, scsi_debug_dsense, int, S_IRUGO | S_IWUSR);
 module_param_named(every_nth, scsi_debug_every_nth, int, S_IRUGO | S_IWUSR);
 module_param_named(fake_rw, scsi_debug_fake_rw, int, S_IRUGO | S_IWUSR);
-module_param_named(guard, scsi_debug_guard, int, S_IRUGO);
+module_param_named(guard, scsi_debug_guard, bool, S_IRUGO);
 module_param_named(lbpu, scsi_debug_lbpu, int, S_IRUGO);
 module_param_named(lbpws, scsi_debug_lbpws, int, S_IRUGO);
 module_param_named(lbpws10, scsi_debug_lbpws10, int, S_IRUGO);
@@ -3312,11 +3312,6 @@ static int __init scsi_debug_init(void)
return -EINVAL;
}
 
-   if (scsi_debug_guard > 1) {
-   printk(KERN_ERR "scsi_debug_init: guard must be 0 or 1\n");
-   return -EINVAL;
-   }
-
if (scsi_debug_ato > 1) {
printk(KERN_ERR "scsi_debug_init: ato must be 0 or 1\n");
return -EINVAL;
@@ -4028,7 +4023,7 @@ static int sdebug_driver_probe(struct device * dev)
   (host_prot & SHOST_DIX_TYPE2_PROTECTION) ? " DIX2" : "",
   (host_prot & SHOST_DIX_TYPE3_PROTECTION) ? " DIX3" : "");
 
-   if (scsi_debug_guard == 1)
+   if (scsi_debug_guard == true)
scsi_host_set_guard(hpnt, SHOST_DIX_GUARD_IP);
else
scsi_host_set_guard(hpnt, SHOST_DIX_GUARD_CRC);
-- 
1.8.1.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


Re: [PATCH] pm80xx: fix Adaptec 71605H hang

2013-07-15 Thread Jack Wang
On 07/14/2013 10:25 AM, Hans Verkuil wrote:
> The IO command size is 128 bytes for these new controllers as opposed to 64
> for the old 8001 controller.
> 
> The Adaptec out-of-tree driver did this correctly. After comparing the two
> this turned out to be the crucial difference.
Thanks Hans for this fix.
We'd better use more meaningful Micro like:

#define MPI_IOMB_SIZE_SPCV 128 and replace current hard coded one.

Thanks,
Jack
> 
> Signed-off-by: Hans Verkuil 
> Acked-by: anandkumar.santha...@pmcs.com
> Cc: sta...@vger.kernel.org  # for v3.10 and up
> ---
>  drivers/scsi/pm8001/pm80xx_hwi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c 
> b/drivers/scsi/pm8001/pm80xx_hwi.c
> index 302514d..e1db5ca 100644
> --- a/drivers/scsi/pm8001/pm80xx_hwi.c
> +++ b/drivers/scsi/pm8001/pm80xx_hwi.c
> @@ -275,7 +275,7 @@ static void init_default_table_values(struct 
> pm8001_hba_info *pm8001_ha)
>  
>   for (i = 0; i < PM8001_MAX_SPCV_INB_NUM; i++) {
>   pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt  =
> - PM8001_MPI_QUEUE | (64 << 16) | (0x00<<30);
> + PM8001_MPI_QUEUE | (128 << 16) | (0x00<<30);
>   pm8001_ha->inbnd_q_tbl[i].upper_base_addr   =
>   pm8001_ha->memoryMap.region[IB + i].phys_addr_hi;
>   pm8001_ha->inbnd_q_tbl[i].lower_base_addr   =
> @@ -301,7 +301,7 @@ static void init_default_table_values(struct 
> pm8001_hba_info *pm8001_ha)
>   }
>   for (i = 0; i < PM8001_MAX_SPCV_OUTB_NUM; i++) {
>   pm8001_ha->outbnd_q_tbl[i].element_size_cnt =
> - PM8001_MPI_QUEUE | (64 << 16) | (0x01<<30);
> + PM8001_MPI_QUEUE | (128 << 16) | (0x01<<30);
>   pm8001_ha->outbnd_q_tbl[i].upper_base_addr  =
>   pm8001_ha->memoryMap.region[OB + i].phys_addr_hi;
>   pm8001_ha->outbnd_q_tbl[i].lower_base_addr  =
> 

--
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: [PATCHv2 0/7] Limit overall SCSI EH runtime

2013-07-15 Thread Ren Mingxin

Hi, Ewan:

On 07/12/2013 09:30 PM, Ewan Milne wrote:

On Fri, 2013-07-12 at 13:54 +0800, Ren Mingxin wrote:

I'm wondering how do you test, with a special hardware or self-made
module?Would you mind pasting your test method() and result?

This was tested in a SAN environment with an EMC Symmetrix and
Brocade FC switches.  The error was injected by the following
commands:

portcfg rscnsupr  --enable
portdisable

Where  is the FC port of the Symmetrix target.

Multipath is used and the test records how long I/O from userspace
takes to complete after the error handling stops and the I/O is
retried on another path.

What happens is that the target never responds to anything the
HBA sends, so commands and TMFs just timeout.  The HBA doesn't
see link down (since it is the target port) and doesn't get an
RSCN.  When the HBA is finally reset, however, it can't login
to the target port and so further I/O gets an immediate error.

Unfortunately, not all SAN environments will exhibit the failing
behavior -- it appears as if in some cases the HBA detects the
problem regardless of the switch portcfg setting.  But this has
been verified to solve the problem of seemingly endless EH
activity in testing at a large customer site.


Thanks in advance for your explanations in detail. I've been able to
reproduce only with this patchset.


Also, to be clear, we tested with the "Limit overall SCSI EH
runtime" patchset but not the "New EH command timeout handler".
I think the changes to issue the abort in the timeout handler
are a good idea, though, because there really is no need to
wait for all activity on the host to cease before issuing the
abort as far as I can see.


Hmm, agree with you. It is much better to issue aborts without
waiting, which can shorten the timeout handling time.


Acked-by: Ewan D. Milne



Hi, Hannes:

I noticed that the dd time had been reduced from 6m+ to 2m+ when the
'eh_deadline' was set as 30s, but the dd time was 6m+(nearly the same
as default - 'eh_deadline' was 0) when the 'eh_deadline' was set as
10s. I havn't been able to dig further, but I guess there is some
restriction when setting this 'eh_deadline' interface. Maybe should
not less than some timeout, otherwise 'eh_deadline' setting will not
work?

Thanks,
Ren
--
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/4] scsi_debug: fix WRITE_SAME with virtual_gb > 0

2013-07-15 Thread Akinobu Mita
With module parameter virtual_gb > 0, the device accesses may go beyond
the actual ramdisk storage (fake_storep).  Such requests should be
treated as fake_storep is repeatedly mirrored up to virtual size
(virtual_gb * 1GB).

Unfortunately, WRITE_SAME commands with such requests access out of
fake_storep region.  For writing to the first LBA, this fixes it by
switching to use existing do_device_access() which does the correct
conversion of LBA.  For spreading the first LBA over the remaining
blocks, this fixes it by using newly introduced fake_store() for getting
valid address which is corresponding to a given LBA in fake_storep.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 16 ++--
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 01c0ffa..1e25c1e 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -257,7 +257,7 @@ struct sdebug_queued_cmd {
 };
 static struct sdebug_queued_cmd queued_arr[SCSI_DEBUG_CANQUEUE];
 
-static unsigned char * fake_storep;/* ramdisk storage */
+static void *fake_storep;  /* ramdisk storage */
 static struct sd_dif_tuple *dif_storep;/* protection info */
 static void *map_storep;   /* provisioning map */
 
@@ -293,6 +293,13 @@ static unsigned char ctrl_m_pg[] = {0xa, 10, 2, 0, 0, 0, 
0, 0,
 static unsigned char iec_m_pg[] = {0x1c, 0xa, 0x08, 0, 0, 0, 0, 0,
   0, 0, 0x0, 0x0};
 
+static void *fake_store(unsigned long long lba)
+{
+   lba = do_div(lba, sdebug_store_sectors);
+
+   return fake_storep + lba * scsi_debug_sector_size;
+}
+
 static int sdebug_add_adapter(void);
 static void sdebug_remove_adapter(void);
 
@@ -2131,9 +2138,7 @@ static int resp_write_same(struct scsi_cmnd *scmd, 
unsigned long long lba,
}
 
/* Else fetch one logical block */
-   ret = fetch_to_dev_buffer(scmd,
- fake_storep + (lba * scsi_debug_sector_size),
- scsi_debug_sector_size);
+   ret = do_device_access(scmd, devip, lba, 1, 1);
 
if (-1 == ret) {
write_unlock_irqrestore(&atomic_rw, iflags);
@@ -2145,8 +2150,7 @@ static int resp_write_same(struct scsi_cmnd *scmd, 
unsigned long long lba,
 
/* Copy first sector to remaining blocks */
for (i = 1 ; i < num ; i++)
-   memcpy(fake_storep + ((lba + i) * scsi_debug_sector_size),
-  fake_storep + (lba * scsi_debug_sector_size),
+   memcpy(fake_store(lba + i), fake_store(lba),
   scsi_debug_sector_size);
 
if (scsi_debug_lbp())
-- 
1.8.3.1

--
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/4] scsi_debug: fix bugs with certain module parameters

2013-07-15 Thread Akinobu Mita
This patch set includes bug fixes with certain module parameters of
scsi_debug.  First one fixes bug with num_parts > 0.  Others fix logical
block provisioning support with unmap_alignment != 0 and with virtual_gb > 0.

Akinobu Mita (4):
  scsi_debug: fix endianness bug in sdebug_build_parts()
  scsi_debug: fix logical block provisioning support when
unmap_alignment != 0
  scsi_debug: fix WRITE_SAME with virtual_gb > 0
  scsi_debug: fix out of range access by Get_LBA_status with virtual_gb
> 0

 drivers/scsi/scsi_debug.c | 41 ++---
 1 file changed, 30 insertions(+), 11 deletions(-)

Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org

-- 
1.8.3.1

--
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/4] scsi_debug: fix endianness bug in sdebug_build_parts()

2013-07-15 Thread Akinobu Mita
With module parameter num_parts > 0, partition table is built on the
ramdisk storage when loading the driver.  Unfortunately, there is an
endianness bug in sdebug_build_parts().  So the partition table is not
correctly initialized on big-endian systems.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index cb4fefa..2f39b13 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2659,8 +2659,8 @@ static void __init sdebug_build_parts(unsigned char *ramp,
   / sdebug_sectors_per;
pp->end_sector = (end_sec % sdebug_sectors_per) + 1;
 
-   pp->start_sect = start_sec;
-   pp->nr_sects = end_sec - start_sec + 1;
+   pp->start_sect = cpu_to_le32(start_sec);
+   pp->nr_sects = cpu_to_le32(end_sec - start_sec + 1);
pp->sys_ind = 0x83; /* plain Linux partition */
}
 }
-- 
1.8.3.1

--
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/4] scsi_debug: fix out of range access by Get_LBA_status with virtual_gb > 0

2013-07-15 Thread Akinobu Mita
With logical block provisioning support enabled, the provisioning map
(map_storep) keeps track of the provisioning status (mapped or unmapped)
for actual ramdisk storage range (fake_storep).  The provisioning status
for out of fake_storep range with module parameter virtual_gb > 0 is
not tracked, and it should be assumed always mapped.  It is reasonable,
because Unmap commands for such virtual range are always ignored.

Unfortunately, Get_LBA_status command for virtual range accesses out of
map_storep range.  This fixes invalid access and makes it return correct
provisioning status.

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 1e25c1e..c519c9f 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -2014,6 +2014,7 @@ static sector_t map_index_to_lba(unsigned long index)
return lba;
 }
 
+/* LBA from sdebug_store_sectors to sdebug_capacity is assumed mapped */
 static unsigned int map_state(sector_t lba, unsigned int *num)
 {
sector_t end;
@@ -2022,6 +2023,10 @@ static unsigned int map_state(sector_t lba, unsigned int 
*num)
unsigned long next;
 
index = lba_to_map_index(lba);
+   if (index >= map_size) {
+   *num = sdebug_capacity - lba;
+   return 1;
+   }
mapped = test_bit(index, map_storep);
 
if (mapped)
@@ -2029,7 +2034,11 @@ static unsigned int map_state(sector_t lba, unsigned int 
*num)
else
next = find_next_bit(map_storep, map_size, index);
 
-   end = min_t(sector_t, sdebug_store_sectors,  map_index_to_lba(next));
+   if (next >= map_size)
+   end = mapped ? sdebug_capacity : sdebug_store_sectors;
+   else
+   end = map_index_to_lba(next);
+
*num = end - lba;
 
return mapped;
-- 
1.8.3.1

--
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/4] scsi_debug: fix logical block provisioning support when unmap_alignment != 0

2013-07-15 Thread Akinobu Mita
Commit b90ebc3d5c41c9164ae04efd2e4f8204c2a186f1 ("[SCSI] scsi_debug:
fix logical block provisioning support") fixed several issues with
logical block provisioning support, but it still doesn't properly fix
the cases when unmap_alignment > 0.  (for example, unmap_alignment=1
and unmap_granularity=3)

The problem is in map_index_to_lba(), which should return the first
LBA which is corresponding to a given index of provisioning map
(map_storep).

Signed-off-by: Akinobu Mita 
Cc: "James E.J. Bottomley" 
Cc: Douglas Gilbert 
Cc: "Martin K. Petersen" 
Cc: linux-scsi@vger.kernel.org
---
 drivers/scsi/scsi_debug.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 2f39b13..01c0ffa 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1997,8 +1997,14 @@ static unsigned long lba_to_map_index(sector_t lba)
 
 static sector_t map_index_to_lba(unsigned long index)
 {
-   return index * scsi_debug_unmap_granularity -
-   scsi_debug_unmap_alignment;
+   sector_t lba = index * scsi_debug_unmap_granularity;
+
+   if (scsi_debug_unmap_alignment) {
+   lba -= scsi_debug_unmap_granularity -
+   scsi_debug_unmap_alignment;
+   }
+
+   return lba;
 }
 
 static unsigned int map_state(sector_t lba, unsigned int *num)
-- 
1.8.3.1

--
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][SCSI] megaraid_sas: megaraid_sas driver init fails in kdump kernel

2013-07-15 Thread Sumit.Saxena
Problem: When Hardware IOMMU is on, megaraid_sas driver initialization fails in 
kdump kernel with LSI MegaRAID controller(device id-0x73). This issue was 
reported to Redhat Bugzilla. Redhat bugzilla ID is 833299.

Actually this issue needs fix in firmware, but for firmware running in field, 
this driver fix is proposed to resolve the issue.
At firmware initialization time, if firmware does not come to ready state, 
driver will reset the adapter and retry for firmware transition to ready state 
unconditionally(not only executed for kdump kernel).

Signed-off-by: Sumit Saxena 
Signed-off-by: Kashyap Desai 
---
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c 
b/drivers/scsi/megaraid/megaraid_sas_base.c
index 4c4abe1..e009a6b 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3547,11 +3547,21 @@ static int megasas_init_fw(struct megasas_instance 
*instance)
break;
}
 
-   /*
-* We expect the FW state to be READY
-*/
-   if (megasas_transition_to_ready(instance, 0))
-   goto fail_ready_state;
+   if (megasas_transition_to_ready(instance, 0)) {
+   atomic_set(&instance->fw_reset_no_pci_access, 1);
+   instance->instancet->adp_reset
+   (instance, instance->reg_set);
+   atomic_set(&instance->fw_reset_no_pci_access, 0);
+   dev_info(&instance->pdev->dev,
+   "megasas: FW restarted successfully from %s!\n",
+   __func__);
+
+   /*waitting for about 30 second before retry*/
+   ssleep(30);
+
+   if (megasas_transition_to_ready(instance, 0))
+   goto fail_ready_state;
+   }
 
/*
 * MSI-X host index 0 is common for all adapter.

--
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: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA

2013-07-15 Thread Anand Kumar Santhanam
Hi Hans,

Pls find responses inline.

Regards
Anand

-Original Message-
From: Jack Wang [mailto:xjtu...@gmail.com] 
Sent: Monday, July 15, 2013 2:24 PM
To: Hans Verkuil
Cc: Anand Kumar Santhanam; lindar_liu; linux-scsi@vger.kernel.org;
jinpu.w...@profitbricks.com
Subject: Re: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA

Hi Hans,
On 07/14/2013 10:45 AM, Hans Verkuil wrote:
> Hi Anand,
> 
> On 07/12/2013 03:14 PM, Anand Kumar Santhanam wrote:
>> Hans,
>>
>> I reviewed the code changes and I did not see major differences 
>> except for the fact that in adaptec driver we have 64 interrupt 
>> handlers to handle 64 MSI-X.
>> This was optimized in open src driver to use only 1 interrupt
handler.
>> Can you pls make this change to the open src driver (i.e have 
>> multiple interrupt handlers for multiple MSI-X) and check?
> 
> I've looked at this more closely, and I wonder whether there isn't a 
> race condition here. When an interrupt arrives you put the interrupt 
> vector in pm8001_ha->int_vector, then schedule the tasklet. But what 
> if two interrupts with different vectors arrive in quick succession 
> before the tasklet got a chance to run? In that case the tasklet will
only see the second vector, not the first. Rather scary.
> 
> I have not actually seen any issues with this, but by definition race 
> conditions are hard to reproduce and I haven't done any serious 
> testing with this card. For now I will run with the quick and dirty
msi.diff (http://hverkuil.home.xs4all.nl/msi.diff).
> 
> I see two solutions: either use the 64 interrupt handlers as done in 
> the adaptec driver, or you can change int_vector into a u64 and use it

> as a bitmask to record all interrupt vectors that have arrived.
Thanks for looking into this, I think second one is what we want, set
the bitmask when interrupt arrived and clear it when it's processed.

Anand>> Yes. We will go for the second solution. The multiple
interrupt/tasklet handlers for MSI-X got rejected by the community and
hence
We went for the existing approach. I checked with a single controller
and I did not observe any issues. Also pls note that the open source
driver
Supports only one MSI-X for now and this problem will not occur.

> 
> BTW, another difference between the linux kernel driver and the 
> adaptec version are several of the defines in pm8001_defs.h: e.g. 
> MPI_QUEUE is 256 in the adaptec driver, while it is 1024 in the kernel
driver. There are other differences as well.
> 
Different value may reflect different performance character, but both
should works, there is no one for all setting.

Anand >> I agree with Jack. I will check on the #defines and get back.

> Are all the changes in the kernel correct? I would like to have a 
> confirmation of that before I am going to trust my data to this
driver.
> 
> It clearly hasn't been tested with actual hardware :-(
> 
:_(

>> My sincere apologies. I tested the same with single controller and it
worked fine. However I messed up when submitting 
The patches. This was my first open source submission and request you to
bear the inconvenience.

Thanks,
Jack

> Regards,
> 
>   Hans
> 

--
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: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA

2013-07-15 Thread Jack Wang
Hi Anand,
On 07/15/2013 02:37 PM, Anand Kumar Santhanam wrote:
> Hi Hans,
> 
> Pls find responses inline.
> 
> Regards
> Anand
> 
> -Original Message-
> From: Jack Wang [mailto:xjtu...@gmail.com] 
> Sent: Monday, July 15, 2013 2:24 PM
> To: Hans Verkuil
> Cc: Anand Kumar Santhanam; lindar_liu; linux-scsi@vger.kernel.org;
> jinpu.w...@profitbricks.com
> Subject: Re: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA
> 
> Hi Hans,
> On 07/14/2013 10:45 AM, Hans Verkuil wrote:
>> Hi Anand,
>>
>> On 07/12/2013 03:14 PM, Anand Kumar Santhanam wrote:
>>> Hans,
>>>
>>> I reviewed the code changes and I did not see major differences 
>>> except for the fact that in adaptec driver we have 64 interrupt 
>>> handlers to handle 64 MSI-X.
>>> This was optimized in open src driver to use only 1 interrupt
> handler.
>>> Can you pls make this change to the open src driver (i.e have 
>>> multiple interrupt handlers for multiple MSI-X) and check?
>>
>> I've looked at this more closely, and I wonder whether there isn't a 
>> race condition here. When an interrupt arrives you put the interrupt 
>> vector in pm8001_ha->int_vector, then schedule the tasklet. But what 
>> if two interrupts with different vectors arrive in quick succession 
>> before the tasklet got a chance to run? In that case the tasklet will
> only see the second vector, not the first. Rather scary.
>>
>> I have not actually seen any issues with this, but by definition race 
>> conditions are hard to reproduce and I haven't done any serious 
>> testing with this card. For now I will run with the quick and dirty
> msi.diff (http://hverkuil.home.xs4all.nl/msi.diff).
>>
>> I see two solutions: either use the 64 interrupt handlers as done in 
>> the adaptec driver, or you can change int_vector into a u64 and use it
> 
>> as a bitmask to record all interrupt vectors that have arrived.
> Thanks for looking into this, I think second one is what we want, set
> the bitmask when interrupt arrived and clear it when it's processed.
> 
> Anand>> Yes. We will go for the second solution. The multiple
> interrupt/tasklet handlers for MSI-X got rejected by the community and
> hence
> We went for the existing approach. I checked with a single controller
> and I did not observe any issues. Also pls note that the open source
> driver
> Supports only one MSI-X for now and this problem will not occur.
> 
>>
>> BTW, another difference between the linux kernel driver and the 
>> adaptec version are several of the defines in pm8001_defs.h: e.g. 
>> MPI_QUEUE is 256 in the adaptec driver, while it is 1024 in the kernel
> driver. There are other differences as well.
>>
> Different value may reflect different performance character, but both
> should works, there is no one for all setting.
> 
> Anand >> I agree with Jack. I will check on the #defines and get back.
> 
>> Are all the changes in the kernel correct? I would like to have a 
>> confirmation of that before I am going to trust my data to this
> driver.
>>
>> It clearly hasn't been tested with actual hardware :-(
>>
> :_(
> 
>>> My sincere apologies. I tested the same with single controller and it
> worked fine. However I messed up when submitting 
> The patches. This was my first open source submission and request you to
> bear the inconvenience.

Never mind, people make mistake, quickly fix that should be fine.
I suggest keep minimal difference between your in house driver and in
tree driver, it will make us easy to maintain the driver and make it
easy to use for user.

Best Regards,
Jack


--
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: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA

2013-07-15 Thread Hans Verkuil
Hi Anand!

On 07/15/2013 02:37 PM, Anand Kumar Santhanam wrote:
> Hi Hans,
> 
> Pls find responses inline.
> 
> Regards
> Anand
> 
> -Original Message-
> From: Jack Wang [mailto:xjtu...@gmail.com] 
> Sent: Monday, July 15, 2013 2:24 PM
> To: Hans Verkuil
> Cc: Anand Kumar Santhanam; lindar_liu; linux-scsi@vger.kernel.org;
> jinpu.w...@profitbricks.com
> Subject: Re: The pm80xx driver hangs in 3.10 with the Adaptec 71605H HBA
> 
> Hi Hans,
> On 07/14/2013 10:45 AM, Hans Verkuil wrote:
>> Hi Anand,
>>
>> On 07/12/2013 03:14 PM, Anand Kumar Santhanam wrote:
>>> Hans,
>>>
>>> I reviewed the code changes and I did not see major differences 
>>> except for the fact that in adaptec driver we have 64 interrupt 
>>> handlers to handle 64 MSI-X.
>>> This was optimized in open src driver to use only 1 interrupt
> handler.
>>> Can you pls make this change to the open src driver (i.e have 
>>> multiple interrupt handlers for multiple MSI-X) and check?
>>
>> I've looked at this more closely, and I wonder whether there isn't a 
>> race condition here. When an interrupt arrives you put the interrupt 
>> vector in pm8001_ha->int_vector, then schedule the tasklet. But what 
>> if two interrupts with different vectors arrive in quick succession 
>> before the tasklet got a chance to run? In that case the tasklet will
> only see the second vector, not the first. Rather scary.
>>
>> I have not actually seen any issues with this, but by definition race 
>> conditions are hard to reproduce and I haven't done any serious 
>> testing with this card. For now I will run with the quick and dirty
> msi.diff (http://hverkuil.home.xs4all.nl/msi.diff).
>>
>> I see two solutions: either use the 64 interrupt handlers as done in 
>> the adaptec driver, or you can change int_vector into a u64 and use it
> 
>> as a bitmask to record all interrupt vectors that have arrived.
> Thanks for looking into this, I think second one is what we want, set
> the bitmask when interrupt arrived and clear it when it's processed.
> 
> Anand>> Yes. We will go for the second solution. The multiple
> interrupt/tasklet handlers for MSI-X got rejected by the community and
> hence
> We went for the existing approach. I checked with a single controller
> and I did not observe any issues.

Well, you typically won't see any issues if there is a race condition :-)

> Also pls note that the open source
> driver
> Supports only one MSI-X for now and this problem will not occur.

Are you referring to the kernel driver or the adaptec driver? Both are
open source...

Anyway, I'm pretty sure I saw interrupts with different vectors arriving
with the kernel driver.

> 
>>
>> BTW, another difference between the linux kernel driver and the 
>> adaptec version are several of the defines in pm8001_defs.h: e.g. 
>> MPI_QUEUE is 256 in the adaptec driver, while it is 1024 in the kernel
> driver. There are other differences as well.
>>
> Different value may reflect different performance character, but both
> should works, there is no one for all setting.
> 
> Anand >> I agree with Jack. I will check on the #defines and get back.

Thanks!

>> Are all the changes in the kernel correct? I would like to have a 
>> confirmation of that before I am going to trust my data to this
> driver.
>>
>> It clearly hasn't been tested with actual hardware :-(
>>
> :_(
> 
>>> My sincere apologies. I tested the same with single controller and it
> worked fine. However I messed up when submitting 
> The patches. This was my first open source submission and request you to
> bear the inconvenience.

No problem, such things happen. Luckily I'm a kernel developer so I know my
way around a driver, even though scsi is not my area of expertise.

Note that I saw one other difference between the kernel and adaptec driver:
the adaptec driver has support for SGPIO commands. I'm not sure what it does
or whether it affects the pm80xx devices.

Regards,

Hans
--
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] [SCSI] scsi_debug: silence GCC warning

2013-07-15 Thread Paul Bolle
Building scsi_debug.o triggers a GCC warning:
drivers/scsi/scsi_debug.c: In function ‘dif_verify’:
drivers/scsi/scsi_debug.c:1755:3: warning: ‘csum’ may be used uninitialized 
in this function [-Wmaybe-uninitialized]

This is a false positive. But if we transform the switch statement in
dif_compute_csum() to a straightforward if/else statement we supply GCC
with enough information to determine that csum will not be used
uninitialized.

Signed-off-by: Paul Bolle 
---
0) v2 because I started to worry whether v1 would change an interface
(ie, the way the "guard" module parameter behaves). This patch is much
simpler, and doesn't change any behavior.

1) Still only compile tested.

 drivers/scsi/scsi_debug.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index cb4fefa..7565ec5 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1735,14 +1735,11 @@ static u16 dif_compute_csum(const void *buf, int len)
 {
u16 csum;
 
-   switch (scsi_debug_guard) {
-   case 1:
+   if (scsi_debug_guard == 1)
csum = ip_compute_csum(buf, len);
-   break;
-   case 0:
+   else
csum = cpu_to_be16(crc_t10dif(buf, len));
-   break;
-   }
+
return csum;
 }
 
-- 
1.8.1.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


Re: [PATCH v2 1/1] [SCSI] sg: fix race condition when do exclusive open

2013-07-15 Thread Jörn Engel
On Sun, 7 July 2013 01:24:44 +0800, vaughan wrote:
> 
> Do you agree that I use a per device spin_lock 'sfd_lock' to protect
> sfds list and leave sg_index_lock
> only protect the global sg device lookup? I think it's reasonable
> for concurrency.

That bit looks fine to me.  I don't think it matters much, but sure,
why not!

Jörn

--
One of the painful things about our time is that those who feel certainty
are stupid, and those with any imagination and understanding are filled
with doubt and indecision.
-- Bertrand Russell
--
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: Linux Plumbers IO & File System Micro-conference

2013-07-15 Thread Ric Wheeler

On 07/12/2013 01:42 PM, faibish, sorin wrote:

Can we have a discussion on Lustre client in the kernel? Thanks

./Sorin


I am not sure that we have that much to do for Lustre on the client side. Is 
this a topic that would be of broad enough interest to include people outside of 
the kernel developers?


thanks!

Ric



-Original Message-
From: linux-fsdevel-ow...@vger.kernel.org 
[mailto:linux-fsdevel-ow...@vger.kernel.org] On Behalf Of Ric Wheeler
Sent: Friday, July 12, 2013 1:21 PM
To: linux-scsi@vger.kernel.org; Linux FS Devel; linux-...@vger.kernel.org; 
linux-btrfs; xfs-oss; linux-e...@vger.kernel.org; device-mapper development; 
IDE/ATA development list; anaconda-devel-l...@redhat.com
Subject: Linux Plumbers IO & File System Micro-conference


Linux Plumbers has approved a file and storage microconference. The overview 
page is here:

http://wiki.linuxplumbersconf.org/2013:file_and_storage_systems

I would like to started gathering in ideas for topics. I have been approached 
already with a request to cover the copy_range work Zach Brown kicked off at 
LSF which I think is a great topic since it has impact throughout the stack, 
all the way up to applications programmers.

A similar request was made to give some time to non-volatile memory devices and the 
proposed "persistent memory" backed block device and persistent memory file 
system from Intel. That also seems to fall in nicely with the plumbers mission statement 
since it clearly will impact everything from the application on down through the kernel.

Last year, we had a good discussion on management of storage (anaconda, yast, 
libstoragemgt, etc) - that also might be worth giving updates on.

The instructions for submitting ideas will be updated later today at:

http://www.linuxplumbersconf.org/2013/submitting-topic/

If you have topics that you would like to add, wait until the instructions get 
posted at the link above. If you are impatient, feel free to email me directly 
(but probably best to drop the broad mailing lists from the reply).

Thanks!

Ric

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



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


Re: [PATCH v3 1/1] [SCSI] sg: fix race condition when do exclusive open

2013-07-15 Thread Jörn Engel
On Mon, 8 July 2013 03:53:49 +0800, vaughan wrote:
> 
> Use rwsem to aid opens. Exclusive open has to get write lock and 
> non-exclusive open should get read lock.
> Replace global sg_open_exclusive_lock with a per device lock - sfd_lock. 
> Since sfds list is now protected by the lock owned by the same sg_device, 
> sg_index_lock becomes a real global lock to only protect sg devices lookup.
> 
> Please pay attention to sdp->detached. Previously sg_open may also race with 
> sg_remove. Now there are two points for sg_open to detect detached and finish 
> itself. One is at sg_device lookup and the other is when trying to link new 
> sfp into the sfds list in sg_add_sfp.
> I don't think it's necessary to do extra set_exclude and wake_up o_excl_wait 
> in sg_release before, so I remove them and only do the cleanup in 
> sg_remove_sfp.
> Although simple testcases are passed, I'm not certain if I've fixed it well, 
> please give me any comments as you wish.
> 
> Signed-off-by: Vaughan Cao 
> ---
>  drivers/scsi/sg.c | 187 
> ++
>  1 file changed, 89 insertions(+), 98 deletions(-)

Had a quick read and I think I like the code.  What I still dislike is
that it merges several independent functional changes into one patch.

Can you create three patches, one for the rwsem part, one for pushing
the locking down to per-device locking and one for the rest?  That
would make it easier for me to understand and trust the individual
patches and for James/Linus to revert one, if it turns out to be bad.

Jörn

--
There are two ways of constructing a software design: one way is to make
it so simple that there are obviously no deficiencies, and the other is
to make it so complicated that there are no obvious deficiencies.
-- C. A. R. Hoare
--
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/13] lpfc 8.3.41: Update lpfc to revision 8.3.41

2013-07-15 Thread James Smart
This patch set updates the lpfc driver to revision 8.3.41

The patches for 8.3.41 contain:

- Fixed freeing of iocb when internal loopback times out
- Fix mailbox byteswap issue on PPC
- Fixed Receive Queue varied frame size handling 
- Fixed max value of lpfc_lun_queue_depth
- Ensure driver properly zeros unused fields in SLI4 mailbox commands
- Fixed support for 128 byte WQEs 
- Fixed SLI3 failing FCP write on check-condition no-sense with residual zero
- Fixed failure in setting SLI3 board mod
- Fixed not able to perform PCI function reset when board was not in online mode
- Add first burst support to driver
- Fixed the format of some log message fields
- Update copyrights for 8.3.41 modifications
- Update lpfc version to driver version 8.3.41 


The patches were cut against scsi.git, branch "misc".

-- james s


Signed-off-by: James Smart 







--
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/13] lpfc 8.3.41: Fixed freeing of iocb when internal loopback times out

2013-07-15 Thread James Smart
Fixed freeing of iocb when internal loopback times out


Signed-off-by: James Smart 

 ---

 lpfc_bsg.c  |8 +---
 lpfc_scsi.c |2 +-
 lpfc_sli.c  |   51 +--
 lpfc_sli.h  |5 -
 4 files changed, 55 insertions(+), 11 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
--- a/drivers/scsi/lpfc/lpfc_bsg.c  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_bsg.c  2013-07-15 07:15:01.938055472 -0400
@@ -2498,7 +2498,7 @@ static int lpfcdiag_loop_get_xri(struct
struct lpfc_sli_ct_request *ctreq = NULL;
int ret_val = 0;
int time_left;
-   int iocb_stat = 0;
+   int iocb_stat = IOCB_SUCCESS;
unsigned long flags;
 
*txxri = 0;
@@ -2574,6 +2574,7 @@ static int lpfcdiag_loop_get_xri(struct
 
cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
cmdiocbq->vport = phba->pport;
+   cmdiocbq->iocb_cmpl = NULL;
 
iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
rspiocbq,
@@ -2963,7 +2964,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg
uint8_t *ptr = NULL, *rx_databuf = NULL;
int rc = 0;
int time_left;
-   int iocb_stat;
+   int iocb_stat = IOCB_SUCCESS;
unsigned long flags;
void *dataout = NULL;
uint32_t total_mem;
@@ -3149,6 +3150,7 @@ lpfc_bsg_diag_loopback_run(struct fc_bsg
}
cmdiocbq->iocb_flag |= LPFC_IO_LIBDFC;
cmdiocbq->vport = phba->pport;
+   cmdiocbq->iocb_cmpl = NULL;
iocb_stat = lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq,
 rspiocbq, (phba->fc_ratov * 2) +
 LPFC_DRVR_TIMEOUT);
@@ -3209,7 +3211,7 @@ err_loopback_test_exit:
lpfc_bsg_event_unref(evt); /* delete */
spin_unlock_irqrestore(&phba->ct_ev_lock, flags);
 
-   if (cmdiocbq != NULL)
+   if ((cmdiocbq != NULL) && (iocb_stat != IOCB_TIMEDOUT))
lpfc_sli_release_iocbq(phba, cmdiocbq);
 
if (rspiocbq != NULL)
diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:01.946055472 -0400
@@ -5022,6 +5022,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vp
lpfc_release_scsi_buf(phba, lpfc_cmd);
return FAILED;
}
+   iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
 
lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
 "0702 Issue %s to TGT %d LUN %d "
@@ -5034,7 +5035,6 @@ lpfc_send_taskmgmt(struct lpfc_vport *vp
  iocbq, iocbqrsp, lpfc_cmd->timeout);
if (status != IOCB_SUCCESS) {
if (status == IOCB_TIMEDOUT) {
-   iocbq->iocb_cmpl = lpfc_tskmgmt_def_cmpl;
ret = TIMEOUT_ERROR;
} else
ret = FAILED;
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:01.997055473 -0400
@@ -9889,6 +9889,24 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba
struct lpfc_scsi_buf *lpfc_cmd;
 
spin_lock_irqsave(&phba->hbalock, iflags);
+   if (cmdiocbq->iocb_flag & LPFC_IO_WAKE_TMO) {
+
+   /*
+* A time out has occurred for the iocb.  If a time out
+* completion handler has been supplied, call it.  Otherwise,
+* just free the iocbq.
+*/
+
+   spin_unlock_irqrestore(&phba->hbalock, iflags);
+   cmdiocbq->iocb_cmpl = cmdiocbq->wait_iocb_cmpl;
+   cmdiocbq->wait_iocb_cmpl = NULL;
+   if (cmdiocbq->iocb_cmpl)
+   (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, NULL);
+   else
+   lpfc_sli_release_iocbq(phba, cmdiocbq);
+   return;
+   }
+
cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
if (cmdiocbq->context2 && rspiocbq)
memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
@@ -9944,10 +9962,16 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba,
  * @timeout: Timeout in number of seconds.
  *
  * This function issues the iocb to firmware and waits for the
- * iocb to complete. If the iocb command is not
- * completed within timeout seconds, it returns IOCB_TIMEDOUT.
- * Caller should not free the iocb resources if this function
- * returns IOCB_TIMEDOUT.
+ * iocb to complete. The iocb_cmpl field of the shall be used
+ * to handle iocbs which time out. If the field is NULL, the
+ * function shall free the iocbq structure.  If more clean up is
+ * needed, the caller is expected to provide a completion function
+ * that will prov

[PATCH 2/13] lpfc 8.3.41: Fix mailbox byteswap issue on PPC

2013-07-15 Thread James Smart
Fix mailbox byteswap issue on PPC


Signed-off-by: James Smart 

 ---

 lpfc_sli.c |1 -
 1 file changed, 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:01.997055473 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:08.819055628 -0400
@@ -10161,7 +10161,6 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba
 */
if (pmboxq->mbox_flag & LPFC_MBX_WAKE) {
retval = MBX_SUCCESS;
-   lpfc_sli4_swap_str(phba, pmboxq);
} else {
retval = MBX_TIMEOUT;
pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;




--
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/13] lpfc 8.3.41: Fixed Receive Queue varied frame size handling

2013-07-15 Thread James Smart
Fixed Receive Queue varied frame size handling 


Signed-off-by: James Smart 

 ---

 lpfc_sli.c |   36 
 1 file changed, 24 insertions(+), 12 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:08.819055628 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:14.692055763 -0400
@@ -14703,14 +14703,20 @@ lpfc_prep_seq(struct lpfc_vport *vport,
first_iocbq->iocb.unsli3.rcvsli3.vpi =
vport->phba->vpi_ids[vport->vpi];
/* put the first buffer into the first IOCBq */
+   tot_len = bf_get(lpfc_rcqe_length,
+  &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
+
first_iocbq->context2 = &seq_dmabuf->dbuf;
first_iocbq->context3 = NULL;
first_iocbq->iocb.ulpBdeCount = 1;
-   first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
+   if (tot_len > LPFC_DATA_BUF_SIZE)
+   first_iocbq->iocb.un.cont64[0].tus.f.bdeSize =
LPFC_DATA_BUF_SIZE;
+   else
+   first_iocbq->iocb.un.cont64[0].tus.f.bdeSize = tot_len;
+
first_iocbq->iocb.un.rcvels.remoteID = sid;
-   tot_len = bf_get(lpfc_rcqe_length,
-  &seq_dmabuf->cq_event.cqe.rcqe_cmpl);
+
first_iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;
}
iocbq = first_iocbq;
@@ -14726,14 +14732,17 @@ lpfc_prep_seq(struct lpfc_vport *vport,
if (!iocbq->context3) {
iocbq->context3 = d_buf;
iocbq->iocb.ulpBdeCount++;
-   pbde = (struct ulp_bde64 *)
-   &iocbq->iocb.unsli3.sli3Words[4];
-   pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
-
/* We need to get the size out of the right CQE */
hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
len = bf_get(lpfc_rcqe_length,
   &hbq_buf->cq_event.cqe.rcqe_cmpl);
+   pbde = (struct ulp_bde64 *)
+   &iocbq->iocb.unsli3.sli3Words[4];
+   if (len > LPFC_DATA_BUF_SIZE)
+   pbde->tus.f.bdeSize = LPFC_DATA_BUF_SIZE;
+   else
+   pbde->tus.f.bdeSize = len;
+
iocbq->iocb.unsli3.rcvsli3.acc_len += len;
tot_len += len;
} else {
@@ -14748,16 +14757,19 @@ lpfc_prep_seq(struct lpfc_vport *vport,
lpfc_in_buf_free(vport->phba, d_buf);
continue;
}
+   /* We need to get the size out of the right CQE */
+   hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
+   len = bf_get(lpfc_rcqe_length,
+  &hbq_buf->cq_event.cqe.rcqe_cmpl);
iocbq->context2 = d_buf;
iocbq->context3 = NULL;
iocbq->iocb.ulpBdeCount = 1;
-   iocbq->iocb.un.cont64[0].tus.f.bdeSize =
+   if (len > LPFC_DATA_BUF_SIZE)
+   iocbq->iocb.un.cont64[0].tus.f.bdeSize =
LPFC_DATA_BUF_SIZE;
+   else
+   iocbq->iocb.un.cont64[0].tus.f.bdeSize = len;
 
-   /* We need to get the size out of the right CQE */
-   hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
-   len = bf_get(lpfc_rcqe_length,
-  &hbq_buf->cq_event.cqe.rcqe_cmpl);
tot_len += len;
iocbq->iocb.unsli3.rcvsli3.acc_len = tot_len;
 




--
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/13] lpfc 8.3.41: Ensure driver properly zeros unused fields in SLI4 mailbox commands

2013-07-15 Thread James Smart
Ensure driver properly zeros unused fields in SLI4 mailbox commands


Signed-off-by: James Smart 

 ---

 lpfc_mbox.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c
--- a/drivers/scsi/lpfc/lpfc_mbox.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_mbox.c 2013-07-15 07:15:19.437055870 -0400
@@ -178,7 +178,8 @@ lpfc_dump_wakeup_param(struct lpfc_hba *
mb->mbxOwner = OWN_HOST;
mb->un.varDmp.cv = 1;
mb->un.varDmp.type = DMP_NV_PARAMS;
-   mb->un.varDmp.entry_index = 0;
+   if (phba->sli_rev < LPFC_SLI_REV4)
+   mb->un.varDmp.entry_index = 0;
mb->un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID;
mb->un.varDmp.word_cnt = WAKE_UP_PARMS_WORD_SIZE;
mb->un.varDmp.co = 0;
@@ -361,7 +362,7 @@ lpfc_config_link(struct lpfc_hba * phba,
/* NEW_FEATURE
 * SLI-2, Coalescing Response Feature.
 */
-   if (phba->cfg_cr_delay) {
+   if (phba->cfg_cr_delay && (phba->sli_rev < LPFC_SLI_REV4)) {
mb->un.varCfgLnk.cr = 1;
mb->un.varCfgLnk.ci = 1;
mb->un.varCfgLnk.cr_delay = phba->cfg_cr_delay;
@@ -377,7 +378,7 @@ lpfc_config_link(struct lpfc_hba * phba,
mb->un.varCfgLnk.crtov = phba->fc_crtov;
mb->un.varCfgLnk.citov = phba->fc_citov;
 
-   if (phba->cfg_ack0)
+   if (phba->cfg_ack0 && (phba->sli_rev < LPFC_SLI_REV4))
mb->un.varCfgLnk.ack0_enable = 1;
 
mb->mbxCommand = MBX_CONFIG_LINK;




--
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 6/13] lpfc 8.3.41: Fixed support for 128 byte WQEs

2013-07-15 Thread James Smart
Fixed support for 128 byte WQEs 


Signed-off-by: James Smart 

 ---

 lpfc_hw4.h  |   13 +
 lpfc_init.c |1 +
 lpfc_sli.c  |   48 +---
 lpfc_sli4.h |6 ++
 4 files changed, 65 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
--- a/drivers/scsi/lpfc/lpfc_hw4.h  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw4.h  2013-07-15 07:15:22.047055930 -0400
@@ -234,6 +234,9 @@ struct ulp_bde64 {
uint32_t addrHigh;
 };
 
+/* Maximun size of immediate data that can fit into a 128 byte WQE */
+#define LPFC_MAX_BDE_IMM_SIZE  64
+
 struct lpfc_sli4_flags {
uint32_t word0;
 #define lpfc_idx_rsrc_rdy_SHIFT0
@@ -2585,6 +2588,9 @@ struct lpfc_sli4_parameters {
 #define cfg_mqv_WORD   word6
uint32_t word7;
uint32_t word8;
+#define cfg_wqsize_SHIFT   8
+#define cfg_wqsize_MASK0x000f
+#define cfg_wqsize_WORDword8
 #define cfg_wqv_SHIFT  14
 #define cfg_wqv_MASK   0x0003
 #define cfg_wqv_WORD   word8
@@ -3622,6 +3628,13 @@ union lpfc_wqe {
struct gen_req64_wqe gen_req;
 };
 
+union lpfc_wqe128 {
+   uint32_t words[32];
+   struct lpfc_wqe_generic generic;
+   struct xmit_seq64_wqe xmit_sequence;
+   struct gen_req64_wqe gen_req;
+};
+
 #define LPFC_GROUP_OJECT_MAGIC_NUM 0xfeaa0001
 #define LPFC_FILE_TYPE_GROUP   0xf7
 #define LPFC_FILE_ID_GROUP 0xa2
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:17.580055828 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:22.052055930 -0400
@@ -9168,6 +9168,7 @@ lpfc_get_sli4_parameters(struct lpfc_hba
sli4_params->mqv = bf_get(cfg_mqv, mbx_sli4_parameters);
sli4_params->wqv = bf_get(cfg_wqv, mbx_sli4_parameters);
sli4_params->rqv = bf_get(cfg_rqv, mbx_sli4_parameters);
+   sli4_params->wqsize = bf_get(cfg_wqsize, mbx_sli4_parameters);
sli4_params->sgl_pages_max = bf_get(cfg_sgl_page_cnt,
mbx_sli4_parameters);
sli4_params->sgl_pp_align = bf_get(cfg_sgl_pp_align,
diff -upNr a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
--- a/drivers/scsi/lpfc/lpfc_sli4.h 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli4.h 2013-07-15 07:15:22.058055930 -0400
@@ -117,6 +117,7 @@ union sli4_qe {
struct lpfc_rcqe_complete *rcqe_complete;
struct lpfc_mqe *mqe;
union  lpfc_wqe *wqe;
+   union  lpfc_wqe128 *wqe128;
struct lpfc_rqe *rqe;
 };
 
@@ -325,12 +326,14 @@ struct lpfc_bmbx {
 #define LPFC_EQE_SIZE_16B  16
 #define LPFC_CQE_SIZE  16
 #define LPFC_WQE_SIZE  64
+#define LPFC_WQE128_SIZE   128
 #define LPFC_MQE_SIZE  256
 #define LPFC_RQE_SIZE  8
 
 #define LPFC_EQE_DEF_COUNT 1024
 #define LPFC_CQE_DEF_COUNT  1024
 #define LPFC_WQE_DEF_COUNT  256
+#define LPFC_WQE128_DEF_COUNT   128
 #define LPFC_MQE_DEF_COUNT  16
 #define LPFC_RQE_DEF_COUNT 512
 
@@ -416,6 +419,9 @@ struct lpfc_pc_sli4_params {
uint8_t mqv;
uint8_t wqv;
uint8_t rqv;
+   uint8_t wqsize;
+#define LPFC_WQ_SZ64_SUPPORT   1
+#define LPFC_WQ_SZ128_SUPPORT  2
 };
 
 struct lpfc_iov {
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:17.589055828 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:22.091055930 -0400
@@ -12869,10 +12869,44 @@ lpfc_wq_create(struct lpfc_hba *phba, st
wq->page_count);
bf_set(lpfc_mbx_wq_create_cq_id, &wq_create->u.request,
cq->queue_id);
+
+   /* wqv is the earliest version supported, NOT the latest */
bf_set(lpfc_mbox_hdr_version, &shdr->request,
   phba->sli4_hba.pc_sli4_params.wqv);
 
-   if (phba->sli4_hba.pc_sli4_params.wqv == LPFC_Q_CREATE_VERSION_1) {
+   switch (phba->sli4_hba.pc_sli4_params.wqv) {
+   case LPFC_Q_CREATE_VERSION_0:
+   switch (wq->entry_size) {
+   default:
+   case 64:
+   /* Nothing to do, version 0 ONLY supports 64 byte */
+   page = wq_create->u.request.page;
+   break;
+   case 128:
+   if (!(phba->sli4_hba.pc_sli4_params.wqsize &
+   LPFC_WQ_SZ128_SUPPORT)) {
+   status = -ERANGE;
+   goto out;
+   }
+   /* If we get here the HBA MUST also support V1 and
+*

[PATCH 4/13] lpfc 8.3.41: Fixed max value of lpfc_lun_queue_depth

2013-07-15 Thread James Smart
Fixed max value of lpfc_lun_queue_depth


Signed-off-by: James Smart 

 ---

 lpfc_attr.c  |9 ++---
 lpfc_init.c  |   34 --
 lpfc_sli.c   |   11 +++
 lpfc_vport.c |3 +++
 4 files changed, 44 insertions(+), 13 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:17.540055827 -0400
@@ -2591,9 +2591,12 @@ LPFC_VPORT_ATTR_R(enable_da_id, 1, 0, 1,
 
 /*
 # lun_queue_depth:  This parameter is used to limit the number of outstanding
-# commands per FCP LUN. Value range is [1,128]. Default value is 30.
+# commands per FCP LUN. Value range is [1,512]. Default value is 30.
+# If this parameter value is greater than 1/8th the maximum number of exchanges
+# supported by the HBA port, then the lun queue depth will be reduced to
+# 1/8th the maximum number of exchanges.
 */
-LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128,
+LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 512,
  "Max number of FCP commands we can queue to a specific LUN");
 
 /*
@@ -2601,7 +2604,7 @@ LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1
 # commands per target port. Value range is [10,65535]. Default value is 65535.
 */
 LPFC_VPORT_ATTR_R(tgt_queue_depth, 65535, 10, 65535,
-   "Max number of FCP commands we can queue to a specific target port");
+ "Max number of FCP commands we can queue to a specific target 
port");
 
 /*
 # hba_queue_depth:  This parameter is used to limit the number of outstanding
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2013-07-15 07:15:17.580055828 -0400
@@ -472,10 +472,22 @@ lpfc_config_port_post(struct lpfc_hba *p
lpfc_sli_read_link_ste(phba);
 
/* Reset the DFT_HBA_Q_DEPTH to the max xri  */
-   if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1))
-   phba->cfg_hba_queue_depth =
-   (mb->un.varRdConfig.max_xri + 1) -
-   lpfc_sli4_get_els_iocb_cnt(phba);
+   i = (mb->un.varRdConfig.max_xri + 1);
+   if (phba->cfg_hba_queue_depth > i) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   "3359 HBA queue depth changed from %d to %d\n",
+   phba->cfg_hba_queue_depth, i);
+   phba->cfg_hba_queue_depth = i;
+   }
+
+   /* Reset the DFT_LUN_Q_DEPTH to (max xri >> 3)  */
+   i = (mb->un.varRdConfig.max_xri >> 3);
+   if (phba->pport->cfg_lun_queue_depth > i) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   "3360 LUN queue depth changed from %d to %d\n",
+   phba->pport->cfg_lun_queue_depth, i);
+   phba->pport->cfg_lun_queue_depth = i;
+   }
 
phba->lmt = mb->un.varRdConfig.lmt;
 
@@ -6664,12 +6676,14 @@ lpfc_sli4_read_config(struct lpfc_hba *p
goto read_cfg_out;
 
/* Reset the DFT_HBA_Q_DEPTH to the max xri  */
-   if (phba->cfg_hba_queue_depth >
-   (phba->sli4_hba.max_cfg_param.max_xri -
-   lpfc_sli4_get_els_iocb_cnt(phba)))
-   phba->cfg_hba_queue_depth =
-   phba->sli4_hba.max_cfg_param.max_xri -
-   lpfc_sli4_get_els_iocb_cnt(phba);
+   length = phba->sli4_hba.max_cfg_param.max_xri -
+   lpfc_sli4_get_els_iocb_cnt(phba);
+   if (phba->cfg_hba_queue_depth > length) {
+   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   "3361 HBA queue depth changed from %d to %d\n",
+   phba->cfg_hba_queue_depth, length);
+   phba->cfg_hba_queue_depth = length;
+   }
 
if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
LPFC_SLI_INTF_IF_TYPE_2)
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:14.692055763 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2013-07-15 07:15:17.589055828 -0400
@@ -6163,6 +6163,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phb
kfree(vpd);
goto out_free_mbox;
}
+
mqe = &mboxq->u.mqe;
phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev);
if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev))
@@ -6249,6 +6250,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phb
phba->vpd.rev.fcphHigh, phba->vpd.rev.fcphLow,
phba->vpd.rev.feaLevelHigh, phba->vpd.rev.feaLevelLow);
 
+   /* Reset the DFT_LUN_Q_DEPTH to (max xri >> 3)  */
+   rc = (phba->sli4_hba.max_cfg_param.max_xri >> 3);
+  

[PATCH 8/13] lpfc 8.3.41: Fixed failure in setting SLI3 board mode

2013-07-15 Thread James Smart
Fixed failure in setting SLI3 board mode


Signed-off-by: James Smart 

 ---

 lpfc_attr.c |3 ---
 1 file changed, 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:17.540055827 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:26.536056032 -0400
@@ -674,9 +674,6 @@ lpfc_do_offline(struct lpfc_hba *phba, u
int i;
int rc;
 
-   if (phba->pport->fc_flag & FC_OFFLINE_MODE)
-   return 0;
-
init_completion(&online_compl);
rc = lpfc_workq_post_event(phba, &status, &online_compl,
  LPFC_EVT_OFFLINE_PREP);





--
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/13] lpfc 8.3.41: Fixed SLI3 failing FCP write on check-condition no-sense with residual zero

2013-07-15 Thread James Smart
Fixed SLI3 failing FCP write on check-condition no-sense with residual zero


Signed-off-by: James Smart 

 ---

 lpfc_scsi.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:01.946055472 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2013-07-15 07:15:23.877055972 -0400
@@ -4386,12 +4386,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *v
if (scsi_sg_count(scsi_cmnd)) {
if (datadir == DMA_TO_DEVICE) {
iocb_cmd->ulpCommand = CMD_FCP_IWRITE64_CR;
-   if (sli4)
-   iocb_cmd->ulpPU = PARM_READ_CHECK;
-   else {
-   iocb_cmd->un.fcpi.fcpi_parm = 0;
-   iocb_cmd->ulpPU = 0;
-   }
+   iocb_cmd->ulpPU = PARM_READ_CHECK;
fcp_cmnd->fcpCntl3 = WRITE_DATA;
phba->fc4OutputRequests++;
} else {




--
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/13] lpfc 8.3.41: Fixed not able to perform PCI function reset when board was not in online mode

2013-07-15 Thread James Smart
Fixed not able to perform PCI function reset when board was not in online mode


Signed-off-by: James Smart 

 ---

 lpfc_attr.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:26.536056032 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:28.343056073 -0400
@@ -741,14 +741,15 @@ lpfc_selective_reset(struct lpfc_hba *ph
int status = 0;
int rc;
 
-   if ((!phba->cfg_enable_hba_reset) ||
-   (phba->pport->fc_flag & FC_OFFLINE_MODE))
+   if (!phba->cfg_enable_hba_reset)
return -EACCES;
 
-   status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
+   if (!(phba->pport->fc_flag & FC_OFFLINE_MODE)) {
+   status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
 
-   if (status != 0)
-   return status;
+   if (status != 0)
+   return status;
+   }
 
init_completion(&online_compl);
rc = lpfc_workq_post_event(phba, &status, &online_compl,




--
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 11/13] lpfc 8.3.41: Fixed the format of some log message fields

2013-07-15 Thread James Smart
Fixed the format of some log message fields


Signed-off-by: James Smart 

 ---

 lpfc_ct.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
--- a/drivers/scsi/lpfc/lpfc_ct.c   2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_ct.c   2013-07-15 07:15:32.810056175 -0400
@@ -895,7 +895,7 @@ lpfc_cmpl_ct(struct lpfc_hba *phba, stru
 
if (irsp->ulpStatus) {
lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
-"0268 NS cmd %x Error (%d %d)\n",
+"0268 NS cmd x%x Error (x%x x%x)\n",
 cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]);
 
if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&




--
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 10/13] lpfc 8.3.41: Add first burst support to driver

2013-07-15 Thread James Smart
Add first burst support to driver


Signed-off-by: James Smart 

 ---

 lpfc.h   |1 +
 lpfc_attr.c  |   11 +++
 lpfc_disc.h  |1 +
 lpfc_els.c   |2 ++
 lpfc_nportdisc.c |   12 ++--
 lpfc_scsi.c  |5 +
 6 files changed, 30 insertions(+), 2 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:28.343056073 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2013-07-15 07:15:29.696056104 -0400
@@ -3950,6 +3950,14 @@ LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1,
   "Use ADISC on rediscovery to authenticate FCP devices");
 
 /*
+# lpfc_first_burst_size: First burst size to use on the NPorts
+# that support first burst.
+# Value range is [0,65536]. Default value is 0.
+*/
+LPFC_VPORT_ATTR_RW(first_burst_size, 0, 0, 65536,
+  "First burst size for Targets that support first burst");
+
+/*
 # lpfc_max_scsicmpl_time: Use scsi command completion time to control I/O queue
 # depth. Default value is 0. When the value of this parameter is zero the
 # SCSI command completion time is not used for controlling I/O queue depth. 
When
@@ -4277,6 +4285,7 @@ struct device_attribute *lpfc_hba_attrs[
&dev_attr_lpfc_devloss_tmo,
&dev_attr_lpfc_fcp_class,
&dev_attr_lpfc_use_adisc,
+   &dev_attr_lpfc_first_burst_size,
&dev_attr_lpfc_ack0,
&dev_attr_lpfc_topology,
&dev_attr_lpfc_scan_down,
@@ -4353,6 +4362,7 @@ struct device_attribute *lpfc_vport_attr
&dev_attr_lpfc_restrict_login,
&dev_attr_lpfc_fcp_class,
&dev_attr_lpfc_use_adisc,
+   &dev_attr_lpfc_first_burst_size,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_max_luns,
&dev_attr_nport_evt_cnt,
@@ -5332,6 +5342,7 @@ lpfc_get_vport_cfgparam(struct lpfc_vpor
lpfc_restrict_login_init(vport, lpfc_restrict_login);
lpfc_fcp_class_init(vport, lpfc_fcp_class);
lpfc_use_adisc_init(vport, lpfc_use_adisc);
+   lpfc_first_burst_size_init(vport, lpfc_first_burst_size);
lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time);
lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
diff -upNr a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
--- a/drivers/scsi/lpfc/lpfc_disc.h 2013-04-10 16:46:40.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 07:15:29.696056104 -0400
@@ -154,6 +154,7 @@ struct lpfc_node_rrq {
 #define NLP_NODEV_REMOVE   0x0800  /* Defer removal till discovery ends */
 #define NLP_TARGET_REMOVE  0x1000   /* Target remove in process */
 #define NLP_SC_REQ 0x2000  /* Target requires authentication */
+#define NLP_FIRSTBURST 0x4000  /* Target supports FirstBurst */
 #define NLP_RPI_REGISTERED 0x8000  /* nlp_rpi is valid */
 
 /* ndlp usage management macros */
diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2013-07-15 07:15:29.702056105 -0400
@@ -2122,6 +2122,8 @@ lpfc_issue_els_prli(struct lpfc_vport *v
}
npr->estabImagePair = 1;
npr->readXferRdyDis = 1;
+if (vport->cfg_first_burst_size)
+   npr->writeXferRdyDis = 1;
 
/* For FCP support */
npr->prliType = PRLI_FCP_TYPE;
diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2013-07-15 07:15:29.712056105 -0400
@@ -421,6 +421,7 @@ struct lpfc_vport {
uint32_t cfg_enable_da_id;
uint32_t cfg_max_scsicmpl_time;
uint32_t cfg_tgt_queue_depth;
+   uint32_t cfg_first_burst_size;
 
uint32_t dev_loss_tmo_changed;
 
diff -upNr a/drivers/scsi/lpfc/lpfc_nportdisc.c 
b/drivers/scsi/lpfc/lpfc_nportdisc.c
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c2013-07-15 06:56:23.0 
-0400
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c2013-07-15 07:15:29.715056106 
-0400
@@ -690,11 +690,15 @@ lpfc_rcv_prli(struct lpfc_vport *vport,
 
ndlp->nlp_type &= ~(NLP_FCP_TARGET | NLP_FCP_INITIATOR);
ndlp->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
+   ndlp->nlp_flag &= ~NLP_FIRSTBURST;
if (npr->prliType == PRLI_FCP_TYPE) {
if (npr->initiatorFunc)
ndlp->nlp_type |= NLP_FCP_INITIATOR;
-   if (npr->targetFunc)
+   if (npr->targetFunc) {
ndlp->nlp_type |= NLP_FCP_TARGET;
+   if (npr->writeXferRdyDis)
+   ndlp->nlp_flag |= NLP_FIRSTBURST;
+   }
if (npr->Retry)
ndlp->nlp_fcp_info |= NLP_FCP_2_DEVICE;
}
@@ -1676,12 +1680,16 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vp
/* Che

[PATCH 13/13] lpfc 8.3.41: Update lpfc version to driver version 8.3.41

2013-07-15 Thread James Smart
Update lpfc version to driver version 8.3.41 


Signed-off-by: James Smart 

 ---

 lpfc_version.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
--- a/drivers/scsi/lpfc/lpfc_version.h  2013-07-15 06:56:23.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_version.h  2013-07-15 07:15:34.546056215 -0400
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION "8.3.40"
+#define LPFC_DRIVER_VERSION "8.3.41"
 #define LPFC_DRIVER_NAME   "lpfc"
 
 /* Used for SLI 2/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 12/13] lpfc 8.3.41: Update copyrights for 8.3.41 modifications

2013-07-15 Thread James Smart
Update copyrights for 8.3.41 modifications


Signed-off-by: James Smart 

 ---

 lpfc_disc.h  |2 +-
 lpfc_sli.h   |2 +-
 lpfc_vport.c |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h
--- a/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 09:25:43.278234018 -0400
+++ b/drivers/scsi/lpfc/lpfc_disc.h 2013-07-15 09:26:17.715234802 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2008 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
--- a/drivers/scsi/lpfc/lpfc_sli.h  2013-07-15 09:25:42.970234010 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.h  2013-07-15 09:26:26.424235001 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2007 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff -upNr a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c
--- a/drivers/scsi/lpfc/lpfc_vport.c2013-07-15 09:25:43.129234014 -0400
+++ b/drivers/scsi/lpfc/lpfc_vport.c2013-07-15 09:26:36.907235238 -0400
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2008 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2013 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *



--
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] drivers/scsi/fnic: updated fileoperations structure to use simple_open

2013-07-15 Thread Dragos Foianu
The function has the same implementation as simple_open. I removed it and 
replaced the reference in the fileoperations struct with simple_open.

Found using Coccinelle.

Signed-off-by: Dragos Foianu 
---
 drivers/scsi/fnic/fnic_debugfs.c |   19 +--
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index cbcb012..ddc7e94 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -25,23 +25,6 @@ static struct dentry *fnic_trace_debugfs_file;
 static struct dentry *fnic_trace_enable;
 
 /*
- * fnic_trace_ctrl_open - Open the trace_enable file
- * @inode: The inode pointer.
- * @file: The file pointer to attach the trace enable/disable flag.
- *
- * Description:
- * This routine opens a debugsfs file trace_enable.
- *
- * Returns:
- * This function returns zero if successful.
- */
-static int fnic_trace_ctrl_open(struct inode *inode, struct file *filp)
-{
-   filp->private_data = inode->i_private;
-   return 0;
-}
-
-/*
  * fnic_trace_ctrl_read - Read a trace_enable debugfs file
  * @filp: The file pointer to read from.
  * @ubuf: The buffer to copy the data to.
@@ -222,7 +205,7 @@ static int fnic_trace_debugfs_release(struct inode *inode,
 
 static const struct file_operations fnic_trace_ctrl_fops = {
.owner = THIS_MODULE,
-   .open = fnic_trace_ctrl_open,
+   .open = simple_open,
.read = fnic_trace_ctrl_read,
.write = fnic_trace_ctrl_write,
 };
-- 
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