RE: [PATCH] megaraid:Make various functions static in megaraid_sas_fusion.c

2015-12-17 Thread Kashyap Desai
> -Original Message-
> From: Nicholas Krause [mailto:xerofo...@gmail.com]
> Sent: Monday, July 06, 2015 10:06 PM
> To: kashyap.de...@avagotech.com
> Cc: sumit.sax...@avagotech.com; uday.ling...@avagotech.com;
> jbottom...@odin.com; megaraidlinux@avagotech.com; linux-
> s...@vger.kernel.org; linux-ker...@vger.kernel.org
> Subject: [PATCH] megaraid:Make various functions static in
> megaraid_sas_fusion.c
>
> This makes various functions that have no external callers outside of
their
> definition/declaration in the file megaraid_sas_fusion.c to be properly
> declared as static functions now.
>
> Signed-off-by: Nicholas Krause 

Nicholas -

You posted patch with subject line "megaraid:Make the function
megasas_alloc_cmd_fusion static" for similar code changes.
Let's have consolidated patch for this and Avago can post it with next
change set (to keep git  commit clean without any failure)

Just to be clear - You can send us patch and we can add with Submitted by
your name as signature. For now NACK.

` Kashyap
--
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] megaraid:Make the function megasas_alloc_cmd_fusion static

2015-12-17 Thread Kashyap Desai
> -int
> +static int
>  megasas_alloc_cmds_fusion(struct megasas_instance *instance)  {
>   int i, j, count;

Good catch.  Let's not include patch to avoid further confusion on series
of acked patch which are not making significant functional difference.
NACK as not making any functional difference. We can make many more such
changes in one shot and let's address those later as we have few patches
ready to send in few days.


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


Reviews, please

2015-12-17 Thread Martin K. Petersen

There are not a whole lot of working days left before the 4.5 merge
window opens...


Driver updates needing full reviews:

https://patchwork.kernel.org/bundle/mkp/be2iscsi/
https://patchwork.kernel.org/bundle/mkp/qla2xxx/


lpfc looks to be in decent shape but another set of eyes wouldn't hurt:

https://patchwork.kernel.org/bundle/mkp/lpfc/


Doug Gilbert, maybe you could take a look at this series since it mainly
touches your code?

https://patchwork.kernel.org/bundle/mkp/constants/


hpsa 2/3 and 3/3 needs a non-PMCS review:

https://patchwork.kernel.org/bundle/mkp/hpsa/


cxlflash needs a non-IBM review:

https://patchwork.kernel.org/bundle/mkp/cxlflash/


storvsc patch 2/4 is missing a review. Johannes, you reviewed the rest
of this series. Care to take a look?

https://patchwork.kernel.org/bundle/mkp/storvsc/


This mvsas GPIO patch hasn't gotten any attention. Would be sad to drop
a sizable patch adding new functionality:

https://patchwork.kernel.org/patch/7610411/


Ewan's /proc/scsi/scsi iterator fixes need comments:

https://patchwork.kernel.org/bundle/mkp/bus_device/


Hannes' ALUA follow-up series is only partially reviewed. I'll review
the patches I haven't done already. But I would like another set of eyes
on these:

https://patchwork.kernel.org/bundle/mkp/alua/


I dropped everything that's been sitting for more than a month. There
are still a bunch of trivial fixes on the list that would be nice to get
either acked or nacked:

https://patchwork.kernel.org/project/linux-scsi/list/

Thank you!

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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 16/17] lpfc: Use kzalloc instead of kmalloc

2015-12-17 Thread Sebastian Herbszt
James Smart wrote:
> From: Punit Vara 
> 
> This patch is to the lpfc_els.c which resolves following warning
> reported by coccicheck:
> 
> WARNING: kzalloc should be used for rdp_context, instead of
> kmalloc/memset
> 
> Signed-off-by: Punit Vara 
> Signed-off-by: James Smart 

You missed the two already available positive reviews [1][2].

Anyway,

Reviewed-by: Sebastian Herbszt 

[1] http://marc.info/?l=linux-scsi&m=144574360607327&w=2
[2] http://marc.info/?l=linux-scsi&m=144823385015994&w=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


Re: [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy"

2015-12-17 Thread Sebastian Herbszt
James Smart wrote:
> From: Markus Elfring 
> 
> The mempool_destroy() function tests whether its argument is NULL
> and then returns immediately. Thus the test around the calls is not needed.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring 
> Signed-off-by: James Smart 

Reviewed-by: Sebastian Herbszt 
--
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 5/6] cxlflash: Resolve oops in wait_port_offline

2015-12-17 Thread Uma Krishnan

On 12/10/2015 4:54 PM, Uma Krishnan wrote:

From: Manoj Kumar 

If an async error interrupt is generated, and the error requires the FC
link to be reset, it cannot be performed in the interrupt context. So
a work element is scheduled to complete the link reset in a process
context. If either an EEH event or an escalation occurs in between
when the interrupt is generated and the scheduled work is started, the
MMIO space may no longer be available. This will cause an oops in the
worker thread.

[  606.806583] NIP kthread_data+0x28/0x40
[  606.806633] LR wq_worker_sleeping+0x30/0x100
[  606.806694] Call Trace:
[  606.806721] 0x50 (unreliable)
[  606.806796] wq_worker_sleeping+0x30/0x100
[  606.806884] __schedule+0x69c/0x8a0
[  606.806959] schedule+0x44/0xc0
[  606.807034] do_exit+0x770/0xb90
[  606.807109] die+0x300/0x460
[  606.807185] bad_page_fault+0xd8/0x150
[  606.807259] handle_page_fault+0x2c/0x30
[  606.807338] wait_port_offline.constprop.12+0x60/0x130 [cxlflash]

To prevent the problem space area from being unmapped, when there is
pending work, a mapcount (using the kref mechanism) is held.  The mapcount
is released only when the work is completed.  The last reference release
is tied to the unmapping service.

Signed-off-by: Manoj N. Kumar 
---


Reviewed-by: Uma Krishnan 

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

2015-12-17 Thread Julian Calaby
Hi Joao,

On Fri, Dec 18, 2015 at 3:04 AM, Joao Pinto  wrote:
> Hi,
> I have a patch ready to send which contains a new UFS driver, but the problem 
> is
> that the patch size is ~200K and my company' email security blocks it.
> Is it possible to send the driver in a tarball?

The usual practise in this case is to split it into patches per file
(I assume it's broken down into a few separate files to implement
different bits of functionality) sending the bits that link it into
the build system (Kconfig and Makefiles) last.

Alternatively, if you have a non-work account, you could send it
through that with appropriate From headers at the top of the email.

Thanks,

-- 
Julian Calaby

Email: julian.cal...@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
--
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 2/6] cxlflash: Fix to avoid virtual LUN failover failure

2015-12-17 Thread Uma Krishnan

On 12/10/2015 4:53 PM, Uma Krishnan wrote:

From: "Matthew R. Ochs" 

Applications which use virtual LUN's that are backed by a physical LUN
over both adapter ports may experience an I/O failure in the event of
a link loss (e.g. cable pull).

Virtual LUNs may be accessed through one or both ports of the adapter.
This access is encoded in the translation entries that comprise the
virtual LUN and used by the AFU for load-balancing I/O and handling
failover scenarios. In a link loss scenario, even though the AFU is
able to maintain connectivity to the LUN, it is up to the application
to retry the failed I/O. When applications are unaware of the virtual
LUN's underlying topology, they are unable to make a sound decision of
when to retry an I/O and therefore are forced to make their reaction to
a failed I/O absolute. The result is either a failure to retry I/O or
increased latency for scenarios where a retry is pointless.

To remedy this scenario, provide feedback back to the application on
virtual LUN creation as to which ports the LUN may be accessed. LUN's
spanning both ports are candidates for a retry in a presence of an I/O
failure.

Signed-off-by: Matthew R. Ochs 
---


Reviewed-by: Uma Krishnan 

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


NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! [kworker/1:1:29]

2015-12-17 Thread Sebastian Herbszt
I got the following lockup on openSUSEs 4.4.0-rc5-2.g1e923a3-default kernel
while unloading the lpfc module:

[  444.088002] NMI watchdog: BUG: soft lockup - CPU#1 stuck for 22s! 
[kworker/1:1:29]
[  444.088002] Modules linked in: lpfc(-) qla2x00tgt(O) qla2xxx_scst(O) 
scst_vdisk(O) scsi_transport_fc libcrc32c scst(O) dlm configfs nfsd lockd grace 
nfs_acl auth_rpcgss sunrpc ed
d snd_pcm_oss snd_mixer_oss snd_seq snd_seq_device dm_mod iTCO_wdt 
snd_hda_codec_realtek snd_hda_codec_generic gpio_ich iTCO_vendor_support ppdev 
snd_hda_intel snd_hda_codec snd_hda
_core snd_hwdep tg3 snd_pcm snd_timer libphy lpc_ich parport_pc ptp 
acpi_cpufreq snd pps_core fjes parport i2c_i801 ehci_pci tpm_tis tpm sr_mod 
cdrom soundcore floppy hwmon sg 8250_
fintek pcspkr i915 drm_kms_helper uhci_hcd ehci_hcd drm fb_sys_fops sysimgblt 
sysfillrect syscopyarea i2c_algo_bit usbcore button video usb_common fan 
ata_generic ata_piix libata th
ermal
[  444.088002] CPU: 1 PID: 29 Comm: kworker/1:1 Tainted: G   O
4.4.0-rc5-2.g1e923a3-default #1
[  444.088002] Hardware name: FUJITSU SIEMENS ESPRIMO E   /D2164-A1, 
BIOS 5.00 R1.10.2164.A1   05/08/2006
[  444.088002] Workqueue: fc_wq_4 fc_rport_final_delete [scsi_transport_fc]
[  444.088002] task: f6266ec0 ti: f6268000 task.ti: f6268000
[  444.088002] EIP: 0060:[] EFLAGS: 0286 CPU: 1
[  444.088002] EIP is at _raw_spin_unlock_irqrestore+0x14/0x20
[  444.088002] EAX: 0286 EBX: f20d3800 ECX: 0002 EDX: 0286
[  444.088002] ESI: f50ba800 EDI: f2146848 EBP: f6269ec8 ESP: f6269ec8
[  444.088002]  DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
[  444.088002] CR0: 8005003b CR2: 08f96600 CR3: 363ae000 CR4: 06d0
[  444.088002] Stack:
[  444.088002]  f6269eec c066b0f7 0286 f2146848 f50ba808 f50ba800 f50ba800 
f2146a90
[  444.088002]  f2146848 f6269f08 f8f0a4ed f3141000 f2146800 f2146a90 f619fa00 
0040
[  444.088002]  f6269f40 c026cb25 0001 166c6392 0061 f6757140 f6136340 
0004
[  444.088002] Call Trace:
[  444.088002]  [] scsi_remove_target+0x167/0x1c0
[  444.088002]  [] fc_rport_final_delete+0x9d/0x1e0 
[scsi_transport_fc]
[  444.088002]  [] process_one_work+0x155/0x3e0
[  444.088002]  [] worker_thread+0x37/0x490
[  444.088002]  [] kthread+0x9b/0xb0
[  444.088002]  [] ret_from_kernel_thread+0x21/0x40
[  444.088002] DWARF2 unwinder stuck at ret_from_kernel_thread+0x21/0x40
[  444.088002]
[  444.088002] Leftover inexact backtrace:
[  444.088002]  [] ? kthread_park+0x50/0x50
[  444.088002] Code: c8 e8 41 7f ab ff 89 d8 5b 5d c3 8d b6 00 00 00 00 8d bf 
00 00 00 00 55 89 e5 3e 8d 74 26 00 0f ae f0 89 f6 c6 00 00 89 d0 50 9d <8d> 74 
26 00 5d c3 8d b6 00 00 00 00 55 89 e5 3e 8d 74 26 00 0f
[  444.088002] Kernel panic - not syncing: softlockup: hung tasks
[  444.088002] CPU: 1 PID: 29 Comm: kworker/1:1 Tainted: G   O L  
4.4.0-rc5-2.g1e923a3-default #1
[  444.088002] Hardware name: FUJITSU SIEMENS ESPRIMO E   /D2164-A1, 
BIOS 5.00 R1.10.2164.A1   05/08/2006
[  444.088002] Workqueue: fc_wq_4 fc_rport_final_delete [scsi_transport_fc]
[  444.088002]    f6269da4 c0518e08 0016 f6269dbc c034faa0 
f6266ec0
[  444.088002]  0016 f6266ec0  f6269df0 c0303f54 c09a6589 0001 
0016
[  444.088002]  f62672ac 001d f6269e8c  0187 f67506c0 f6750700 
f6750a60
[  444.088002] Call Trace:
[  444.088002]  [] try_stack_unwind+0x132/0x140
[  444.088002]  [] dump_trace+0x54/0x200
[  444.088002]  [] show_trace_log_lvl+0x46/0x50
[  444.088002]  [] show_stack_log_lvl+0xcb/0x110
[  444.088002]  [] show_stack+0x26/0x50
[  444.088002]  [] dump_stack+0x41/0x59
[  444.088002]  [] panic+0x81/0x1b4
[  444.088002]  [] watchdog_timer_fn+0x1e4/0x1f0
[  444.088002]  [] __hrtimer_run_queues+0xc0/0x240
[  444.088002]  [] hrtimer_interrupt+0x8a/0x190
[  444.088002]  [] local_apic_timer_interrupt+0x32/0x60
[  444.088002]  [] smp_apic_timer_interrupt+0x33/0x50
[  444.088002]  [] apic_timer_interrupt+0x34/0x40
[  444.088002] DWARF2 unwinder stuck at apic_timer_interrupt+0x34/0x40
[  444.088002]
[  444.088002] Leftover inexact backtrace:
[  444.088002]  [] ? mipi_dsi_host_register+0x30/0x1d0
[  444.088002]  [] ? _raw_spin_unlock_irqrestore+0x14/0x20
[  444.088002]  [] scsi_remove_target+0x167/0x1c0
[  444.088002]  [] fc_rport_final_delete+0x9d/0x1e0 
[scsi_transport_fc]
[  444.088002]  [] process_one_work+0x155/0x3e0
[  444.088002]  [] worker_thread+0x37/0x490
[  444.088002]  [] ? process_one_work+0x3e0/0x3e0
[  444.088002]  [] kthread+0x9b/0xb0
[  444.088002]  [] ret_from_kernel_thread+0x21/0x40
[  444.088002]  [] ? kthread_park+0x50/0x50

Sebastian
--
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 1/6] cxlflash: Fix to escalate LINK_RESET also on port 1

2015-12-17 Thread Uma Krishnan

On 12/14/2015 11:30 AM, Matthew R. Ochs wrote:

Acked-by: Matthew R. Ochs 



Reviewed-by: Uma Krishnan 

--
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 06/16] qla2xxx: Delete session if initiator is gone from FW

2015-12-17 Thread Himanshu Madhani
From: Alexei Potashnik 

1. Initiator A is logged in with fc_id(1)/loop_id(1)
2. Initiator A re-logs in with fc_id(2)/loop_id(2)
3. Part of old session deletion async logoout for 1/1 is queued
4. Initiator B logs in with fc_id(1)/loop_id(1), starts
   passing data and creates session.
5. Async logo from 3 is processed by DPC and sent to FW

Now initiator B has the session but is logged out from FW.

This condition is detected first with CTIO error 29 at which
point we should delete current session. During session
deletion we will send LOGO to initiator to force re-login.

Under rare circumstances initiator might be logged out of FW,
not have driver session, but still think it's logged in.
E.g. the above sequence plus session deletion due to re-config.
Incoming commands will fail to create local session because
initiator is not found in FW. In this case we also issue LOGO
to initiator to force him re-login.

Finally this patch fixes exchange leak when commands where
received in logged out state. In this case loop_id must be
set to  when corresponding exchange is terminated. The
patch modifies exchange termination to always use ,
since in certain scenarios it's impossible to tell whether
command was received in logged in or logged out state.

Signed-off-by: Alexei Potashnik 
Acked-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/qla2xxx/qla_def.h|2 +
 drivers/scsi/qla2xxx/qla_os.c |1 +
 drivers/scsi/qla2xxx/qla_target.c |  108 +++--
 drivers/scsi/qla2xxx/qla_target.h |9 +++
 4 files changed, 104 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 83d2251..495a0aa 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3652,6 +3652,8 @@ typedef struct scsi_qla_host {
atomic_tgeneration_tick;
/* Time when global fcport update has been scheduled */
int total_fcport_update_gen;
+   /* List of pending LOGOs, protected by tgt_mutex */
+   struct list_headlogo_list;
 
uint32_tvp_abort_cnt;
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2e62d9c..416b45c 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3920,6 +3920,7 @@ struct scsi_qla_host *qla2x00_create_host(struct 
scsi_host_template *sht,
INIT_LIST_HEAD(&vha->list);
INIT_LIST_HEAD(&vha->qla_cmd_list);
INIT_LIST_HEAD(&vha->qla_sess_op_cmd_list);
+   INIT_LIST_HEAD(&vha->logo_list);
 
spin_lock_init(&vha->work_lock);
spin_lock_init(&vha->cmd_list_lock);
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 661124a..5ef9d4c 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -389,6 +389,52 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, 
response_t *pkt)
 
 }
 
+typedef struct {
+   /* These fields must be initialized by the caller */
+   port_id_t id;
+   /*
+* number of cmds dropped while we were waiting for
+* initiator to ack LOGO initialize to 1 if LOGO is
+* triggered by a command, otherwise, to 0
+*/
+   int cmd_count;
+
+   /* These fields are used by callee */
+   struct list_head list;
+} qlt_port_logo_t;
+
+static void
+qlt_send_first_logo(struct scsi_qla_host *vha, qlt_port_logo_t *logo)
+{
+   qlt_port_logo_t *tmp;
+   int res;
+
+   mutex_lock(&vha->vha_tgt.tgt_mutex);
+
+   list_for_each_entry(tmp, &vha->logo_list, list) {
+   if (tmp->id.b24 == logo->id.b24) {
+   tmp->cmd_count += logo->cmd_count;
+   mutex_unlock(&vha->vha_tgt.tgt_mutex);
+   return;
+   }
+   }
+
+   list_add_tail(&logo->list, &vha->logo_list);
+
+   mutex_unlock(&vha->vha_tgt.tgt_mutex);
+
+   res = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, logo->id);
+
+   mutex_lock(&vha->vha_tgt.tgt_mutex);
+   list_del(&logo->list);
+   mutex_unlock(&vha->vha_tgt.tgt_mutex);
+
+   dev_info(&vha->hw->pdev->dev,
+"Finished LOGO to %02x:%02x:%02x, dropped %d cmds, res = 
%#x\n",
+logo->id.b.domain, logo->id.b.area, logo->id.b.al_pa,
+logo->cmd_count, res);
+}
+
 static void qlt_free_session_done(struct work_struct *work)
 {
struct qla_tgt_sess *sess = container_of(work, struct qla_tgt_sess,
@@ -402,14 +448,21 @@ static void qlt_free_session_done(struct work_struct 
*work)
 
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf084,
"%s: se_sess %p / sess %p from port %8phC loop_id %#04x"
-   " s_id %02x:%02x:%02x logout %d keep %d plogi %d\n",
+   " s_id %02x:%02x:%02x logout %d keep %d plogi %d els_logo %d\n",
__func__, sess->se_se

[PATCH v2 08/16] qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit.

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

Replace QLA_TGT_STATE_ABORTED state with a bit because
the current state of the command is lost when an abort
is requested by upper layer.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/qla2xxx/qla_target.c |   23 ++-
 drivers/scsi/qla2xxx/qla_target.h |3 ++-
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 2b218b6..104d129 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1469,7 +1469,7 @@ static int abort_cmd_for_tag(struct scsi_qla_host *vha, 
uint32_t tag)
 
list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) {
if (tag == cmd->atio.u.isp24.exchange_addr) {
-   cmd->state = QLA_TGT_STATE_ABORTED;
+   cmd->aborted = 1;
spin_unlock(&vha->cmd_list_lock);
return 1;
}
@@ -1511,7 +1511,7 @@ static void abort_cmds_for_lun(struct scsi_qla_host *vha,
cmd_lun = scsilun_to_int(
(struct scsi_lun *)&cmd->atio.u.isp24.fcp_cmnd.lun);
if (cmd_key == key && cmd_lun == lun)
-   cmd->state = QLA_TGT_STATE_ABORTED;
+   cmd->aborted = 1;
}
spin_unlock(&vha->cmd_list_lock);
 }
@@ -3175,7 +3175,7 @@ static void qlt_send_term_exchange(struct scsi_qla_host 
*vha,
qlt_alloc_qfull_cmd(vha, atio, 0, 0);
 
 done:
-   if (cmd && ((cmd->state != QLA_TGT_STATE_ABORTED) ||
+   if (cmd && (!cmd->aborted ||
!cmd->cmd_sent_to_fw)) {
if (cmd->sg_mapped)
qlt_unmap_sg(vha, cmd);
@@ -3246,7 +3246,7 @@ void qlt_abort_cmd(struct qla_tgt_cmd *cmd)
"(se_cmd=%p, tag=%llu)", vha->vp_idx, cmd, &cmd->se_cmd,
se_cmd->tag);
 
-   cmd->state = QLA_TGT_STATE_ABORTED;
+   cmd->aborted = 1;
cmd->cmd_flags |= BIT_6;
 
qlt_send_term_exchange(vha, cmd, &cmd->atio, 0);
@@ -3466,9 +3466,6 @@ qlt_abort_cmd_on_host_reset(struct scsi_qla_host *vha, 
struct qla_tgt_cmd *cmd)
 
ha->tgt.tgt_ops->handle_data(cmd);
return;
-   } else if (cmd->state == QLA_TGT_STATE_ABORTED) {
-   ql_dbg(ql_dbg_io, vha, 0xff02,
-   "HOST-ABORT: handle=%d, state=ABORTED.\n", handle);
} else {
ql_dbg(ql_dbg_io, vha, 0xff03,
"HOST-ABORT: handle=%d, state=BAD(%d).\n", handle,
@@ -3633,14 +3630,14 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
}
 
 
-   /* "cmd->state == QLA_TGT_STATE_ABORTED" means
+   /* "cmd->aborted" means
 * cmd is already aborted/terminated, we don't
 * need to terminate again.  The exchange is already
 * cleaned up/freed at FW level.  Just cleanup at driver
 * level.
 */
if ((cmd->state != QLA_TGT_STATE_NEED_DATA) &&
-   (cmd->state != QLA_TGT_STATE_ABORTED)) {
+   (!cmd->aborted)) {
cmd->cmd_flags |= BIT_13;
if (qlt_term_ctio_exchange(vha, ctio, cmd, status))
return;
@@ -3658,7 +3655,7 @@ skip_term:
 
ha->tgt.tgt_ops->handle_data(cmd);
return;
-   } else if (cmd->state == QLA_TGT_STATE_ABORTED) {
+   } else if (cmd->aborted) {
cmd->cmd_flags |= BIT_18;
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01e,
  "Aborted command %p (tag %lld) finished\n", cmd, se_cmd->tag);
@@ -3670,7 +3667,7 @@ skip_term:
}
 
if (unlikely(status != CTIO_SUCCESS) &&
-   (cmd->state != QLA_TGT_STATE_ABORTED)) {
+   !cmd->aborted) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01f, "Finishing failed CTIO\n");
dump_stack();
}
@@ -3732,7 +3729,7 @@ static void __qlt_do_work(struct qla_tgt_cmd *cmd)
if (tgt->tgt_stop)
goto out_term;
 
-   if (cmd->state == QLA_TGT_STATE_ABORTED) {
+   if (cmd->aborted) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf082,
"cmd with tag %u is aborted\n",
cmd->atio.u.isp24.exchange_addr);
@@ -4290,7 +4287,7 @@ static int abort_cmds_for_s_id(struct scsi_qla_host *vha, 
port_id_t *s_id)
list_for_each_entry(cmd, &vha->qla_cmd_list, cmd_list) {
uint32_t cmd_key = sid_to_key(cmd->atio.u.isp24.fcp_hdr.s_id);
if (cmd_key == key) {
-   cmd->state = QLA_TGT_STATE_ABORTED;
+   cmd->aborted = 1;
count++;
}
}
diff --git a/drivers/scsi/qla2xxx/qla_target.h 
b/driver

[PATCH v2 10/16] qla2xxx: Add irq affinity notification

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

Register to receive notification of when irq setting change
occured.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h|6 +++
 drivers/scsi/qla2xxx/qla_isr.c|   76 -
 drivers/scsi/qla2xxx/qla_target.c |   12 ++
 3 files changed, 93 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 216a944..c4fc32e 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2714,11 +2714,16 @@ struct isp_operations {
 
 struct scsi_qla_host;
 
+
+#define QLA83XX_RSPQ_MSIX_ENTRY_NUMBER 1 /* refer to qla83xx_msix_entries */
+
 struct qla_msix_entry {
int have_irq;
uint32_t vector;
uint16_t entry;
struct rsp_que *rsp;
+   struct irq_affinity_notify irq_notify;
+   int cpuid;
 };
 
 #defineWATCH_INTERVAL  1   /* number of seconds */
@@ -2930,6 +2935,7 @@ struct qlt_hw_data {
spinlock_t q_full_lock;
uint32_t leak_exchg_thresh_hold;
spinlock_t sess_lock;
+   int rspq_vector_cpuid;
 };
 
 #define MAX_QFULL_CMDS_ALLOC   8192
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index ea7e8e8..cf0fe8e 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -18,6 +18,10 @@ static void qla2x00_status_entry(scsi_qla_host_t *, struct 
rsp_que *, void *);
 static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *);
 static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *,
sts_entry_t *);
+static void qla_irq_affinity_notify(struct irq_affinity_notify *,
+const cpumask_t *);
+static void qla_irq_affinity_release(struct kref *);
+
 
 /**
  * qla2100_intr_handler() - Process interrupts for the ISP2100 and ISP2200.
@@ -2548,6 +2552,14 @@ void qla24xx_process_response_queue(struct scsi_qla_host 
*vha,
if (!vha->flags.online)
return;
 
+   if (rsp->msix->cpuid != smp_processor_id()) {
+   /* if kernel does not notify qla of IRQ's CPU change,
+* then set it here.
+*/
+   rsp->msix->cpuid = smp_processor_id();
+   ha->tgt.rspq_vector_cpuid = rsp->msix->cpuid;
+   }
+
while (rsp->ring_ptr->signature != RESPONSE_PROCESSED) {
pkt = (struct sts_entry_24xx *)rsp->ring_ptr;
 
@@ -2979,8 +2991,11 @@ qla24xx_disable_msix(struct qla_hw_data *ha)
 
for (i = 0; i < ha->msix_count; i++) {
qentry = &ha->msix_entries[i];
-   if (qentry->have_irq)
+   if (qentry->have_irq) {
+   /* un-register irq cpu affinity notification */
+   irq_set_affinity_notifier(qentry->vector, NULL);
free_irq(qentry->vector, qentry->rsp);
+   }
}
pci_disable_msix(ha->pdev);
kfree(ha->msix_entries);
@@ -3043,6 +3058,9 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
qentry->entry = entries[i].entry;
qentry->have_irq = 0;
qentry->rsp = NULL;
+   qentry->irq_notify.notify  = qla_irq_affinity_notify;
+   qentry->irq_notify.release = qla_irq_affinity_release;
+   qentry->cpuid = -1;
}
 
/* Enable MSI-X vectors for the base queue */
@@ -3061,6 +3079,18 @@ qla24xx_enable_msix(struct qla_hw_data *ha, struct 
rsp_que *rsp)
qentry->have_irq = 1;
qentry->rsp = rsp;
rsp->msix = qentry;
+
+   /* Register for CPU affinity notification. */
+   irq_set_affinity_notifier(qentry->vector, &qentry->irq_notify);
+
+   /* Schedule work (ie. trigger a notification) to read cpu
+* mask for this specific irq.
+* kref_get is required because
+   * irq_affinity_notify() will do
+   * kref_put().
+   */
+   kref_get(&qentry->irq_notify.kref);
+   schedule_work(&qentry->irq_notify.work);
}
 
/*
@@ -3240,3 +3270,47 @@ int qla25xx_request_irq(struct rsp_que *rsp)
msix->rsp = rsp;
return ret;
 }
+
+
+/* irq_set_affinity/irqbalance will trigger notification of cpu mask update */
+static void qla_irq_affinity_notify(struct irq_affinity_notify *notify,
+   const cpumask_t *mask)
+{
+   struct qla_msix_entry *e =
+   container_of(notify, struct qla_msix_entry, irq_notify);
+   struct qla_hw_data *ha;
+   struct scsi_qla_host *base_vha;
+
+   /* user is recommended to set mask to just 1 cpu */
+   e->cpuid = cpumask_first(mask);
+
+   ha = e->rsp->hw;
+   base_vha = pci_get_drvdata(ha->pdev);
+
+   ql_dbg(ql_dbg_init, base_vha, 0x,
+   "%s: host %ld : vector %d cpu %d \n", __func__,
+ 

[PATCH v2 12/16] qla2xxx: Move atioq to a different lock to reduce lock contention

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

99% of the time the ATIOQ has SCSI command.  The other 1% of time
is something else.  Most of the time this interrupt does not need
to hold the hardware_lock.  We're moving the ATIO interrupt thread
to a different lock to reduce lock contention.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h|1 +
 drivers/scsi/qla2xxx/qla_gbl.h|1 +
 drivers/scsi/qla2xxx/qla_init.c   |6 ++-
 drivers/scsi/qla2xxx/qla_isr.c|   44 +
 drivers/scsi/qla2xxx/qla_os.c |2 +
 drivers/scsi/qla2xxx/qla_target.c |   99 +++--
 drivers/scsi/qla2xxx/qla_target.h |4 +-
 7 files changed, 129 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c4fc32e..96c5ffe 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2936,6 +2936,7 @@ struct qlt_hw_data {
uint32_t leak_exchg_thresh_hold;
spinlock_t sess_lock;
int rspq_vector_cpuid;
+   spinlock_t atio_lock cacheline_aligned;
 };
 
 #define MAX_QFULL_CMDS_ALLOC   8192
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index a1b5384..0103e46 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -778,5 +778,6 @@ extern int qla_get_exlogin_status(scsi_qla_host_t *, 
uint16_t *,
 extern int qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr);
 extern int qla_get_exchoffld_status(scsi_qla_host_t *, uint16_t *, uint16_t *);
 extern int qla_set_exchoffld_mem_cfg(scsi_qla_host_t *, dma_addr_t);
+extern void qlt_handle_abts_recv(struct scsi_qla_host *, response_t *);
 
 #endif /* _QLA_GBL_H */
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 35d1ea8..993dd25 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4919,7 +4919,7 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
struct qla_hw_data *ha = vha->hw;
struct req_que *req = ha->req_q_map[0];
struct rsp_que *rsp = ha->rsp_q_map[0];
-   unsigned long flags;
+   unsigned long flags, flags2;
 
/* If firmware needs to be loaded */
if (qla2x00_isp_firmware(vha)) {
@@ -4948,8 +4948,10 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
 * while we weren't online.
 */
spin_lock_irqsave(&ha->hardware_lock, flags);
+   spin_lock_irqsave(&ha->tgt.atio_lock, flags2);
if (qla_tgt_mode_enabled(vha))
-   qlt_24xx_process_atio_queue(vha);
+   qlt_24xx_process_atio_queue(vha, 1);
+   spin_unlock_irqrestore(&ha->tgt.atio_lock, flags2);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 3e89122..d4d65eb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2605,8 +2605,14 @@ process_err:
qla24xx_els_ct_entry(vha, rsp->req, pkt, ELS_IOCB_TYPE);
break;
case ABTS_RECV_24XX:
-   /* ensure that the ATIO queue is empty */
-   qlt_24xx_process_atio_queue(vha);
+   if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
+   /* ensure that the ATIO queue is empty */
+   qlt_handle_abts_recv(vha, (response_t *)pkt);
+   break;
+   } else {
+   /* drop through */
+   qlt_24xx_process_atio_queue(vha, 1);
+   }
case ABTS_RESP_24XX:
case CTIO_TYPE7:
case NOTIFY_ACK_TYPE:
@@ -2773,13 +2779,22 @@ qla24xx_intr_handler(int irq, void *dev_id)
case INTR_RSP_QUE_UPDATE_83XX:
qla24xx_process_response_queue(vha, rsp);
break;
-   case INTR_ATIO_QUE_UPDATE:
-   qlt_24xx_process_atio_queue(vha);
+   case INTR_ATIO_QUE_UPDATE:{
+   unsigned long flags2;
+   spin_lock_irqsave(&ha->tgt.atio_lock, flags2);
+   qlt_24xx_process_atio_queue(vha, 1);
+   spin_unlock_irqrestore(&ha->tgt.atio_lock, flags2);
break;
-   case INTR_ATIO_RSP_QUE_UPDATE:
-   qlt_24xx_process_atio_queue(vha);
+   }
+   case INTR_ATIO_RSP_QUE_UPDATE: {
+   unsigned long flags2;
+   spin_lock_irqsave(&ha->tgt.atio_lock, flags2);
+   qlt_2

[PATCH v2 13/16] qla2xxx: Disable ZIO at start time.

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

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

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index ac7a754..da35f51 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -6544,10 +6544,21 @@ qlt_24xx_config_nvram_stage2(struct scsi_qla_host *vha,
 {
struct qla_hw_data *ha = vha->hw;
 
+   if (!QLA_TGT_MODE_ENABLED())
+   return;
+
if (ha->tgt.node_name_set) {
memcpy(icb->node_name, ha->tgt.tgt_node_name, WWN_SIZE);
icb->firmware_options_1 |= cpu_to_le32(BIT_14);
}
+
+   /* disable ZIO at start time. */
+   if (!vha->flags.init_done) {
+   uint32_t tmp;
+   tmp = le32_to_cpu(icb->firmware_options_2);
+   tmp &= ~(BIT_3 | BIT_2 | BIT_1 | BIT_0);
+   icb->firmware_options_2 = cpu_to_le32(tmp);
+   }
 }
 
 void
@@ -6638,6 +6649,15 @@ qlt_81xx_config_nvram_stage2(struct scsi_qla_host *vha,
memcpy(icb->node_name, ha->tgt.tgt_node_name, WWN_SIZE);
icb->firmware_options_1 |= cpu_to_le32(BIT_14);
}
+
+   /* disable ZIO at start time. */
+   if (!vha->flags.init_done) {
+   uint32_t tmp;
+   tmp = le32_to_cpu(icb->firmware_options_2);
+   tmp &= ~(BIT_3 | BIT_2 | BIT_1 | BIT_0);
+   icb->firmware_options_2 = cpu_to_le32(tmp);
+   }
+
 }
 
 void
-- 
1.7.7

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


[PATCH v2 11/16] qla2xxx: Add selective command queuing

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

queue work element to specific process lessen cache miss

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_isr.c |2 +-
 drivers/scsi/qla2xxx/qla_target.c  |   13 -
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |4 ++--
 drivers/target/target_core_transport.c |5 -
 include/target/target_core_base.h  |1 +
 5 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index cf0fe8e..3e89122 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -3302,7 +3302,7 @@ static void qla_irq_affinity_notify(struct 
irq_affinity_notify *notify,
}
 }
 
-void qla_irq_affinity_release(struct kref *ref)
+static void qla_irq_affinity_release(struct kref *ref)
 {
struct irq_affinity_notify *notify =
container_of(ref, struct irq_affinity_notify, kref);
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 9a4aed0..d3cd271 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3982,13 +3982,24 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host 
*vha,
 
cmd->cmd_in_wq = 1;
cmd->cmd_flags |= BIT_0;
+   cmd->se_cmd.cpuid = -1;
 
spin_lock(&vha->cmd_list_lock);
list_add_tail(&cmd->cmd_list, &vha->qla_cmd_list);
spin_unlock(&vha->cmd_list_lock);
 
INIT_WORK(&cmd->work, qlt_do_work);
-   queue_work(qla_tgt_wq, &cmd->work);
+   if (ha->msix_count) {
+   cmd->se_cmd.cpuid = ha->tgt.rspq_vector_cpuid;
+   if (cmd->atio.u.isp24.fcp_cmnd.rddata)
+   queue_work_on(smp_processor_id(), qla_tgt_wq,
+   &cmd->work);
+   else
+   queue_work_on(cmd->se_cmd.cpuid, qla_tgt_wq,
+   &cmd->work);
+   } else {
+   queue_work(qla_tgt_wq, &cmd->work);
+   }
return 0;
 
 }
diff --git a/drivers/scsi/qla2xxx/tcm_qla2xxx.c 
b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
index 2d185bc..faf0a12 100644
--- a/drivers/scsi/qla2xxx/tcm_qla2xxx.c
+++ b/drivers/scsi/qla2xxx/tcm_qla2xxx.c
@@ -299,7 +299,7 @@ static void tcm_qla2xxx_free_cmd(struct qla_tgt_cmd *cmd)
cmd->vha->tgt_counters.core_qla_free_cmd++;
cmd->cmd_in_wq = 1;
INIT_WORK(&cmd->work, tcm_qla2xxx_complete_free);
-   queue_work(tcm_qla2xxx_free_wq, &cmd->work);
+   queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
 }
 
 /*
@@ -504,7 +504,7 @@ static void tcm_qla2xxx_handle_data(struct qla_tgt_cmd *cmd)
cmd->cmd_flags |= BIT_10;
cmd->cmd_in_wq = 1;
INIT_WORK(&cmd->work, tcm_qla2xxx_handle_data_work);
-   queue_work(tcm_qla2xxx_free_wq, &cmd->work);
+   queue_work_on(smp_processor_id(), tcm_qla2xxx_free_wq, &cmd->work);
 }
 
 static void tcm_qla2xxx_handle_dif_work(struct work_struct *work)
diff --git a/drivers/target/target_core_transport.c 
b/drivers/target/target_core_transport.c
index 4fdcee2..b5158a4 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -715,7 +715,10 @@ void target_complete_cmd(struct se_cmd *cmd, u8 
scsi_status)
cmd->transport_state |= (CMD_T_COMPLETE | CMD_T_ACTIVE);
spin_unlock_irqrestore(&cmd->t_state_lock, flags);
 
-   queue_work(target_completion_wq, &cmd->work);
+   if (cmd->cpuid == -1)
+   queue_work(target_completion_wq, &cmd->work);
+   else
+   queue_work_on(cmd->cpuid, target_completion_wq, &cmd->work);
 }
 EXPORT_SYMBOL(target_complete_cmd);
 
diff --git a/include/target/target_core_base.h 
b/include/target/target_core_base.h
index aabf0ac..3310ef1 100644
--- a/include/target/target_core_base.h
+++ b/include/target/target_core_base.h
@@ -526,6 +526,7 @@ struct se_cmd {
unsigned intt_prot_nents;
sense_reason_t  pi_err;
sector_tbad_sector;
+   int cpuid;
 };
 
 struct se_ua {
-- 
1.7.7

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


[PATCH v2 07/16] qla2xxx: Wait for all conflicts before ack'ing PLOGI

2015-12-17 Thread Himanshu Madhani
From: Alexei Potashnik 

Until now ack'ing of a new PLOGI has only been delayed if there
was an existing session for the same WWN. Ack was released when
the session deletion completed.

If there was another WWN session with the same fc_id/loop_id pair
(aka "conflicting session"), PLOGI was still ack'ed immediately.
This potentially caused a problem when old session deletion logged
fc_id/loop_id out of FW after new session has been established.

Two work-arounds were attempted before:
1. Dropping PLOGIs until conflicting session goes away.
2. Detecting initiator being logged out of FW and issuing LOGO
to force re-login.

This patch introduces proper solution to the problem where PLOGI
is held until either existing session with same WWN or any
conflicting session goes away. Mechanism supports one session holding
two PLOGI acks as well as one PLOGI ack being held by many sessions.

Signed-off-by: Alexei Potashnik 
Acked-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/qla2xxx/qla_dbg.c|4 +-
 drivers/scsi/qla2xxx/qla_def.h|2 +
 drivers/scsi/qla2xxx/qla_os.c |1 +
 drivers/scsi/qla2xxx/qla_target.c |  205 +
 drivers/scsi/qla2xxx/qla_target.h |   18 +++-
 5 files changed, 180 insertions(+), 50 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 432db48..cd0d94e 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -26,7 +26,7 @@
  * |  || 0x3036,0x3038  |
  * |  || 0x303a
|
  * | DPC Thread   |   0x4023   | 0x4002,0x4013  |
- * | Async Events |   0x508a   | 0x502b-0x502f  |
+ * | Async Events |   0x5089   | 0x502b-0x502f  |
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
  * |  || 0x507b,0x505f |
@@ -63,7 +63,7 @@
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
  * | Target Mode |   0xe080   ||
- * | Target Mode Management  |   0xf096   | 0xf002 |
+ * | Target Mode Management  |   0xf09b   | 0xf002 |
  * |  || 0xf046-0xf049  |
  * | Target Mode Task Management  |  0x1000d  ||
  * --
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 495a0aa..734524f 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3654,6 +3654,8 @@ typedef struct scsi_qla_host {
int total_fcport_update_gen;
/* List of pending LOGOs, protected by tgt_mutex */
struct list_headlogo_list;
+   /* List of pending PLOGI acks, protected by hw lock */
+   struct list_headplogi_ack_list;
 
uint32_tvp_abort_cnt;
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 416b45c..9303552 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3921,6 +3921,7 @@ struct scsi_qla_host *qla2x00_create_host(struct 
scsi_host_template *sht,
INIT_LIST_HEAD(&vha->qla_cmd_list);
INIT_LIST_HEAD(&vha->qla_sess_op_cmd_list);
INIT_LIST_HEAD(&vha->logo_list);
+   INIT_LIST_HEAD(&vha->plogi_ack_list);
 
spin_lock_init(&vha->work_lock);
spin_lock_init(&vha->cmd_list_lock);
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 5ef9d4c..2b218b6 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -118,10 +118,13 @@ static void qlt_send_notify_ack(struct scsi_qla_host *vha,
struct imm_ntfy_from_isp *ntfy,
uint32_t add_flags, uint16_t resp_code, int resp_code_valid,
uint16_t srr_flags, uint16_t srr_reject_code, uint8_t srr_explan);
+static void qlt_send_term_imm_notif(struct scsi_qla_host *vha,
+   struct imm_ntfy_from_isp *imm, int ha_locked);
 /*
  * Global Variables
  */
 static struct kmem_cache *qla_tgt_mgmt_cmd_cachep;
+static struct kmem_cache *qla_tgt_plogi_cachep;
 static mempool_t *qla_tgt_mgmt_cmd_mempool;
 static struct workqueue_struct *qla_tgt_wq;
 static DEFINE_MUTEX(qla_tgt_mutex);
@@ -389,6 +392,85 @@ void qlt_response_pkt_all_vps(struct scsi_qla_host *vha, 
response_t *pkt)
 
 }
 
+/*
+ * All qlt_plogi_ack_t operations are protected by hardware_lock
+ */
+
+/*
+ * This is a zero-base ref-counting solution, since hardware_lock
+ * guarantees that ref_count is not modified concurrently.
+ * Upon succes

[PATCH v2 09/16] qla2xxx: Remove dependency on hardware_lock to reduce lock contention.

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

Sessions management (add, deleted, modify) currently are serialized
through the hardware_lock.  Hardware_lock is a high traffic lock.
This lock is accessed by both the transmit & receive sides.

Sessions management is now moved off to another lock call sess_lock.
This is done to reduce lock contention and increase traffic throughput.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |1 +
 drivers/scsi/qla2xxx/qla_os.c  |1 +
 drivers/scsi/qla2xxx/qla_target.c  |  132 ---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |   28 
 4 files changed, 106 insertions(+), 56 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 734524f..216a944 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2929,6 +2929,7 @@ struct qlt_hw_data {
uint32_t num_qfull_cmds_dropped;
spinlock_t q_full_lock;
uint32_t leak_exchg_thresh_hold;
+   spinlock_t sess_lock;
 };
 
 #define MAX_QFULL_CMDS_ALLOC   8192
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 9303552..6fbce49 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2336,6 +2336,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
ha->tgt.enable_class_2 = ql2xenableclass2;
INIT_LIST_HEAD(&ha->tgt.q_full_list);
spin_lock_init(&ha->tgt.q_full_lock);
+   spin_lock_init(&ha->tgt.sess_lock);
 
/* Clear our data area */
ha->bars = bars;
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 104d129..6136987 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -636,7 +636,7 @@ static void qlt_free_session_done(struct work_struct *work)
wake_up_all(&tgt->waitQ);
 }
 
-/* ha->hardware_lock supposed to be held on entry */
+/* ha->tgt.sess_lock supposed to be held on entry */
 void qlt_unreg_sess(struct qla_tgt_sess *sess)
 {
struct scsi_qla_host *vha = sess->vha;
@@ -652,7 +652,7 @@ void qlt_unreg_sess(struct qla_tgt_sess *sess)
 }
 EXPORT_SYMBOL(qlt_unreg_sess);
 
-/* ha->hardware_lock supposed to be held on entry */
+
 static int qlt_reset(struct scsi_qla_host *vha, void *iocb, int mcmd)
 {
struct qla_hw_data *ha = vha->hw;
@@ -662,12 +662,15 @@ static int qlt_reset(struct scsi_qla_host *vha, void 
*iocb, int mcmd)
int res = 0;
struct imm_ntfy_from_isp *n = (struct imm_ntfy_from_isp *)iocb;
struct atio_from_isp *a = (struct atio_from_isp *)iocb;
+   unsigned long flags;
 
loop_id = le16_to_cpu(n->u.isp24.nport_handle);
if (loop_id == 0x) {
/* Global event */
atomic_inc(&vha->vha_tgt.qla_tgt->tgt_global_resets_count);
+   spin_lock_irqsave(&ha->tgt.sess_lock, flags);
qlt_clear_tgt_db(vha->vha_tgt.qla_tgt);
+   spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
 #if 0 /* FIXME: do we need to choose a session here? */
if (!list_empty(&ha->tgt.qla_tgt->sess_list)) {
sess = list_entry(ha->tgt.qla_tgt->sess_list.next,
@@ -694,7 +697,9 @@ static int qlt_reset(struct scsi_qla_host *vha, void *iocb, 
int mcmd)
sess = NULL;
 #endif
} else {
+   spin_lock_irqsave(&ha->tgt.sess_lock, flags);
sess = ha->tgt.tgt_ops->find_sess_by_loop_id(vha, loop_id);
+   spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
}
 
ql_dbg(ql_dbg_tgt, vha, 0xe000,
@@ -716,7 +721,7 @@ static int qlt_reset(struct scsi_qla_host *vha, void *iocb, 
int mcmd)
iocb, QLA24XX_MGMT_SEND_NACK);
 }
 
-/* ha->hardware_lock supposed to be held on entry */
+/* ha->tgt.sess_lock supposed to be held on entry */
 static void qlt_schedule_sess_for_deletion(struct qla_tgt_sess *sess,
bool immediate)
 {
@@ -760,7 +765,7 @@ static void qlt_schedule_sess_for_deletion(struct 
qla_tgt_sess *sess,
sess->expires - jiffies);
 }
 
-/* ha->hardware_lock supposed to be held on entry */
+/* ha->tgt.sess_lock supposed to be held on entry */
 static void qlt_clear_tgt_db(struct qla_tgt *tgt)
 {
struct qla_tgt_sess *sess;
@@ -820,7 +825,7 @@ out_free_id_list:
return res;
 }
 
-/* ha->hardware_lock supposed to be held on entry */
+/* ha->tgt.sess_lock supposed to be held on entry */
 static void qlt_undelete_sess(struct qla_tgt_sess *sess)
 {
BUG_ON(sess->deleted != QLA_SESS_DELETION_PENDING);
@@ -838,7 +843,7 @@ static void qlt_del_sess_work_fn(struct delayed_work *work)
struct qla_tgt_sess *sess;
unsigned long flags, elapsed;
 
-   spin_lock_irqsave(&ha->hardware_lock, flags);
+   spin_lock_irqsave(&ha->tgt.sess_lock, flags);
while (!list_empty(&tgt->del_sess_list)) {

[PATCH v2 16/16] qla2xxx: Check for online flag instead of active reset when transmitting responses

2015-12-17 Thread Himanshu Madhani
From: Dilip Kumar Uppugandla 

Driver has following initialization sequence for Target mode

1. Driver initialization starts

2. ISP Abort is scheduled when the target is enabled.

qla2xxx [:04:00.0]-4807:25: ISP abort scheduled
qla2xxx [:04:00.0]-00af:25: Performing ISP error recovery - 
ha=880caa9e.

3. DPC thread starts the ISP Abort

4. While DPC is resetting the chip and initializing the firmware, we get
   async events from the firmware about P2P mode, LOOP UP and PORT UPDATE.

5. PRLI from a initiator is delivered to us followed by a PLOGI and then a
   SCSI command which creates a session.

6. If the SCSI command is a WRITE in this case, we issue XFR RDY and it
   gets dropped as can be seen with messages RESET-XFR because ISP Abort
   is still active

qla2xxx [:04:00.0]-e902:25: RESET-XFR active/old-count/new-count = 1/1/1.

7. If the SCSI command is a READ, we issue RESPONSE and they get dropped
   as well because Abort is still active.

qla2xxx [:04:00.0]-e901:25: RESET-RSP active/old-count/new-count = 1/1/1

8. Now eventually, ISP Abort finishes clearing the DPC flags.

qla2xxx [:04:00.0]-8822:25: qla2x00_abort_isp succeeded.
qla2xxx [:04:00.0]-4808:25: ISP abort end.

9. Since we dropped SCSI commands silently (without any responses sent
   to the initiator) initiator waits for a SCSI timeout (which is 60
   seconds in our case), Sends an ABTS which fails since there
   no se_cmd found for the tag that ABTS is referencing as the
   commands were cleaned up in Step 6 and 7.

10. Initiator send an IO after the ABTS which succeed fine.

To fix the above case, the following changes have been made:
  - To prevent target from dropping commands silently, use the online flag
instead to check for an active chip reset. Once the port is online during
a chip reset phase, we are good to process the commands.
  - Clean up qla2x00_restart_isp to not set the online flag and process ATIO
as it is unnecessary. During a chip reset, interrupts are enabled only
after setting the online flag to 1, so ATIO's won't be missed and hence
no need to process ATIO's after setting the online flag.

Signed-off-by: Dilip Kumar Uppugandla 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c   |   34 --
 drivers/scsi/qla2xxx/qla_target.c |   34 +-
 2 files changed, 37 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 993dd25..52a8765 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3065,6 +3065,26 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
atomic_set(&vha->loop_state, LOOP_READY);
ql_dbg(ql_dbg_disc, vha, 0x2069,
"LOOP READY.\n");
+
+   /*
+* Process any ATIO queue entries that came in
+* while we weren't online.
+*/
+   if (qla_tgt_mode_enabled(vha)) {
+   if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) {
+   spin_lock_irqsave(&ha->tgt.atio_lock,
+   flags);
+   qlt_24xx_process_atio_queue(vha, 0);
+   spin_unlock_irqrestore(
+   &ha->tgt.atio_lock, flags);
+   } else {
+   spin_lock_irqsave(&ha->hardware_lock,
+   flags);
+   qlt_24xx_process_atio_queue(vha, 1);
+   spin_unlock_irqrestore(
+   &ha->hardware_lock, flags);
+   }
+   }
}
}
 
@@ -4919,7 +4939,6 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
struct qla_hw_data *ha = vha->hw;
struct req_que *req = ha->req_q_map[0];
struct rsp_que *rsp = ha->rsp_q_map[0];
-   unsigned long flags, flags2;
 
/* If firmware needs to be loaded */
if (qla2x00_isp_firmware(vha)) {
@@ -4941,19 +4960,6 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
/* Issue a marker after FW becomes ready. */
qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL);
 
-   vha->flags.online = 1;
-
-   /*
-* Process any ATIO queue entries that came in
-* while we weren't online.
-*/
-   spin_lock_irqsave(&ha->hardware_lock, flags);
-   spin_lock_irqsave(&ha->tgt.atio_lock, flags2);
-   if (qla_tgt_mode_enabled(vha))
-   qlt_24

[PATCH v2 02/16] qla2xxx: Enable Exchange offload support.

2015-12-17 Thread Himanshu Madhani
This patch enables Exchange offload support in Qlogic ISP.
To enable exchange offload with Qlogic ISP24XX/25XX/26XX,
set module parameter ql2xexchoffld to any non-zero number.
This will alow ISP firmware to store exchange data structures
used by firmware to host memory provided by driver. ISP firmware
can supports upto 32k total active exchanges.

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |9 +--
 drivers/scsi/qla2xxx/qla_def.h  |   12 -
 drivers/scsi/qla2xxx/qla_gbl.h  |5 ++
 drivers/scsi/qla2xxx/qla_init.c |7 ++
 drivers/scsi/qla2xxx/qla_mbx.c  |  118 +++
 drivers/scsi/qla2xxx/qla_os.c   |   78 ++
 6 files changed, 222 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 5766640..e8b38db 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,8 +14,8 @@
  * | Module Init and Probe|   0x017f   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e-0x0170  |
- * | Mailbox commands |   0x1192   | 0x1018-0x1019 |
- * |  || 0x111a-0x111b  |
+ * | Mailbox commands |   0x1192   |   |
+ * |  ||   |
  * | Device Discovery |   0x2016   | 0x2020-0x2022, |
  * |  || 0x2011-0x2012, |
  * |  || 0x2099-0x20a4  |
@@ -60,10 +60,7 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd300   | 0xd012-0xd014 |
- * |  || 0xd016-0xd017 |
- * |  || 0xd02e
|
- * |  || 0xd031-0xd0ff |
+ * | Misc |   0xd300   | 0xd031-0xd0ff |
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
  * | Target Mode |   0xe080   ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 8f465b7..d31401c 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -272,6 +272,7 @@
 #define RESPONSE_ENTRY_CNT_MQ  128 /* Number of response entries.*/
 #define ATIO_ENTRY_CNT_24XX4096/* Number of ATIO entries. */
 #define RESPONSE_ENTRY_CNT_FX00256 /* Number of response 
entries.*/
+#define EXTENDED_EXCH_ENTRY_CNT32768   /* Entries for offload 
case */
 
 struct req_que;
 struct qla_tgt_sess;
@@ -2968,7 +2969,8 @@ struct qla_hw_data {
 
uint32_tfawwpn_enabled:1;
uint32_texlogins_enabled:1;
-   /* 34 bits */
+   uint32_texchoffld_enabled:1;
+   /* 35 bits */
} flags;
 
/* This spinlock is used to protect "io transactions", you must
@@ -3246,6 +3248,14 @@ struct qla_hw_data {
dma_addr_t  exlogin_buf_dma;
int exlogin_size;
 
+#define ENABLE_EXCHANGE_OFFLD  BIT_2
+
+   /* Exchange Offload */
+   void*exchoffld_buf;
+   dma_addr_t  exchoffld_buf_dma;
+   int exchoffld_size;
+   int exchoffld_count;
+
void*swl;
 
/* These are used by mailbox operations. */
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index d396c49..3dc323c 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -118,6 +118,7 @@ extern uint64_t ql2xmaxlun;
 extern int ql2xmdcapmask;
 extern int ql2xmdenable;
 extern int ql2xexlogins;
+extern int ql2xexchoffld;
 
 extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
@@ -138,6 +139,8 @@ extern int qla2x00_post_async_adisc_done_work(struct 
scsi_qla_host *,
 fc_port_t *, uint16_t *);
 extern int qla2x00_set_exlogins_buffer(struct scsi_qla_host *);
 extern void qla2x00_free_exlogin_buffer(struct qla_hw_data *);
+extern int qla2x00_set_exchoffld_buffer(struct scsi_qla_host *);
+extern void qla2x00_free_exchoffld_buffer(struct qla_hw_data *);
 
 extern int qla81xx_restart_mpi_firmware(scsi_qla_host_t *);
 
@@ -772,5 +775,7 @@ extern void qlt_host_reset_handler(struct qla_hw_data *ha);
 extern int qla_get_exlogin_status(scsi_qla_host_t *

[PATCH v2 04/16] qla2xxx: Add FW resource count in DebugFS.

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

DebugFS now will show fw_resource_count node.

FW Resource count

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

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

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

[PATCH v2 14/16] qla2xxx: Set all queues to 4k

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

set ATIO/Request/Response Queues and Default number
of outstanding command to 4k.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |3 ++-
 drivers/scsi/qla2xxx/qla_os.c  |6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 96c5ffe..9872f34 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -259,7 +259,7 @@
 #define LOOP_DOWN_TIME 255 /* 240 */
 #defineLOOP_DOWN_RESET (LOOP_DOWN_TIME - 30)
 
-#define DEFAULT_OUTSTANDING_COMMANDS   1024
+#define DEFAULT_OUTSTANDING_COMMANDS   4096
 #define MIN_OUTSTANDING_COMMANDS   128
 
 /* ISP request and response entry counts (37-65535) */
@@ -267,6 +267,7 @@
 #define REQUEST_ENTRY_CNT_2200 2048/* Number of request entries. */
 #define REQUEST_ENTRY_CNT_24XX 2048/* Number of request entries. */
 #define REQUEST_ENTRY_CNT_83XX 8192/* Number of request entries. */
+#define RESPONSE_ENTRY_CNT_83XX4096/* Number of response 
entries.*/
 #define RESPONSE_ENTRY_CNT_210064  /* Number of response 
entries.*/
 #define RESPONSE_ENTRY_CNT_2300512 /* Number of response 
entries.*/
 #define RESPONSE_ENTRY_CNT_MQ  128 /* Number of response entries.*/
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index ad121fa..f1788db 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2483,7 +2483,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400;
ha->mbx_count = MAILBOX_REGISTER_COUNT;
req_length = REQUEST_ENTRY_CNT_83XX;
-   rsp_length = RESPONSE_ENTRY_CNT_2300;
+   rsp_length = RESPONSE_ENTRY_CNT_83XX;
ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX;
ha->max_loop_id = SNS_LAST_LOOP_ID_2300;
ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
@@ -2513,8 +2513,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
ha->portnum = PCI_FUNC(ha->pdev->devfn);
ha->max_fibre_devices = MAX_FIBRE_DEVICES_2400;
ha->mbx_count = MAILBOX_REGISTER_COUNT;
-   req_length = REQUEST_ENTRY_CNT_24XX;
-   rsp_length = RESPONSE_ENTRY_CNT_2300;
+   req_length = REQUEST_ENTRY_CNT_83XX;
+   rsp_length = RESPONSE_ENTRY_CNT_83XX;
ha->tgt.atio_q_length = ATIO_ENTRY_CNT_24XX;
ha->max_loop_id = SNS_LAST_LOOP_ID_2300;
ha->init_cb_size = sizeof(struct mid_init_cb_81xx);
-- 
1.7.7

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


[PATCH v2 15/16] qla2xxx: Add bulk send for atio & ctio completion paths.

2015-12-17 Thread Himanshu Madhani
From: Quinn Tran 

At high traffic, the work queue can become a bottle neck.
Instead of putting each command on the work queue as 1 work
element, the fix would daisy chain a list of commands that came
from FW/interrupt under 1 work element to reduce lock contention.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h |3 ++
 drivers/scsi/qla2xxx/qla_isr.c |3 ++
 drivers/scsi/qla2xxx/qla_target.c  |   65 -
 drivers/scsi/qla2xxx/qla_target.h  |2 +
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |   71 ++--
 5 files changed, 130 insertions(+), 14 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 9872f34..7475716 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2937,6 +2937,9 @@ struct qlt_hw_data {
uint32_t leak_exchg_thresh_hold;
spinlock_t sess_lock;
int rspq_vector_cpuid;
+
+   void *ctio_for_bulk_process;
+   void *atio_for_bulk_process;
spinlock_t atio_lock cacheline_aligned;
 };
 
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index d4d65eb..0edf2eb 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2646,6 +2646,9 @@ process_err:
WRT_REG_DWORD(®->rsp_q_out[0], rsp->ring_index);
} else
WRT_REG_DWORD(rsp->rsp_q_out, rsp->ring_index);
+
+   if (ha->tgt.ctio_for_bulk_process)
+   vha->hw->tgt.tgt_ops->handle_bulk(vha);
 }
 
 static void
diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index da35f51..5a87dd4 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -3812,12 +3812,23 @@ static void qlt_do_work(struct work_struct *work)
struct qla_tgt_cmd *cmd = container_of(work, struct qla_tgt_cmd, work);
scsi_qla_host_t *vha = cmd->vha;
unsigned long flags;
+   struct list_head h;
+   struct qla_tgt_cmd *c = NULL, *tc = NULL;
 
spin_lock_irqsave(&vha->cmd_list_lock, flags);
list_del(&cmd->cmd_list);
spin_unlock_irqrestore(&vha->cmd_list_lock, flags);
 
+   INIT_LIST_HEAD(&h);
+   if (!list_empty(&cmd->bulk_process_list))
+   list_splice_init(&cmd->bulk_process_list, &h);
+
__qlt_do_work(cmd);
+
+   list_for_each_entry_safe(c, tc, &h, bulk_process_list) {
+   list_del_init(&c->bulk_process_list);
+   c->work.func(&c->work);
+   }
 }
 
 static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t *vha,
@@ -3849,6 +3860,7 @@ static struct qla_tgt_cmd *qlt_get_tag(scsi_qla_host_t 
*vha,
cmd->jiffies_at_alloc = get_jiffies_64();
 
cmd->reset_count = vha->hw->chip_reset;
+   INIT_LIST_HEAD(&cmd->bulk_process_list);
 
return cmd;
 }
@@ -3908,6 +3920,7 @@ static void qlt_create_sess_from_atio(struct work_struct 
*work)
kfree(op);
return;
}
+
/*
 * __qlt_do_work() will call ha->tgt.tgt_ops->put_sess() to release
 * the extra reference taken above by qlt_make_local_sess()
@@ -3924,6 +3937,40 @@ out_term:
 
 }
 
+static void qlt_add_cmd_to_bulk_list(struct qla_tgt_cmd *cmd)
+{
+   struct qla_hw_data *ha = cmd->tgt->ha;
+   struct qla_tgt_cmd *hc = (struct qla_tgt_cmd *)
+   ha->tgt.atio_for_bulk_process;
+
+   if (IS_QLA27XX(ha) || IS_QLA83XX(ha))
+   /* We are running under atio_lock protection here. */
+   assert_spin_locked(&ha->tgt.atio_lock);
+   else
+   assert_spin_locked(&ha->hardware_lock);
+
+   if (hc)
+   list_add_tail(&cmd->bulk_process_list, &hc->bulk_process_list);
+   else
+   ha->tgt.atio_for_bulk_process = (void *)cmd;
+}
+
+static void qlt_send_atio_bulk(struct qla_hw_data *ha)
+{
+   struct qla_tgt_cmd *cmd =
+   (struct qla_tgt_cmd *)ha->tgt.atio_for_bulk_process;
+
+   if (IS_QLA27XX(ha) || IS_QLA83XX(ha))
+   /*We are running under atio_lock protection here */
+   assert_spin_locked(&ha->tgt.atio_lock);
+   else
+   assert_spin_locked(&ha->hardware_lock);
+
+   ha->tgt.atio_for_bulk_process = NULL;
+   queue_work_on(smp_processor_id(), qla_tgt_wq, &cmd->work);
+}
+
+
 /* ha->hardware_lock supposed to be held on entry */
 static int qlt_handle_cmd_for_atio(struct scsi_qla_host *vha,
struct atio_from_isp *atio)
@@ -3989,17 +4036,11 @@ static int qlt_handle_cmd_for_atio(struct scsi_qla_host 
*vha,
spin_unlock(&vha->cmd_list_lock);
 
INIT_WORK(&cmd->work, qlt_do_work);
-   if (ha->msix_count) {
+   if (ha->msix_count)
cmd->se_cmd.cpuid = ha->tgt.rspq_vector_cpuid;
-   if (cmd->atio.u.isp24.fcp_cmnd.rddata)
-   queue_work_on(smp_processor_id

[PATCH v2 05/16] qla2xxx: Added interface to send explicit LOGO.

2015-12-17 Thread Himanshu Madhani
This patch adds interface to send explicit LOGO
explicit LOGO using using ELS commands from driver.

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_attr.c   |   36 +++
 drivers/scsi/qla2xxx/qla_dbg.c|5 +-
 drivers/scsi/qla2xxx/qla_def.h|   19 -
 drivers/scsi/qla2xxx/qla_gbl.h|2 +
 drivers/scsi/qla2xxx/qla_inline.h |2 +
 drivers/scsi/qla2xxx/qla_iocb.c   |  187 +
 drivers/scsi/qla2xxx/qla_isr.c|6 +
 7 files changed, 253 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 6b942d9..6992ebc 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -824,6 +824,41 @@ static struct bin_attribute sysfs_reset_attr = {
 };
 
 static ssize_t
+qla2x00_issue_logo(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)));
+   int type;
+   int rval = 0;
+   port_id_t did;
+
+   type = simple_strtol(buf, NULL, 10);
+
+   did.b.domain = (type & 0x00ff) >> 16;
+   did.b.area = (type & 0xff00) >> 8;
+   did.b.al_pa = (type & 0x00ff);
+
+   ql_log(ql_log_info, vha, 0x70e3, "portid=%02x%02x%02x done\n",
+   did.b.domain, did.b.area, did.b.al_pa);
+
+   ql_log(ql_log_info, vha, 0x70e4, "%s: %d\n", __func__, type);
+
+   rval = qla24xx_els_dcmd_iocb(vha, ELS_DCMD_LOGO, did);
+   return count;
+}
+
+static struct bin_attribute sysfs_issue_logo_attr = {
+   .attr = {
+   .name = "issue_logo",
+   .mode = S_IWUSR,
+   },
+   .size = 0,
+   .write = qla2x00_issue_logo,
+};
+
+static ssize_t
 qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
@@ -937,6 +972,7 @@ static struct sysfs_entry {
{ "vpd", &sysfs_vpd_attr, 1 },
{ "sfp", &sysfs_sfp_attr, 1 },
{ "reset", &sysfs_reset_attr, },
+   { "issue_logo", &sysfs_issue_logo_attr, },
{ "xgmac_stats", &sysfs_xgmac_stats_attr, 3 },
{ "dcbx_tlv", &sysfs_dcbx_tlv_attr, 3 },
{ NULL },
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 4d4d784..432db48 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -19,7 +19,7 @@
  * | Device Discovery |   0x2016   | 0x2020-0x2022, |
  * |  || 0x2011-0x2012, |
  * |  || 0x2099-0x20a4  |
- * | Queue Command and IO tracing |   0x3075   | 0x300b |
+ * | Queue Command and IO tracing |   0x3074   | 0x300b |
  * |  || 0x3027-0x3028  |
  * |  || 0x303d-0x3041  |
  * |  || 0x302d,0x3033  |
@@ -27,12 +27,11 @@
  * |  || 0x303a
|
  * | DPC Thread   |   0x4023   | 0x4002,0x4013  |
  * | Async Events |   0x508a   | 0x502b-0x502f  |
- * |  || 0x5047
|
  * |  || 0x5084,0x5075 |
  * |  || 0x503d,0x5044  |
  * |  || 0x507b,0x505f |
  * | Timer Routines   |   0x6012   ||
- * | User Space Interactions  |   0x70e2   | 0x7018,0x702e  |
+ * | User Space Interactions  |   0x70e65  | 0x7018,0x702e  |
  * | || 0x7020,0x7024  |
  * |  || 0x7039,0x7045  |
  * |  || 0x7073-0x7075  |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 8e89848..83d2251 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -310,6 +310,14 @@ struct srb_cmd {
 /* To identify if a srb is of T10-CRC type. @sp => srb_t pointer */
 #define IS_PROT_IO(sp) (sp->flags & SRB_CRC_CTX_DSD_VALID)
 
+struct els_logo_payload {
+   uint8_t opcode;
+   uint8_t rsvd[3];
+   uint8_t s_id[3];
+   uint8_t rsvd1[1];
+   uint8_t wwpn[WWN_SIZE];
+};
+
 /*
  * SRB extensions.
  */
@@ -323,6 +331,15 @@ struct srb_iocb {
uint16_t data[2];
} logio;
struct {
+#define ELS_DCMD_TIMEOUT 20
+#define ELS_DCMD_LOGO 0x5
+ 

[PATCH v2 03/16] qla2xxx: Enable Target counters in DebugFS.

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

Target Counters

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

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
Reviewed-by: Hannes Reinecke 
---
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_def.h |   15 +
 drivers/scsi/qla2xxx/qla_dfs.c |   56 
 drivers/scsi/qla2xxx/qla_iocb.c|1 +
 drivers/scsi/qla2xxx/qla_target.c  |7 
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |4 ++
 6 files changed, 84 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index e8b38db..4d4d784 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -60,7 +60,7 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd300   | 0xd031-0xd0ff |
+ * | Misc |   0xd301   | 0xd031-0xd0ff |
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
  * | Target Mode |   0xe080   ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index d31401c..f63de35 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3342,6 +3342,8 @@ struct qla_hw_data {
uint32_tchain_offset;
struct dentry *dfs_dir;
struct dentry *dfs_fce;
+   struct dentry *dfs_tgt_counters;
+
dma_addr_t  fce_dma;
void*fce;
uint32_tfce_bufs;
@@ -3499,6 +3501,18 @@ struct qla_hw_data {
int allow_cna_fw_dump;
 };
 
+struct qla_tgt_counters {
+   uint64_t qla_core_sbt_cmd;
+   uint64_t core_qla_que_buf;
+   uint64_t qla_core_ret_ctio;
+   uint64_t core_qla_snd_status;
+   uint64_t qla_core_ret_sta_ctio;
+   uint64_t core_qla_free_cmd;
+   uint64_t num_q_full_sent;
+   uint64_t num_alloc_iocb_failed;
+   uint64_t num_term_xchg_sent;
+};
+
 /*
  * Qlogic scsi host structure
  */
@@ -3651,6 +3665,7 @@ typedef struct scsi_qla_host {
 
atomic_tvref_count;
struct qla8044_reset_template reset_tmplt;
+   struct qla_tgt_counters tgt_counters;
 } scsi_qla_host_t;
 
 #define SET_VP_IDX 1
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 15cf074..449541f 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -13,6 +13,48 @@ static struct dentry *qla2x00_dfs_root;
 static atomic_t qla2x00_dfs_root_count;
 
 static int
+qla_dfs_tgt_counters_show(struct seq_file *s, void *unused)
+{
+   struct scsi_qla_host *vha = s->private;
+
+   seq_puts(s, "Target Counters\n");
+   seq_printf(s, "qla_core_sbt_cmd = %lld\n",
+   vha->tgt_counters.qla_core_sbt_cmd);
+   seq_printf(s, "qla_core_ret_sta_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_sta_ctio);
+   seq_printf(s, "qla_core_ret_ctio = %lld\n",
+   vha->tgt_counters.qla_core_ret_ctio);
+   seq_printf(s, "core_qla_que_buf = %lld\n",
+   vha->tgt_counters.core_qla_que_buf);
+   seq_printf(s, "core_qla_snd_status = %lld\n",
+   vha->tgt_counters.core_qla_snd_status);
+   seq_printf(s, "core_qla_free_cmd = %lld\n",
+   vha->tgt_counters.core_qla_free_cmd);
+   seq_printf(s, "num alloc iocb failed = %lld\n",
+   vha->tgt_counters.num_alloc_iocb_failed);
+   seq_printf(s, "num term exchange sent = %lld\n",
+   vha->tgt_counters.num_term_xchg_sent);
+   seq_printf(s, "num Q full sent = %lld\n",
+   vha->tgt_counters.num_q_full_sent);
+
+   return 0;
+}
+
+static int
+qla_dfs_tgt_counters_open(struct inode *inode, struct file *file)
+{
+   struct scsi_qla_host *vha = inode->i_private;
+   return single_open(file, qla_dfs_tgt_counters_show, vha);
+}
+
+static const struct file_operations dfs_tgt_counters_ops = {
+   .open   = qla_dfs_tgt_counters_open,
+   .read   = seq_read,
+   .llseek = seq_lseek,
+   .release= single_release,
+};
+
+static int
 qla2x00_dfs_fce_show(struct seq_file *s, void *unused)
 {
scsi_qla_host_t *vha = s->private;
@@ -146,6 +188,14 @@ create_dir:
atomic_inc(&qla2x00_dfs_root_count);
 
 create_nodes:
+   ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
+   ha->dfs_dir, vha, &dfs_tgt_counters_ops);
+  

[PATCH v2 00/16] qla2xxx: Patches for target-pending branch

2015-12-17 Thread Himanshu Madhani
Hi Nic,

Please apply this series to target-pending at your earliest convenience.

changes from v1 -> v2

o Added Reviewed-by tag for reviewed patches.

o Dropped following patches for rework.
  - qla2xxx: Change check_stop_free to always return 1
  - qla2xxx: Fix interaction issue between qla2xxx and Target Core Module
  - qla2xxx: Add TAS detection for kernel 3.15 n newer
  - target/tmr: LUN reset cause cmd premature free.

o Fixed patch description on following patches
  - qla2xxx: Enable Extended Login support
  - qla2xxx: Enable Exchange offload support.

o Fixed patch description as well as kbuild warning for
  - qla2xxx: Added interface to send explicit LOGO.

o Fixed kbuild warning for
  - qla2xxx: Remove dependency on hardware_lock to reduce lock
contention.

Thanks,
Himanshu

Alexei Potashnik (2):
  qla2xxx: Delete session if initiator is gone from FW
  qla2xxx: Wait for all conflicts before ack'ing PLOGI

Dilip Kumar Uppugandla (1):
  qla2xxx: Check for online flag instead of active reset when
transmitting responses

Himanshu Madhani (4):
  qla2xxx: Enable Extended Logins support
  qla2xxx: Enable Exchange offload support.
  qla2xxx: Enable Target counters in DebugFS.
  qla2xxx: Added interface to send explicit LOGO.

Quinn Tran (9):
  qla2xxx: Add FW resource count in DebugFS.
  qla2xxx: Replace QLA_TGT_STATE_ABORTED with a bit.
  qla2xxx: Remove dependency on hardware_lock to reduce lock
contention.
  qla2xxx: Add irq affinity notification
  qla2xxx: Add selective command queuing
  qla2xxx: Move atioq to a different lock to reduce lock contention
  qla2xxx: Disable ZIO at start time.
  qla2xxx: Set all queues to 4k
  qla2xxx: Add bulk send for atio & ctio completion paths.

 drivers/scsi/qla2xxx/qla_attr.c|   36 ++
 drivers/scsi/qla2xxx/qla_dbg.c |   19 +-
 drivers/scsi/qla2xxx/qla_def.h |   86 -
 drivers/scsi/qla2xxx/qla_dfs.c |  106 +
 drivers/scsi/qla2xxx/qla_gbl.h |   18 +-
 drivers/scsi/qla2xxx/qla_init.c|   58 ++-
 drivers/scsi/qla2xxx/qla_inline.h  |2 +
 drivers/scsi/qla2xxx/qla_iocb.c|  188 +
 drivers/scsi/qla2xxx/qla_isr.c |  129 ++-
 drivers/scsi/qla2xxx/qla_mbx.c |  265 -
 drivers/scsi/qla2xxx/qla_os.c  |  165 -
 drivers/scsi/qla2xxx/qla_target.c  |  690 +---
 drivers/scsi/qla2xxx/qla_target.h  |   36 ++-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |  107 -
 drivers/target/target_core_transport.c |5 +-
 include/target/target_core_base.h  |1 +
 16 files changed, 1671 insertions(+), 240 deletions(-)

-- 
1.7.7

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


[PATCH v2 01/16] qla2xxx: Enable Extended Logins support

2015-12-17 Thread Himanshu Madhani
This patch enables Extended Logins support in Qlogic ISP.
To enable extended login with Qlogic ISP24XX/25XX/26XX,
set module parameter ql2xexlogins to any non-zero number.
This will alow ISP firmware to store port database structure
information of remote login sessions to host memory provided
by driver. ISP firmware supports upto 16k total logins.

Signed-off-by: Himanshu Madhani 
Signed-off-by: Giridhar Malavali 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |9 +--
 drivers/scsi/qla2xxx/qla_def.h  |   13 -
 drivers/scsi/qla2xxx/qla_gbl.h  |7 ++
 drivers/scsi/qla2xxx/qla_init.c |7 ++
 drivers/scsi/qla2xxx/qla_mbx.c  |  119 +++
 drivers/scsi/qla2xxx/qla_os.c   |   76 +
 6 files changed, 224 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 34dc9a3..5766640 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -14,7 +14,7 @@
  * | Module Init and Probe|   0x017f   | 0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e-0x0170  |
- * | Mailbox commands |   0x118d   | 0x1115-0x1116 |
+ * | Mailbox commands |   0x1192   | 0x1018-0x1019 |
  * |  || 0x111a-0x111b  |
  * | Device Discovery |   0x2016   | 0x2020-0x2022, |
  * |  || 0x2011-0x2012, |
@@ -60,10 +60,9 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd300   | 0xd016-0xd017 |
- * |  || 0xd021,0xd024 |
- * |  || 0xd025,0xd029 |
- * |  || 0xd02a,0xd02e |
+ * | Misc |   0xd300   | 0xd012-0xd014 |
+ * |  || 0xd016-0xd017 |
+ * |  || 0xd02e
|
  * |  || 0xd031-0xd0ff |
  * |  || 0xd101-0xd1fe |
  * |  || 0xd214-0xd2fe |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 388d790..8f465b7 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -891,6 +891,7 @@ struct mbx_cmd_32 {
 #define MBC_DISABLE_VI 0x24/* Disable VI operation. */
 #define MBC_ENABLE_VI  0x25/* Enable VI operation. */
 #define MBC_GET_FIRMWARE_OPTION0x28/* Get Firmware 
Options. */
+#define MBC_GET_MEM_OFFLOAD_CNTRL_STAT 0x34/* Memory Offload ctrl/Stat*/
 #define MBC_SET_FIRMWARE_OPTION0x38/* Set Firmware 
Options. */
 #define MBC_LOOP_PORT_BYPASS   0x40/* Loop Port Bypass. */
 #define MBC_LOOP_PORT_ENABLE   0x41/* Loop Port Enable. */
@@ -2962,11 +2963,12 @@ struct qla_hw_data {
uint32_tisp82xx_no_md_cap:1;
uint32_thost_shutting_down:1;
uint32_tidc_compl_status:1;
-
uint32_tmr_reset_hdlr_active:1;
uint32_tmr_intr_valid:1;
+
uint32_tfawwpn_enabled:1;
-   /* 35 bits */
+   uint32_texlogins_enabled:1;
+   /* 34 bits */
} flags;
 
/* This spinlock is used to protect "io transactions", you must
@@ -3237,6 +3239,13 @@ struct qla_hw_data {
void*async_pd;
dma_addr_t  async_pd_dma;
 
+#define ENABLE_EXTENDED_LOGIN  BIT_7
+
+   /* Extended Logins  */
+   void*exlogin_buf;
+   dma_addr_t  exlogin_buf_dma;
+   int exlogin_size;
+
void*swl;
 
/* These are used by mailbox operations. */
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 7686bfe..d396c49 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -117,6 +117,7 @@ extern int ql2xdontresethba;
 extern uint64_t ql2xmaxlun;
 extern int ql2xmdcapmask;
 extern int ql2xmdenable;
+extern int ql2xexlogins;
 
 extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
@@ -135,6 +136,8 @@ extern int qla2x00_post_async_adisc_work(struct 
scsi_qla_host *, fc_port_t *,
 uint16_t *);
 extern int qla2x00_post_async_adisc_done_work(struct scsi_qla_host *,
 fc_port_t *, uint16_t *);
+extern int 

Re: [PATCHv4 1/1] SCSI: hosts: update to use ida_simple for host_no management

2015-12-17 Thread Lee Duncan
On 12/14/2015 05:55 PM, Martin K. Petersen wrote:
>> "Hannes" == Hannes Reinecke  writes:
> 
>>> I'm not opposed to having the module option if others (Martin?) feel
>>> they need it, but generally I think it's better to keep things as
>>> simple as possible.  So, unless there are strong objections, I would
>>> say no.
> 
> Hannes> Agreeing with Ewan here.
> 
> Hannes> I guess it's up to you to tell us whether you absolutely need a
> Hannes> module parameter ...
> 
> Still not a big ida fan but since the most people seem to be in favor of
> this I guess I'll have to bite the bullet.
> 
> I don't see much value in the module parameter since it will require
> customers to tweak their configs and reproduce. Not worth the hassle.
> 

Thank you Martin. I'll look at further cleaning up the host module, but
I think this still much better than leaving the code as is.

-- 
Lee Duncan
--
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: fix a timeout loop

2015-12-17 Thread Martin K. Petersen
> "Dan" == Dan Carpenter  writes:

Dan> The qlogic devs asked me to redo this patch but you have already
Dan> applied it.  Should I resend or redo it on top of the earlier
Dan> patch.  (James's tree was rebaseable for a day after a patch was
Dan> "applied".)

I dropped it for now.

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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/17] lpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

2015-12-17 Thread James Smart



On 12/17/2015 12:32 AM, Hannes Reinecke wrote:

Ah. So here is the missing 32G speed.

Should be moved into the 'Fix RDP Speed reporting' patch, no?



which of these 2 patches is not that meaningful.

-- james

--
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 14/17] lpfc: Add logging for misconfigured optics.

2015-12-17 Thread Hannes Reinecke
On Thursday, December 17, 2015 07:51:36 AM James Smart wrote:
> On 12/17/2015 12:38 AM, Hannes Reinecke wrote:
> > On 12/17/2015 12:12 AM, James Smart wrote:
> > 
> > Why isn't this special cased anymore? Is it now supported by all HBAs?
> 
> Yes - if and when/where an async event is generated by the adapter is in
> the fw. The special casing wasn't needed in the first place.
> 
> > Hmm. How does this pan out on older cards?
> > Does every card sending out this event support the optic
> > misconfiguration detection? Or is there a chance that we lose the link
> > just because the event isn't properly implemented and we detect it as
> > non-operational?
> 
> Every card could - but whether it does is specific to the card and how
> it was built and the restrictions made on that card type. The adapter
> itself manages that. The event to the driver is solely for reporting.
> The driver can't influence optics behavior.
> 
Okay, fair enough. Just wanted to clarify this.

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke  zSeries & Storage
h...@suse.de+49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (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 08/17] lpfc: Fix RDP Speed reporting.

2015-12-17 Thread Hannes Reinecke
On Thursday, December 17, 2015 07:47:46 AM James Smart wrote:
> See patch 11/17 for the 32G additions
> 
Right.

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke  zSeries & Storage
h...@suse.de+49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (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


Patch size problem

2015-12-17 Thread Joao Pinto
Hi,
I have a patch ready to send which contains a new UFS driver, but the problem is
that the patch size is ~200K and my company' email security blocks it.
Is it possible to send the driver in a tarball?

Thanks,
Joao
--
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/17] lpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

2015-12-17 Thread Hannes Reinecke
On Thursday, December 17, 2015 08:03:21 AM James Smart wrote:
> On 12/17/2015 12:32 AM, Hannes Reinecke wrote:
> > Ah. So here is the missing 32G speed.
> > 
> > Should be moved into the 'Fix RDP Speed reporting' patch, no?
> 
> which of these 2 patches is not that meaningful.
> 
Yeah, and not that big deal.

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
-- 
Dr. Hannes Reinecke  zSeries & Storage
h...@suse.de+49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (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 03/17] lpfc: Added throttle logging support.

2015-12-17 Thread James Smart
The real issue is when extended logging is turned on, which is not there 
by default, then it definitely can become a problem.  I don't doubt 
other drivers hit it too.


I can understand solving this generically and I'm sure there's much 
better people than I to solve the issue at the kernel level.


-- james s


On 12/17/2015 12:14 AM, Hannes Reinecke wrote:

On 12/17/2015 12:11 AM, James Smart wrote:


Implemented a throttle on error logging.


Weee ... that stuff doesn't really belong into the driver.

_If_ that really is an issue it should be moved into a generic helper, 
as other drivers will have the same problem.
There also have been quite some discussions at KS about how to handle 
high-volume logging traffic; also systemd implements its own handling, 
too.


So it really needs to be discussed separately, and not implemented 
within a driver.


Cheers,

Hannes


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


Re: [PATCH 14/17] lpfc: Add logging for misconfigured optics.

2015-12-17 Thread James Smart



On 12/17/2015 12:38 AM, Hannes Reinecke wrote:

On 12/17/2015 12:12 AM, James Smart wrote:



Why isn't this special cased anymore? Is it now supported by all HBAs?



Yes - if and when/where an async event is generated by the adapter is in 
the fw. The special casing wasn't needed in the first place.





Hmm. How does this pan out on older cards?
Does every card sending out this event support the optic 
misconfiguration detection? Or is there a chance that we lose the link 
just because the event isn't properly implemented and we detect it as 
non-operational?




Every card could - but whether it does is specific to the card and how 
it was built and the restrictions made on that card type. The adapter 
itself manages that. The event to the driver is solely for reporting.  
The driver can't influence optics behavior.


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


Re: [PATCH 08/17] lpfc: Fix RDP Speed reporting.

2015-12-17 Thread James Smart

See patch 11/17 for the 32G additions

-- james s

On 12/17/2015 12:25 AM, Hannes Reinecke wrote:

What happened to 32G? Has development ceased on that?

Cheers,

Hannes


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


Re: [PATCH 3/3] block: Export max_dev_sectors_kb in sysfs

2015-12-17 Thread Ewan Milne
On Wed, 2015-12-16 at 17:53 -0500, Martin K. Petersen wrote:
> Some storage devices report a maximum transfer length which indicates
> the maximum size of an I/O request that the device can process. This
> limit is enforced in combination with the controller's max_hw_sectors
> and DMA constraints to ensure that we do not issue a command too big for
> the device.
> 
> Export the max_dev_sectors_kb queue limit in sysfs and update the
> documentation accordingly.
> 
> Signed-off-by: Martin K. Petersen 
> ---
>  Documentation/ABI/testing/sysfs-block |  9 +
>  Documentation/block/queue-sysfs.txt   | 11 +--
>  block/blk-settings.c  |  4 +++-
>  block/blk-sysfs.c | 13 +
>  4 files changed, 34 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/ABI/testing/sysfs-block 
> b/Documentation/ABI/testing/sysfs-block
> index 71d184dbb70d..4f284d38c085 100644
> --- a/Documentation/ABI/testing/sysfs-block
> +++ b/Documentation/ABI/testing/sysfs-block
> @@ -235,3 +235,12 @@ Description:
>   write_same_max_bytes is 0, write same is not supported
>   by the device.
>  
> +What:/sys/block//queue/max_dev_sectors_kb
> +Date:December 2015
> +Contact: Martin K. Petersen 
> +Description:
> + Some storage devices report the maximum size that the
> + device can process in a single READ or WRITE
> + request. This limit is used in combination with
> + constraints set by the controller driver to limit the
> + size of filesystem requests.
> diff --git a/Documentation/block/queue-sysfs.txt 
> b/Documentation/block/queue-sysfs.txt
> index e5d914845be6..a078995f3eae 100644
> --- a/Documentation/block/queue-sysfs.txt
> +++ b/Documentation/block/queue-sysfs.txt
> @@ -55,9 +55,15 @@ logical_block_size (RO)
>  ---
>  This is the logcal block size of the device, in bytes.
>  
> +max_dev_sectors_kb (R)
> +--
> +This is the maximum number of kilobytes supported by the storage device
> +for a READ or WRITE request.
> +
>  max_hw_sectors_kb (RO)
>  --
> -This is the maximum number of kilobytes supported in a single data transfer.
> +This is the maximum number of kilobytes supported by the storage
> +controller in a single data transfer.
>  
>  max_integrity_segments (RO)
>  ---
> @@ -68,7 +74,8 @@ max_sectors_kb (RW)
>  ---
>  This is the maximum number of kilobytes that the block layer will allow
>  for a filesystem request. Must be smaller than or equal to the maximum
> -size allowed by the hardware.
> +size allowed by the storage controller (max_hw_sectors_kb) and the
> +maximum size allowed by the storage device (max_dev_sectors_kb).
>  
>  max_segments (RO)
>  -
> diff --git a/block/blk-settings.c b/block/blk-settings.c
> index dd4973583978..362b0179c86a 100644
> --- a/block/blk-settings.c
> +++ b/block/blk-settings.c
> @@ -232,7 +232,9 @@ EXPORT_SYMBOL(blk_queue_bounce_limit);
>   *max_sectors is a soft limit imposed by the block layer for
>   *filesystem type requests.  This value can be overridden on a
>   *per-device basis in /sys/block//queue/max_sectors_kb.
> - *The soft limit can not exceed max_hw_sectors.
> + *
> + *The soft limit's lower bound is the page cache size and it can not
> + *exceed neither max_hw_sectors, nor max_dev_sectors.
>   **/
>  void blk_queue_max_hw_sectors(struct request_queue *q, unsigned int 
> max_hw_sectors)
>  {
> diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
> index e140cc487ce1..c289f9f6dcd9 100644
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -225,6 +225,13 @@ static ssize_t queue_max_hw_sectors_show(struct 
> request_queue *q, char *page)
>   return queue_var_show(max_hw_sectors_kb, (page));
>  }
>  
> +static ssize_t queue_max_dev_sectors_show(struct request_queue *q, char 
> *page)
> +{
> + int max_dev_sectors_kb = q->limits.max_dev_sectors >> 1;

Consider adding inline queue_max_dev_sectors() to blkdev.h and using it
in the line above?

> +
> + return queue_var_show(max_dev_sectors_kb, (page));
> +}
> +
>  #define QUEUE_SYSFS_BIT_FNS(name, flag, neg) \
>  static ssize_t   
> \
>  queue_show_##name(struct request_queue *q, char *page)   
> \
> @@ -371,6 +378,11 @@ static struct queue_sysfs_entry 
> queue_max_hw_sectors_entry = {
>   .show = queue_max_hw_sectors_show,
>  };
>  
> +static struct queue_sysfs_entry queue_max_dev_sectors_entry = {
> + .attr = {.name = "max_dev_sectors_kb", .mode = S_IRUGO },
> + .show = queue_max_dev_sectors_show,
> +};
> +
>  static struct queue_sysfs_entry queue_max_segments_entry = {
>   .attr = {.name = "max_segments", .mode = S_IRUGO },
>   .show = queue_max_segments_show,
> @@ -483,6 +495,7 @@

Re: [PATCH 2/3] sd: Reject optimal transfer length smaller than page size

2015-12-17 Thread Ewan Milne
On Wed, 2015-12-16 at 17:53 -0500, Martin K. Petersen wrote:
> Eryu Guan reported that loading scsi_debug would fail. This turned out
> to be caused by scsi_debug reporting an optimal I/O size of 32KB which
> is smaller than the 64KB page size on the PowerPC system in question.
> 
> Add a check to ensure that we only use the device-reported OPTIMAL
> TRANSFER LENGTH if it is bigger than or equal to the page cache size.
> 
> Reported-by: Eryu Guan 
> Reported-by: Ming Lei 
> Signed-off-by: Martin K. Petersen 
> ---
>  drivers/scsi/sd.c | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index 3d22fc3e3c1a..4e08d1cd704d 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -2885,10 +2885,13 @@ static int sd_revalidate_disk(struct gendisk *disk)
>  
>   /*
>* Use the device's preferred I/O size for reads and writes
> -  * unless the reported value is unreasonably large (or garbage).
> +  * unless the reported value is unreasonably small, large, or
> +  * garbage.
>*/
> - if (sdkp->opt_xfer_blocks && sdkp->opt_xfer_blocks <= dev_max &&
> - sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS)
> + if (sdkp->opt_xfer_blocks &&
> + sdkp->opt_xfer_blocks <= dev_max &&
> + sdkp->opt_xfer_blocks <= SD_DEF_XFER_BLOCKS &&
> + sdkp->opt_xfer_blocks * sdp->sector_size >= PAGE_CACHE_SIZE)
>   rw_max = q->limits.io_opt =
>   logical_to_sectors(sdp, sdkp->opt_xfer_blocks);
>   else

Reviewed-by: Ewan D. Milne 


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


Re: [PATCH 1/3] scsi_debug: Increase the reported optimal transfer length

2015-12-17 Thread Ewan Milne
On Wed, 2015-12-16 at 17:53 -0500, Martin K. Petersen wrote:
> The OPTIMAL TRANSFER LENGTH reported by scsi_debug is 64 blocks which
> translates to 32KB with the default logical block size. That's much
> lower than what real storage devices typically report (256KB to 1MB).
> 
> Bump the optimal transfer length to 1024 blocks.
> 
> Signed-off-by: Martin K. Petersen 
> ---
>  drivers/scsi/scsi_debug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
> index d09d60293c27..b80b037f2982 100644
> --- a/drivers/scsi/scsi_debug.c
> +++ b/drivers/scsi/scsi_debug.c
> @@ -129,7 +129,7 @@ static const char *scsi_debug_version_date = "20141022";
>  #define DEF_NO_LUN_0   0
>  #define DEF_NUM_PARTS   0
>  #define DEF_OPTS   0
> -#define DEF_OPT_BLKS 64
> +#define DEF_OPT_BLKS 1024
>  #define DEF_PHYSBLK_EXP 0
>  #define DEF_PTYPE   0
>  #define DEF_REMOVABLE false
> @@ -4140,7 +4140,7 @@ MODULE_PARM_DESC(no_lun_0, "no LU number 0 (def=0 -> 
> have lun 0)");
>  MODULE_PARM_DESC(no_uld, "stop ULD (e.g. sd driver) attaching (def=0))");
>  MODULE_PARM_DESC(num_parts, "number of partitions(def=0)");
>  MODULE_PARM_DESC(num_tgts, "number of targets per host to simulate(def=1)");
> -MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)");
> +MODULE_PARM_DESC(opt_blks, "optimal transfer length in blocks (def=1024)");
>  MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 
> 8->recovered_err... (def=0)");
>  MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
>  MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");

Reviewed-by: Ewan D. Milne 


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


Re: [patch] qla2xxx: fix a timeout loop

2015-12-17 Thread Dan Carpenter
On Wed, Dec 16, 2015 at 05:50:17PM -0500, Martin K. Petersen wrote:
> > "Dan" == Dan Carpenter  writes:
> 
> Dan> After the loop we test for "if (!retries) " as a failure, but
> Dan> actually the post-op here will end with retries set to -1.  I have
> Dan> fixed this by using a pre-op instead.
> 
> Applied to 4.4/scsi-fixes.
> 

The qlogic devs asked me to redo this patch but you have already applied
it.  Should I resend or redo it on top of the earlier patch.  (James's
tree was rebaseable for a day after a patch was "applied".)

regards,
dan carpenter

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


Re: [RFC PATCH] lpfc: Add lockdep assertions

2015-12-17 Thread Bart Van Assche

On 12/17/2015 09:49 AM, Johannes Thumshirn wrote:

On Wed, Dec 16, 2015 at 03:22:50PM -0800, James Smart wrote:

Johannes,

Thank you for the time and effort on the patch. At this time, as it doesn't
functionally change anything, I did not include the patch. I will consider
it if we see additional issues it can help resolve.


As I already said in the patch mail, I'm not sure if it is of intereset for
upstream, but can actually be quite handy to find something if it goes wrong.


I'd like to see this patch being merged upstream. lockdep_assert_held() 
statements are checked at runtime when using a debug kernel, which is 
not the case for comments that document locking conventions.


Thanks,

Bart.

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


Re: [RFC PATCH] lpfc: Add lockdep assertions

2015-12-17 Thread Johannes Thumshirn
On Wed, Dec 16, 2015 at 03:22:50PM -0800, James Smart wrote:
> Johannes,
> 
> Thank you for the time and effort on the patch. At this time, as it doesn't
> functionally change anything, I did not include the patch. I will consider
> it if we see additional issues it can help resolve.

As I already said in the patch mail, I'm not sure if it is of intereset for
upstream, but can actually be quite handy to find something if it goes wrong.

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


Re: [PATCH 17/17] lpfc: Update version to 11.0.0.10 for upstream patch set

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Update version to 11.0.0.10 for upstream patch set

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 ea53aa6..4dc2256 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.0.0.0."
+#define LPFC_DRIVER_VERSION "11.0.0.10."
  #define LPFC_DRIVER_NAME  "lpfc"

  /* Used for SLI 2/3 */


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 16/17] lpfc: Use kzalloc instead of kmalloc

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


From:   Punit Vara 

This patch is to the lpfc_els.c which resolves following warning
reported by coccicheck:

WARNING: kzalloc should be used for rdp_context, instead of
kmalloc/memset

Signed-off-by: Punit Vara 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_els.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 273a1db..7f5abb8 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -5016,13 +5016,12 @@ lpfc_els_rcv_rdp(struct lpfc_vport *vport, struct 
lpfc_iocbq *cmdiocb,
if (RDP_NPORT_ID_SIZE !=
be32_to_cpu(rdp_req->nport_id_desc.length))
goto rjt_logerr;
-   rdp_context = kmalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
+   rdp_context = kzalloc(sizeof(struct lpfc_rdp_context), GFP_KERNEL);
if (!rdp_context) {
rjt_err = LSRJT_UNABLE_TPC;
goto error;
}

-   memset(rdp_context, 0, sizeof(struct lpfc_rdp_context));
cmd = &cmdiocb->iocb;
rdp_context->ndlp = lpfc_nlp_get(ndlp);
rdp_context->ox_id = cmd->unsli3.rcvsli3.ox_id;


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 14/17] lpfc: Add logging for misconfigured optics.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Add logging for misconfigured optics acqe reported by fw.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_hw4.h  | 51 
  drivers/scsi/lpfc/lpfc_init.c | 67 ++-
  drivers/scsi/lpfc/lpfc_sli4.h |  1 +
  3 files changed, 87 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
index f13a76a..608f941 100644
--- a/drivers/scsi/lpfc/lpfc_hw4.h
+++ b/drivers/scsi/lpfc/lpfc_hw4.h
@@ -3448,23 +3448,50 @@ struct lpfc_acqe_fc_la {
  struct lpfc_acqe_misconfigured_event {
struct {
uint32_t word0;
-#define lpfc_sli_misconfigured_port0_SHIFT 0
-#define lpfc_sli_misconfigured_port0_MASK  0x00FF
-#define lpfc_sli_misconfigured_port0_WORD  word0
-#define lpfc_sli_misconfigured_port1_SHIFT 8
-#define lpfc_sli_misconfigured_port1_MASK  0x00FF
-#define lpfc_sli_misconfigured_port1_WORD  word0
-#define lpfc_sli_misconfigured_port2_SHIFT 16
-#define lpfc_sli_misconfigured_port2_MASK  0x00FF
-#define lpfc_sli_misconfigured_port2_WORD  word0
-#define lpfc_sli_misconfigured_port3_SHIFT 24
-#define lpfc_sli_misconfigured_port3_MASK  0x00FF
-#define lpfc_sli_misconfigured_port3_WORD  word0
+#define lpfc_sli_misconfigured_port0_state_SHIFT   0
+#define lpfc_sli_misconfigured_port0_state_MASK0x00FF
+#define lpfc_sli_misconfigured_port0_state_WORDword0
+#define lpfc_sli_misconfigured_port1_state_SHIFT   8
+#define lpfc_sli_misconfigured_port1_state_MASK0x00FF
+#define lpfc_sli_misconfigured_port1_state_WORDword0
+#define lpfc_sli_misconfigured_port2_state_SHIFT   16
+#define lpfc_sli_misconfigured_port2_state_MASK0x00FF
+#define lpfc_sli_misconfigured_port2_state_WORDword0
+#define lpfc_sli_misconfigured_port3_state_SHIFT   24
+#define lpfc_sli_misconfigured_port3_state_MASK0x00FF
+#define lpfc_sli_misconfigured_port3_state_WORDword0
+   uint32_t word1;
+#define lpfc_sli_misconfigured_port0_op_SHIFT  0
+#define lpfc_sli_misconfigured_port0_op_MASK   0x0001
+#define lpfc_sli_misconfigured_port0_op_WORD   word1
+#define lpfc_sli_misconfigured_port0_severity_SHIFT1
+#define lpfc_sli_misconfigured_port0_severity_MASK 0x0003
+#define lpfc_sli_misconfigured_port0_severity_WORD word1
+#define lpfc_sli_misconfigured_port1_op_SHIFT  8
+#define lpfc_sli_misconfigured_port1_op_MASK   0x0001
+#define lpfc_sli_misconfigured_port1_op_WORD   word1
+#define lpfc_sli_misconfigured_port1_severity_SHIFT9
+#define lpfc_sli_misconfigured_port1_severity_MASK 0x0003
+#define lpfc_sli_misconfigured_port1_severity_WORD word1
+#define lpfc_sli_misconfigured_port2_op_SHIFT  16
+#define lpfc_sli_misconfigured_port2_op_MASK   0x0001
+#define lpfc_sli_misconfigured_port2_op_WORD   word1
+#define lpfc_sli_misconfigured_port2_severity_SHIFT17
+#define lpfc_sli_misconfigured_port2_severity_MASK 0x0003
+#define lpfc_sli_misconfigured_port2_severity_WORD word1
+#define lpfc_sli_misconfigured_port3_op_SHIFT  24
+#define lpfc_sli_misconfigured_port3_op_MASK   0x0001
+#define lpfc_sli_misconfigured_port3_op_WORD   word1
+#define lpfc_sli_misconfigured_port3_severity_SHIFT25
+#define lpfc_sli_misconfigured_port3_severity_MASK 0x0003
+#define lpfc_sli_misconfigured_port3_severity_WORD word1
} theEvent;
  #define LPFC_SLI_EVENT_STATUS_VALID   0x00
  #define LPFC_SLI_EVENT_STATUS_NOT_PRESENT 0x01
  #define LPFC_SLI_EVENT_STATUS_WRONG_TYPE  0x02
  #define LPFC_SLI_EVENT_STATUS_UNSUPPORTED 0x03
+#define LPFC_SLI_EVENT_STATUS_UNQUALIFIED  0x04
+#define LPFC_SLI_EVENT_STATUS_UNCERTIFIED  0x05
  };

  struct lpfc_acqe_sli {
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index fdf750e..b94d114 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4079,22 +4079,18 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct 
lpfc_acqe_sli *acqe_sli)
char message[128];
uint8_t status;
uint8_t evt_type;
+   uint8_t operational = 0;
struct temp_event temp_event_data;
struct lpfc_acqe_misconfigured_event *misconfigured;
struct Scsi_Host  *shost;

evt_type = bf_get(lpfc_trailer_type, acqe_sli);

-   /* Special case Lancer */
-   if (bf_get(lpfc_sli_intf_if_type, &phba->sli4_hba.sli_intf) !=
-LPFC_SLI_INTF_IF_TYPE_2) {
-   lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-   "2901 Async SLI event - Event Data1:x%08x Event 
Data2:"
-   "

Re: [PATCH 15/17] lpfc: Delete unnecessary checks before the function call "mempool_destroy"

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


From: Markus Elfring 

The mempool_destroy() function tests whether its argument is NULL
and then returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_mem.c | 6 ++
  1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_mem.c b/drivers/scsi/lpfc/lpfc_mem.c
index 3fa6533..4fb3581 100644
--- a/drivers/scsi/lpfc/lpfc_mem.c
+++ b/drivers/scsi/lpfc/lpfc_mem.c
@@ -231,15 +231,13 @@ lpfc_mem_free(struct lpfc_hba *phba)
if (phba->lpfc_hbq_pool)
pci_pool_destroy(phba->lpfc_hbq_pool);
phba->lpfc_hbq_pool = NULL;
-
-   if (phba->rrq_pool)
-   mempool_destroy(phba->rrq_pool);
+   mempool_destroy(phba->rrq_pool);
phba->rrq_pool = NULL;

/* Free NLP memory pool */
mempool_destroy(phba->nlp_mem_pool);
phba->nlp_mem_pool = NULL;
-   if (phba->sli_rev == LPFC_SLI_REV4 && phba->active_rrq_pool) {
+   if (phba->sli_rev == LPFC_SLI_REV4) {
mempool_destroy(phba->active_rrq_pool);
phba->active_rrq_pool = NULL;
}


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 13/17] lpfc: Fix external loopback failure.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Fix external loopback failure.

Rx sequence reassembly was incorrect.

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

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index e504d51..b4bff35 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -14849,10 +14849,12 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct 
hbq_dmabuf *dmabuf)
struct lpfc_dmabuf *h_buf;
struct hbq_dmabuf *seq_dmabuf = NULL;
struct hbq_dmabuf *temp_dmabuf = NULL;
+   uint8_t found = 0;

INIT_LIST_HEAD(&dmabuf->dbuf.list);
dmabuf->time_stamp = jiffies;
new_hdr = (struct fc_frame_header *)dmabuf->hbuf.virt;
+
/* Use the hdr_buf to find the sequence that this frame belongs to */
list_for_each_entry(h_buf, &vport->rcv_buffer_list, list) {
temp_hdr = (struct fc_frame_header *)h_buf->virt;
@@ -14892,7 +14894,8 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct 
hbq_dmabuf *dmabuf)
return seq_dmabuf;
}
/* find the correct place in the sequence to insert this frame */
-   list_for_each_entry_reverse(d_buf, &seq_dmabuf->dbuf.list, list) {
+   d_buf = list_entry(seq_dmabuf->dbuf.list.prev, typeof(*d_buf), list);
+   while (!found) {
temp_dmabuf = container_of(d_buf, struct hbq_dmabuf, dbuf);
temp_hdr = (struct fc_frame_header *)temp_dmabuf->hbuf.virt;
/*
@@ -14902,9 +14905,17 @@ lpfc_fc_frame_add(struct lpfc_vport *vport, struct 
hbq_dmabuf *dmabuf)
if (be16_to_cpu(new_hdr->fh_seq_cnt) >
be16_to_cpu(temp_hdr->fh_seq_cnt)) {
list_add(&dmabuf->dbuf.list, &temp_dmabuf->dbuf.list);
-   return seq_dmabuf;
+   found = 1;
+   break;
}
+
+   if (&d_buf->list == &seq_dmabuf->dbuf.list)
+   break;
+   d_buf = list_entry(d_buf->list.prev, typeof(*d_buf), list);
}
+
+   if (found)
+   return seq_dmabuf;
return NULL;
  }



Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 11/17] lpfc: Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Use new FDMI speed definitions for 10G, 25G and 40G FCoE.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_attr.c|   2 +-
  drivers/scsi/lpfc/lpfc_ct.c  | 146 ++-
  drivers/scsi/lpfc/lpfc_els.c |   3 +
  drivers/scsi/lpfc/lpfc_hbadisc.c |  29 
  drivers/scsi/lpfc/lpfc_hw4.h |   1 +
  drivers/scsi/lpfc/lpfc_init.c|  95 -
  drivers/scsi/lpfc/lpfc_scsi.c|  10 +--
  7 files changed, 150 insertions(+), 136 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index be40266..46b2a44 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -5271,7 +5271,7 @@ lpfc_get_host_speed(struct Scsi_Host *shost)

spin_lock_irq(shost->host_lock);

-   if (lpfc_is_link_up(phba)) {
+   if ((lpfc_is_link_up(phba)) && (!(phba->hba_flag & HBA_FCOE_MODE))) {
switch(phba->fc_linkspeed) {
case LPFC_LINK_SPEED_1GHZ:
fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c
index ac6e087..79e261d 100644
--- a/drivers/scsi/lpfc/lpfc_ct.c
+++ b/drivers/scsi/lpfc/lpfc_ct.c
@@ -48,15 +48,26 @@
  #include "lpfc_vport.h"
  #include "lpfc_debugfs.h"

-/* FDMI Port Speed definitions */
-#define HBA_PORTSPEED_1GBIT0x0001  /* 1 GBit/sec */
-#define HBA_PORTSPEED_2GBIT0x0002  /* 2 GBit/sec */
-#define HBA_PORTSPEED_4GBIT0x0008  /* 4 GBit/sec */
-#define HBA_PORTSPEED_10GBIT   0x0004  /* 10 GBit/sec */
-#define HBA_PORTSPEED_8GBIT0x0010  /* 8 GBit/sec */
-#define HBA_PORTSPEED_16GBIT   0x0020  /* 16 GBit/sec */
-#define HBA_PORTSPEED_32GBIT   0x0040  /* 32 GBit/sec */
-#define HBA_PORTSPEED_UNKNOWN  0x0800  /* Unknown */
+/* FDMI Port Speed definitions - FC-GS-7 */
+#define HBA_PORTSPEED_1GFC 0x0001  /* 1G FC */
+#define HBA_PORTSPEED_2GFC 0x0002  /* 2G FC */
+#define HBA_PORTSPEED_4GFC 0x0008  /* 4G FC */
+#define HBA_PORTSPEED_10GFC0x0004  /* 10G FC */
+#define HBA_PORTSPEED_8GFC 0x0010  /* 8G FC */
+#define HBA_PORTSPEED_16GFC0x0020  /* 16G FC */
+#define HBA_PORTSPEED_32GFC0x0040  /* 32G FC */
+#define HBA_PORTSPEED_20GFC0x0080  /* 20G FC */
+#define HBA_PORTSPEED_40GFC0x0100  /* 40G FC */
+#define HBA_PORTSPEED_128GFC   0x0200  /* 128G FC */
+#define HBA_PORTSPEED_64GFC0x0400  /* 64G FC */
+#define HBA_PORTSPEED_256GFC   0x0800  /* 256G FC */
+#define HBA_PORTSPEED_UNKNOWN  0x8000  /* Unknown */
+#define HBA_PORTSPEED_10GE 0x0001  /* 10G E */
+#define HBA_PORTSPEED_40GE 0x0002  /* 40G E */
+#define HBA_PORTSPEED_100GE0x0004  /* 100G E */
+#define HBA_PORTSPEED_25GE 0x0008  /* 25G E */
+#define HBA_PORTSPEED_50GE 0x0010  /* 50G E */
+#define HBA_PORTSPEED_400GE0x0020  /* 400G E */

  #define FOURBYTES 4

@@ -1921,20 +1932,38 @@ lpfc_fdmi_port_attr_support_speed(struct lpfc_vport 
*vport,
ae = (struct lpfc_fdmi_attr_entry *)&ad->AttrValue;

ae->un.AttrInt = 0;
-   if (phba->lmt & LMT_32Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_32GBIT;
-   if (phba->lmt & LMT_16Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_16GBIT;
-   if (phba->lmt & LMT_10Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_10GBIT;
-   if (phba->lmt & LMT_8Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_8GBIT;
-   if (phba->lmt & LMT_4Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_4GBIT;
-   if (phba->lmt & LMT_2Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_2GBIT;
-   if (phba->lmt & LMT_1Gb)
-   ae->un.AttrInt |= HBA_PORTSPEED_1GBIT;
+   if (!(phba->hba_flag & HBA_FCOE_MODE)) {
+   if (phba->lmt & LMT_32Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_32GFC;
+   if (phba->lmt & LMT_16Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_16GFC;
+   if (phba->lmt & LMT_10Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_10GFC;
+   if (phba->lmt & LMT_8Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_8GFC;
+   if (phba->lmt & LMT_4Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_4GFC;
+   if (phba->lmt & LMT_2Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_2GFC;
+   if (phba->lmt & LMT_1Gb)
+   ae->un.AttrInt |= HBA_PORTSPEED_1GFC;
+   } else {
+   /* FCoE links support only one speed */
+   switch (

Re: [PATCH 12/17] lpfc: Fix mbox reuse in PLOGI completion

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Fix mbox reuse in PLOGI completion. Moved allocations so that buffer
properly init'd.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_nportdisc.c | 31 +--
  1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c 
b/drivers/scsi/lpfc/lpfc_nportdisc.c
index 9e571dd..193733e 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -1045,16 +1045,6 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
if (irsp->ulpStatus)
goto out;

-   mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
-   if (!mbox) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
-"0133 PLOGI: no memory for reg_login "
-"Data: x%x x%x x%x x%x\n",
-ndlp->nlp_DID, ndlp->nlp_state,
-ndlp->nlp_flag, ndlp->nlp_rpi);
-   goto out;
-   }
-
pcmd = (struct lpfc_dmabuf *) cmdiocb->context2;

prsp = list_get_first(&pcmd->list, struct lpfc_dmabuf, list);
@@ -1118,6 +1108,17 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
if (phba->sli_rev == LPFC_SLI_REV4) {
lpfc_issue_reg_vfi(vport);
} else {
+   mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+   if (!mbox) {
+   lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+"0133 PLOGI: no memory "
+"for config_link "
+"Data: x%x x%x x%x x%x\n",
+ndlp->nlp_DID, ndlp->nlp_state,
+ndlp->nlp_flag, ndlp->nlp_rpi);
+   goto out;
+   }
+
lpfc_config_link(phba, mbox);

mbox->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
@@ -1132,6 +1133,16 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,

lpfc_unreg_rpi(vport, ndlp);

+   mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+   if (!mbox) {
+   lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+"0018 PLOGI: no memory for reg_login "
+"Data: x%x x%x x%x x%x\n",
+ndlp->nlp_DID, ndlp->nlp_state,
+ndlp->nlp_flag, ndlp->nlp_rpi);
+   goto out;
+   }
+
if (lpfc_reg_rpi(phba, vport->vpi, irsp->un.elsreq64.remoteID,
 (uint8_t *) sp, mbox, ndlp->nlp_rpi) == 0) {
switch (ndlp->nlp_DID) {


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 10/17] lpfc: Make write check error processing more resilient

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Make write check error processing more resilient.

Checks to catch writes that fw reports weren't fully complete yet SCSI
status indicated fine needed correction.

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

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index 3162469..b2414da 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3676,6 +3676,7 @@ static void
  lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
struct lpfc_iocbq *rsp_iocb)
  {
+   struct lpfc_hba *phba = vport->phba;
struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;
struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd;
struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp;
@@ -3685,6 +3686,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
uint32_t *lp;
uint32_t host_status = DID_OK;
uint32_t rsplen = 0;
+   uint32_t fcpDl;
uint32_t logit = LOG_FCP | LOG_FCP_ERROR;


@@ -3755,13 +3757,14 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
 fcprsp->rspInfo3);

scsi_set_resid(cmnd, 0);
+   fcpDl = be32_to_cpu(fcpcmd->fcpDl);
if (resp_info & RESID_UNDER) {
scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId));

lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP_UNDER,
 "9025 FCP Read Underrun, expected %d, "
 "residual %d Data: x%x x%x x%x\n",
-be32_to_cpu(fcpcmd->fcpDl),
+fcpDl,
 scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0],
 cmnd->underflow);

@@ -3777,7 +3780,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
 LOG_FCP | LOG_FCP_ERROR,
 "9026 FCP Read Check Error "
 "and Underrun Data: x%x x%x x%x x%x\n",
-be32_to_cpu(fcpcmd->fcpDl),
+fcpDl,
 scsi_get_resid(cmnd), fcpi_parm,
 cmnd->cmnd[0]);
scsi_set_resid(cmnd, scsi_bufflen(cmnd));
@@ -3812,13 +3815,25 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct 
lpfc_scsi_buf *lpfc_cmd,
 * Check SLI validation that all the transfer was actually done
 * (fcpi_parm should be zero). Apply check only to reads.
 */
-   } else if (fcpi_parm && (cmnd->sc_data_direction == DMA_FROM_DEVICE)) {
+   } else if (fcpi_parm) {
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
-"9029 FCP Read Check Error Data: "
+"9029 FCP %s Check Error xri x%x  Data: "
 "x%x x%x x%x x%x x%x\n",
-be32_to_cpu(fcpcmd->fcpDl),
-be32_to_cpu(fcprsp->rspResId),
+((cmnd->sc_data_direction == DMA_FROM_DEVICE) ?
+"Read" : "Write"),
+((phba->sli_rev == LPFC_SLI_REV4) ?
+lpfc_cmd->cur_iocbq.sli4_xritag :
+rsp_iocb->iocb.ulpContext),
+fcpDl, be32_to_cpu(fcprsp->rspResId),
 fcpi_parm, cmnd->cmnd[0], scsi_status);
+
+   /* There is some issue with the LPe12000 that causes it
+* to miscalculate the fcpi_parm and falsely trip this
+* recovery logic.  Detect this case and don't error when true.
+*/
+   if (fcpi_parm > fcpDl)
+   goto out;
+
switch (scsi_status) {
case SAM_STAT_GOOD:
case SAM_STAT_CHECK_CONDITION:


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 09/17] lpfc: Fix RDP ACC being too long.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:12 AM, James Smart wrote:


Fix RDP ACC being too long.

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

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index f7a2967..817cdfc 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4824,6 +4824,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct 
lpfc_rdp_context *rdp_context,
struct lpfc_nodelist *ndlp = rdp_context->ndlp;
struct lpfc_vport *vport = ndlp->vport;
struct lpfc_iocbq *elsiocb;
+   struct ulp_bde64 *bpl;
IOCB_t *icmd;
uint8_t *pcmd;
struct ls_rjt *stat;
@@ -4833,6 +4834,8 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct 
lpfc_rdp_context *rdp_context,

if (status != SUCCESS)
goto error;
+
+   /* This will change once we know the true size of the RDP payload */
cmdsize = sizeof(struct fc_rdp_res_frame);

elsiocb = lpfc_prep_els_iocb(vport, 0, cmdsize,
@@ -4874,6 +4877,13 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct 
lpfc_rdp_context *rdp_context,
rdp_res->length = cpu_to_be32(fec_size + RDP_DESC_PAYLOAD_SIZE);
elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;

+   /* Now that we know the true size of the payload, update the BPL */
+   bpl = (struct ulp_bde64 *)
+   (((struct lpfc_dmabuf *)(elsiocb->context3))->virt);
+   bpl->tus.f.bdeSize = (fec_size + RDP_DESC_PAYLOAD_SIZE + 8);
+   bpl->tus.f.bdeFlags = 0;
+   bpl->tus.w = le32_to_cpu(bpl->tus.w);
+
phba->fc_stat.elsXmitACC++;
rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, elsiocb, 0);
if (rc == IOCB_ERROR)


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 08/17] lpfc: Fix RDP Speed reporting.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix RDP Speed reporting.

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

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 3394648..f7a2967 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -4730,28 +4730,25 @@ lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, 
struct lpfc_hba *phba)

desc->tag = cpu_to_be32(RDP_PORT_SPEED_DESC_TAG);

-   switch (phba->sli4_hba.link_state.speed) {
-   case LPFC_FC_LA_SPEED_1G:
+   switch (phba->fc_linkspeed) {
+   case LPFC_LINK_SPEED_1GHZ:
rdp_speed = RDP_PS_1GB;
break;
-   case LPFC_FC_LA_SPEED_2G:
+   case LPFC_LINK_SPEED_2GHZ:
rdp_speed = RDP_PS_2GB;
break;
-   case LPFC_FC_LA_SPEED_4G:
+   case LPFC_LINK_SPEED_4GHZ:
rdp_speed = RDP_PS_4GB;
break;
-   case LPFC_FC_LA_SPEED_8G:
+   case LPFC_LINK_SPEED_8GHZ:
rdp_speed = RDP_PS_8GB;
break;
-   case LPFC_FC_LA_SPEED_10G:
+   case LPFC_LINK_SPEED_10GHZ:
rdp_speed = RDP_PS_10GB;
break;
-   case LPFC_FC_LA_SPEED_16G:
+   case LPFC_LINK_SPEED_16GHZ:
rdp_speed = RDP_PS_16GB;
break;
-   case LPFC_FC_LA_SPEED_32G:
-   rdp_speed = RDP_PS_32GB;
-   break;
default:
rdp_speed = RDP_PS_UNKNOWN;
break;


What happened to 32G? Has development ceased on that?

Cheers,

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


Re: [PATCH 07/17] lpfc: Modularize and cleanup FDMI code in driver

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Modularize, cleanup, add comments - for FDMI code in driver

Note: I don't like the comments with leading # - but as we have a lot if
present, I'm deferring to handle it in one big fix later.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc.h |   16 +-
  drivers/scsi/lpfc/lpfc_attr.c|   46 +-
  drivers/scsi/lpfc/lpfc_crtn.h|5 +-
  drivers/scsi/lpfc/lpfc_ct.c  | 1794 --
  drivers/scsi/lpfc/lpfc_els.c |   99 ++-
  drivers/scsi/lpfc/lpfc_hbadisc.c |   16 +-
  drivers/scsi/lpfc/lpfc_hw.h  |  184 +++-
  drivers/scsi/lpfc/lpfc_init.c|   27 +-
  drivers/scsi/lpfc/lpfc_vport.c   |8 +
  9 files changed, 1450 insertions(+), 745 deletions(-)



I would have loved to have all the attribute functions abstracted 
away by using a generic one, but still a good improvement over the 
existing code.


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: Note to driver maintainers

2015-12-17 Thread Johannes Thumshirn
On Wed, Dec 16, 2015 at 07:32:28PM -0500, Martin K. Petersen wrote:
> 
> When somebody posts a patch to a piece of code you maintain it is your
> responsibility to respond to it. That's what being a maintainer means.
> 
> There are a ton of trivial/Coccinelle fixes posted that nobody has done
> anything about. I'm not talking about spelling fixes or whitespace
> churn. Many of these patches look valid to me. There are also a few
> non-trivial patches that have gotten no attention from the relevant
> driver maintainers.
> 
> People such as Hannes, Johannes, Tomas and Christoph are reviewing
> *your* submissions, providing the mandatory impartial review tag that
> permits your patches to go into the main tree.
> 
> You can not rely on these people also taking on the burden of reviewing
> third party changes to your code. That really is your job as the driver
> maintainer. Every patch that touches code that you own demands a
> response from you. Every. Single. Patch.
> 
> We review your changes. You have to review everybody else's.
> 

One more thing. If your patches fix a bug (a good indicator is the word "fix"
in the subject or commit message), please add a

Fixes: 1234abcf 'Buggy commit'
Cc: sta...@vger.kernel.org # vX.Y

To the SOB area of your patch. This really makes our lives as distribution
maintainers - who have to care about actual users - a _lot_ easier.

Thanks,
Johannes
-- 
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


Re: [PATCH 06/17] lpfc: Fix crash in fcp command completion path.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix crash in fcp command completion path.

Missed null check.

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

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index d51f751..3162469 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -3908,9 +3908,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct 
lpfc_iocbq *pIocbIn,
uint32_t logit = LOG_FCP;

/* Sanity check on return of outstanding command */
-   if (!(lpfc_cmd->pCmd))
-   return;
cmd = lpfc_cmd->pCmd;
+   if (!cmd)
+   return;
shost = cmd->device->host;

lpfc_cmd->result = (pIocbOut->iocb.un.ulpWord[4] & IOERR_PARAM_MASK);


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 05/17] lpfc: Fix driver crash when module parameter lpfc_fcp_io_channel set to 16

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix driver crash when module parameter lpfc_fcp_io_channel set to 16

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


Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 04/17] lpfc: Fix RegLogin failed error seen on Lancer FC during port bounce

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix RegLogin failed error seen on Lancer FC during port bounce

Fix the statemachine and ref counting.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_els.c   | 14 +-
  drivers/scsi/lpfc/lpfc_hbadisc.c   |  8 
  drivers/scsi/lpfc/lpfc_nportdisc.c |  3 +++
  3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index f6dd15b..d508378 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -3779,14 +3779,17 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct 
lpfc_iocbq *cmdiocb,
lpfc_nlp_set_state(vport, ndlp,
   NLP_STE_REG_LOGIN_ISSUE);
}
+
+   ndlp->nlp_flag |= NLP_REG_LOGIN_SEND;
if (lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT)
!= MBX_NOT_FINISHED)
goto out;
-   else
-   /* Decrement the ndlp reference count we
-* set for this failed mailbox command.
-*/
-   lpfc_nlp_put(ndlp);
+
+   /* Decrement the ndlp reference count we
+* set for this failed mailbox command.
+*/
+   lpfc_nlp_put(ndlp);
+   ndlp->nlp_flag &= ~NLP_REG_LOGIN_SEND;

/* ELS rsp: Cannot issue reg_login for  */
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
@@ -3843,6 +3846,7 @@ out:
 * the routine lpfc_els_free_iocb.
 */
cmdiocb->context1 = NULL;
+
}

lpfc_els_free_iocb(phba, cmdiocb);
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
index f0777f2..b19237b 100644
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c
@@ -3452,10 +3452,10 @@ lpfc_mbx_cmpl_reg_login(struct lpfc_hba *phba, 
LPFC_MBOXQ_t *pmb)
spin_lock_irq(shost->host_lock);
ndlp->nlp_flag &= ~NLP_IGNR_REG_CMPL;
spin_unlock_irq(shost->host_lock);
-   } else
-   /* Good status, call state machine */
-   lpfc_disc_state_machine(vport, ndlp, pmb,
-   NLP_EVT_CMPL_REG_LOGIN);
+   }
+
+   /* Call state machine */
+   lpfc_disc_state_machine(vport, ndlp, pmb, NLP_EVT_CMPL_REG_LOGIN);

lpfc_mbuf_free(phba, mp->virt, mp->phys);
kfree(mp);
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c 
b/drivers/scsi/lpfc/lpfc_nportdisc.c
index daeda6d..9e571dd 100644
--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
@@ -2325,6 +2325,9 @@ lpfc_cmpl_reglogin_npr_node(struct lpfc_vport *vport,
if (vport->phba->sli_rev < LPFC_SLI_REV4)
ndlp->nlp_rpi = mb->un.varWords[0];
ndlp->nlp_flag |= NLP_RPI_REGISTERED;
+   if (ndlp->nlp_flag & NLP_LOGO_ACC) {
+   lpfc_unreg_rpi(vport, ndlp);
+   }
} else {
if (ndlp->nlp_flag & NLP_NODEV_REMOVE) {
lpfc_drop_node(vport, ndlp);


Not sure if that belong into this patch, but let's not be picky here.

Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 03/17] lpfc: Added throttle logging support.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Implemented a throttle on error logging.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc.h |  5 +++
  drivers/scsi/lpfc/lpfc_attr.c| 18 +++
  drivers/scsi/lpfc/lpfc_crtn.h|  1 +
  drivers/scsi/lpfc/lpfc_disc.h| 11 +++
  drivers/scsi/lpfc/lpfc_hbadisc.c | 23 +
  drivers/scsi/lpfc/lpfc_init.c| 70 
  drivers/scsi/lpfc/lpfc_logmsg.h  | 40 +++
  drivers/scsi/lpfc/lpfc_scsi.c| 41 ---
  drivers/scsi/lpfc/lpfc_sli.c |  7 
  9 files changed, 205 insertions(+), 11 deletions(-)


Weee ... that stuff doesn't really belong into the driver.

_If_ that really is an issue it should be moved into a generic 
helper, as other drivers will have the same problem.
There also have been quite some discussions at KS about how to 
handle high-volume logging traffic; also systemd implements its own 
handling, too.


So it really needs to be discussed separately, and not implemented 
within a driver.


Cheers,

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


Re: [PATCH 02/17] lpfc: Fix the FLOGI discovery logic to comply with T11 standards

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix the FLOGI discovery logic to comply with T11 standards

We weren't properly setting fabric parameters, such as R_A_TOV and E_D_TOV,
when we registered the vfi object in default configs and pt2pt configs.
Revise to now pass service params with the values to the firmware and
ensure they are reset on link bounce. Required reworking the call sequence
in the discovery threads.

Signed-off-by: Dick Kennedy 
Signed-off-by: James Smart 
---
  drivers/scsi/lpfc/lpfc_crtn.h  |   1 +
  drivers/scsi/lpfc/lpfc_els.c   | 342 +
  drivers/scsi/lpfc/lpfc_hbadisc.c   |  12 +-
  drivers/scsi/lpfc/lpfc_nportdisc.c | 124 --
  4 files changed, 240 insertions(+), 239 deletions(-)


I hope you know what you're doing ...

Reviewed-by: Hannes Reinecke 

Cheers,

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


Re: [PATCH 01/17] lpfc: Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.

2015-12-17 Thread Hannes Reinecke

On 12/17/2015 12:11 AM, James Smart wrote:


Fix FCF Infinite loop in lpfc_sli4_fcf_rr_next_index_get.

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

diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f9585cd..6aae828 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -16173,7 +16173,7 @@ fail_fcf_read:
  }

  /**
- * lpfc_check_next_fcf_pri
+ * lpfc_check_next_fcf_pri_level
   * phba pointer to the lpfc_hba struct for this port.
   * This routine is called from the lpfc_sli4_fcf_rr_next_index_get
   * routine when the rr_bmask is empty. The FCF indecies are put into the
@@ -16329,8 +16329,12 @@ next_priority:

if (next_fcf_index < LPFC_SLI4_FCF_TBL_INDX_MAX &&
phba->fcf.fcf_pri[next_fcf_index].fcf_rec.flag &
-   LPFC_FCF_FLOGI_FAILED)
+   LPFC_FCF_FLOGI_FAILED) {
+   if (list_is_singular(&phba->fcf.fcf_pri_list))
+   return LPFC_FCOE_FCF_NEXT_NONE;
+
goto next_priority;
+   }

lpfc_printf_log(phba, KERN_INFO, LOG_FIP,
"2845 Get next roundrobin failover FCF (x%x)\n",


Hehe. I think I've hit that one once.

Reviewed-by: Hannes Reinecke 

Cheers,

Hannes

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