Re: [PATCH] qla2xxx: Fix NULL pointer deref in QLA interrupt

2016-07-06 Thread Johannes Thumshirn
On Thu, Jun 30, 2016 at 05:00:32PM +0200, Bruno Prémont wrote:
> In qla24xx_process_response_queue() rsp->msix->cpuid may trigger NULL
> pointer dereference when rsp->msix is NULL:
> 
> [5.622457] NULL pointer dereference at 0050
> [5.622457] IP: [] 
> qla24xx_process_response_queue+0x44/0x4b0
> [5.622457] PGD 0
> [5.622457] Oops:  [#1] SMP
> [5.622457] Modules linked in:
> [5.622457] CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.6.3-x86_64 #1
> [5.622457] Hardware name: HP ProLiant DL360 G5, BIOS P58 05/02/2011
> [5.622457] task: 8801a88f3740 ti: 8801a8954000 task.ti: 
> 8801a8954000
> [5.622457] RIP: 0010:[]  [] 
> qla24xx_process_response_queue+0x44/0x4b0
> [5.622457] RSP: :8801afb03de8  EFLAGS: 00010002
> [5.622457] RAX:  RBX: 0032 RCX: 
> 
> [5.622457] RDX: 0002 RSI: 8801a79bf8c8 RDI: 
> 8800c8f7e7c0
> [5.622457] RBP: 8801afb03e68 R08:  R09: 
> 
> [5.622457] R10: 8c47 R11: 0002 R12: 
> 8801a79bf8c8
> [5.622457] R13: 8800c8f7e7c0 R14: 8800c8f6 R15: 
> 00018013
> [5.622457] FS:  () GS:8801afb0() 
> knlGS:
> [5.622457] CS:  0010 DS:  ES:  CR0: 80050033
> [5.622457] CR2: 0050 CR3: 01e07000 CR4: 
> 06e0
> [5.622457] Stack:
> [5.622457]  8801afb03e30 810c0f2d 0086 
> 0002
> [5.622457]  8801afb03e28 816570e1 8800c8994628 
> 0002
> [5.622457]  8801afb03e60 816772d4 b47c472ad6955e68 
> 0032
> [5.622457] Call Trace:
> [5.622457]  
> [5.622457]  [] ? __wake_up_common+0x4d/0x80
> [5.622457]  [] ? usb_hcd_resume_root_hub+0x51/0x60
> [5.622457]  [] ? uhci_hub_status_data+0x64/0x240
> [5.622457]  [] qla24xx_intr_handler+0xf0/0x2e0
> [5.622457]  [] ? get_next_timer_interrupt+0xce/0x200
> [5.622457]  [] handle_irq_event_percpu+0x64/0x100
> [5.622457]  [] handle_irq_event+0x27/0x50
> [5.622457]  [] handle_edge_irq+0x65/0x140
> [5.622457]  [] handle_irq+0x18/0x30
> [5.622457]  [] do_IRQ+0x46/0xd0
> [5.622457]  [] common_interrupt+0x7f/0x7f
> [5.622457]  
> [5.622457]  [] ? mwait_idle+0x68/0x80
> [5.622457]  [] arch_cpu_idle+0xa/0x10
> [5.622457]  [] default_idle_call+0x27/0x30
> [5.622457]  [] cpu_startup_entry+0x19b/0x230
> [5.622457]  [] start_secondary+0x136/0x140
> [5.622457] Code: 00 00 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31 c0 48 8b 
> 47 58 a8 02 0f 84 c5 00 00 00 48 8b 46 50 49 89 f4 65 8b 15 34 bb aa 7e <39> 
> 50 50 74 11 89 50 50 48 8b 46 50 8b 40 50 41 89 86 60 8b 00
> [5.622457] RIP  [] 
> qla24xx_process_response_queue+0x44/0x4b0
> [5.622457]  RSP 
> [5.622457] CR2: 0050
> [5.622457] ---[ end trace fa2b19c25106d42b ]---
> [5.622457] Kernel panic - not syncing: Fatal exception in interrupt
> 
> 
> The affected code was introduced by commit 
> cdb898c52d1dfad4b4800b83a58b3fe5d352edde
> (qla2xxx: Add irq affinity notification).
> 
> Only dereference rsp->msix when it has been set so the machine can boot
> fine. Possibly rsp->msix is unset because:
> [3.479679] qla2xxx [:00:00.0]-0005: : QLogic Fibre Channel HBA 
> Driver: 8.07.00.33-k.
> [3.481839] qla2xxx [:13:00.0]-001d: : Found an ISP2432 irq 17 iobase 
> 0xc9038000.
> [3.484081] qla2xxx [:13:00.0]-0035:0: MSI-X; Unsupported ISP2432 
> (0x2, 0x3).
> [3.485804] qla2xxx [:13:00.0]-0037:0: Falling back-to MSI mode -258.
> [3.890145] scsi host0: qla2xxx
> [3.891956] qla2xxx [:13:00.0]-00fb:0: QLogic QLE2460 - PCI-Express 
> Single Channel 4Gb Fibre Channel HBA.
> [3.894207] qla2xxx [:13:00.0]-00fc:0: ISP2432: PCIe (2.5GT/s x4) @ 
> :13:00.0 hdma+ host#=0 fw=7.03.00 (9496).
> [5.714774] qla2xxx [:13:00.0]-500a:0: LOOP UP detected (4 Gbps).
> 
> 
> CC: 
> Signed-off-by: Bruno Prémont 

Reviewed-by: Johannes Thumshirn 

-- 
Johannes Thumshirn  Storage
jthumsh...@suse.de+49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
--
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] qla2xxx: setup data needed in ISR before setting up the ISR

2016-07-06 Thread Johannes Thumshirn
qla2xxx first calls request_irq() and then does the setup of the queue
entry data needed in the interrupt handlers in when using MSI-X. This
could lead to a NULL pointer dereference when an IRQ fires between the
request_irq() call and the assignment of the qentry data structure to the
rsp->msix field. A possible case for such a race would be in the kdump
case when the HBA's IRQs are still enabled but the driver is undergoing
a new initialisation and thus is not aware of already activated IRQs in
the HBA.

Signed-off-by: Johannes Thumshirn 
---
 drivers/scsi/qla2xxx/qla_isr.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5649c20..20743a3 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3086,6 +3086,8 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
/* Enable MSI-X vectors for the base queue */
for (i = 0; i < 2; i++) {
qentry = &ha->msix_entries[i];
+   qentry->rsp = rsp;
+   rsp->msix = qentry;
if (IS_P3P_TYPE(ha))
ret = request_irq(qentry->vector,
qla82xx_msix_entries[i].handler,
@@ -3097,8 +3099,6 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
if (ret)
goto msix_register_fail;
qentry->have_irq = 1;
-   qentry->rsp = rsp;
-   rsp->msix = qentry;
 
/* Register for CPU affinity notification. */
irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify);
@@ -3119,12 +3119,12 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
 */
if (QLA_TGT_MODE_ENABLED() && IS_ATIO_MSIX_CAPABLE(ha)) {
qentry = &ha->msix_entries[ATIO_VECTOR];
+   qentry->rsp = rsp;
+   rsp->msix = qentry;
ret = request_irq(qentry->vector,
qla83xx_msix_entries[ATIO_VECTOR].handler,
0, qla83xx_msix_entries[ATIO_VECTOR].name, rsp);
qentry->have_irq = 1;
-   qentry->rsp = rsp;
-   rsp->msix = qentry;
}
 
 msix_register_fail:
-- 
1.8.5.6

--
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:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
A freed task has been assigned to ->lldd_task when lldd_execute_task()
failed in sas_ata_qc_issue(), and access of ->lldd_task will cause
an oops:

Call trace:
[] sas_ata_post_internal+0x6c/0x150
[] ata_exec_internal_sg+0x32c/0x588
[] ata_exec_internal+0x88/0xe8
[] ata_dev_read_id+0x204/0x5e0
[] ata_dev_reread_id+0x60/0xc8
[] ata_dev_revalidate+0x88/0x1e0
[] ata_eh_recover+0xcf8/0x13a8
[] ata_do_eh+0x5c/0xe0
[] ata_std_error_handler+0x48/0x98
[] ata_scsi_port_error_handler+0x474/0x658
[] async_sas_ata_eh+0x50/0x80
[] async_run_entry_fn+0x64/0x180
[] process_one_work+0x164/0x438
[] worker_thread+0x144/0x4b0
[] kthread+0xfc/0x110

Fix this by reassigning NULL to ->lldd_task in error path.

Signed-off-by: Wei Fang 
---
 drivers/scsi/libsas/sas_ata.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 935c430..33c7c66 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -253,6 +253,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd 
*qc)
if (qc->scsicmd)
ASSIGN_SAS_TASK(qc->scsicmd, NULL);
sas_free_task(task);
+   qc->lldd_task = task;
ret = AC_ERR_SYSTEM;
}
 
-- 
1.7.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


Re: [PATCH] scsi:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Hannes Reinecke
On 07/06/2016 10:28 AM, Wei Fang wrote:
> A freed task has been assigned to ->lldd_task when lldd_execute_task()
> failed in sas_ata_qc_issue(), and access of ->lldd_task will cause
> an oops:
> 
> Call trace:
> [] sas_ata_post_internal+0x6c/0x150
> [] ata_exec_internal_sg+0x32c/0x588
> [] ata_exec_internal+0x88/0xe8
> [] ata_dev_read_id+0x204/0x5e0
> [] ata_dev_reread_id+0x60/0xc8
> [] ata_dev_revalidate+0x88/0x1e0
> [] ata_eh_recover+0xcf8/0x13a8
> [] ata_do_eh+0x5c/0xe0
> [] ata_std_error_handler+0x48/0x98
> [] ata_scsi_port_error_handler+0x474/0x658
> [] async_sas_ata_eh+0x50/0x80
> [] async_run_entry_fn+0x64/0x180
> [] process_one_work+0x164/0x438
> [] worker_thread+0x144/0x4b0
> [] kthread+0xfc/0x110
> 
> Fix this by reassigning NULL to ->lldd_task in error path.
> 
> Signed-off-by: Wei Fang 
> ---
>  drivers/scsi/libsas/sas_ata.c |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index 935c430..33c7c66 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -253,6 +253,7 @@ static unsigned int sas_ata_qc_issue(struct 
> ata_queued_cmd *qc)
>   if (qc->scsicmd)
>   ASSIGN_SAS_TASK(qc->scsicmd, NULL);
>   sas_free_task(task);
> + qc->lldd_task = task;
>   ret = AC_ERR_SYSTEM;
>   }
>  
> 
Errm.
This is most definitely wrong.
Sure you mean

qc->lldd_task = NULL;

in that line?

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] scsi:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
Hi, Hannes,

> This is most definitely wrong.
> Sure you mean
> 
> qc->lldd_task = NULL;
> 
> in that line?

My mistake. Thanks for pointing me out. Will resend soon.
Please ignore this patch.

Thanks,
Wei

--
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:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
A freed task has been assigned to ->lldd_task when lldd_execute_task()
failed in sas_ata_qc_issue(), and access of ->lldd_task will cause
an oops:

Call trace:
[] sas_ata_post_internal+0x6c/0x150
[] ata_exec_internal_sg+0x32c/0x588
[] ata_exec_internal+0x88/0xe8
[] ata_dev_read_id+0x204/0x5e0
[] ata_dev_reread_id+0x60/0xc8
[] ata_dev_revalidate+0x88/0x1e0
[] ata_eh_recover+0xcf8/0x13a8
[] ata_do_eh+0x5c/0xe0
[] ata_std_error_handler+0x48/0x98
[] ata_scsi_port_error_handler+0x474/0x658
[] async_sas_ata_eh+0x50/0x80
[] async_run_entry_fn+0x64/0x180
[] process_one_work+0x164/0x438
[] worker_thread+0x144/0x4b0
[] kthread+0xfc/0x110

Fix this by reassigning NULL to ->lldd_task in error path.

Signed-off-by: Wei Fang 
---
 drivers/scsi/libsas/sas_ata.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index 935c430..596a545 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -253,6 +253,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd 
*qc)
if (qc->scsicmd)
ASSIGN_SAS_TASK(qc->scsicmd, NULL);
sas_free_task(task);
+   qc->lldd_task = NULL;
ret = AC_ERR_SYSTEM;
}
 
-- 
1.7.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


Re: [PATCH] qla2xxx: setup data needed in ISR before setting up the ISR

2016-07-06 Thread Hannes Reinecke
On 07/06/2016 09:51 AM, Johannes Thumshirn wrote:
> qla2xxx first calls request_irq() and then does the setup of the queue
> entry data needed in the interrupt handlers in when using MSI-X. This
> could lead to a NULL pointer dereference when an IRQ fires between the
> request_irq() call and the assignment of the qentry data structure to the
> rsp->msix field. A possible case for such a race would be in the kdump
> case when the HBA's IRQs are still enabled but the driver is undergoing
> a new initialisation and thus is not aware of already activated IRQs in
> the HBA.
> 
> Signed-off-by: Johannes Thumshirn 
> ---
>  drivers/scsi/qla2xxx/qla_isr.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: parisc late boot crash in 4.4-rc, scsi-related

2016-07-06 Thread John David Anglin

On 2016-07-06 2:59 AM, Meelis Roos wrote:

What distro are you using?

My pariscs are gentoo and still only the old versions are available on
hppa.

Several newer versions (4.9, 5.3) are in portage, maybe they just need to be
unmasked.

4.9.3 and 5.3.0 were too old.

Correct.  4.9.4 will include fix if it is released.


However, at the end of June, 5.4.0 appeared masked. Unmasking kgcc64
5.4.0 and building it made my pariscs work again, with 4.7-rc6 running
fine on all of them.

Great!  Thanks for report.

Dave

--
John David Anglin  dave.ang...@bell.net

--
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 2/2] libata-scsi: do not respond with "invalid field" for FORMAT UNIT

2016-07-06 Thread Tejun Heo
On Wed, Jul 06, 2016 at 06:40:32AM +, Tom Yan wrote:
> Um it's not mainly about in caps or not, but more about wrongly spelled as 
> cbd.

Heh, right, so please just note it in the description.

Thanks.

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


[Bug 121531] New: Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

Bug ID: 121531
   Summary: Adaptec 7805H SAS HBA (pm80xx): hangs when writing
>80MB at once
   Product: IO/Storage
   Version: 2.5
Kernel Version: 3.16.0-4-amd64
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: SCSI
  Assignee: linux-scsi@vger.kernel.org
  Reporter: martin.von.witt...@iserv.eu
Regression: No

Created attachment 222171
  --> https://bugzilla.kernel.org/attachment.cgi?id=222171&action=edit
dd loop output, writing 64 - 128 MB to a disk

One of our customers attempted to install our Debian 8-based distribution on a
Fujitsu PRIMERGY TX150 S8 server with an Adaptec 7805H SAS HBA. Unfortunately,
the system tended to lock up during use; almost all services stopped
responding, but it was still possible to run simple commands via SSH, e.g. "ssh
server 'cat /proc/loadavg'" or "ssh server dmesg". Everything that required
write access (like actually logging in via SSH, or using the web interface)
just seemed to hang. Load average was extremely high (>100) and dmesg reported
a lot of sas/pm80xx errors:

[11748.246360] sas: trying to find task 0x88082fcc7d40
[11748.246362] sas: sas_scsi_find_task: aborting task 0x88082fcc7d40
[11748.246572] pm80xx mpi_ssp_completion 1514:sas IO status 0x1
[11748.246574] pm80xx mpi_ssp_completion 1523:SAS Address of IO Failure
Drive:5000c50062c1b09d
[11748.246576] sas: task done but aborted
[11748.246581] sas: sas_scsi_find_task: task 0x88082fcc7d40 is done
[11748.246583] sas: sas_eh_handle_sas_errors: task 0x88082fcc7d40 is done
[11748.246585] sas: trying to find task 0x88082fcc7c00
[11748.246587] sas: sas_scsi_find_task: aborting task 0x88082fcc7c00
[11748.246829] pm80xx mpi_ssp_completion 1514:sas IO status 0x1
[11748.246831] pm80xx mpi_ssp_completion 1523:SAS Address of IO Failure
Drive:5000c50062c1b09d
[11748.246832] sas: task done but aborted
[11748.246837] sas: sas_scsi_find_task: task 0x88082fcc7c00 is done
[11748.246839] sas: sas_eh_handle_sas_errors: task 0x88082fcc7c00 is done
[11748.246841] sas: trying to find task 0x88082fcc7ac0
[11748.246844] sas: sas_scsi_find_task: aborting task 0x88082fcc7ac0
[11748.247055] pm80xx mpi_ssp_completion 1514:sas IO status 0x1
[11748.247057] pm80xx mpi_ssp_completion 1523:SAS Address of IO Failure
Drive:5000c50062c1b09d
[11748.247059] sas: task done but aborted
[11748.247064] sas: sas_scsi_find_task: task 0x88082fcc7ac0 is done
[11748.247067] sas: sas_eh_handle_sas_errors: task 0x88082fcc7ac0 is done
[11748.247069] sas: trying to find task 0x88082fcc7840
[11748.247070] sas: sas_scsi_find_task: aborting task 0x88082fcc7840
[11748.247366] pm80xx mpi_ssp_completion 1514:sas IO status 0x1
[11748.247368] pm80xx mpi_ssp_completion 1523:SAS Address of IO Failure
Drive:5000c50062c1b09d
[11748.247370] sas: task done but aborted
[11748.247375] sas: sas_scsi_find_task: task 0x88082fcc7840 is done
[11748.247377] sas: sas_eh_handle_sas_errors: task 0x88082fcc7840 is done
[11748.247379] sas: trying to find task 0x88082ff72e00
[11748.247380] sas: sas_scsi_find_task: aborting task 0x88082ff72e00
[11748.247591] pm80xx mpi_ssp_completion 1514:sas IO status 0x1
[11748.247593] pm80xx mpi_ssp_completion 1523:SAS Address of IO Failure
Drive:5000c50062c1b09d
[11748.247595] sas: task done but aborted
[11748.247600] sas: sas_scsi_find_task: task 0x88082ff72e00 is done
[11748.247601] sas: sas_eh_handle_sas_errors: task 0x88082ff72e00 is done
[11748.247603] sas: trying to find task 0x88082ff72400
[11748.247605] sas: sas_scsi_find_task: aborting task 0x88082ff72400

At first we believed the underlying cause to be a hardware problem, but the
problem persisted after the HBA and the backplane were replaced (the disks were
ruled out as a possible cause because the selftests reported no errors).

To isolate the issue, I ran the following tests in a live system on the
affected server:

1) "smartctl -t long" on both disks; both reported "Completed", so the disks
seem to be OK.

2) "dd if=/dev/sdX of=/dev/null bs=1M" on both disks; both completed
successfully, with an average speed of ~150 MB/s. Reading seems to be fine too.

3) "dd if=/dev/zero of=/dev/sdX bs=1M" on both disks. It stopped responding,
and dmesg started spewing lots of sas/pm80xx errors. So apparently writing to
the disks causes the problem.

To track it down further, I tried to repeatedly write 64 MB to one disk - this
works without problems:

root@unassigned:~# for i in $(seq 1 8); do dd if=/dev/zero of=/dev/sdc bs=1M
count=64; done
64+0 records in
64+0 records out
67108864 bytes (67 MB) copied, 0.482716 s, 139 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB) copied, 0.482339 s, 139 MB/s
64+0 records in
64+0 records out
67108864 bytes (67 MB

[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #1 from Martin von Wittich  ---
Created attachment 222181
  --> https://bugzilla.kernel.org/attachment.cgi?id=222181&action=edit
dmidecode output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #5 from Martin von Wittich  ---
Created attachment 21
  --> https://bugzilla.kernel.org/attachment.cgi?id=21&action=edit
smartctl -a /dev/sdc output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #4 from Martin von Wittich  ---
Created attachment 11
  --> https://bugzilla.kernel.org/attachment.cgi?id=11&action=edit
smartctl -a /dev/sdb output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #3 from Martin von Wittich  ---
Created attachment 01
  --> https://bugzilla.kernel.org/attachment.cgi?id=01&action=edit
modinfo pm80xx output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #2 from Martin von Wittich  ---
Created attachment 222191
  --> https://bugzilla.kernel.org/attachment.cgi?id=222191&action=edit
lspci -vnn output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #6 from Martin von Wittich  ---
Created attachment 31
  --> https://bugzilla.kernel.org/attachment.cgi?id=31&action=edit
uname -a, cat /proc/version output

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #7 from Martin von Wittich  ---
Created attachment 41
  --> https://bugzilla.kernel.org/attachment.cgi?id=41&action=edit
dmesg output after booting, before writing to the disks

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #8 from Martin von Wittich  ---
Created attachment 51
  --> https://bugzilla.kernel.org/attachment.cgi?id=51&action=edit
dmesg output a few seconds after writing >128 MB to one disk

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #9 from Martin von Wittich  ---
Created attachment 61
  --> https://bugzilla.kernel.org/attachment.cgi?id=61&action=edit
dmesg output another few seconds later, completely filled with pm80xx errors

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


[PATCH 02/19] qla2xxx: Add ram area DDR for fwdump template entry T262.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h  | 2 ++
 drivers/scsi/qla2xxx/qla_mbx.c  | 7 +--
 drivers/scsi/qla2xxx/qla_tmpl.c | 9 -
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 47f8b9b4..7f86147 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3370,6 +3370,8 @@ struct qla_hw_data {
 
uint32_tfw_shared_ram_start;
uint32_tfw_shared_ram_end;
+   uint32_tfw_ddr_ram_start;
+   uint32_tfw_ddr_ram_end;
 
uint16_tfw_options[16]; /* slots: 1,2,3,10,11 */
uint8_t fw_seriallink_options[4];
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 968b846..9673a0b 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -782,8 +782,9 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha)
if (IS_FWI2_CAPABLE(ha))
mcp->in_mb |= MBX_17|MBX_16|MBX_15;
if (IS_QLA27XX(ha))
-   mcp->in_mb |= MBX_23 | MBX_22 | MBX_21 | MBX_20 | MBX_19 |
-   MBX_18 | MBX_14 | MBX_13 | MBX_11 | MBX_10 | MBX_9 | MBX_8;
+   mcp->in_mb |=
+   MBX_25|MBX_24|MBX_23|MBX_22|MBX_21|MBX_20|MBX_19|MBX_18|
+   MBX_14|MBX_13|MBX_11|MBX_10|MBX_9|MBX_8;
 
mcp->flags = 0;
mcp->tov = MBX_TOV_SECONDS;
@@ -842,6 +843,8 @@ qla2x00_get_fw_version(scsi_qla_host_t *vha)
ha->pep_version[2] = mcp->mb[14] & 0xff;
ha->fw_shared_ram_start = (mcp->mb[19] << 16) | mcp->mb[18];
ha->fw_shared_ram_end = (mcp->mb[21] << 16) | mcp->mb[20];
+   ha->fw_ddr_ram_start = (mcp->mb[23] << 16) | mcp->mb[22];
+   ha->fw_ddr_ram_end = (mcp->mb[25] << 16) | mcp->mb[24];
}
 
 failed:
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index c3e6225..36935c9 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -357,6 +357,13 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha,
ent->t262.start_addr = start;
ent->t262.end_addr = end;
}
+   } else if (ent->t262.ram_area == T262_RAM_AREA_DDR_RAM) {
+   start = vha->hw->fw_ddr_ram_start;
+   end = vha->hw->fw_ddr_ram_end;
+   if (buf) {
+   ent->t262.start_addr = start;
+   ent->t262.end_addr = end;
+   }
} else {
ql_dbg(ql_dbg_misc, vha, 0xd022,
"%s: unknown area %x\n", __func__, ent->t262.ram_area);
@@ -364,7 +371,7 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha,
goto done;
}
 
-   if (end < start || end == 0) {
+   if (end <= start || start == 0 || end == 0) {
ql_dbg(ql_dbg_misc, vha, 0xd023,
"%s: unusable range (start=%x end=%x)\n", __func__,
ent->t262.end_addr, ent->t262.start_addr);
-- 
2.7.2

--
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 04/19] qla2xxx: Set FLOGI retry in additional firmware options for P2P (N2N) mode.

2016-07-06 Thread Himanshu Madhani
From: Giridhar Malavali 

When VP decoupling enabled, there could be a window where, FLOGI from initiators
can be dropped before VP0 is enabled, causing link level recovery.
Retry FLOGI to avoid link level recovery.

Signed-off-by: Giridhar Malavali 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |  2 +-
 drivers/scsi/qla2xxx/qla_init.c | 24 
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 0671f07..907a7ac 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -16,7 +16,7 @@
  * |  || 0x016e-0x0170  |
  * | Mailbox commands |   0x1192   |   |
  * |  ||   |
- * | Device Discovery |   0x2016   | 0x2020-0x2022, |
+ * | Device Discovery |   0x2003   | 0x2016
|
  * |  || 0x2011-0x2012, |
  * |  || 0x2099-0x20a4  |
  * | Queue Command and IO tracing |   0x3074   | 0x300b |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index c56cdb3..a3685b6 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2053,6 +2053,14 @@ qla2x00_update_fw_options(scsi_qla_host_t *vha)
if (IS_QLA6312(ha))
ha->fw_options[2] |= BIT_13;
 
+   /* Set Retry FLOGI in case of P2P connection */
+   if (ha->operating_mode == P2P) {
+   ha->fw_options[2] |= BIT_3;
+   ql_dbg(ql_dbg_disc, vha, 0x2100,
+   "(%s): Setting FLOGI retry BIT in fw_options[2]: 0x%x\n",
+   __func__, ha->fw_options[2]);
+   }
+
/* Update firmware options. */
qla2x00_set_fw_options(vha, ha->fw_options);
 }
@@ -2070,6 +2078,14 @@ qla24xx_update_fw_options(scsi_qla_host_t *vha)
if (ql2xfwholdabts)
ha->fw_options[3] |= BIT_12;
 
+   /* Set Retry FLOGI in case of P2P connection */
+   if (ha->operating_mode == P2P) {
+   ha->fw_options[2] |= BIT_3;
+   ql_dbg(ql_dbg_disc, vha, 0x2101,
+   "(%s): Setting FLOGI retry BIT in fw_options[2]: 0x%x\n",
+   __func__, ha->fw_options[2]);
+   }
+
/* Update Serial Link options. */
if ((le16_to_cpu(ha->fw_seriallink_options24[0]) & BIT_0) == 0)
return;
@@ -6513,6 +6529,14 @@ qla81xx_update_fw_options(scsi_qla_host_t *vha)
if (ql2xfwholdabts)
ha->fw_options[3] |= BIT_12;
 
+   /* Set Retry FLOGI in case of P2P connection */
+   if (ha->operating_mode == P2P) {
+   ha->fw_options[2] |= BIT_3;
+   ql_dbg(ql_dbg_disc, vha, 0x2103,
+   "(%s): Setting FLOGI retry BIT in fw_options[2]: 0x%x\n",
+   __func__, ha->fw_options[2]);
+   }
+
if (!ql2xetsenable)
goto out;
 
-- 
2.7.2

--
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 08/19] qla2xxx: Properly reset firmware statistics.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c | 28 
 drivers/scsi/qla2xxx/qla_bsg.c  |  2 +-
 drivers/scsi/qla2xxx/qla_dbg.c  |  2 +-
 drivers/scsi/qla2xxx/qla_gbl.h  |  2 +-
 drivers/scsi/qla2xxx/qla_mbx.c  | 18 --
 5 files changed, 35 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index e0256a4..8b06ce8 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1828,17 +1828,17 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
goto done;
 
stats = dma_alloc_coherent(&ha->pdev->dev,
-   sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
-   if (stats == NULL) {
+   sizeof(*stats), &stats_dma, GFP_KERNEL);
+   if (!stats) {
ql_log(ql_log_warn, vha, 0x707d,
"Failed to allocate memory for stats.\n");
goto done;
}
-   memset(stats, 0, DMA_POOL_SIZE);
+   memset(stats, 0, sizeof(*stats));
 
rval = QLA_FUNCTION_FAILED;
if (IS_FWI2_CAPABLE(ha)) {
-   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
+   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, 0);
} else if (atomic_read(&base_vha->loop_state) == LOOP_READY &&
!ha->dpc_active) {
/* Must be in a 'READY' state for statistics retrieval. */
@@ -1886,11 +1886,31 @@ static void
 qla2x00_reset_host_stats(struct Scsi_Host *shost)
 {
scsi_qla_host_t *vha = shost_priv(shost);
+   struct qla_hw_data *ha = vha->hw;
+   struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
+   struct link_statistics *stats;
+   dma_addr_t stats_dma;
 
memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
 
vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
+
+   if (IS_FWI2_CAPABLE(ha)) {
+   stats = dma_alloc_coherent(&ha->pdev->dev,
+   sizeof(*stats), &stats_dma, GFP_KERNEL);
+   if (!stats) {
+   ql_log(ql_log_warn, vha, 0x70d7,
+   "Failed to allocate memory for stats.\n");
+   return;
+   }
+
+   /* reset firmware statistics */
+   qla24xx_get_isp_stats(base_vha, stats, stats_dma, BIT_0);
+
+   dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
+   stats, stats_dma);
+   }
 }
 
 static void
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 392c147..8cadc4d 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2270,7 +2270,7 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
 
memset(stats, 0, sizeof(struct link_statistics));
 
-   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
+   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, 0);
 
if (rval != QLA_SUCCESS)
goto done_free;
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 589cd13..c6ccc8a 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -41,7 +41,7 @@
  * |  || 0x70ad-0x70ae  |
  * |  || 0x70d0-0x70d6 |
  * |  || 0x70d7-0x70db  |
- * |  || 0x70de-0x70df  |
+ * |  || 0x70db
|
  * | Task Management  |   0x803d   | 0x8000,0x800b  |
  * |  || 0x8019 |
  * |  || 0x8025,0x8026  |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index fe94377..be24e62 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -344,7 +344,7 @@ qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct 
link_statistics *,
 
 extern int
 qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
-dma_addr_t);
+dma_addr_t, uint);
 
 extern int qla24xx_abort_command(srb_t *);
 extern int qla24xx_async_abort_command(srb_t *);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 9673a0b..583ad62 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2762,15 +2762,16 @@ qla2x00_get_link_status(scsi_qla_host_t *vha, uint16_t 
loop_id,
int rval;
mbx_cmd_t mc;
mbx_cmd_t *mcp = &mc;
-   uint32_t *iter, dwords;
+   uint32_t *iter = (void *)stats;
+   ushort dwords = offsetof(typeof(*stats), link_up_cnt)/sizeof(*iter);
stru

[PATCH 01/19] qla2xxx: Remove sysfs node fw_dump_template.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c | 89 -
 drivers/scsi/qla2xxx/qla_dbg.c  |  1 +
 2 files changed, 1 insertion(+), 89 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 4dc06a13..c9bcd82 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -147,92 +147,6 @@ static struct bin_attribute sysfs_fw_dump_attr = {
 };
 
 static ssize_t
-qla2x00_sysfs_read_fw_dump_template(struct file *filp, struct kobject *kobj,
-  struct bin_attribute *bin_attr,
-  char *buf, loff_t off, size_t count)
-{
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
-   struct qla_hw_data *ha = vha->hw;
-
-   if (!ha->fw_dump_template || !ha->fw_dump_template_len)
-   return 0;
-
-   ql_dbg(ql_dbg_user, vha, 0x70e2,
-   "chunk <- off=%llx count=%zx\n", off, count);
-   return memory_read_from_buffer(buf, count, &off,
-   ha->fw_dump_template, ha->fw_dump_template_len);
-}
-
-static ssize_t
-qla2x00_sysfs_write_fw_dump_template(struct file *filp, struct kobject *kobj,
-   struct bin_attribute *bin_attr,
-   char *buf, loff_t off, size_t count)
-{
-   struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
-   struct device, kobj)));
-   struct qla_hw_data *ha = vha->hw;
-   uint32_t size;
-
-   if (off == 0) {
-   if (ha->fw_dump)
-   vfree(ha->fw_dump);
-   if (ha->fw_dump_template)
-   vfree(ha->fw_dump_template);
-
-   ha->fw_dump = NULL;
-   ha->fw_dump_len = 0;
-   ha->fw_dump_template = NULL;
-   ha->fw_dump_template_len = 0;
-
-   size = qla27xx_fwdt_template_size(buf);
-   ql_dbg(ql_dbg_user, vha, 0x70d1,
-   "-> allocating fwdt (%x bytes)...\n", size);
-   ha->fw_dump_template = vmalloc(size);
-   if (!ha->fw_dump_template) {
-   ql_log(ql_log_warn, vha, 0x70d2,
-   "Failed allocate fwdt (%x bytes).\n", size);
-   return -ENOMEM;
-   }
-   ha->fw_dump_template_len = size;
-   }
-
-   if (off + count > ha->fw_dump_template_len) {
-   count = ha->fw_dump_template_len - off;
-   ql_dbg(ql_dbg_user, vha, 0x70d3,
-   "chunk -> truncating to %zx bytes.\n", count);
-   }
-
-   ql_dbg(ql_dbg_user, vha, 0x70d4,
-   "chunk -> off=%llx count=%zx\n", off, count);
-   memcpy(ha->fw_dump_template + off, buf, count);
-
-   if (off + count == ha->fw_dump_template_len) {
-   size = qla27xx_fwdt_calculate_dump_size(vha);
-   ql_dbg(ql_dbg_user, vha, 0x70d5,
-   "-> allocating fwdump (%x bytes)...\n", size);
-   ha->fw_dump = vmalloc(size);
-   if (!ha->fw_dump) {
-   ql_log(ql_log_warn, vha, 0x70d6,
-   "Failed allocate fwdump (%x bytes).\n", size);
-   return -ENOMEM;
-   }
-   ha->fw_dump_len = size;
-   }
-
-   return count;
-}
-static struct bin_attribute sysfs_fw_dump_template_attr = {
-   .attr = {
-   .name = "fw_dump_template",
-   .mode = S_IRUSR | S_IWUSR,
-   },
-   .size = 0,
-   .read = qla2x00_sysfs_read_fw_dump_template,
-   .write = qla2x00_sysfs_write_fw_dump_template,
-};
-
-static ssize_t
 qla2x00_sysfs_read_nvram(struct file *filp, struct kobject *kobj,
 struct bin_attribute *bin_attr,
 char *buf, loff_t off, size_t count)
@@ -973,7 +887,6 @@ static struct sysfs_entry {
int is4GBp_only;
 } bin_file_entries[] = {
{ "fw_dump", &sysfs_fw_dump_attr, },
-   { "fw_dump_template", &sysfs_fw_dump_template_attr, 0x27 },
{ "nvram", &sysfs_nvram_attr, },
{ "optrom", &sysfs_optrom_attr, },
{ "optrom_ctl", &sysfs_optrom_ctl_attr, },
@@ -1000,8 +913,6 @@ qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha)
continue;
if (iter->is4GBp_only == 3 && !(IS_CNA_CAPABLE(vha->hw)))
continue;
-   if (iter->is4GBp_only == 0x27 && !IS_QLA27XX(vha->hw))
-   continue;
 
ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
iter->attr);
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index b64c504..b985fcb 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -39,6 +39,7 @@
  * |  | 

[PATCH 00/19] qla2xxx: Patches for scsi "misc" branch.

2016-07-06 Thread Himanshu Madhani
Hi James, Martin,

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

Thanks,
-Himanshu

Giridhar Malavali (1):
  qla2xxx: Set FLOGI retry in additional firmware options for P2P (N2N)
mode.

Himanshu Madhani (1):
  qla2xxx: Update driver version to 8.07.00.38-k

Joe Carnuccio (12):
  qla2xxx: Remove sysfs node fw_dump_template.
  qla2xxx: Add ram area DDR for fwdump template entry T262.
  qla2xxx: Shutdown board on thermal shutdown aen.
  qla2xxx: Add module parameter alternate/short names.
  qla2xxx: Make debug buffer log easier to view.
  qla2xxx: Properly initialize IO statistics.
  qla2xxx: Properly reset firmware statistics.
  qla2xxx: Add bsg interface to support D_Port Diagnostics.
  qla2xxx: Let DPORT be enabled purely by nvram.
  qla2xxx: Add support to handle Loop Init error Asynchronus event.
  qla2xxx: Correction to function qla26xx_dport_diagnostics().
  qla2xxx: Separate ISP type bits out from device type.

Sawan Chandak (5):
  qla2xxx: Check for device state before unloading the driver.
  qla2xxx: Add bsg interface to support statistics counter reset.
  qla2xxx: Disable the adapter and skip error recovery in case of
register disconnect.
  qla2xxx: Fix duplicate message id.
  qla2xxx: Fix BBCR offset

 drivers/scsi/qla2xxx/qla_attr.c| 170 -
 drivers/scsi/qla2xxx/qla_bsg.c |  92 +++-
 drivers/scsi/qla2xxx/qla_bsg.h |  13 +++
 drivers/scsi/qla2xxx/qla_dbg.c |  50 +--
 drivers/scsi/qla2xxx/qla_def.h |  12 ++-
 drivers/scsi/qla2xxx/qla_fw.h  |   2 +-
 drivers/scsi/qla2xxx/qla_gbl.h |   5 +-
 drivers/scsi/qla2xxx/qla_init.c|  39 +++--
 drivers/scsi/qla2xxx/qla_isr.c |  23 -
 drivers/scsi/qla2xxx/qla_mbx.c | 123 ++-
 drivers/scsi/qla2xxx/qla_os.c  | 127 ++-
 drivers/scsi/qla2xxx/qla_target.c  |  16 ++--
 drivers/scsi/qla2xxx/qla_tmpl.c|   9 +-
 drivers/scsi/qla2xxx/qla_version.h |   2 +-
 14 files changed, 443 insertions(+), 240 deletions(-)

-- 
2.7.2

--
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 18/19] qla2xxx: Fix BBCR offset

2016-07-06 Thread Himanshu Madhani
From: Sawan Chandak 

Fixes: 969a619 ("qla2xxx: Add support for buffer to buffer credit value for 
ISP27XX.")
Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_fw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 4c0f3a7..8a2368b 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1288,7 +1288,7 @@ struct vp_rpt_id_entry_24xx {
 
uint8_t vp_idx_map[16];
 
-   uint8_t reserved_4[28];
+   uint8_t reserved_4[24];
uint16_t bbcr;
uint8_t reserved_5[6];
 };
-- 
2.7.2

--
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 03/19] qla2xxx: Shutdown board on thermal shutdown aen.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c |  2 +-
 drivers/scsi/qla2xxx/qla_def.h |  1 +
 drivers/scsi/qla2xxx/qla_isr.c |  7 +++
 drivers/scsi/qla2xxx/qla_os.c  | 10 ++
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index b985fcb..0671f07 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -27,7 +27,7 @@
  * |  || 0x303a
|
  * | DPC Thread   |   0x4023   | 0x4002,0x4013  |
  * | Async Events |   0x5089   | 0x502b-0x502f  |
- * |  || 0x505e |
+ * | || 0x5047 |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
  * |  || 0x507b,0x505f |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7f86147..2b7e4f5 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -829,6 +829,7 @@ struct mbx_cmd_32 {
 #define MBA_FW_RESTART_CMPLT   0x8060  /* Firmware restart complete */
 #define MBA_INIT_REQUIRED  0x8061  /* Initialization required */
 #define MBA_SHUTDOWN_REQUESTED 0x8062  /* Shutdown Requested */
+#define MBA_TEMPERATURE_ALERT  0x8070  /* Temperature Alert */
 #define MBA_DPORT_DIAGNOSTICS  0x8080  /* D-port Diagnostics */
 #define MBA_FW_INIT_FAILURE0x8401  /* Firmware initialization failure */
 #define MBA_MIRROR_LUN_CHANGE  0x8402  /* Mirror LUN State Change
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 5649c20..f1bfb42 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1158,6 +1158,13 @@ global_port_update:
mb[1] == 2 ? "done (error)" : "other");
break;
 
+   case MBA_TEMPERATURE_ALERT:
+   ql_dbg(ql_dbg_async, vha, 0x505e,
+   "TEMPERATURE ALERT: %04x %04x %04x\n", mb[1], mb[2], mb[3]);
+   if (mb[1] == 0x12)
+   schedule_work(&ha->board_disable);
+   break;
+
default:
ql_dbg(ql_dbg_async, vha, 0x5057,
"Unknown AEN:%04x %04x %04x %04x\n",
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 7c0b60c..dc608ce 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2901,6 +2901,10 @@ skip_dpc:
qlt_add_target(ha, base_vha);
 
clear_bit(PFLG_DRIVER_PROBING, &base_vha->pci_flags);
+
+   if (test_bit(UNLOADING, &base_vha->dpc_flags))
+   return -ENODEV;
+
return 0;
 
 probe_init_failed:
@@ -2947,7 +2951,10 @@ iospace_config_failed:
ha = NULL;
 
 probe_out:
+   pci_disable_pcie_error_reporting(pdev);
pci_disable_device(pdev);
+   if (test_bit(UNLOADING, &base_vha->dpc_flags))
+   return -ENODEV;
return ret;
 }
 
@@ -5002,6 +5009,9 @@ qla2x00_do_dpc(void *data)
"DPC handler waking up, dpc_flags=0x%lx.\n",
base_vha->dpc_flags);
 
+   if (test_bit(UNLOADING, &base_vha->dpc_flags))
+   break;
+
qla2x00_do_work(base_vha);
 
if (IS_P3P_TYPE(ha)) {
-- 
2.7.2

--
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 14/19] qla2xxx: Correction to function qla26xx_dport_diagnostics().

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c | 2 +-
 drivers/scsi/qla2xxx/qla_isr.c | 8 +++-
 drivers/scsi/qla2xxx/qla_mbx.c | 5 -
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 288338d..1a04270 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,7 +14,7 @@
  * | Module Init and Probe|   0x0191   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
- * | Mailbox commands |   0x1196   |   |
+ * | Mailbox commands |   0x1196   | 0x1193
|
  * |  ||   |
  * | Device Discovery |   0x2003   | 0x2016
|
  * |  || 0x2011-0x2012, |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 134ad2f..1b87977 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1159,13 +1159,11 @@ global_port_update:
 
case MBA_DPORT_DIAGNOSTICS:
ql_dbg(ql_dbg_async, vha, 0x5052,
-   "D-Port Diagnostics: %04x result=%s index=%u size=%u\n",
+   "D-Port Diagnostics: %04x result=%s\n",
mb[0],
mb[1] == 0 ? "start" :
-   mb[1] == 1 ? "done (ok)" :
-   mb[1] == 2 ? "done (error)" : "other",
-   LSB(mb[2]),
-   mb[3]);
+   mb[1] == 1 ? "done (pass)" :
+   mb[1] == 2 ? "done (error)" : "other");
break;
 
case MBA_TEMPERATURE_ALERT:
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 0f7b83a..bf16e6f 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -5764,11 +5764,6 @@ qla26xx_dport_diagnostics(scsi_qla_host_t *vha,
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1192,
"Entered %s.\n", __func__);
 
-   if (size < 1024) {
-   ql_log(ql_log_warn, vha, 0x1193, "Failed insufficient size.\n");
-   return QLA_FUNCTION_PARAMETER_ERROR;
-   }
-
dd_dma = dma_map_single(&vha->hw->pdev->dev,
dd_buf, size, DMA_FROM_DEVICE);
if (!dd_dma) {
-- 
2.7.2

--
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 07/19] qla2xxx: Properly initialize IO statistics.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Properly initialize IO statistics to avoid initial 0xFFF (-1) values.

Cleanup/simplify usage of pointer to statistics structure.

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c   | 50 +++
 drivers/scsi/qla2xxx/qla_def.h|  1 -
 drivers/scsi/qla2xxx/qla_init.c   |  3 +++
 drivers/scsi/qla2xxx/qla_target.c | 16 ++---
 4 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index c9bcd82..e0256a4 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1811,10 +1811,9 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
int rval;
struct link_statistics *stats;
dma_addr_t stats_dma;
-   struct fc_host_statistics *pfc_host_stat;
+   struct fc_host_statistics *p = &vha->fc_host_stat;
 
-   pfc_host_stat = &vha->fc_host_stat;
-   memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
+   memset(p, -1, sizeof(*p));
 
if (IS_QLAFX00(vha->hw))
goto done;
@@ -1850,37 +1849,37 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
if (rval != QLA_SUCCESS)
goto done_free;
 
-   pfc_host_stat->link_failure_count = stats->link_fail_cnt;
-   pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt;
-   pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt;
-   pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
-   pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt;
-   pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt;
+   p->link_failure_count = stats->link_fail_cnt;
+   p->loss_of_sync_count = stats->loss_sync_cnt;
+   p->loss_of_signal_count = stats->loss_sig_cnt;
+   p->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
+   p->invalid_tx_word_count = stats->inval_xmit_word_cnt;
+   p->invalid_crc_count = stats->inval_crc_cnt;
if (IS_FWI2_CAPABLE(ha)) {
-   pfc_host_stat->lip_count = stats->lip_cnt;
-   pfc_host_stat->tx_frames = stats->tx_frames;
-   pfc_host_stat->rx_frames = stats->rx_frames;
-   pfc_host_stat->dumped_frames = stats->discarded_frames;
-   pfc_host_stat->nos_count = stats->nos_rcvd;
-   pfc_host_stat->error_frames =
+   p->lip_count = stats->lip_cnt;
+   p->tx_frames = stats->tx_frames;
+   p->rx_frames = stats->rx_frames;
+   p->dumped_frames = stats->discarded_frames;
+   p->nos_count = stats->nos_rcvd;
+   p->error_frames =
stats->dropped_frames + stats->discarded_frames;
-   pfc_host_stat->rx_words = vha->qla_stats.input_bytes;
-   pfc_host_stat->tx_words = vha->qla_stats.output_bytes;
+   p->rx_words = vha->qla_stats.input_bytes;
+   p->tx_words = vha->qla_stats.output_bytes;
}
-   pfc_host_stat->fcp_control_requests = vha->qla_stats.control_requests;
-   pfc_host_stat->fcp_input_requests = vha->qla_stats.input_requests;
-   pfc_host_stat->fcp_output_requests = vha->qla_stats.output_requests;
-   pfc_host_stat->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
-   pfc_host_stat->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
-   pfc_host_stat->seconds_since_last_reset =
+   p->fcp_control_requests = vha->qla_stats.control_requests;
+   p->fcp_input_requests = vha->qla_stats.input_requests;
+   p->fcp_output_requests = vha->qla_stats.output_requests;
+   p->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
+   p->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
+   p->seconds_since_last_reset =
get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset;
-   do_div(pfc_host_stat->seconds_since_last_reset, HZ);
+   do_div(p->seconds_since_last_reset, HZ);
 
 done_free:
dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
stats, stats_dma);
 done:
-   return pfc_host_stat;
+   return p;
 }
 
 static void
@@ -1888,6 +1887,7 @@ qla2x00_reset_host_stats(struct Scsi_Host *shost)
 {
scsi_qla_host_t *vha = shost_priv(shost);
 
+   memset(&vha->qla_stats, 0, sizeof(vha->qla_stats));
memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
 
vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 2b7e4f5..a73ecc7 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3508,7 +3508,6 @@ struct qla_hw_data {
int cur_vport_count;
 
struct qla_chip_state_84xx *cs84xx;
-   struct qla_statistics qla_stats;
struct isp_operations *isp_ops;
str

[PATCH 16/19] qla2xxx: Disable the adapter and skip error recovery in case of register disconnect.

2016-07-06 Thread Himanshu Madhani
From: Sawan Chandak 

If there is error recovery going on due to command timeout and
there is register disconnect, then disable the adapter.

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_attr.c |  3 +++
 drivers/scsi/qla2xxx/qla_dbg.c  |  2 +-
 drivers/scsi/qla2xxx/qla_os.c   | 55 +
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 8b06ce8..fe7469c 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1769,6 +1769,9 @@ qla2x00_terminate_rport_io(struct fc_rport *rport)
if (!fcport)
return;
 
+   if (test_bit(UNLOADING, &fcport->vha->dpc_flags))
+   return;
+
if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
return;
 
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 1a04270..97b0a9d 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -41,7 +41,7 @@
  * |  || 0x70ad-0x70ae  |
  * |  || 0x70d0-0x70d6 |
  * |  || 0x70d7-0x70db  |
- * | Task Management  |   0x803d   | 0x8000,0x800b  |
+ * | Task Management  |   0x8042   | 0x8000,0x800b  |
  * |  || 0x8019 |
  * |  || 0x8025,0x8026  |
  * |  || 0x8031,0x8032  |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index dc7e583..2674f4c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -943,6 +943,30 @@ sp_get(struct srb *sp)
atomic_inc(&sp->ref_count);
 }
 
+#define ISP_REG_DISCONNECT 0xU
+/**
+* qla2x00_isp_reg_stat
+*
+* Description:
+*  Read the host status register of ISP before aborting the command.
+*
+* Input:
+*  ha = pointer to host adapter structure.
+*
+*
+* Returns:
+*  Either true or false.
+*
+* Note:Return true if there is register disconnect.
+**/
+static inline
+uint32_t qla2x00_isp_reg_stat(struct qla_hw_data *ha)
+{
+   struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
+
+   return ((RD_REG_DWORD(®->host_status)) == ISP_REG_DISCONNECT);
+}
+
 /**
 * qla2xxx_eh_abort
 *
@@ -970,6 +994,11 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
int rval, wait = 0;
struct qla_hw_data *ha = vha->hw;
 
+   if (qla2x00_isp_reg_stat(ha)) {
+   ql_log(ql_log_info, vha, 0x8042,
+   "PCI/Register disconnect, exiting.\n");
+   return FAILED;
+   }
if (!CMD_SP(cmd))
return SUCCESS;
 
@@ -1153,6 +1182,12 @@ qla2xxx_eh_device_reset(struct scsi_cmnd *cmd)
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
struct qla_hw_data *ha = vha->hw;
 
+   if (qla2x00_isp_reg_stat(ha)) {
+   ql_log(ql_log_info, vha, 0x803e,
+   "PCI/Register disconnect, exiting.\n");
+   return FAILED;
+   }
+
return __qla2xxx_eh_generic_reset("DEVICE", WAIT_LUN, cmd,
ha->isp_ops->lun_reset);
 }
@@ -1163,6 +1198,12 @@ qla2xxx_eh_target_reset(struct scsi_cmnd *cmd)
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
struct qla_hw_data *ha = vha->hw;
 
+   if (qla2x00_isp_reg_stat(ha)) {
+   ql_log(ql_log_info, vha, 0x803f,
+   "PCI/Register disconnect, exiting.\n");
+   return FAILED;
+   }
+
return __qla2xxx_eh_generic_reset("TARGET", WAIT_TARGET, cmd,
ha->isp_ops->target_reset);
 }
@@ -1190,6 +1231,13 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *cmd)
int ret = FAILED;
unsigned int id;
uint64_t lun;
+   struct qla_hw_data *ha = vha->hw;
+
+   if (qla2x00_isp_reg_stat(ha)) {
+   ql_log(ql_log_info, vha, 0x8040,
+   "PCI/Register disconnect, exiting.\n");
+   return FAILED;
+   }
 
id = cmd->device->id;
lun = cmd->device->lun;
@@ -1259,6 +1307,13 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
uint64_t lun;
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
 
+   if (qla2x00_isp_reg_stat(ha)) {
+   ql_log(ql_log_info, vha, 0x8041,
+   "PCI/Register disconnect, exiting.\n");
+   schedule_work(&ha->board_disable);
+   return SUCCESS;
+   }
+
id = cmd->device->id;
lun = cmd->device->lu

[PATCH 11/19] qla2xxx: Add bsg interface to support statistics counter reset.

2016-07-06 Thread Himanshu Madhani
From: Sawan Chandak 

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_bsg.c | 48 ++
 drivers/scsi/qla2xxx/qla_bsg.h |  1 +
 2 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 592e924..8a953aa 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2246,53 +2246,54 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
struct link_statistics *stats = NULL;
dma_addr_t stats_dma;
-   int rval = QLA_FUNCTION_FAILED;
+   int rval;
+   uint32_t *cmd = bsg_job->request->rqst_data.h_vendor.vendor_cmd;
+   uint options = cmd[0] == QL_VND_GET_PRIV_STATS_EX ? cmd[1] : 0;
 
if (test_bit(UNLOADING, &vha->dpc_flags))
-   goto done;
+   return -ENODEV;
 
if (unlikely(pci_channel_offline(ha->pdev)))
-   goto done;
+   return -ENODEV;
 
if (qla2x00_reset_active(vha))
-   goto done;
+   return -EBUSY;
 
if (!IS_FWI2_CAPABLE(ha))
-   goto done;
+   return -EPERM;
 
stats = dma_alloc_coherent(&ha->pdev->dev,
-   sizeof(struct link_statistics), &stats_dma, GFP_KERNEL);
+   sizeof(*stats), &stats_dma, GFP_KERNEL);
if (!stats) {
ql_log(ql_log_warn, vha, 0x70e2,
-   "Failed to allocate memory for stats.\n");
-   goto done;
+   "Failed to allocate memory for stats.\n");
+   return -ENOMEM;
}
 
-   memset(stats, 0, sizeof(struct link_statistics));
-
-   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, 0);
-
-   if (rval != QLA_SUCCESS)
-   goto done_free;
+   memset(stats, 0, sizeof(*stats));
 
-   ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3,
-   (uint8_t *)stats, sizeof(struct link_statistics));
+   rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma, options);
 
-   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
-   bsg_job->reply_payload.sg_cnt, stats, sizeof(struct link_statistics));
-   bsg_job->reply->reply_payload_rcv_len = sizeof(struct link_statistics);
+   if (rval == QLA_SUCCESS) {
+   ql_dump_buffer(ql_dbg_user + ql_dbg_verbose, vha, 0x70e3,
+   (uint8_t *)stats, sizeof(*stats));
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, stats, sizeof(*stats));
+   }
 
-   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] = EXT_STATUS_OK;
+   bsg_job->reply->reply_payload_rcv_len = sizeof(*stats);
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   rval ? EXT_STATUS_MAILBOX : EXT_STATUS_OK;
 
-   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply_len = sizeof(*bsg_job->reply);
bsg_job->reply->result = DID_OK << 16;
bsg_job->job_done(bsg_job);
 
 done_free:
-   dma_free_coherent(&ha->pdev->dev, sizeof(struct link_statistics),
+   dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
stats, stats_dma);
 done:
-   return rval;
+   return 0;
 }
 
 static int
@@ -2401,6 +2402,7 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
return qla27xx_get_bbcr_data(bsg_job);
 
case QL_VND_GET_PRIV_STATS:
+   case QL_VND_GET_PRIV_STATS_EX:
return qla2x00_get_priv_stats(bsg_job);
 
case QL_VND_DPORT_DIAGNOSTICS:
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index 3b1045f..d97dfd5 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -30,6 +30,7 @@
 #define QL_VND_GET_BBCR_DATA0x17
 #define QL_VND_GET_PRIV_STATS  0x18
 #define QL_VND_DPORT_DIAGNOSTICS   0x19
+#define QL_VND_GET_PRIV_STATS_EX   0x1A
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK  0
-- 
2.7.2

--
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/19] qla2xxx: Let DPORT be enabled purely by nvram.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |  2 +-
 drivers/scsi/qla2xxx/qla_def.h  |  1 +
 drivers/scsi/qla2xxx/qla_init.c | 12 ++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 2a1eb02..eebd1a58 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -11,7 +11,7 @@
  * --
  * | Level|   Last Value Used  | Holes |
  * --
- * | Module Init and Probe|   0x018f   | 0x0146 |
+ * | Module Init and Probe|   0x0191   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
  * | Mailbox commands |   0x1196   |   |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 7d4bd7d..c04d83e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3029,6 +3029,7 @@ struct qla_hw_data {
uint32_tmr_reset_hdlr_active:1;
uint32_tmr_intr_valid:1;
 
+   uint32_tdport_enabled:1;
uint32_tfawwpn_enabled:1;
uint32_texlogins_enabled:1;
uint32_texchoffld_enabled:1;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 68e9309..5b09296 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2288,13 +2288,13 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
mid_init_cb->options = cpu_to_le16(BIT_1);
mid_init_cb->init_cb.execution_throttle =
cpu_to_le16(ha->cur_fw_xcb_count);
-   /* D-Port Status */
-   if (IS_DPORT_CAPABLE(ha))
-   mid_init_cb->init_cb.firmware_options_1 |=
-   cpu_to_le16(BIT_7);
-   /* Enable FA-WWPN */
+   ha->flags.dport_enabled =
+   (mid_init_cb->init_cb.firmware_options_1 & BIT_7) != 0;
+   ql_dbg(ql_dbg_init, vha, 0x0191, "DPORT Support: %s.\n",
+   (ha->flags.dport_enabled) ? "enabled" : "disabled");
+   /* FA-WWPN Status */
ha->flags.fawwpn_enabled =
-   (mid_init_cb->init_cb.firmware_options_1 & BIT_6) ? 1 : 0;
+   (mid_init_cb->init_cb.firmware_options_1 & BIT_6) != 0;
ql_dbg(ql_dbg_init, vha, 0x0141, "FA-WWPN Support: %s.\n",
(ha->flags.fawwpn_enabled) ? "enabled" : "disabled");
}
-- 
2.7.2

--
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/19] qla2xxx: Add bsg interface to support D_Port Diagnostics.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_bsg.c | 44 
 drivers/scsi/qla2xxx/qla_bsg.h | 12 +
 drivers/scsi/qla2xxx/qla_dbg.c |  3 +--
 drivers/scsi/qla2xxx/qla_gbl.h |  3 +++
 drivers/scsi/qla2xxx/qla_isr.c |  7 +++--
 drivers/scsi/qla2xxx/qla_mbx.c | 58 +-
 6 files changed, 122 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 8cadc4d..592e924 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2296,6 +2296,47 @@ done:
 }
 
 static int
+qla2x00_do_dport_diagnostics(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   int rval;
+   struct qla_dport_diag *dd;
+
+   if (!IS_QLA83XX(vha->hw) && !IS_QLA27XX(vha->hw))
+   return -EPERM;
+
+   dd = kmalloc(sizeof(*dd), GFP_KERNEL);
+   if (!dd) {
+   ql_log(ql_log_warn, vha, 0x70db,
+   "Failed to allocate memory for dport.\n");
+   return -ENOMEM;
+   }
+
+   sg_copy_to_buffer(bsg_job->request_payload.sg_list,
+   bsg_job->request_payload.sg_cnt, dd, sizeof(*dd));
+
+   rval = qla26xx_dport_diagnostics(
+   vha, dd->buf, sizeof(dd->buf), dd->options);
+   if (rval == QLA_SUCCESS) {
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, dd, sizeof(*dd));
+   }
+
+   bsg_job->reply->reply_payload_rcv_len = sizeof(*dd);
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   rval ? EXT_STATUS_MAILBOX : EXT_STATUS_OK;
+
+   bsg_job->reply_len = sizeof(*bsg_job->reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+
+   kfree(dd);
+
+   return 0;
+}
+
+static int
 qla2x00_process_vendor_specific(struct fc_bsg_job *bsg_job)
 {
switch (bsg_job->request->rqst_data.h_vendor.vendor_cmd[0]) {
@@ -2362,6 +2403,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
case QL_VND_GET_PRIV_STATS:
return qla2x00_get_priv_stats(bsg_job);
 
+   case QL_VND_DPORT_DIAGNOSTICS:
+   return qla2x00_do_dport_diagnostics(bsg_job);
+
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index c80192d..3b1045f 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -29,6 +29,7 @@
 #define QL_VND_SET_FLASH_UPDATE_CAPS0x16
 #define QL_VND_GET_BBCR_DATA0x17
 #define QL_VND_GET_PRIV_STATS  0x18
+#define QL_VND_DPORT_DIAGNOSTICS   0x19
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK  0
@@ -266,4 +267,15 @@ struct  qla_bbcr_data {
uint16_t  mbx1; /* Port state */
uint8_t   reserved[9];
 } __packed;
+
+struct qla_dport_diag {
+   uint16_t options;
+   uint32_t buf[16];
+   uint8_t  unused[62];
+} __packed;
+
+/* D_Port options */
+#define QLA_DPORT_RESULT   0x0
+#define QLA_DPORT_START0x2
+
 #endif
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 2790e5f..2a1eb02 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,7 +14,7 @@
  * | Module Init and Probe|   0x018f   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
- * | Mailbox commands |   0x1191   |   |
+ * | Mailbox commands |   0x1196   |   |
  * |  ||   |
  * | Device Discovery |   0x2003   | 0x2016
|
  * |  || 0x2011-0x2012, |
@@ -41,7 +41,6 @@
  * |  || 0x70ad-0x70ae  |
  * |  || 0x70d0-0x70d6 |
  * |  || 0x70d7-0x70db  |
- * |  || 0x70db
|
  * | Task Management  |   0x803d   | 0x8000,0x800b  |
  * |  || 0x8019 |
  * |  || 0x8025,0x8026  |
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index be24e62..6ca0081 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -445,6 +445,9 @@ qla2x00_port_logout(scsi_qla_host_t *, struct fc_port *);
 extern int
 qla2x00_dump_mctp_data(scsi_qla_host_t *, dma_addr_t, uin

[PATCH 06/19] qla2xxx: Make debug buffer log easier to view.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c | 33 ++---
 1 file changed, 14 insertions(+), 19 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 907a7ac..589cd13 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -13,7 +13,7 @@
  * --
  * | Module Init and Probe|   0x018f   | 0x0146 |
  * |  || 0x015b-0x0160 |
- * |  || 0x016e-0x0170  |
+ * |  || 0x016e
|
  * | Mailbox commands |   0x1192   |   |
  * |  ||   |
  * | Device Discovery |   0x2003   | 0x2016
|
@@ -2698,29 +2698,24 @@ ql_dump_regs(uint32_t level, scsi_qla_host_t *vha, 
int32_t id)
 
 void
 ql_dump_buffer(uint32_t level, scsi_qla_host_t *vha, int32_t id,
-   uint8_t *b, uint32_t size)
+   uint8_t *buf, uint size)
 {
-   uint32_t cnt;
-   uint8_t c;
+   uint cnt;
 
if (!ql_mask_match(level))
return;
 
-   ql_dbg(level, vha, id, " 0   1   2   3   4   5   6   7   8   "
-   "9  Ah  Bh  Ch  Dh  Eh  Fh\n");
-   ql_dbg(level, vha, id, "--"
-   "\n");
-
-   ql_dbg(level, vha, id, " ");
-   for (cnt = 0; cnt < size;) {
-   c = *b++;
-   printk("%02x", (uint32_t) c);
-   cnt++;
-   if (!(cnt % 16))
+   ql_dbg(level, vha, id,
+   "%-+5d  0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F\n", size);
+   ql_dbg(level, vha, id,
+   "- ---\n");
+   for (cnt = 0; cnt < size; cnt++, buf++) {
+   if (cnt % 16 == 0)
+   ql_dbg(level, vha, id, "%04x:", cnt & ~0xFU);
+   printk(" %02x", *buf);
+   if (cnt % 16 == 15)
printk("\n");
-   else
-   printk("  ");
}
-   if (cnt % 16)
-   ql_dbg(level, vha, id, "\n");
+   if (cnt % 16 != 0)
+   printk("\n");
 }
-- 
2.7.2

--
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 09/19] qla2xxx: Check for device state before unloading the driver.

2016-07-06 Thread Himanshu Madhani
From: Sawan Chandak 

During hot swap of PCI device, there can be PCI error on device,
during normal driver unload. The race between normal driver unload and
driver unload due to PCI error, can lead to system crash.Fix is to check
if there is unload going on and allow that function to unload the driver.

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c |  2 +-
 drivers/scsi/qla2xxx/qla_def.h |  1 +
 drivers/scsi/qla2xxx/qla_mbx.c | 41 +
 drivers/scsi/qla2xxx/qla_os.c  | 21 +
 4 files changed, 52 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index c6ccc8a..2790e5f 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,7 +14,7 @@
  * | Module Init and Probe|   0x018f   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
- * | Mailbox commands |   0x1192   |   |
+ * | Mailbox commands |   0x1191   |   |
  * |  ||   |
  * | Device Discovery |   0x2003   | 0x2016
|
  * |  || 0x2011-0x2012, |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index a73ecc7..7d4bd7d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3658,6 +3658,7 @@ typedef struct scsi_qla_host {
 #define PFLG_DISCONNECTED  0   /* PCI device removed */
 #define PFLG_DRIVER_REMOVING   1   /* PCI driver .remove */
 #define PFLG_DRIVER_PROBING2   /* PCI driver .probe */
+#define PCI_ERR30
 
uint32_tdevice_flags;
 #define SWITCH_FOUND   BIT_0
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 583ad62..97099ce 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -64,6 +64,13 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
return QLA_FUNCTION_TIMEOUT;
}
 
+/* if PCI error, then avoid mbx processing.*/
+if (test_bit(PCI_ERR, &base_vha->dpc_flags)) {
+   ql_log(ql_log_warn, vha, 0x1191,
+   "PCI error, exiting.\n");
+   return QLA_FUNCTION_TIMEOUT;
+}
+
reg = ha->iobase;
io_lock_on = base_vha->flags.init_done;
 
@@ -266,6 +273,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t 
*mcp)
 
uint16_t mb0;
uint32_t ictrl;
+   uint16_tw;
 
if (IS_FWI2_CAPABLE(ha)) {
mb0 = RD_REG_WORD(®->isp24.mailbox0);
@@ -279,15 +287,32 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t 
*mcp)
"mb[0]=0x%x\n", command, ictrl, jiffies, mb0);
ql_dump_regs(ql_dbg_mbx + ql_dbg_buffer, vha, 0x1019);
 
-   /*
-* Attempt to capture a firmware dump for further analysis
-* of the current firmware state.  We do not need to do this
-* if we are intentionally generating a dump.
-*/
-   if (mcp->mb[0] != MBC_GEN_SYSTEM_ERROR)
-   ha->isp_ops->fw_dump(vha, 0);
+   /* Capture FW dump only, if PCI device active */
+   if (!pci_channel_offline(vha->hw->pdev)) {
+   pci_read_config_word(ha->pdev, PCI_VENDOR_ID, &w);
+   if (w == 0x || ictrl == 0x) {
+   /* This is special case if there is unload
+* of driver happening and if PCI device go
+* into bad state due to PCI error condition
+* then only PCI ERR flag would be set.
+* we will do premature exit for above case.
+*/
+   if (test_bit(UNLOADING, &base_vha->dpc_flags))
+   set_bit(PCI_ERR, &base_vha->dpc_flags);
+   ha->flags.mbox_busy = 0;
+   rval = QLA_FUNCTION_TIMEOUT;
+   goto premature_exit;
+   }
 
-   rval = QLA_FUNCTION_TIMEOUT;
+   /* Attempt to capture firmware dump for further
+* anallysis of the current formware state. we do not
+* need to do this if we are intentionally generating
+* a dump
+*/
+   if (mcp->mb[0] != MBC_GEN_SYSTEM_ERROR)
+

[PATCH 05/19] qla2xxx: Add module parameter alternate/short names.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_os.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index dc608ce..f1a2394 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -80,6 +80,7 @@ MODULE_PARM_DESC(ql2xallocfwdump,
 
 int ql2xextended_error_logging;
 module_param(ql2xextended_error_logging, int, S_IRUGO|S_IWUSR);
+module_param_named(logging, ql2xextended_error_logging, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(ql2xextended_error_logging,
"Option to enable extended error logging,\n"
"\t\tDefault is 0 - no logging.  0x4000 - Module Init & 
Probe.\n"
@@ -106,6 +107,7 @@ MODULE_PARM_DESC(ql2xshiftctondsd,
 
 int ql2xfdmienable=1;
 module_param(ql2xfdmienable, int, S_IRUGO|S_IWUSR);
+module_param_named(fdmi, ql2xfdmienable, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(ql2xfdmienable,
"Enables FDMI registrations. "
"0 - no FDMI. Default is 1 - perform FDMI.");
@@ -157,6 +159,7 @@ MODULE_PARM_DESC(ql2xmultique_tag,
 
 int ql2xfwloadbin;
 module_param(ql2xfwloadbin, int, S_IRUGO|S_IWUSR);
+module_param_named(fwload, ql2xfwloadbin, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(ql2xfwloadbin,
"Option to specify location from which to load ISP firmware:.\n"
" 2 -- load firmware via the request_firmware() (hotplug).\n"
-- 
2.7.2

--
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 19/19] qla2xxx: Update driver version to 8.07.00.38-k

2016-07-06 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index 0bc93fa..3cb1964 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "8.07.00.33-k"
+#define QLA2XXX_VERSION  "8.07.00.38-k"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   7
-- 
2.7.2

--
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 13/19] qla2xxx: Add support to handle Loop Init error Asynchronus event.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c |  2 +-
 drivers/scsi/qla2xxx/qla_isr.c | 11 +--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index eebd1a58..288338d 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -30,7 +30,7 @@
  * | || 0x5047 |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
- * |  || 0x507b,0x505f |
+ * |  || 0x505f
|
  * | Timer Routines   |   0x6012   ||
  * | User Space Interactions  |   0x70e3   | 0x7018,0x702e  |
  * | || 0x7020,0x7024  |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index b8d0b78a..134ad2f 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -710,16 +710,23 @@ skip_rio:
 
case MBA_RSP_TRANSFER_ERR:  /* Response Transfer Error */
ql_log(ql_log_warn, vha, 0x5007,
-   "ISP Response Transfer Error.\n");
+   "ISP Response Transfer Error (%x).\n", mb[1]);
 
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
break;
 
case MBA_WAKEUP_THRES:  /* Request Queue Wake-up */
ql_dbg(ql_dbg_async, vha, 0x5008,
-   "Asynchronous WAKEUP_THRES.\n");
+   "Asynchronous WAKEUP_THRES (%x).\n", mb[1]);
+   break;
 
+   case MBA_LOOP_INIT_ERR:
+   ql_log(ql_log_warn, vha, 0x507b,
+   "LOOP INIT ERROR (%x).\n", mb[1]);
+   ha->isp_ops->fw_dump(vha, 1);
+   set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
break;
+
case MBA_LIP_OCCURRED:  /* Loop Initialization Procedure */
ql_dbg(ql_dbg_async, vha, 0x5009,
"LIP occurred (%x).\n", mb[1]);
-- 
2.7.2

--
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 17/19] qla2xxx: Fix duplicate message id.

2016-07-06 Thread Himanshu Madhani
From: Sawan Chandak 

Signed-off-by: Sawan Chandak 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_dbg.c | 7 +++
 drivers/scsi/qla2xxx/qla_isr.c | 2 +-
 drivers/scsi/qla2xxx/qla_mbx.c | 4 ++--
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 97b0a9d..45af34d 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,9 +14,8 @@
  * | Module Init and Probe|   0x0191   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e
|
- * | Mailbox commands |   0x1196   | 0x1193
|
- * |  ||   |
- * | Device Discovery |   0x2003   | 0x2016
|
+ * | Mailbox commands |   0x1199   | 0x1193
|
+ * | Device Discovery |   0x2004   | 0x2016
|
  * |  || 0x2011-0x2012, |
  * |  || 0x2099-0x20a4  |
  * | Queue Command and IO tracing |   0x3074   | 0x300b |
@@ -26,7 +25,7 @@
  * |  || 0x3036,0x3038  |
  * |  || 0x303a
|
  * | DPC Thread   |   0x4023   | 0x4002,0x4013  |
- * | Async Events |   0x5089   | 0x502b-0x502f  |
+ * | Async Events |   0x5090   | 0x502b-0x502f  |
  * | || 0x5047 |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 1b87977..90b3c2e 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -721,7 +721,7 @@ skip_rio:
break;
 
case MBA_LOOP_INIT_ERR:
-   ql_log(ql_log_warn, vha, 0x507b,
+   ql_log(ql_log_warn, vha, 0x5090,
"LOOP INIT ERROR (%x).\n", mb[1]);
ha->isp_ops->fw_dump(vha, 1);
set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index bf16e6f..23698c9 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -404,7 +404,7 @@ mbx_done:
" Failed mbx[0]=%x, mb[1]=%x, mb[2]=%x, mb[3]=%x, 
cmd=%x .\n",
mcp->mb[0], mcp->mb[1], mcp->mb[2], mcp->mb[3], command);
 
-   ql_dbg(ql_dbg_disc, vha, 0x1115,
+   ql_dbg(ql_dbg_mbx, vha, 0x1198,
"host status: 0x%x, flags:0x%lx, intr ctrl reg:0x%x, intr 
status:0x%x\n",
RD_REG_DWORD(®->isp24.host_status),
ha->fw_dump_cap_flags,
@@ -413,7 +413,7 @@ mbx_done:
 
mbx_reg = ®->isp24.mailbox0;
for (i = 0; i < 6; i++)
-   ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x1116,
+   ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1199,
"mbox[%d] 0x%04x\n", i, RD_REG_WORD(mbx_reg++));
} else {
ql_dbg(ql_dbg_mbx, base_vha, 0x1021, "Done %s.\n", __func__);
-- 
2.7.2

--
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 15/19] qla2xxx: Separate ISP type bits out from device type.

2016-07-06 Thread Himanshu Madhani
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |  6 --
 drivers/scsi/qla2xxx/qla_os.c  | 44 +-
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c04d83e..ae4a747 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3130,7 +3130,7 @@ struct qla_hw_data {
 #define PCI_DEVICE_ID_QLOGIC_ISP2271   0x2271
 #define PCI_DEVICE_ID_QLOGIC_ISP2261   0x2261
 
-   uint32_tdevice_type;
+   uint32_tisp_type;
 #define DT_ISP2100  BIT_0
 #define DT_ISP2200  BIT_1
 #define DT_ISP2300  BIT_2
@@ -3155,6 +3155,7 @@ struct qla_hw_data {
 #define DT_ISP2261 BIT_21
 #define DT_ISP_LAST(DT_ISP2261 << 1)
 
+   uint32_tdevice_type;
 #define DT_T10_PI   BIT_25
 #define DT_IIDMABIT_26
 #define DT_FWI2 BIT_27
@@ -3162,7 +3163,8 @@ struct qla_hw_data {
 #define DT_OEM_001  BIT_29
 #define DT_ISP2200A BIT_30
 #define DT_EXTENDED_IDS BIT_31
-#define DT_MASK(ha) ((ha)->device_type & (DT_ISP_LAST - 1))
+
+#define DT_MASK(ha) ((ha)->isp_type & (DT_ISP_LAST - 1))
 #define IS_QLA2100(ha)  (DT_MASK(ha) & DT_ISP2100)
 #define IS_QLA2200(ha)  (DT_MASK(ha) & DT_ISP2200)
 #define IS_QLA2300(ha)  (DT_MASK(ha) & DT_ISP2300)
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index fde7ee1..dc7e583 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2110,27 +2110,27 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->device_type = DT_EXTENDED_IDS;
switch (ha->pdev->device) {
case PCI_DEVICE_ID_QLOGIC_ISP2100:
-   ha->device_type |= DT_ISP2100;
+   ha->isp_type |= DT_ISP2100;
ha->device_type &= ~DT_EXTENDED_IDS;
ha->fw_srisc_address = RISC_START_ADDRESS_2100;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2200:
-   ha->device_type |= DT_ISP2200;
+   ha->isp_type |= DT_ISP2200;
ha->device_type &= ~DT_EXTENDED_IDS;
ha->fw_srisc_address = RISC_START_ADDRESS_2100;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2300:
-   ha->device_type |= DT_ISP2300;
+   ha->isp_type |= DT_ISP2300;
ha->device_type |= DT_ZIO_SUPPORTED;
ha->fw_srisc_address = RISC_START_ADDRESS_2300;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2312:
-   ha->device_type |= DT_ISP2312;
+   ha->isp_type |= DT_ISP2312;
ha->device_type |= DT_ZIO_SUPPORTED;
ha->fw_srisc_address = RISC_START_ADDRESS_2300;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2322:
-   ha->device_type |= DT_ISP2322;
+   ha->isp_type |= DT_ISP2322;
ha->device_type |= DT_ZIO_SUPPORTED;
if (ha->pdev->subsystem_vendor == 0x1028 &&
ha->pdev->subsystem_device == 0x0170)
@@ -2138,60 +2138,60 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->fw_srisc_address = RISC_START_ADDRESS_2300;
break;
case PCI_DEVICE_ID_QLOGIC_ISP6312:
-   ha->device_type |= DT_ISP6312;
+   ha->isp_type |= DT_ISP6312;
ha->fw_srisc_address = RISC_START_ADDRESS_2300;
break;
case PCI_DEVICE_ID_QLOGIC_ISP6322:
-   ha->device_type |= DT_ISP6322;
+   ha->isp_type |= DT_ISP6322;
ha->fw_srisc_address = RISC_START_ADDRESS_2300;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2422:
-   ha->device_type |= DT_ISP2422;
+   ha->isp_type |= DT_ISP2422;
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
case PCI_DEVICE_ID_QLOGIC_ISP2432:
-   ha->device_type |= DT_ISP2432;
+   ha->isp_type |= DT_ISP2432;
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
case PCI_DEVICE_ID_QLOGIC_ISP8432:
-   ha->device_type |= DT_ISP8432;
+   ha->isp_type |= DT_ISP8432;
ha->device_type |= DT_ZIO_SUPPORTED;
ha->device_type |= DT_FWI2;
ha->device_type |= DT_IIDMA;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
  

[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

--- Comment #10 from Martin von Wittich  ---
I forgot to mention: the issue is also reproducible on a Ubuntu 16.04 live
system with Linux 4.4, by running "dd if=/dev/zero of=/dev/sdX bs=1M
count=128".

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


[Bug 121531] Adaptec 7805H SAS HBA (pm80xx): hangs when writing >80MB at once

2016-07-06 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=121531

Jack Wang  changed:

   What|Removed |Added

 CC||xjtu...@gmail.com

--- Comment #11 from Jack Wang  ---
Have you tried the version from microsemi? they have a lot of changes which are
not
in upstream: 
http://storage.microsemi.com/en-us/support/sas/sas/asa-7805h/

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


[PATCH] qla2xxx: Fix compiler warning

2016-07-06 Thread Himanshu Madhani
Fixes: 7f939ab ("qla2xxx: Add bsg interface to support statistics counter 
reset.")
Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_bsg.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 8a953aa..643014f 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2289,10 +2289,9 @@ qla2x00_get_priv_stats(struct fc_bsg_job *bsg_job)
bsg_job->reply->result = DID_OK << 16;
bsg_job->job_done(bsg_job);
 
-done_free:
dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
stats, stats_dma);
-done:
+
return 0;
 }
 
-- 
1.7.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


Re: [PATCH 11/19] qla2xxx: Add bsg interface to support statistics counter reset.

2016-07-06 Thread kbuild test robot
Hi,

[auto build test WARNING on scsi/for-next]
[also build test WARNING on v4.7-rc6 next-20160706]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Patches-for-scsi-misc-branch/20160707-000429
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 5.3.1-8) 5.3.1 20160205
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_bsg.c: In function 'qla2x00_get_priv_stats':
>> drivers/scsi/qla2xxx/qla_bsg.c:2295:1: warning: label 'done' defined but not 
>> used [-Wunused-label]
done:
^
>> drivers/scsi/qla2xxx/qla_bsg.c:2292:1: warning: label 'done_free' defined 
>> but not used [-Wunused-label]
done_free:
^

vim +/done +2295 drivers/scsi/qla2xxx/qla_bsg.c

181330c1 Sawan Chandak2016-07-06  2286  rval ? EXT_STATUS_MAILBOX : 
EXT_STATUS_OK;
243de676 Harish Zunjarrao 2016-01-27  2287  
181330c1 Sawan Chandak2016-07-06  2288  bsg_job->reply_len = 
sizeof(*bsg_job->reply);
243de676 Harish Zunjarrao 2016-01-27  2289  bsg_job->reply->result = DID_OK 
<< 16;
243de676 Harish Zunjarrao 2016-01-27  2290  bsg_job->job_done(bsg_job);
243de676 Harish Zunjarrao 2016-01-27  2291  
243de676 Harish Zunjarrao 2016-01-27 @2292  done_free:
181330c1 Sawan Chandak2016-07-06  2293  
dma_free_coherent(&ha->pdev->dev, sizeof(*stats),
243de676 Harish Zunjarrao 2016-01-27  2294  stats, stats_dma);
243de676 Harish Zunjarrao 2016-01-27 @2295  done:
181330c1 Sawan Chandak2016-07-06  2296  return 0;
243de676 Harish Zunjarrao 2016-01-27  2297  }
243de676 Harish Zunjarrao 2016-01-27  2298  

:: The code at line 2295 was first introduced by commit
:: 243de6768db50266f595ec62c5ae34783edb72ea qla2xxx: Add support for 
Private link statistics counters.

:: TO: Harish Zunjarrao 
:: CC: Martin K. Petersen 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[PATCH v3 1/2] libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and translate it to a TRIM command with the upper limit.

However, according to SBC (as of sbc4r11.pdf), the "device server"
should terminate the command with "Invalid field in CBD" in that case.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..a1f061a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3305,7 +3305,11 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
goto invalid_param_len;
 
buf = page_address(sg_page(scsi_sglist(scmd)));
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+
+   if (n_block <= 65535 * 512 / 8)
+   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   else
+   goto invalid_fld;
 
if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
/* Newer devices support queued TRIM commands */
-- 
2.9.0

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


[PATCH v3 2/2] libata-scsi: avoid repeated calculation of number of TRIM ranges

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.

It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for the result.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a1f061a..05a5f44 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3306,8 +3306,8 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
 
buf = page_address(sg_page(scsi_sglist(scmd)));
 
-   if (n_block <= 65535 * 512 / 8)
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   if (n_block <= 65535 * ATA_MAX_TRIM_RNUM)
+   size = ata_set_lba_range_entries(buf, ATA_MAX_TRIM_RNUM, block, 
n_block);
else
goto invalid_fld;
 
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 99346be..ce59500 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -48,6 +48,7 @@ enum {
ATA_MAX_SECTORS_1024= 1024,
ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
ATA_MAX_SECTORS_TAPE= 65535,
+   ATA_MAX_TRIM_RNUM   = 64,   /* 512-byte payload / (6-byte LBA + 
2-byte range per entry) */
 
ATA_ID_WORDS= 256,
ATA_ID_CONFIG   = 0,
@@ -1071,7 +1072,7 @@ static inline unsigned ata_set_lba_range_entries(void 
*_buffer,
__le64 *buffer = _buffer;
unsigned i = 0, used_bytes;
 
-   while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
+   while (i < buf_size) {
u64 entry = sector |
((u64)(count > 0x ? 0x : count) << 48);
buffer[i++] = __cpu_to_le64(entry);
-- 
2.9.0

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


Re: [PATCH v3 2/2] libata-scsi: avoid repeated calculation of number of TRIM ranges

2016-07-06 Thread Tom Yan
Oops I missed the block limit VPD this time. Will send a v4.

On 7 July 2016 at 00:44,   wrote:
> From: Tom Yan 
>
> Currently libata statically allows only 1-block (512-byte) payload
> for each TRIM command. Each payload can carry 64 TRIM ranges since
> each range requires 8 bytes.
>
> It is silly to keep doing the calculation (512 / 8) in different
> places. Hence, define the new ATA_MAX_TRIM_RNUM for the result.
>
> Signed-off-by: Tom Yan 
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index a1f061a..05a5f44 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -3306,8 +3306,8 @@ static unsigned int ata_scsi_write_same_xlat(struct 
> ata_queued_cmd *qc)
>
> buf = page_address(sg_page(scsi_sglist(scmd)));
>
> -   if (n_block <= 65535 * 512 / 8)
> -   size = ata_set_lba_range_entries(buf, 512, block, n_block);
> +   if (n_block <= 65535 * ATA_MAX_TRIM_RNUM)
> +   size = ata_set_lba_range_entries(buf, ATA_MAX_TRIM_RNUM, 
> block, n_block);
> else
> goto invalid_fld;
>
> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index 99346be..ce59500 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -48,6 +48,7 @@ enum {
> ATA_MAX_SECTORS_1024= 1024,
> ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
> ATA_MAX_SECTORS_TAPE= 65535,
> +   ATA_MAX_TRIM_RNUM   = 64,   /* 512-byte payload / (6-byte LBA + 
> 2-byte range per entry) */
>
> ATA_ID_WORDS= 256,
> ATA_ID_CONFIG   = 0,
> @@ -1071,7 +1072,7 @@ static inline unsigned ata_set_lba_range_entries(void 
> *_buffer,
> __le64 *buffer = _buffer;
> unsigned i = 0, used_bytes;
>
> -   while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
> +   while (i < buf_size) {
> u64 entry = sector |
> ((u64)(count > 0x ? 0x : count) << 48);
> buffer[i++] = __cpu_to_le64(entry);
> --
> 2.9.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and translate it to a TRIM command with the upper limit.

However, according to SBC (as of sbc4r11.pdf), the "device server"
should terminate the command with "Invalid field in CBD" in that case.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..a1f061a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3305,7 +3305,11 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
goto invalid_param_len;
 
buf = page_address(sg_page(scsi_sglist(scmd)));
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+
+   if (n_block <= 65535 * 512 / 8)
+   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   else
+   goto invalid_fld;
 
if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
/* Newer devices support queued TRIM commands */
-- 
2.9.0

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


[PATCH v4 2/2] libata-scsi: avoid repeated calculation of number of TRIM ranges

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.

It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for the result.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a1f061a..82739be 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2314,7 +2314,7 @@ static unsigned int ata_scsiop_inq_b0(struct 
ata_scsi_args *args, u8 *rbuf)
 * with the unmap bit set.
 */
if (ata_id_has_trim(args->id)) {
-   put_unaligned_be64(65535 * 512 / 8, &rbuf[36]);
+   put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
put_unaligned_be32(1, &rbuf[28]);
}
 
@@ -3306,8 +3306,8 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
 
buf = page_address(sg_page(scsi_sglist(scmd)));
 
-   if (n_block <= 65535 * 512 / 8)
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   if (n_block <= 65535 * ATA_MAX_TRIM_RNUM)
+   size = ata_set_lba_range_entries(buf, ATA_MAX_TRIM_RNUM, block, 
n_block);
else
goto invalid_fld;
 
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 99346be..ce59500 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -48,6 +48,7 @@ enum {
ATA_MAX_SECTORS_1024= 1024,
ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
ATA_MAX_SECTORS_TAPE= 65535,
+   ATA_MAX_TRIM_RNUM   = 64,   /* 512-byte payload / (6-byte LBA + 
2-byte range per entry) */
 
ATA_ID_WORDS= 256,
ATA_ID_CONFIG   = 0,
@@ -1071,7 +1072,7 @@ static inline unsigned ata_set_lba_range_entries(void 
*_buffer,
__le64 *buffer = _buffer;
unsigned i = 0, used_bytes;
 
-   while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
+   while (i < buf_size) {
u64 entry = sector |
((u64)(count > 0x ? 0x : count) << 48);
buffer[i++] = __cpu_to_le64(entry);
-- 
2.9.0

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


Re: [PATCH v4 2/2] libata-scsi: avoid repeated calculation of number of TRIM ranges

2016-07-06 Thread Tom Yan
I decided not to define a macro (e.g. ATA_MAX_TRIM_RSIZE) for all the
0x / 65535 in the various functions in libata-scsi.c / ata.h. Let
me know if you think I should.

On 7 July 2016 at 00:55,   wrote:
> From: Tom Yan 
>
> Currently libata statically allows only 1-block (512-byte) payload
> for each TRIM command. Each payload can carry 64 TRIM ranges since
> each range requires 8 bytes.
>
> It is silly to keep doing the calculation (512 / 8) in different
> places. Hence, define the new ATA_MAX_TRIM_RNUM for the result.
>
> Signed-off-by: Tom Yan 
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index a1f061a..82739be 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -2314,7 +2314,7 @@ static unsigned int ata_scsiop_inq_b0(struct 
> ata_scsi_args *args, u8 *rbuf)
>  * with the unmap bit set.
>  */
> if (ata_id_has_trim(args->id)) {
> -   put_unaligned_be64(65535 * 512 / 8, &rbuf[36]);
> +   put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
> put_unaligned_be32(1, &rbuf[28]);
> }
>
> @@ -3306,8 +3306,8 @@ static unsigned int ata_scsi_write_same_xlat(struct 
> ata_queued_cmd *qc)
>
> buf = page_address(sg_page(scsi_sglist(scmd)));
>
> -   if (n_block <= 65535 * 512 / 8)
> -   size = ata_set_lba_range_entries(buf, 512, block, n_block);
> +   if (n_block <= 65535 * ATA_MAX_TRIM_RNUM)
> +   size = ata_set_lba_range_entries(buf, ATA_MAX_TRIM_RNUM, 
> block, n_block);
> else
> goto invalid_fld;
>
> diff --git a/include/linux/ata.h b/include/linux/ata.h
> index 99346be..ce59500 100644
> --- a/include/linux/ata.h
> +++ b/include/linux/ata.h
> @@ -48,6 +48,7 @@ enum {
> ATA_MAX_SECTORS_1024= 1024,
> ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
> ATA_MAX_SECTORS_TAPE= 65535,
> +   ATA_MAX_TRIM_RNUM   = 64,   /* 512-byte payload / (6-byte LBA + 
> 2-byte range per entry) */
>
> ATA_ID_WORDS= 256,
> ATA_ID_CONFIG   = 0,
> @@ -1071,7 +1072,7 @@ static inline unsigned ata_set_lba_range_entries(void 
> *_buffer,
> __le64 *buffer = _buffer;
> unsigned i = 0, used_bytes;
>
> -   while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
> +   while (i < buf_size) {
> u64 entry = sector |
> ((u64)(count > 0x ? 0x : count) << 48);
> buffer[i++] = __cpu_to_le64(entry);
> --
> 2.9.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 1/2] libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit

2016-07-06 Thread Sergei Shtylyov

On 07/06/2016 07:44 PM, tom.t...@gmail.com wrote:


From: Tom Yan 

Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and translate it to a TRIM command with the upper limit.

However, according to SBC (as of sbc4r11.pdf), the "device server"
should terminate the command with "Invalid field in CBD" in that case.


   CDB again. :-)


Signed-off-by: Tom Yan 

[...]

MBR, Sergei

--
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 resend 1/2] libata-scsi: do not respond with "invalid field" for FORMAT UNIT

2016-07-06 Thread tom . ty89
From: Tom Yan 

It does not make sense and is confusing to respond with "Invalid
field in CDB" while we have no support at all implemented for
FORMAT UNIT. It is decent to let it go to the default, which
will respond with "Invalid command operation code" instead.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..f1125fd 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4039,11 +4039,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct 
scsi_cmnd *cmd)
args.done = cmd->scsi_done;
 
switch(scsicmd[0]) {
-   /* TODO: worth improving? */
-   case FORMAT_UNIT:
-   ata_scsi_invalid_field(dev, cmd, 0);
-   break;
-
case INQUIRY:
if (scsicmd[1] & 2)/* is CmdDt set?  */
ata_scsi_invalid_field(dev, cmd, 1);
-- 
2.9.0

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


[PATCH resend 2/2] libata-scsi: correct cbd to CDB in comment

2016-07-06 Thread tom . ty89
From: Tom Yan 

It's Command Descriptor Block. Also capitalized it.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index f1125fd..c9cd216 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -304,7 +304,7 @@ static void ata_scsi_set_invalid_field(struct ata_device 
*dev,
   struct scsi_cmnd *cmd, u16 field, u8 bit)
 {
ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0);
-   /* "Invalid field in cbd" */
+   /* "Invalid field in CDB" */
scsi_set_sense_field_pointer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE,
 field, bit, 1);
 }
-- 
2.9.0

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


Re: [PATCH v3 13/13] cxgbit: add files for cxgbit.ko

2016-07-06 Thread Varun Prakash
On Wed, Jul 06, 2016 at 12:24:43AM +0300, Or Gerlitz wrote:
> On Thu, May 26, 2016 at 9:58 PM, Varun Prakash  wrote:
> 
> > Hi Or, Nicholas and Steve
> > Thank you for the feedback and apologies for the delay in my response.
> 
> > I agree that we can refactor initiator, target and iwarp drivers to
> > reduce code duplication as Steve has mentioned. We will work on this for
> > 4.8 merge window.
> 
> Nic, Varun, was anything done on this matter? we're on rc6

Yes, I am working on this, I will post first series
within two days, it will add common library module
libcxgb.ko.

In first series libcxgb.ko will have common
iSCSI DDP Page Pod Manager that will be shared
by three Chelsio iSCSI drivers
cxgb3i, cxgb4i, cxgbit.

In subsequent series I will add common connection
management and other hardware specific common code
in this module.
--
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/2] libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit

2016-07-06 Thread Tom Yan
I am so sorry. Now I hate acronym. v5 coming. :-)

On 7 July 2016 at 01:02, Sergei Shtylyov
 wrote:
> On 07/06/2016 07:44 PM, tom.t...@gmail.com wrote:
>
>> From: Tom Yan 
>>
>> Currently if a WRITE SAME (16) command is issued to the SATL with
>> "number of blocks" that is larger than the "Maximum write same length"
>> (which is the maximum number of blocks per TRIM command allowed in
>> libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
>> command and translate it to a TRIM command with the upper limit.
>>
>> However, according to SBC (as of sbc4r11.pdf), the "device server"
>> should terminate the command with "Invalid field in CBD" in that case.
>
>
>CDB again. :-)
>
>> Signed-off-by: Tom Yan 
>
> [...]
>
> MBR, Sergei
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 1/2] libata-scsi: reject WRITE SAME (16) with n_block that exceeds limit

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently if a WRITE SAME (16) command is issued to the SATL with
"number of blocks" that is larger than the "Maximum write same length"
(which is the maximum number of blocks per TRIM command allowed in
libata, currently 65535 * 512 / 8 blocks), the SATL will accept the
command and translate it to a TRIM command with the upper limit.

However, according to SBC (as of sbc4r11.pdf), the "device server"
should terminate the command with "Invalid field in CDB" in that case.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..a1f061a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3305,7 +3305,11 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
goto invalid_param_len;
 
buf = page_address(sg_page(scsi_sglist(scmd)));
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+
+   if (n_block <= 65535 * 512 / 8)
+   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   else
+   goto invalid_fld;
 
if (ata_ncq_enabled(dev) && ata_fpdma_dsm_supported(dev)) {
/* Newer devices support queued TRIM commands */
-- 
2.9.0

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


[PATCH v5 2/2] libata-scsi: avoid repeated calculation of number of TRIM ranges

2016-07-06 Thread tom . ty89
From: Tom Yan 

Currently libata statically allows only 1-block (512-byte) payload
for each TRIM command. Each payload can carry 64 TRIM ranges since
each range requires 8 bytes.

It is silly to keep doing the calculation (512 / 8) in different
places. Hence, define the new ATA_MAX_TRIM_RNUM for the result.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index a1f061a..82739be 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2314,7 +2314,7 @@ static unsigned int ata_scsiop_inq_b0(struct 
ata_scsi_args *args, u8 *rbuf)
 * with the unmap bit set.
 */
if (ata_id_has_trim(args->id)) {
-   put_unaligned_be64(65535 * 512 / 8, &rbuf[36]);
+   put_unaligned_be64(65535 * ATA_MAX_TRIM_RNUM, &rbuf[36]);
put_unaligned_be32(1, &rbuf[28]);
}
 
@@ -3306,8 +3306,8 @@ static unsigned int ata_scsi_write_same_xlat(struct 
ata_queued_cmd *qc)
 
buf = page_address(sg_page(scsi_sglist(scmd)));
 
-   if (n_block <= 65535 * 512 / 8)
-   size = ata_set_lba_range_entries(buf, 512, block, n_block);
+   if (n_block <= 65535 * ATA_MAX_TRIM_RNUM)
+   size = ata_set_lba_range_entries(buf, ATA_MAX_TRIM_RNUM, block, 
n_block);
else
goto invalid_fld;
 
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 99346be..ce59500 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -48,6 +48,7 @@ enum {
ATA_MAX_SECTORS_1024= 1024,
ATA_MAX_SECTORS_LBA48   = 65535,/* TODO: 65536? */
ATA_MAX_SECTORS_TAPE= 65535,
+   ATA_MAX_TRIM_RNUM   = 64,   /* 512-byte payload / (6-byte LBA + 
2-byte range per entry) */
 
ATA_ID_WORDS= 256,
ATA_ID_CONFIG   = 0,
@@ -1071,7 +1072,7 @@ static inline unsigned ata_set_lba_range_entries(void 
*_buffer,
__le64 *buffer = _buffer;
unsigned i = 0, used_bytes;
 
-   while (i < buf_size / 8 ) { /* 6-byte LBA + 2-byte range per entry */
+   while (i < buf_size) {
u64 entry = sector |
((u64)(count > 0x ? 0x : count) << 48);
buffer[i++] = __cpu_to_le64(entry);
-- 
2.9.0

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


Re: [PATCH resend 2/2] libata-scsi: correct cbd to CDB in comment

2016-07-06 Thread Tejun Heo
On Thu, Jul 07, 2016 at 01:13:09AM +0800, tom.t...@gmail.com wrote:
> From: Tom Yan 
> 
> It's Command Descriptor Block. Also capitalized it.
> 
> Signed-off-by: Tom Yan 

Applied to libata/for-4.8.

Thanks.

-- 
tejun
--
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 resend 1/2] libata-scsi: do not respond with "invalid field" for FORMAT UNIT

2016-07-06 Thread Tejun Heo
On Thu, Jul 07, 2016 at 01:13:08AM +0800, tom.t...@gmail.com wrote:
> From: Tom Yan 
> 
> It does not make sense and is confusing to respond with "Invalid
> field in CDB" while we have no support at all implemented for
> FORMAT UNIT. It is decent to let it go to the default, which
> will respond with "Invalid command operation code" instead.
> 
> Signed-off-by: Tom Yan 

Applied to libata/for-4.8.

Thanks.

-- 
tejun
--
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 00/21] lpfc: Update to revision 11.2.0.0

2016-07-06 Thread James Smart

This patch set updates the lpfc driver to revision 11.2.0.00

The patches were cut against scsi-misc

James Smart (21):
  Fix Transgression Flag of Optical Element descriptor for RDP on Linux
  Correct RDP response sizing issue
  Add recovery from adapter parity errors on some SLI4 adapters
  Correct Buffer credit descriptor values in RDP response
  Reject RDP ELS if port has no login
  Add sysfs proc_name support
  Add MDS Diagnostics Support
  Fix SLI mode 2 config failure
  Correct FCOE discovery to avoid loss of storage devices after system
reboot
  Re-organize source for easier device-id management
  Correct RDP response Revision location
  Add support for XLane LUN priority
  Correct Port reset resulting in FC port going offline
  Remove global lpfc_enable_npiv attribute in leiu of per-hba
lpfc_enable_npiv
  Remove global lpfc_delay_discovery attribute in leiu of per-hba
lpfc_delay_discovery
  Remove global lpfc_sli_mode attribute in leiu of per-hba lpfc_sli_mode
  Re-organize source for easier driver attribute management
  Correct issue with ioremap() call on 32bit kernel
  Disable FDMI probing if not connected to a fabric
  Copyright updates
  Update lpfc version to 11.2.0.0

 drivers/scsi/lpfc/lpfc.h |  27 +++-
 drivers/scsi/lpfc/lpfc_attr.c| 224 ++
 drivers/scsi/lpfc/lpfc_attr.h| 116 
 drivers/scsi/lpfc/lpfc_crtn.h|   7 +-
 drivers/scsi/lpfc/lpfc_ct.c  |   4 +
 drivers/scsi/lpfc/lpfc_els.c | 290 ++-
 drivers/scsi/lpfc/lpfc_hw.h  |  36 +++--
 drivers/scsi/lpfc/lpfc_hw4.h |  41 +-
 drivers/scsi/lpfc/lpfc_ids.h | 122 
 drivers/scsi/lpfc/lpfc_init.c| 277 ++---
 drivers/scsi/lpfc/lpfc_scsi.c|  14 +-
 drivers/scsi/lpfc/lpfc_scsi.h|   3 +-
 drivers/scsi/lpfc/lpfc_sli.c |  99 ++---
 drivers/scsi/lpfc/lpfc_sli.h |   3 +-
 drivers/scsi/lpfc/lpfc_sli4.h|   4 +-
 drivers/scsi/lpfc/lpfc_version.h |   2 +-
 16 files changed, 843 insertions(+), 426 deletions(-)
 create mode 100644 drivers/scsi/lpfc/lpfc_attr.h
 create mode 100644 drivers/scsi/lpfc/lpfc_ids.h

-- 
2.5.0

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


[PATCH 09/21] lpfc: Correct FCOE discovery to avoid loss of storage devices after system reboot

2016-07-06 Thread James Smart

Correct FCOE discovery to avoid loss of storage devices after system reboot

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index bb514d2..8d940ed 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4484,7 +4484,8 @@ lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
 * the corresponding FCF bit in the roundrobin bitmap.
 */
spin_lock_irq(&phba->hbalock);
-   if (phba->fcf.fcf_flag & FCF_DISCOVERY) {
+   if ((phba->fcf.fcf_flag & FCF_DISCOVERY) &&
+   (phba->fcf.current_rec.fcf_indx != acqe_fip->index)) {
spin_unlock_irq(&phba->hbalock);
/* Update FLOGI FCF failover eligible FCF bmask */
lpfc_sli4_fcf_rr_index_clear(phba, acqe_fip->index);
-- 
2.5.0

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


[PATCH 04/21] lpfc: Correct Buffer credit descriptor values in RDP response

2016-07-06 Thread James Smart

Correct Buffer credit descriptor values in RDP response

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_els.c | 74 +++-
 drivers/scsi/lpfc/lpfc_hw.h  |  2 +-
 2 files changed, 32 insertions(+), 44 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 0d05e1a..02e3a1f 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4719,17 +4719,20 @@ uint32_t
 lpfc_rdp_res_bbc_desc(struct fc_rdp_bbc_desc *desc, READ_LNK_VAR *stat,
  struct lpfc_vport *vport)
 {
+   uint32_t bbCredit;
+
desc->tag = cpu_to_be32(RDP_BBC_DESC_TAG);
 
-   desc->bbc_info.port_bbc = cpu_to_be32(
-   vport->fc_sparam.cmn.bbCreditMsb |
-   vport->fc_sparam.cmn.bbCreditlsb << 8);
-   if (vport->phba->fc_topology != LPFC_TOPOLOGY_LOOP)
-   desc->bbc_info.attached_port_bbc = cpu_to_be32(
-   vport->phba->fc_fabparam.cmn.bbCreditMsb |
-   vport->phba->fc_fabparam.cmn.bbCreditlsb << 8);
-   else
+   bbCredit = vport->fc_sparam.cmn.bbCreditLsb |
+   (vport->fc_sparam.cmn.bbCreditMsb << 8);
+   desc->bbc_info.port_bbc = cpu_to_be32(bbCredit);
+   if (vport->phba->fc_topology != LPFC_TOPOLOGY_LOOP) {
+   bbCredit = vport->phba->fc_fabparam.cmn.bbCreditLsb |
+   (vport->phba->fc_fabparam.cmn.bbCreditMsb << 8);
+   desc->bbc_info.attached_port_bbc = cpu_to_be32(bbCredit);
+   } else {
desc->bbc_info.attached_port_bbc = 0;
+   }
 
desc->bbc_info.rtt = 0;
desc->length = cpu_to_be32(sizeof(desc->bbc_info));
@@ -4745,13 +4748,10 @@ lpfc_rdp_res_oed_temp_desc(struct lpfc_hba *phba,
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
-   desc->oed_info.hi_alarm =
-   cpu_to_be16(page_a2[SSF_TEMP_HIGH_ALARM]);
-   desc->oed_info.lo_alarm = cpu_to_be16(page_a2[SSF_TEMP_LOW_ALARM]);
-   desc->oed_info.hi_warning =
-   cpu_to_be16(page_a2[SSF_TEMP_HIGH_WARNING]);
-   desc->oed_info.lo_warning =
-   cpu_to_be16(page_a2[SSF_TEMP_LOW_WARNING]);
+   desc->oed_info.hi_alarm = page_a2[SSF_TEMP_HIGH_ALARM];
+   desc->oed_info.lo_alarm = page_a2[SSF_TEMP_LOW_ALARM];
+   desc->oed_info.hi_warning = page_a2[SSF_TEMP_HIGH_WARNING];
+   desc->oed_info.lo_warning = page_a2[SSF_TEMP_LOW_WARNING];
 
if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH_TEMPERATURE)
flags |= RDP_OET_HIGH_ALARM;
@@ -4777,13 +4777,10 @@ lpfc_rdp_res_oed_voltage_desc(struct lpfc_hba *phba,
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
-   desc->oed_info.hi_alarm =
-   cpu_to_be16(page_a2[SSF_VOLTAGE_HIGH_ALARM]);
-   desc->oed_info.lo_alarm = cpu_to_be16(page_a2[SSF_VOLTAGE_LOW_ALARM]);
-   desc->oed_info.hi_warning =
-   cpu_to_be16(page_a2[SSF_VOLTAGE_HIGH_WARNING]);
-   desc->oed_info.lo_warning =
-   cpu_to_be16(page_a2[SSF_VOLTAGE_LOW_WARNING]);
+   desc->oed_info.hi_alarm = page_a2[SSF_VOLTAGE_HIGH_ALARM];
+   desc->oed_info.lo_alarm = page_a2[SSF_VOLTAGE_LOW_ALARM];
+   desc->oed_info.hi_warning = page_a2[SSF_VOLTAGE_HIGH_WARNING];
+   desc->oed_info.lo_warning = page_a2[SSF_VOLTAGE_LOW_WARNING];
 
if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH_VOLTAGE)
flags |= RDP_OET_HIGH_ALARM;
@@ -4809,13 +4806,10 @@ lpfc_rdp_res_oed_txbias_desc(struct lpfc_hba *phba,
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
-   desc->oed_info.hi_alarm =
-   cpu_to_be16(page_a2[SSF_BIAS_HIGH_ALARM]);
-   desc->oed_info.lo_alarm = cpu_to_be16(page_a2[SSF_BIAS_LOW_ALARM]);
-   desc->oed_info.hi_warning =
-   cpu_to_be16(page_a2[SSF_BIAS_HIGH_WARNING]);
-   desc->oed_info.lo_warning =
-   cpu_to_be16(page_a2[SSF_BIAS_LOW_WARNING]);
+   desc->oed_info.hi_alarm = page_a2[SSF_BIAS_HIGH_ALARM];
+   desc->oed_info.lo_alarm = page_a2[SSF_BIAS_LOW_ALARM];
+   desc->oed_info.hi_warning = page_a2[SSF_BIAS_HIGH_WARNING];
+   desc->oed_info.lo_warning = page_a2[SSF_BIAS_LOW_WARNING];
 
if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH_TXBIAS)
flags |= RDP_OET_HIGH_ALARM;
@@ -4841,13 +4835,10 @@ lpfc_rdp_res_oed_txpower_desc(struct lpfc_hba *phba,
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
-   desc->oed_info.hi_alarm =
-   cpu_to_be16(page_a2[SSF_TXPOWER_HIGH_ALARM]);
-   desc->oed_info.lo_alarm = cpu_to_be16(page_a2[SSF_TXPOWER_LOW_ALARM]);
-   desc->oed_info.hi_warning =
-   cpu_to_be16(page_a2[SSF_TXPOWER_HIGH_WARNING]);
-   desc->oed_info.lo_warning =
-   cpu_to_be16(p

[PATCH 16/21] lpfc: Remove global lpfc_sli_mode attribute in leiu of per-hba lpfc_sli_mode

2016-07-06 Thread James Smart

Remove global lpfc_sli_mode attribute in leiu of per-hba lpfc_sli_mode

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  |  1 +
 drivers/scsi/lpfc/lpfc_attr.c | 12 ++--
 drivers/scsi/lpfc/lpfc_crtn.h |  1 -
 drivers/scsi/lpfc/lpfc_sli.c  | 12 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 82d7b11..4d9f1b1 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -755,6 +755,7 @@ struct lpfc_hba {
uint32_t cfg_suppress_link_up;
uint32_t cfg_rrq_xri_bitmap_sz;
uint32_t cfg_delay_discovery;
+   uint32_t cfg_sli_mode;
 #define LPFC_INITIALIZE_LINK  0/* do normal init_link mbox */
 #define LPFC_DELAY_INIT_LINK  1/* layered driver hold off */
 #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2/* wait, manual intervention */
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index f5abcea..07d8033 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2837,12 +2837,11 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode 
control:"
 static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR,
   lpfc_poll_show, lpfc_poll_store);
 
-int  lpfc_sli_mode = 0;
-module_param(lpfc_sli_mode, int, S_IRUGO);
-MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
-" 0 - auto (SLI-3 if supported),"
-" 2 - select SLI-2 even on SLI-3 capable HBAs,"
-" 3 - select SLI-3");
+LPFC_ATTR(sli_mode, 0, 0, 3,
+   "SLI mode selector:"
+   " 0 - auto (SLI-3 if supported),"
+   " 2 - select SLI-2 even on SLI-3 capable HBAs,"
+   " 3 - select SLI-3");
 
 LPFC_ATTR_R(enable_npiv, 1, 0, 1,
"Enable NPIV functionality");
@@ -5936,6 +5935,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);
lpfc_iocb_cnt_init(phba, lpfc_iocb_cnt);
lpfc_delay_discovery_init(phba, lpfc_delay_discovery);
+   lpfc_sli_mode_init(phba, lpfc_sli_mode);
phba->cfg_enable_dss = 1;
lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags);
return;
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 9f075db..3a5a02e 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -359,7 +359,6 @@ extern struct scsi_host_template lpfc_template_s3;
 extern struct scsi_host_template lpfc_vport_template;
 extern struct fc_function_template lpfc_transport_functions;
 extern struct fc_function_template lpfc_vport_transport_functions;
-extern int lpfc_sli_mode;
 
 int  lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t);
 int  lpfc_vport_symbolic_port_name(struct lpfc_vport *, char *,size_t);
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 53ed6c5..c8fd0a3 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -4665,13 +4665,13 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
int  mode = 3, i;
int longs;
 
-   switch (lpfc_sli_mode) {
+   switch (phba->cfg_sli_mode) {
case 2:
if (phba->cfg_enable_npiv) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-   "1824 NPIV enabled: Override lpfc_sli_mode "
+   "1824 NPIV enabled: Override sli_mode "
"parameter (%d) to auto (0).\n",
-   lpfc_sli_mode);
+   phba->cfg_sli_mode);
break;
}
mode = 2;
@@ -4681,8 +4681,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
break;
default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-   "1819 Unrecognized lpfc_sli_mode "
-   "parameter: %d.\n", lpfc_sli_mode);
+   "1819 Unrecognized sli_mode parameter: %d.\n",
+   phba->cfg_sli_mode);
 
break;
}
@@ -4690,7 +4690,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
 
rc = lpfc_sli_config_port(phba, mode);
 
-   if (rc && lpfc_sli_mode == 3)
+   if (rc && phba->cfg_sli_mode == 3)
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
"1820 Unable to select SLI-3.  "
"Not supported by adapter.\n");
-- 
2.5.0

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


[PATCH 05/21] lpfc: Reject RDP ELS if port has no login

2016-07-06 Thread James Smart

Reject RDP ELS if port has no login

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_els.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 02e3a1f..861270e 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5243,6 +5243,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct 
lpfc_iocbq *cmdiocb,
 be32_to_cpu(rdp_req->nport_id_desc.nport_id),
 be32_to_cpu(rdp_req->nport_id_desc.length));
 
+   if (!(ndlp->nlp_flag & NLP_RPI_REGISTERED) &&
+   !phba->cfg_enable_SmartSAN) {
+   rjt_err = LSRJT_UNABLE_TPC;
+   rjt_expl = LSEXP_PORT_LOGIN_REQ;
+   goto error;
+   }
if (sizeof(struct fc_rdp_nport_desc) !=
be32_to_cpu(rdp_req->rdp_des_length))
goto rjt_logerr;
-- 
2.5.0

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


[PATCH 02/21] lpfc: Correct RDP response sizing issue

2016-07-06 Thread James Smart

Correct RDP response sizing issue

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_els.c | 113 ---
 drivers/scsi/lpfc/lpfc_hw.h  |  26 +++---
 2 files changed, 81 insertions(+), 58 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 300131a..0d05e1a 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4609,7 +4609,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport)
return sentplogi;
 }
 
-void
+uint32_t
 lpfc_rdp_res_link_service(struct fc_rdp_link_service_desc *desc,
uint32_t word0)
 {
@@ -4617,9 +4617,11 @@ lpfc_rdp_res_link_service(struct 
fc_rdp_link_service_desc *desc,
desc->tag = cpu_to_be32(RDP_LINK_SERVICE_DESC_TAG);
desc->payload.els_req = word0;
desc->length = cpu_to_be32(sizeof(desc->payload));
+
+   return sizeof(struct fc_rdp_link_service_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_sfp_desc(struct fc_rdp_sfp_desc *desc,
uint8_t *page_a0, uint8_t *page_a2)
 {
@@ -4680,9 +4682,11 @@ lpfc_rdp_res_sfp_desc(struct fc_rdp_sfp_desc *desc,
 
desc->sfp_info.flags = cpu_to_be16(flag);
desc->length = cpu_to_be32(sizeof(desc->sfp_info));
+
+   return sizeof(struct fc_rdp_sfp_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_link_error(struct fc_rdp_link_error_status_desc *desc,
READ_LNK_VAR *stat)
 {
@@ -4707,9 +4711,11 @@ lpfc_rdp_res_link_error(struct 
fc_rdp_link_error_status_desc *desc,
desc->info.link_status.invalid_crc_cnt = cpu_to_be32(stat->crcCnt);
 
desc->length = cpu_to_be32(sizeof(desc->info));
+
+   return sizeof(struct fc_rdp_link_error_status_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_bbc_desc(struct fc_rdp_bbc_desc *desc, READ_LNK_VAR *stat,
  struct lpfc_vport *vport)
 {
@@ -4727,9 +4733,11 @@ lpfc_rdp_res_bbc_desc(struct fc_rdp_bbc_desc *desc, 
READ_LNK_VAR *stat,
 
desc->bbc_info.rtt = 0;
desc->length = cpu_to_be32(sizeof(desc->bbc_info));
+
+   return sizeof(struct fc_rdp_bbc_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_oed_temp_desc(struct lpfc_hba *phba,
   struct fc_rdp_oed_sfp_desc *desc, uint8_t *page_a2)
 {
@@ -4757,9 +4765,10 @@ lpfc_rdp_res_oed_temp_desc(struct lpfc_hba *phba,
flags |= ((0xf & RDP_OED_TEMPERATURE) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
+   return sizeof(struct fc_rdp_oed_sfp_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_oed_voltage_desc(struct lpfc_hba *phba,
  struct fc_rdp_oed_sfp_desc *desc,
  uint8_t *page_a2)
@@ -4788,9 +4797,10 @@ lpfc_rdp_res_oed_voltage_desc(struct lpfc_hba *phba,
flags |= ((0xf & RDP_OED_VOLTAGE) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
+   return sizeof(struct fc_rdp_oed_sfp_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_oed_txbias_desc(struct lpfc_hba *phba,
 struct fc_rdp_oed_sfp_desc *desc,
 uint8_t *page_a2)
@@ -4819,9 +4829,10 @@ lpfc_rdp_res_oed_txbias_desc(struct lpfc_hba *phba,
flags |= ((0xf & RDP_OED_TXBIAS) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
+   return sizeof(struct fc_rdp_oed_sfp_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_oed_txpower_desc(struct lpfc_hba *phba,
  struct fc_rdp_oed_sfp_desc *desc,
  uint8_t *page_a2)
@@ -4850,10 +4861,11 @@ lpfc_rdp_res_oed_txpower_desc(struct lpfc_hba *phba,
flags |= ((0xf & RDP_OED_TXPOWER) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
+   return sizeof(struct fc_rdp_oed_sfp_desc);
 }
 
 
-void
+uint32_t
 lpfc_rdp_res_oed_rxpower_desc(struct lpfc_hba *phba,
  struct fc_rdp_oed_sfp_desc *desc,
  uint8_t *page_a2)
@@ -4882,9 +4894,10 @@ lpfc_rdp_res_oed_rxpower_desc(struct lpfc_hba *phba,
flags |= ((0xf & RDP_OED_RXPOWER) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
+   return sizeof(struct fc_rdp_oed_sfp_desc);
 }
 
-void
+uint32_t
 lpfc_rdp_res_opd_desc(struct fc_rdp_opd_sfp_desc *desc,
  uint8_t *page_a0, struct lpfc_vport *vport)
 {
@@ -4895,9 +4908,10 @@ lpfc_rdp_res_opd_desc(struct fc_rdp_opd_sfp_desc *desc,
memcpy(desc->opd_info.revision, &page_a0[SSF_VENDOR_REV], 2);
memcpy(desc->opd_info.date, &page_a0[SSF_DATE_CODE], 8);
desc->length = cpu_to_be32

[PATCH 01/21] lpfc: Fix Transgression Flag of Optical Element descriptor for RDP on Linux

2016-07-06 Thread James Smart

Fix Transgression Flag of Optical Element descriptor for RDP on Linux

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  |  12 +
 drivers/scsi/lpfc/lpfc_els.c  | 101 +-
 drivers/scsi/lpfc/lpfc_hw.h   |   6 +++
 drivers/scsi/lpfc/lpfc_hw4.h  |   6 +--
 drivers/scsi/lpfc/lpfc_init.c |   2 +
 5 files changed, 101 insertions(+), 26 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index d5bd420..c6ade9b 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -999,6 +999,18 @@ struct lpfc_hba {
spinlock_t devicelock;  /* lock for luns list */
mempool_t *device_data_mem_pool;
struct list_head luns;
+#define LPFC_TRANSGRESSION_HIGH_TEMPERATURE0x0080
+#define LPFC_TRANSGRESSION_LOW_TEMPERATURE 0x0040
+#define LPFC_TRANSGRESSION_HIGH_VOLTAGE0x0020
+#define LPFC_TRANSGRESSION_LOW_VOLTAGE 0x0010
+#define LPFC_TRANSGRESSION_HIGH_TXBIAS 0x0008
+#define LPFC_TRANSGRESSION_LOW_TXBIAS  0x0004
+#define LPFC_TRANSGRESSION_HIGH_TXPOWER0x0002
+#define LPFC_TRANSGRESSION_LOW_TXPOWER 0x0001
+#define LPFC_TRANSGRESSION_HIGH_RXPOWER0x8000
+#define LPFC_TRANSGRESSION_LOW_RXPOWER 0x4000
+   uint16_t sfp_alarm;
+   uint16_t sfp_warning;
 };
 
 static inline struct Scsi_Host *
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 0498f57..300131a 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4730,9 +4730,10 @@ lpfc_rdp_res_bbc_desc(struct fc_rdp_bbc_desc *desc, 
READ_LNK_VAR *stat,
 }
 
 void
-lpfc_rdp_res_oed_temp_desc(struct fc_rdp_oed_sfp_desc *desc, uint8_t *page_a2)
+lpfc_rdp_res_oed_temp_desc(struct lpfc_hba *phba,
+  struct fc_rdp_oed_sfp_desc *desc, uint8_t *page_a2)
 {
-   uint32_t flags;
+   uint32_t flags = 0;
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
@@ -4743,17 +4744,27 @@ lpfc_rdp_res_oed_temp_desc(struct fc_rdp_oed_sfp_desc 
*desc, uint8_t *page_a2)
cpu_to_be16(page_a2[SSF_TEMP_HIGH_WARNING]);
desc->oed_info.lo_warning =
cpu_to_be16(page_a2[SSF_TEMP_LOW_WARNING]);
-   flags = 0xf; /* All four are valid */
+
+   if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH_TEMPERATURE)
+   flags |= RDP_OET_HIGH_ALARM;
+   if (phba->sfp_alarm & LPFC_TRANSGRESSION_LOW_TEMPERATURE)
+   flags |= RDP_OET_LOW_ALARM;
+   if (phba->sfp_warning & LPFC_TRANSGRESSION_HIGH_TEMPERATURE)
+   flags |= RDP_OET_HIGH_WARNING;
+   if (phba->sfp_warning & LPFC_TRANSGRESSION_LOW_TEMPERATURE)
+   flags |= RDP_OET_LOW_WARNING;
+
flags |= ((0xf & RDP_OED_TEMPERATURE) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
 }
 
 void
-lpfc_rdp_res_oed_voltage_desc(struct fc_rdp_oed_sfp_desc *desc,
+lpfc_rdp_res_oed_voltage_desc(struct lpfc_hba *phba,
+ struct fc_rdp_oed_sfp_desc *desc,
  uint8_t *page_a2)
 {
-   uint32_t flags;
+   uint32_t flags = 0;
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
@@ -4764,17 +4775,27 @@ lpfc_rdp_res_oed_voltage_desc(struct 
fc_rdp_oed_sfp_desc *desc,
cpu_to_be16(page_a2[SSF_VOLTAGE_HIGH_WARNING]);
desc->oed_info.lo_warning =
cpu_to_be16(page_a2[SSF_VOLTAGE_LOW_WARNING]);
-   flags = 0xf; /* All four are valid */
+
+   if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH_VOLTAGE)
+   flags |= RDP_OET_HIGH_ALARM;
+   if (phba->sfp_alarm & LPFC_TRANSGRESSION_LOW_VOLTAGE)
+   flags |= RDP_OET_LOW_ALARM;
+   if (phba->sfp_warning & LPFC_TRANSGRESSION_HIGH_VOLTAGE)
+   flags |= RDP_OET_HIGH_WARNING;
+   if (phba->sfp_warning & LPFC_TRANSGRESSION_LOW_VOLTAGE)
+   flags |= RDP_OET_LOW_WARNING;
+
flags |= ((0xf & RDP_OED_VOLTAGE) << RDP_OED_TYPE_SHIFT);
desc->oed_info.function_flags = cpu_to_be32(flags);
desc->length = cpu_to_be32(sizeof(desc->oed_info));
 }
 
 void
-lpfc_rdp_res_oed_txbias_desc(struct fc_rdp_oed_sfp_desc *desc,
+lpfc_rdp_res_oed_txbias_desc(struct lpfc_hba *phba,
+struct fc_rdp_oed_sfp_desc *desc,
 uint8_t *page_a2)
 {
-   uint32_t flags;
+   uint32_t flags = 0;
 
desc->tag = cpu_to_be32(RDP_OED_DESC_TAG);
 
@@ -4785,17 +4806,27 @@ lpfc_rdp_res_oed_txbias_desc(struct fc_rdp_oed_sfp_desc 
*desc,
cpu_to_be16(page_a2[SSF_BIAS_HIGH_WARNING]);
desc->oed_info.lo_warning =
cpu_to_be16(page_a2[SSF_BIAS_LOW_WARNING]);
-   flags = 0xf; /* All four are valid */
+
+   if (phba->sfp_alarm & LPFC_TRANSGRESSION_HIGH

[PATCH 14/21] lpfc: Remove global lpfc_enable_npiv attribute in leiu of per-hba lpfc_enable_npiv

2016-07-06 Thread James Smart

Remove global lpfc_enable_npiv attribute in leiu of per-hba lpfc_enable_npiv

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_attr.c |  8 ++--
 drivers/scsi/lpfc/lpfc_crtn.h |  1 -
 drivers/scsi/lpfc/lpfc_init.c | 24 +---
 3 files changed, 11 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index a75404a..25d91a8 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2844,12 +2844,8 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
 " 3 - select SLI-3");
 
-int lpfc_enable_npiv = 1;
-module_param(lpfc_enable_npiv, int, S_IRUGO);
-MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality");
-lpfc_param_show(enable_npiv);
-lpfc_param_init(enable_npiv, 1, 0, 1);
-static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, lpfc_enable_npiv_show, NULL);
+LPFC_ATTR_R(enable_npiv, 1, 0, 1,
+   "Enable NPIV functionality");
 
 LPFC_ATTR_R(fcf_failover_policy, 1, 1, 2,
"FCF Fast failover=1 Priority failover=2");
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index bc0e2f1..b8a2ddc 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -360,7 +360,6 @@ extern struct scsi_host_template lpfc_vport_template;
 extern struct fc_function_template lpfc_transport_functions;
 extern struct fc_function_template lpfc_vport_transport_functions;
 extern int lpfc_sli_mode;
-extern int lpfc_enable_npiv;
 extern int lpfc_delay_discovery;
 
 int  lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t);
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index f4b3548..adf61b43 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -11441,21 +11441,17 @@ lpfc_init(void)
printk(KERN_ERR "Could not register lpfcmgmt device, "
"misc_register returned with status %d", error);
 
-   if (lpfc_enable_npiv) {
-   lpfc_transport_functions.vport_create = lpfc_vport_create;
-   lpfc_transport_functions.vport_delete = lpfc_vport_delete;
-   }
+   lpfc_transport_functions.vport_create = lpfc_vport_create;
+   lpfc_transport_functions.vport_delete = lpfc_vport_delete;
lpfc_transport_template =
fc_attach_transport(&lpfc_transport_functions);
if (lpfc_transport_template == NULL)
return -ENOMEM;
-   if (lpfc_enable_npiv) {
-   lpfc_vport_transport_template =
-   fc_attach_transport(&lpfc_vport_transport_functions);
-   if (lpfc_vport_transport_template == NULL) {
-   fc_release_transport(lpfc_transport_template);
-   return -ENOMEM;
-   }
+   lpfc_vport_transport_template =
+   fc_attach_transport(&lpfc_vport_transport_functions);
+   if (lpfc_vport_transport_template == NULL) {
+   fc_release_transport(lpfc_transport_template);
+   return -ENOMEM;
}
 
/* Initialize in case vector mapping is needed */
@@ -11467,8 +11463,7 @@ lpfc_init(void)
error = pci_register_driver(&lpfc_driver);
if (error) {
fc_release_transport(lpfc_transport_template);
-   if (lpfc_enable_npiv)
-   fc_release_transport(lpfc_vport_transport_template);
+   fc_release_transport(lpfc_vport_transport_template);
}
 
return error;
@@ -11487,8 +11482,7 @@ lpfc_exit(void)
misc_deregister(&lpfc_mgmt_dev);
pci_unregister_driver(&lpfc_driver);
fc_release_transport(lpfc_transport_template);
-   if (lpfc_enable_npiv)
-   fc_release_transport(lpfc_vport_transport_template);
+   fc_release_transport(lpfc_vport_transport_template);
if (_dump_buf_data) {
printk(KERN_ERR "9062 BLKGRD: freeing %lu pages for "
"_dump_buf_data at 0x%p\n",
-- 
2.5.0

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


[PATCH 13/21] lpfc: Correct Port reset resulting in FC port going offline

2016-07-06 Thread James Smart

Correct Port reset resulting in FC port going offline

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 6e11574..f4b3548 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1595,9 +1595,10 @@ lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int 
mbx_action,
 * ready before performing reset.
 */
rc = lpfc_sli4_pdev_status_reg_wait(phba);
-   if (!rc)
+   if (rc)
return rc;
}
+
/* need reset: attempt for port recovery */
if (en_rn_msg)
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-- 
2.5.0

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


[PATCH 03/21] lpfc: Add recovery from adapter parity errors on some SLI4 adapters

2016-07-06 Thread James Smart

Add recovery from adapter parity errors on some SLI4 adapters

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  |   2 +
 drivers/scsi/lpfc/lpfc_hw4.h  |  23 
 drivers/scsi/lpfc/lpfc_init.c | 118 +++---
 drivers/scsi/lpfc/lpfc_sli.c  |  45 ++--
 drivers/scsi/lpfc/lpfc_sli4.h |   2 +
 5 files changed, 155 insertions(+), 35 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index c6ade9b..64d6e33 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -647,6 +647,7 @@ struct lpfc_hba {
 #define HBA_RRQ_ACTIVE 0x4000 /* process the rrq active list */
 #define HBA_FCP_IOQ_FLUSH  0x8000 /* FCP I/O queues being flushed */
 #define HBA_FW_DUMP_OP 0x1 /* Skips fn reset before FW dump */
+#define HBA_RECOVERABLE_UE 0x2 /* Firmware supports recoverable UE */
uint32_t fcp_ring_in_use; /* When polling test if intr-hndlr active*/
struct lpfc_dmabuf slim2p;
 
@@ -827,6 +828,7 @@ struct lpfc_hba {
 
struct timer_list fcp_poll_timer;
struct timer_list eratt_poll;
+   uint32_t eratt_poll_interval;
 
/*
 * stat  counters
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 8a5e08d..8738b3d 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -544,6 +544,8 @@ struct lpfc_register {
uint32_t word0;
 };
 
+#define LPFC_PORT_SEM_UE_RECOVERABLE0xE000
+#define LPFC_PORT_SEM_MASK 0xF000
 /* The following BAR0 Registers apply to SLI4 if_type 0 UCNAs. */
 #define LPFC_UERR_STATUS_HI0x00A4
 #define LPFC_UERR_STATUS_LO0x00A0
@@ -937,6 +939,7 @@ struct mbox_header {
 #define LPFC_MBOX_OPCODE_READ_OBJECT_LIST  0xAD
 #define LPFC_MBOX_OPCODE_DELETE_OBJECT 0xAE
 #define LPFC_MBOX_OPCODE_GET_SLI4_PARAMETERS   0xB5
+#define LPFC_MBOX_OPCODE_SET_FEATURES   0xBF
 
 /* FCoE Opcodes */
 #define LPFC_MBOX_OPCODE_FCOE_WQ_CREATE0x01
@@ -2887,6 +2890,25 @@ struct lpfc_sli4_parameters {
 #define cfg_ext_embed_cb_WORD  word19
 };
 
+#define LPFC_SET_UE_RECOVERY0x10
+struct lpfc_mbx_set_feature {
+   struct mbox_header header;
+   uint32_t feature;
+   uint32_t param_len;
+   uint32_t word6;
+#define lpfc_mbx_set_feature_UER_SHIFT  0
+#define lpfc_mbx_set_feature_UER_MASK   0x0001
+#define lpfc_mbx_set_feature_UER_WORD   word6
+   uint32_t word7;
+#define lpfc_mbx_set_feature_UERP_SHIFT 0
+#define lpfc_mbx_set_feature_UERP_MASK  0x
+#define lpfc_mbx_set_feature_UERP_WORD  word7
+#define lpfc_mbx_set_feature_UESR_SHIFT 16
+#define lpfc_mbx_set_feature_UESR_MASK  0x
+#define lpfc_mbx_set_feature_UESR_WORD  word7
+};
+
+
 struct lpfc_mbx_get_sli4_parameters {
struct mbox_header header;
struct lpfc_sli4_parameters sli4_parameters;
@@ -3279,6 +3301,7 @@ struct lpfc_mqe {
struct lpfc_mbx_get_prof_cfg get_prof_cfg;
struct lpfc_mbx_wr_object wr_object;
struct lpfc_mbx_get_port_name get_port_name;
+   struct lpfc_mbx_set_feature  set_feature;
struct lpfc_mbx_memory_dump_type3 mem_dump_type3;
struct lpfc_mbx_nop nop;
} un;
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index bce73b4..f11e33e 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -568,7 +568,7 @@ lpfc_config_port_post(struct lpfc_hba *phba)
phba->last_completion_time = jiffies;
/* Set up error attention (ERATT) polling timer */
mod_timer(&phba->eratt_poll,
- jiffies + msecs_to_jiffies(1000 * LPFC_ERATT_POLL_INTERVAL));
+ jiffies + msecs_to_jiffies(1000 * phba->eratt_poll_interval));
 
if (phba->hba_flag & LINK_DISABLED) {
lpfc_printf_log(phba,
@@ -1587,35 +1587,38 @@ lpfc_sli4_port_sta_fn_reset(struct lpfc_hba *phba, int 
mbx_action,
int rc;
uint32_t intr_mode;
 
-   /*
-* On error status condition, driver need to wait for port
-* ready before performing reset.
-*/
-   rc = lpfc_sli4_pdev_status_reg_wait(phba);
-   if (!rc) {
-   /* need reset: attempt for port recovery */
-   if (en_rn_msg)
-   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-   "2887 Reset Needed: Attempting Port "
-   "Recovery...\n");
-   lpfc_offline_prep(phba, mbx_action);
-   lpfc_offline(phba);
-   /* release interrupt for possible resource change */
-   lpfc_sli4_disable_intr(phba);
-   lpfc_sli_brdrestart(phba);
-   /* request and enable interrupt */
-   intr_mode = lp

[PATCH 12/21] lpfc: Add support for XLane LUN priority

2016-07-06 Thread James Smart

Add support for XLane LUN priority

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  |  1 +
 drivers/scsi/lpfc/lpfc_attr.c | 89 +--
 drivers/scsi/lpfc/lpfc_crtn.h |  2 +-
 drivers/scsi/lpfc/lpfc_scsi.c |  9 -
 drivers/scsi/lpfc/lpfc_scsi.h |  1 +
 drivers/scsi/lpfc/lpfc_sli.c  | 21 +++---
 drivers/scsi/lpfc/lpfc_sli.h  |  1 +
 7 files changed, 104 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 69da16d..40e069c 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -743,6 +743,7 @@ struct lpfc_hba {
 #define OAS_FIND_ANY_VPORT 0x01
 #define OAS_FIND_ANY_TARGET0x02
 #define OAS_LUN_VALID  0x04
+   uint32_t cfg_oas_priority;
uint32_t cfg_XLanePriority;
uint32_t cfg_enable_bg;
uint32_t cfg_hostmem_hgp;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index cde7da6..a75404a 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2401,6 +2401,69 @@ static DEVICE_ATTR(lpfc_xlane_tgt, S_IRUGO | S_IWUSR,
   lpfc_oas_tgt_show, lpfc_oas_tgt_store);
 
 /**
+ * lpfc_oas_priority_show - Return wwpn of target whose luns maybe enabled for
+ *   Optimized Access Storage (OAS) operations.
+ * @dev: class device that is converted into a Scsi_host.
+ * @attr: device attribute, not used.
+ * @buf: buffer for passing information.
+ *
+ * Returns:
+ * value of count
+ **/
+static ssize_t
+lpfc_oas_priority_show(struct device *dev, struct device_attribute *attr,
+  char *buf)
+{
+   struct Scsi_Host *shost = class_to_shost(dev);
+   struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
+
+   return snprintf(buf, PAGE_SIZE, "%d\n", phba->cfg_oas_priority);
+}
+
+/**
+ * lpfc_oas_priority_store - Store wwpn of target whose luns maybe enabled for
+ *   Optimized Access Storage (OAS) operations.
+ * @dev: class device that is converted into a Scsi_host.
+ * @attr: device attribute, not used.
+ * @buf: buffer for passing information.
+ * @count: Size of the data buffer.
+ *
+ * Returns:
+ * -EINVAL count is invalid, invalid wwpn byte invalid
+ * -EPERM oas is not supported by hba
+ * value of count on success
+ **/
+static ssize_t
+lpfc_oas_priority_store(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   struct Scsi_Host *shost = class_to_shost(dev);
+   struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
+   unsigned int cnt = count;
+   unsigned long val;
+   int ret;
+
+   if (!phba->cfg_fof)
+   return -EPERM;
+
+   /* count may include a LF at end of string */
+   if (buf[cnt-1] == '\n')
+   cnt--;
+
+   ret = kstrtoul(buf, 0, &val);
+   if (ret || (val > 0x7f))
+   return -EINVAL;
+
+   if (val)
+   phba->cfg_oas_priority = (uint8_t)val;
+   else
+   phba->cfg_oas_priority = phba->cfg_XLanePriority;
+   return count;
+}
+static DEVICE_ATTR(lpfc_xlane_priority, S_IRUGO | S_IWUSR,
+  lpfc_oas_priority_show, lpfc_oas_priority_store);
+
+/**
  * lpfc_oas_vpt_show - Return wwpn of vport whose targets maybe enabled
  *   for Optimized Access Storage (OAS) operations.
  * @dev: class device that is converted into a Scsi_host.
@@ -2462,6 +2525,7 @@ lpfc_oas_vpt_store(struct device *dev, struct 
device_attribute *attr,
else
phba->cfg_oas_flags &= ~OAS_FIND_ANY_VPORT;
phba->cfg_oas_flags &= ~OAS_LUN_VALID;
+   phba->cfg_oas_priority = phba->cfg_XLanePriority;
phba->sli4_hba.oas_next_lun = FIND_FIRST_OAS_LUN;
return count;
 }
@@ -2524,7 +2588,6 @@ lpfc_oas_lun_state_store(struct device *dev, struct 
device_attribute *attr,
return -EINVAL;
 
phba->cfg_oas_lun_state = val;
-
return strlen(buf);
 }
 static DEVICE_ATTR(lpfc_xlane_lun_state, S_IRUGO | S_IWUSR,
@@ -2572,7 +2635,8 @@ static DEVICE_ATTR(lpfc_xlane_lun_status, S_IRUGO,
  */
 static size_t
 lpfc_oas_lun_state_set(struct lpfc_hba *phba, uint8_t vpt_wwpn[],
-  uint8_t tgt_wwpn[], uint64_t lun, uint32_t oas_state)
+  uint8_t tgt_wwpn[], uint64_t lun,
+  uint32_t oas_state, uint8_t pri)
 {
 
int rc = 0;
@@ -2582,7 +2646,8 @@ lpfc_oas_lun_state_set(struct lpfc_hba *phba, uint8_t 
vpt_wwpn[],
 
if (oas_state) {
if (!lpfc_enable_oas_lun(phba, (struct lpfc_name *)vpt_wwpn,
-(struct lpfc_name *)tgt_wwpn, lun))
+(struct lpfc_name *)tgt_wwpn,
+lun, pri))
rc = -ENOMEM;
} else {
lpfc_disable_oa

[PATCH 08/21] lpfc: Fix SLI mode 2 config failure

2016-07-06 Thread James Smart

Fix SLI mode 2 config failure

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_sli.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index 6eef972..b1ddbaa 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -4696,6 +4696,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
"Not supported by adapter.\n");
if (rc && mode != 2)
rc = lpfc_sli_config_port(phba, 2);
+   else if (rc && mode == 2)
+   rc = lpfc_sli_config_port(phba, 3);
if (rc)
goto lpfc_sli_hba_setup_error;
 
-- 
2.5.0

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


[PATCH 17/21] lpfc: Re-organize source for easier driver attribute management

2016-07-06 Thread James Smart

Re-organize source for easier driver attribute management

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_attr.c |  97 +--
 drivers/scsi/lpfc/lpfc_attr.h | 116 ++
 2 files changed, 117 insertions(+), 96 deletions(-)
 create mode 100644 drivers/scsi/lpfc/lpfc_attr.h

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 07d8033..6793df8 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -48,6 +48,7 @@
 #include "lpfc_compat.h"
 #include "lpfc_crtn.h"
 #include "lpfc_vport.h"
+#include "lpfc_attr.h"
 
 #define LPFC_DEF_DEVLOSS_TMO 30
 #define LPFC_MIN_DEVLOSS_TMO 1
@@ -1939,102 +1940,6 @@ lpfc_##attr##_store(struct device *dev, struct 
device_attribute *attr, \
 }
 
 
-#define LPFC_ATTR(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_param_init(name, defval, minval, maxval)
-
-#define LPFC_ATTR_R(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_param_show(name)\
-lpfc_param_init(name, defval, minval, maxval)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
-
-#define LPFC_ATTR_RW(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_param_show(name)\
-lpfc_param_init(name, defval, minval, maxval)\
-lpfc_param_set(name, defval, minval, maxval)\
-lpfc_param_store(name)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
-  lpfc_##name##_show, lpfc_##name##_store)
-
-#define LPFC_ATTR_HEX_R(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_param_hex_show(name)\
-lpfc_param_init(name, defval, minval, maxval)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
-
-#define LPFC_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_param_hex_show(name)\
-lpfc_param_init(name, defval, minval, maxval)\
-lpfc_param_set(name, defval, minval, maxval)\
-lpfc_param_store(name)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
-  lpfc_##name##_show, lpfc_##name##_store)
-
-#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_init(name, defval, minval, maxval)
-
-#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_show(name)\
-lpfc_vport_param_init(name, defval, minval, maxval)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
-
-#define LPFC_VPORT_ULL_ATTR_R(name, defval, minval, maxval, desc) \
-static uint64_t lpfc_##name = defval;\
-module_param(lpfc_##name, ullong, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_show(name)\
-lpfc_vport_param_init(name, defval, minval, maxval)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
-
-#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_show(name)\
-lpfc_vport_param_init(name, defval, minval, maxval)\
-lpfc_vport_param_set(name, defval, minval, maxval)\
-lpfc_vport_param_store(name)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
-  lpfc_##name##_show, lpfc_##name##_store)
-
-#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_hex_show(name)\
-lpfc_vport_param_init(name, defval, minval, maxval)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
-
-#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
-static uint lpfc_##name = defval;\
-module_param(lpfc_##name, uint, S_IRUGO);\
-MODULE_PARM_DESC(lpfc_##name, desc);\
-lpfc_vport_param_hex_show(name)\
-lpfc_vport_param_init(name, defval, minval, maxval)\
-lpfc_vport_param_set(name, defval, minval, maxval)\
-lpfc_vport_param_store(name)\
-static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
-  lpfc_##name##_show, lpfc_##name##_store)
-
 static DEVICE_ATTR(bg_info, S_IRUGO, lpfc_bg_info_show, NULL);
 static DEVICE_ATTR(bg_guard_err, S_IRUGO, lpfc_bg_guard_err_show, NULL);
 static DEVICE_ATTR(bg_apptag_err, S_IRUGO

[PATCH 19/21] lpfc: Disable FDMI probing if not connected to a fabric

2016-07-06 Thread James Smart

Disable FDMI probing if not connected to a fabric

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_ct.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index a38816e..63e48d4 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -1510,6 +1510,10 @@ lpfc_fdmi_num_disc_check(struct lpfc_vport *vport)
if (!lpfc_is_link_up(phba))
return;
 
+   /* Must be connected to a Fabric */
+   if (!(vport->fc_flag & FC_FABRIC))
+   return;
+
if (!(vport->fdmi_port_mask & LPFC_FDMI_PORT_ATTR_num_disc))
return;
 
-- 
2.5.0

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


[PATCH 21/21] lpfc: Update lpfc version to 11.2.0.0

2016-07-06 Thread James Smart

Update lpfc version to 11.2.0.0

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
index fa0d531..c9bf20e 100644
--- a/drivers/scsi/lpfc/lpfc_version.h
+++ b/drivers/scsi/lpfc/lpfc_version.h
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION "11.1.0.0."
+#define LPFC_DRIVER_VERSION "11.2.0.0."
 #define LPFC_DRIVER_NAME   "lpfc"
 
 /* Used for SLI 2/3 */
-- 
2.5.0

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


[PATCH 07/21] lpfc: Add MDS Diagnostics Support

2016-07-06 Thread James Smart

Add MDS Diagnostics Support

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  |  4 ++-
 drivers/scsi/lpfc/lpfc_attr.c | 10 +++
 drivers/scsi/lpfc/lpfc_els.c  |  7 +
 drivers/scsi/lpfc/lpfc_hw4.h  | 14 +-
 drivers/scsi/lpfc/lpfc_init.c | 28 +++
 drivers/scsi/lpfc/lpfc_sli.c  | 65 ---
 6 files changed, 103 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 64d6e33..69da16d 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -695,7 +695,8 @@ struct lpfc_hba {
uint8_t  wwnn[8];
uint8_t  wwpn[8];
uint32_t RandomData[7];
-   uint32_t fcp_embed_io;
+   uint8_t  fcp_embed_io;
+   uint8_t  mds_diags_support;
 
/* HBA Config Parameters */
uint32_t cfg_ack0;
@@ -760,6 +761,7 @@ struct lpfc_hba {
 #define LPFC_FDMI_NO_SUPPORT   0   /* FDMI not supported */
 #define LPFC_FDMI_SUPPORT  1   /* FDMI supported? */
uint32_t cfg_enable_SmartSAN;
+   uint32_t cfg_enable_mds_diags;
lpfc_vpd_t vpd; /* vital product data */
 
struct pci_dev *pcidev;
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index cfec2ec..cde7da6 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -4780,6 +4780,14 @@ LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT,
LPFC_DEFAULT_SG_SEG_CNT, LPFC_MAX_SG_SEG_CNT,
"Max Protection Scatter Gather Segment Count");
 
+/*
+ * lpfc_enable_mds_diags: Enable MDS Diagnostics
+ *   0  = MDS Diagnostics disabled (default)
+ *   1  = MDS Diagnostics enabled
+ * Value range is [0,1]. Default value is 0.
+ */
+LPFC_ATTR_R(enable_mds_diags, 0, 0, 1, "Enable MDS Diagnostics");
+
 struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_bg_info,
&dev_attr_bg_guard_err,
@@ -4876,6 +4884,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_lpfc_sriov_hw_max_virtfn,
&dev_attr_protocol,
&dev_attr_lpfc_xlane_supported,
+   &dev_attr_lpfc_enable_mds_diags,
NULL,
 };
 
@@ -5867,6 +5876,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);
lpfc_iocb_cnt_init(phba, lpfc_iocb_cnt);
phba->cfg_enable_dss = 1;
+   lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags);
return;
 }
 
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 861270e..5afbf4d 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -3299,6 +3299,12 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq 
*cmdiocb,
 FC_VPORT_FABRIC_REJ_WWN);
}
break;
+   case LSRJT_VENDOR_UNIQUE:
+   if ((stat.un.b.vendorUnique == 0x45) &&
+   (cmd == ELS_CMD_FLOGI)) {
+   goto out_retry;
+   }
+   break;
}
break;
 
@@ -3344,6 +3350,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq 
*cmdiocb,
if ((vport->load_flag & FC_UNLOADING) != 0)
retry = 0;
 
+out_retry:
if (retry) {
if ((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_FDISC)) {
/* Stop retrying PLOGI and FDISC if in FCF discovery */
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index 8738b3d..ee80227 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -2888,9 +2888,13 @@ struct lpfc_sli4_parameters {
 #define cfg_ext_embed_cb_SHIFT 0
 #define cfg_ext_embed_cb_MASK  0x0001
 #define cfg_ext_embed_cb_WORD  word19
+#define cfg_mds_diags_SHIFT1
+#define cfg_mds_diags_MASK 0x0001
+#define cfg_mds_diags_WORD word19
 };
 
-#define LPFC_SET_UE_RECOVERY0x10
+#define LPFC_SET_UE_RECOVERY   0x10
+#define LPFC_SET_MDS_DIAGS 0x11
 struct lpfc_mbx_set_feature {
struct mbox_header header;
uint32_t feature;
@@ -2899,6 +2903,12 @@ struct lpfc_mbx_set_feature {
 #define lpfc_mbx_set_feature_UER_SHIFT  0
 #define lpfc_mbx_set_feature_UER_MASK   0x0001
 #define lpfc_mbx_set_feature_UER_WORD   word6
+#define lpfc_mbx_set_feature_mds_SHIFT  0
+#define lpfc_mbx_set_feature_mds_MASK   0x0001
+#define lpfc_mbx_set_feature_mds_WORD   word6
+#define lpfc_mbx_set_feature_mds_deep_loopbk_SHIFT  1
+#define lpfc_mbx_set_feature_mds_deep_loopbk_MASK   0x0001
+#define lpfc_mbx_set_feature_mds_deep_loopbk_WORD   word6
uint32_t word7;
 #define lpfc_mbx_set_feature_UERP_SHIFT 0
 #define lpfc_mbx_set_feature_UERP_MASK  0x
@@ -3

[PATCH 18/21] lpfc: Correct issue with ioremap() call on 32bit kernel

2016-07-06 Thread James Smart

Correct issue with ioremap() call on 32bit kernel

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 4d9f1b1..b484859 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -785,9 +785,9 @@ struct lpfc_hba {
 
atomic_t fcp_qidx;  /* next work queue to post work to */
 
-   unsigned long pci_bar0_map; /* Physical address for PCI BAR0 */
-   unsigned long pci_bar1_map; /* Physical address for PCI BAR1 */
-   unsigned long pci_bar2_map; /* Physical address for PCI BAR2 */
+   phys_addr_t pci_bar0_map; /* Physical address for PCI BAR0 */
+   phys_addr_t pci_bar1_map; /* Physical address for PCI BAR1 */
+   phys_addr_t pci_bar2_map; /* Physical address for PCI BAR2 */
void __iomem *slim_memmap_p;/* Kernel memory mapped address for
   PCI BAR0 */
void __iomem *ctrl_regs_memmap_p;/* Kernel memory mapped address for
-- 
2.5.0

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


[PATCH 11/21] lpfc: Correct RDP response Revision location

2016-07-06 Thread James Smart

Correct RDP response Revision location

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_hw.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h
index c99c2b3..8226543 100644
--- a/drivers/scsi/lpfc/lpfc_hw.h
+++ b/drivers/scsi/lpfc/lpfc_hw.h
@@ -1239,8 +1239,8 @@ struct fc_rdp_opd_sfp_info {
uint8_tvendor_name[16];
uint8_tmodel_number[16];
uint8_tserial_number[16];
-   uint8_treserved[2];
uint8_trevision[2];
+   uint8_treserved[2];
uint8_tdate[8];
 };
 
-- 
2.5.0

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


[PATCH 10/21] lpfc: Re-organize source for easier device-id management

2016-07-06 Thread James Smart

Re-organize source for easier device-id management

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_ids.h  | 122 ++
 drivers/scsi/lpfc/lpfc_init.c | 101 +-
 2 files changed, 123 insertions(+), 100 deletions(-)
 create mode 100644 drivers/scsi/lpfc/lpfc_ids.h

diff --git a/drivers/scsi/lpfc/lpfc_ids.h b/drivers/scsi/lpfc/lpfc_ids.h
new file mode 100644
index 000..5733fea
--- /dev/null
+++ b/drivers/scsi/lpfc/lpfc_ids.h
@@ -0,0 +1,122 @@
+/***
+ * This file is part of the Emulex Linux Device Driver for *
+ * Fibre Channel Host Bus Adapters.*
+ * Copyright (C) 2004-2016 Emulex.  All rights reserved.   *
+ * EMULEX and SLI are trademarks of Emulex.*
+ * www.emulex.com  *
+ * Portions Copyright (C) 2004-2005 Christoph Hellwig  *
+ * *
+ * This program is free software; you can redistribute it and/or   *
+ * modify it under the terms of version 2 of the GNU General   *
+ * Public License as published by the Free Software Foundation.*
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND  *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE  *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package. *
+ ***/
+
+#include 
+
+const struct pci_device_id lpfc_id_table[] = {
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_VIPER,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_FIREFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_THOR,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PEGASUS,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_CENTAUR,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_DRAGONFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SUPERFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_RFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_SCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_DCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_SCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_DCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HORNET,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_SCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_DCSP,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZMID,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_TFLY,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP101,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP1S,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP11000S,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_MID,
+   PCI_ANY_ID, PCI_ANY_ID, },
+   {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_SAT_SMB,
+   PCI

[PATCH 20/21] lpfc: Copyright updates

2016-07-06 Thread James Smart

Copyright updates

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_crtn.h | 2 +-
 drivers/scsi/lpfc/lpfc_scsi.c | 2 +-
 drivers/scsi/lpfc/lpfc_scsi.h | 2 +-
 drivers/scsi/lpfc/lpfc_sli.h  | 2 +-
 drivers/scsi/lpfc/lpfc_sli4.h | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index 3a5a02e..bd7576d 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2015 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2016 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 3f33fd6..a5655d5 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2015 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2016 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * Portions Copyright (C) 2004-2005 Christoph Hellwig  *
diff --git a/drivers/scsi/lpfc/lpfc_scsi.h b/drivers/scsi/lpfc/lpfc_scsi.h
index 46c090b..8cb80da 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.h
+++ b/drivers/scsi/lpfc/lpfc_scsi.h
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2015 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2016 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h
index b33dbd3..74227a2 100644
--- a/drivers/scsi/lpfc/lpfc_sli.h
+++ b/drivers/scsi/lpfc/lpfc_sli.h
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2004-2015 Emulex.  All rights reserved.   *
+ * Copyright (C) 2004-2016 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
index 1f45723..0b88b570 100644
--- a/drivers/scsi/lpfc/lpfc_sli4.h
+++ b/drivers/scsi/lpfc/lpfc_sli4.h
@@ -1,7 +1,7 @@
 /***
  * This file is part of the Emulex Linux Device Driver for *
  * Fibre Channel Host Bus Adapters.*
- * Copyright (C) 2009-2015 Emulex.  All rights reserved.   *
+ * Copyright (C) 2009-2016 Emulex.  All rights reserved.   *
  * EMULEX and SLI are trademarks of Emulex.*
  * www.emulex.com  *
  * *
-- 
2.5.0

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


[PATCH 06/21] lpfc: Add sysfs proc_name support

2016-07-06 Thread James Smart

Add sysfs proc_name support

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc_scsi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 3bd0be6..12b8e82 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5886,6 +5886,7 @@ lpfc_disable_oas_lun(struct lpfc_hba *phba, struct 
lpfc_name *vport_wwpn,
 struct scsi_host_template lpfc_template_s3 = {
.module = THIS_MODULE,
.name   = LPFC_DRIVER_NAME,
+   .proc_name  = LPFC_DRIVER_NAME,
.info   = lpfc_info,
.queuecommand   = lpfc_queuecommand,
.eh_abort_handler   = lpfc_abort_handler,
@@ -5910,6 +5911,7 @@ struct scsi_host_template lpfc_template_s3 = {
 struct scsi_host_template lpfc_template = {
.module = THIS_MODULE,
.name   = LPFC_DRIVER_NAME,
+   .proc_name  = LPFC_DRIVER_NAME,
.info   = lpfc_info,
.queuecommand   = lpfc_queuecommand,
.eh_abort_handler   = lpfc_abort_handler,
@@ -5935,6 +5937,7 @@ struct scsi_host_template lpfc_template = {
 struct scsi_host_template lpfc_vport_template = {
.module = THIS_MODULE,
.name   = LPFC_DRIVER_NAME,
+   .proc_name  = LPFC_DRIVER_NAME,
.info   = lpfc_info,
.queuecommand   = lpfc_queuecommand,
.eh_abort_handler   = lpfc_abort_handler,
-- 
2.5.0

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


[PATCH 15/21] lpfc: Remove global lpfc_delay_discovery attribute in leiu of per-hba lpfc_delay_discovery

2016-07-06 Thread James Smart

Remove global lpfc_delay_discovery attribute in leiu of per-hba
lpfc_delay_discovery

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
 drivers/scsi/lpfc/lpfc.h  | 1 +
 drivers/scsi/lpfc/lpfc_attr.c | 8 +++-
 drivers/scsi/lpfc/lpfc_crtn.h | 1 -
 drivers/scsi/lpfc/lpfc_els.c  | 3 ++-
 4 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
index 40e069c..82d7b11 100644
--- a/drivers/scsi/lpfc/lpfc.h
+++ b/drivers/scsi/lpfc/lpfc.h
@@ -754,6 +754,7 @@ struct lpfc_hba {
uint32_t cfg_iocb_cnt;
uint32_t cfg_suppress_link_up;
uint32_t cfg_rrq_xri_bitmap_sz;
+   uint32_t cfg_delay_discovery;
 #define LPFC_INITIALIZE_LINK  0/* do normal init_link mbox */
 #define LPFC_DELAY_INIT_LINK  1/* layered driver hold off */
 #define LPFC_DELAY_INIT_LINK_INDEFINITELY 2/* wait, manual intervention */
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 25d91a8..f5abcea 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -4815,11 +4815,8 @@ MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard 
type");
  * accept and FCID/Fabric name/Fabric portname is changed.
  * Default value is 0.
  */
-int lpfc_delay_discovery;
-module_param(lpfc_delay_discovery, int, S_IRUGO);
-MODULE_PARM_DESC(lpfc_delay_discovery,
-   "Delay NPort discovery when Clean Address bit is cleared. "
-   "Allowed values: 0,1.");
+LPFC_ATTR(delay_discovery, 0, 0, 1,
+   "Delay NPort discovery when Clean Address bit is cleared.");
 
 /*
  * lpfc_sg_seg_cnt - Initial Maximum DMA Segment Count
@@ -5938,6 +5935,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_request_firmware_upgrade_init(phba, lpfc_req_fw_upgrade);
lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up);
lpfc_iocb_cnt_init(phba, lpfc_iocb_cnt);
+   lpfc_delay_discovery_init(phba, lpfc_delay_discovery);
phba->cfg_enable_dss = 1;
lpfc_enable_mds_diags_init(phba, lpfc_enable_mds_diags);
return;
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
index b8a2ddc..9f075db 100644
--- a/drivers/scsi/lpfc/lpfc_crtn.h
+++ b/drivers/scsi/lpfc/lpfc_crtn.h
@@ -360,7 +360,6 @@ extern struct scsi_host_template lpfc_vport_template;
 extern struct fc_function_template lpfc_transport_functions;
 extern struct fc_function_template lpfc_vport_transport_functions;
 extern int lpfc_sli_mode;
-extern int lpfc_delay_discovery;
 
 int  lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t);
 int  lpfc_vport_symbolic_port_name(struct lpfc_vport *, char *,size_t);
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 5afbf4d..c0af32f 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -594,6 +594,7 @@ static uint8_t
 lpfc_check_clean_addr_bit(struct lpfc_vport *vport,
struct serv_parm *sp)
 {
+   struct lpfc_hba *phba = vport->phba;
uint8_t fabric_param_changed = 0;
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
 
@@ -615,7 +616,7 @@ lpfc_check_clean_addr_bit(struct lpfc_vport *vport,
 * - lpfc_delay_discovery module parameter is set.
 */
if (fabric_param_changed && !sp->cmn.clean_address_bit &&
-   (vport->fc_prevDID || lpfc_delay_discovery)) {
+   (vport->fc_prevDID || phba->cfg_delay_discovery)) {
spin_lock_irq(shost->host_lock);
vport->fc_flag |= FC_DISC_DELAYED;
spin_unlock_irq(shost->host_lock);
-- 
2.5.0

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


[PATCH 1/2] libata-scsi: do not return designator for serial number

2016-07-06 Thread tom . ty89
From: Tom Yan 

SAT (as of sat4r05f.pdf) does not require this vendor specific
designator. Besides, we already have the Unit Serial Number VPD.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..9f478ad 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2210,14 +2210,6 @@ static unsigned int ata_scsiop_inq_83(struct 
ata_scsi_args *args, u8 *rbuf)
rbuf[1] = 0x83; /* this page code */
num = 4;
 
-   /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
-   rbuf[num + 0] = 2;
-   rbuf[num + 3] = ATA_ID_SERNO_LEN;
-   num += 4;
-   ata_id_string(args->id, (unsigned char *) rbuf + num,
- ATA_ID_SERNO, ATA_ID_SERNO_LEN);
-   num += ATA_ID_SERNO_LEN;
-
/* SAT defined lu model and serial numbers descriptor */
/* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
rbuf[num + 0] = 2;
-- 
2.9.0

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


[PATCH 2/2] libata-scsi: do not return t10 designator if drive has WWN

2016-07-06 Thread tom . ty89
From: Tom Yan 

SAT (as of sat4r05f.pdf) only requires the t10 designator if the
drive does not support/have WWN. Besides, we already have the ATA
information VPD.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 9f478ad..84b3d42 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2210,21 +2210,6 @@ static unsigned int ata_scsiop_inq_83(struct 
ata_scsi_args *args, u8 *rbuf)
rbuf[1] = 0x83; /* this page code */
num = 4;
 
-   /* SAT defined lu model and serial numbers descriptor */
-   /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
-   rbuf[num + 0] = 2;
-   rbuf[num + 1] = 1;
-   rbuf[num + 3] = sat_model_serial_desc_len;
-   num += 4;
-   memcpy(rbuf + num, "ATA ", 8);
-   num += 8;
-   ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD,
- ATA_ID_PROD_LEN);
-   num += ATA_ID_PROD_LEN;
-   ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO,
- ATA_ID_SERNO_LEN);
-   num += ATA_ID_SERNO_LEN;
-
if (ata_id_has_wwn(args->id)) {
/* SAT defined lu world wide name */
/* piv=0, assoc=lu, code_set=binary, designator=NAA */
@@ -2236,6 +2221,23 @@ static unsigned int ata_scsiop_inq_83(struct 
ata_scsi_args *args, u8 *rbuf)
  ATA_ID_WWN, ATA_ID_WWN_LEN);
num += ATA_ID_WWN_LEN;
}
+   else {
+   /* SAT defined lu model and serial numbers descriptor */
+   /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */
+   rbuf[num + 0] = 2;
+   rbuf[num + 1] = 1;
+   rbuf[num + 3] = sat_model_serial_desc_len;
+   num += 4;
+   memcpy(rbuf + num, "ATA ", 8);
+   num += 8;
+   ata_id_string(args->id, (unsigned char *) rbuf + num, 
ATA_ID_PROD,
+ ATA_ID_PROD_LEN);
+   num += ATA_ID_PROD_LEN;
+   ata_id_string(args->id, (unsigned char *) rbuf + num, 
ATA_ID_SERNO,
+ ATA_ID_SERNO_LEN);
+   num += ATA_ID_SERNO_LEN;
+   }
+
rbuf[3] = num - 4;/* page len (assume less than 256 bytes) */
return 0;
 }
-- 
2.9.0

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


Zpráva pro vás

2016-07-06 Thread Bertphl



Mam investicni zajem, pro ktere hledame vasi ucast jako prijemce. Odpoved
na e-mailu nize v pripade zajmu.
e-mail: pbrt...@gmail.com

--
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/2] libata-scsi: better style in ata_msense_caching()

2016-07-06 Thread tom . ty89
From: Tom Yan 

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bfec66f..e3f5751 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2424,10 +2424,12 @@ static void modecpy(u8 *dest, const u8 *src, int n, 
bool changeable)
 static unsigned int ata_msense_caching(u16 *id, u8 *buf, bool changeable)
 {
modecpy(buf, def_cache_mpage, sizeof(def_cache_mpage), changeable);
-   if (changeable || ata_id_wcache_enabled(id))
-   buf[2] |= (1 << 2); /* write cache enable */
-   if (!changeable && !ata_id_rahead_enabled(id))
-   buf[12] |= (1 << 5);/* disable read ahead */
+   if (changeable)
+   buf[2] |= (1 << 2); /* ata_mselect_caching() */
+   else {
+   buf[2] |= (ata_id_wcache_enabled(id) << 2); /* write cache 
enable */
+   buf[12] |= (!ata_id_rahead_enabled(id) << 5);   /* disable read 
ahead */
+   }
return sizeof(def_cache_mpage);
 }
 
-- 
2.9.0

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


[PATCH 1/2] libata-scsi: fix SET FEATURES "filtering" for ata_msense_caching()

2016-07-06 Thread tom . ty89
From: Tom Yan 

Without this fix, the DRA bit of the caching mode page would not
be updated when the read look-ahead feature is toggled (e.g. with
`smartctl --set`), but will only be until, for example, the write
cache feature is touched.

Signed-off-by: Tom Yan 

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 6be7770..077daf0 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -5127,7 +5127,9 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
switch (qc->tf.command) {
case ATA_CMD_SET_FEATURES:
if (qc->tf.feature != SETFEATURES_WC_ON &&
-   qc->tf.feature != SETFEATURES_WC_OFF)
+   qc->tf.feature != SETFEATURES_WC_OFF &&
+   qc->tf.feature != SETFEATURES_RA_ON &&
+   qc->tf.feature != SETFEATURES_RA_OFF)
break;
/* fall through */
case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 99346be..2d68793 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -409,6 +409,9 @@ enum {
SETFEATURES_WC_ON   = 0x02, /* Enable write cache */
SETFEATURES_WC_OFF  = 0x82, /* Disable write cache */
 
+   SETFEATURES_RA_ON   = 0xaa, /* Enable read look-ahead */
+   SETFEATURES_RA_OFF  = 0x55, /* Disable read look-ahead */
+
/* Enable/Disable Automatic Acoustic Management */
SETFEATURES_AAM_ON  = 0x42,
SETFEATURES_AAM_OFF = 0xC2,
-- 
2.9.0

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


Re: [Nouveau] [PATCH v2 0/7] lib: string: add functions to case-convert strings

2016-07-06 Thread Alexandre Courbot
On Wed, Jul 6, 2016 at 7:56 AM, Joe Perches  wrote:
> On Tue, 2016-07-05 at 15:36 -0700, Markus Mayer wrote:
>> On 5 July 2016 at 15:14, Joe Perches  wrote:
>> > On Tue, 2016-07-05 at 13:47 -0700, Markus Mayer wrote:
>> > > This series introduces a family of generic string case conversion
>> > > functions. This kind of functionality is needed in several places in
>> > > the kernel. Right now, everybody seems to be implementing their own
>> > > copy of this functionality.
>> > >
>> > > Based on the discussion of the previous version of this series[1] and
>> > > the use cases found in the kernel, it does look like having several
>> > > flavours of case conversion functions is beneficial. The use cases fall
>> > > into three categories:
>> > > - copying a string and converting the case while specifying a
>> > >   maximum length to mimic strncpy()
>> > > - copying a string and converting the case without specifying a
>> > >   length to mimic strcpy()
>> > > - converting the case of a string in-place (i.e. modifying the
>> > >   string that was passed in)
>> > >
>> > > Consequently, I am proposing these new functions:
>> > > char *strncpytoupper(char *dst, const char *src, size_t len);
>> > > char *strncpytolower(char *dst, const char *src, size_t len);
>> > > char *strcpytoupper(char *dst, const char *src);
>> > > char *strcpytolower(char *dst, const char *src);
>> > > char *strtoupper(char *s);
>> > > char *strtolower(char *s);
>> > I think there isn't much value in anything other
>> > than strto.
>> >
>> > Using str[n]cpy followed by strto is
>> > pretty obvious and rarely used anyway.
>> First time around, folks were proposing the "copy" variants when I
>> submitted just strtolower() by itself[1]. They just asked for source
>> and destination parameters to strtolower(), but looking at the use
>> cases that wouldn't have worked so well. Hence it evolved into these 6
>> functions.
>>
>> Here's a breakdown of how the functions are being used (patches 2-7),
>> see also [2]:
>>
>> Patch 2: strncpytolower()
>> Patch 3: strtolower()
>> Patch 4: strncpytolower() and strtolower()
>> Patch 5: strtolower()
>> Patch 6: strcpytoupper()
>> Patch 7: strcpytoupper()
>>
>> So it does look like the copy + change case variant is more frequently
>> used than just strto.
>
> Are these functions useful?   Not to me, not so much.
>
> None of the functions would have the strcpy performance of
> the arch / asm
> versions of strcpy and the savings in overall
> code isn't significant (or
> measured?).
>
> Of course none of the uses are runtime performance important.

I tend to agree. strcpy is better left to architecture-specific code
when it exists. Then doing a strcpy() followed by strtolower() is not
exactly unintuitive. An explosion of closely related function is
certainly more confusing to me.

I'd just keep strtolower()/strtoupper() because they are commonly done
operations and we can probably save some space by having a unique
implementation. But going beyond that is overthinking the problem
IMHO.
--
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