Re: [PATCH v3] target/iblock: split T10 PI SGL across command bios

2018-08-31 Thread kbuild test robot
Hi Greg,

Thank you for the patch! Perhaps something to improve:

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

url:
https://github.com/0day-ci/linux/commits/Greg-Edwards/target-iblock-split-T10-PI-SGL-across-command-bios/20180831-204618
base:   https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git 
for-next
config: i386-randconfig-h1-09010405 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All warnings (new ones prefixed by >>):

   drivers//target/target_core_iblock.c: In function 'iblock_alloc_bip':
   drivers//target/target_core_iblock.c:663:2: error: implicit declaration of 
function 'bio_integrity_bytes' [-Werror=implicit-function-declaration]
 bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
 ^
   In file included from include/linux/printk.h:329:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from drivers//target/target_core_iblock.c:29:
>> include/linux/dynamic_debug.h:75:16: warning: format '%lu' expects argument 
>> of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat=]
 static struct _ddebug  __aligned(8)   \
   ^
   include/linux/dynamic_debug.h:111:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
 DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
 ^
   include/linux/dynamic_debug.h:125:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA'
 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
 ^
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
 dynamic_pr_debug(fmt, ##__VA_ARGS__)
 ^
   drivers//target/target_core_iblock.c:681:3: note: in expansion of macro 
'pr_debug'
  pr_debug("Added bio integrity page: %p length: %lu offset: %lu\n",
  ^
   cc1: some warnings being treated as errors
--
   drivers/target/target_core_iblock.c: In function 'iblock_alloc_bip':
   drivers/target/target_core_iblock.c:663:2: error: implicit declaration of 
function 'bio_integrity_bytes' [-Werror=implicit-function-declaration]
 bip->bip_iter.bi_size = bio_integrity_bytes(bi, bio_sectors(bio));
 ^
   In file included from include/linux/printk.h:329:0,
from include/linux/kernel.h:14,
from include/linux/list.h:9,
from include/linux/timer.h:5,
from drivers/target/target_core_iblock.c:29:
>> include/linux/dynamic_debug.h:75:16: warning: format '%lu' expects argument 
>> of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat=]
 static struct _ddebug  __aligned(8)   \
   ^
   include/linux/dynamic_debug.h:111:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
 DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
 ^
   include/linux/dynamic_debug.h:125:2: note: in expansion of macro 
'DEFINE_DYNAMIC_DEBUG_METADATA'
 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
 ^
   include/linux/printk.h:333:2: note: in expansion of macro 'dynamic_pr_debug'
 dynamic_pr_debug(fmt, ##__VA_ARGS__)
 ^
   drivers/target/target_core_iblock.c:681:3: note: in expansion of macro 
'pr_debug'
  pr_debug("Added bio integrity page: %p length: %lu offset: %lu\n",
  ^
   cc1: some warnings being treated as errors

vim +75 include/linux/dynamic_debug.h

ffa10cb4 Jason Baron 2011-08-11  68  
b9075fa9 Joe Perches 2011-10-31  69  extern __printf(3, 4)
906d2015 Joe Perches 2014-09-24  70  void __dynamic_netdev_dbg(struct _ddebug 
*descriptor,
ffa10cb4 Jason Baron 2011-08-11  71   const struct 
net_device *dev,
b9075fa9 Joe Perches 2011-10-31  72   const char *fmt, ...);
ffa10cb4 Jason Baron 2011-08-11  73  
9049fc74 Jason Baron 2016-08-03  74  #define 
DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, key, init)\
c0d2af63 Joe Perches 2012-10-18 @75 static struct _ddebug  __aligned(8) 
\
07613b0b Jason Baron 2011-10-04  76 __attribute__((section("__verbose"))) 
name = {  \
07613b0b Jason Baron 2011-10-04  77 .modname = KBUILD_MODNAME,  
\
07613b0b Jason Baron 2011-10-04  78 .function = __func__,   
\
07613b0b Jason Baron 2011-10-04  79 .filename = __FILE__,   
\
07613b0b Jason Baron 2011-10-04  80 .format = (fmt),
\
07613b0b Jason Baron 2011-10-04  81 .lineno = __LINE__, 
\
07613b0b Jason

[PATCH v2 02/14] qla2xxx: Fix incorrect port speed being set for FC adapters

2018-08-31 Thread Himanshu Madhani
Fixes: 6246b8a1d26c7c ("[SCSI] qla2xxx: Enhancements to support ISP83xx.")
Fixes: 1bb395485160d2 ("qla2xxx: Correct iiDMA-update calling conventions.")
Cc: 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_mbx.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 2c6c2cd5a0d0..c73039916c03 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3762,10 +3762,7 @@ qla2x00_set_idma_speed(scsi_qla_host_t *vha, uint16_t 
loop_id,
mcp->mb[0] = MBC_PORT_PARAMS;
mcp->mb[1] = loop_id;
mcp->mb[2] = BIT_0;
-   if (IS_CNA_CAPABLE(vha->hw))
-   mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0);
-   else
-   mcp->mb[3] = port_speed & (BIT_2|BIT_1|BIT_0);
+   mcp->mb[3] = port_speed & (BIT_5|BIT_4|BIT_3|BIT_2|BIT_1|BIT_0);
mcp->mb[9] = vha->vp_idx;
mcp->out_mb = MBX_9|MBX_3|MBX_2|MBX_1|MBX_0;
mcp->in_mb = MBX_3|MBX_1|MBX_0;
-- 
2.12.0



[PATCH v2 03/14] qla2xxx: Use correct qpair for ABTS/CMD

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

On Abort of initiator scsi command, the abort needs to
follow the same qpair as the the scsi command to prevent
out of order processing.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c | 15 +--
 drivers/scsi/qla2xxx/qla_iocb.c | 12 +++-
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 4686fb5f26aa..3eb3c4f554fa 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1747,18 +1747,18 @@ int
 qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
 {
scsi_qla_host_t *vha = cmd_sp->vha;
-   fc_port_t *fcport = cmd_sp->fcport;
struct srb_iocb *abt_iocb;
srb_t *sp;
int rval = QLA_FUNCTION_FAILED;
 
-   sp = qla2x00_get_sp(vha, fcport, GFP_KERNEL);
+   sp = qla2xxx_get_qpair_sp(cmd_sp->qpair, cmd_sp->fcport, GFP_KERNEL);
if (!sp)
goto done;
 
abt_iocb = >u.iocb_cmd;
sp->type = SRB_ABT_CMD;
sp->name = "abort";
+   sp->qpair = cmd_sp->qpair;
if (wait)
sp->flags = SRB_WAKEUP_ON_COMP;
 
@@ -1767,12 +1767,7 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
qla2x00_init_timer(sp, qla2x00_get_async_timeout(vha));
 
abt_iocb->u.abt.cmd_hndl = cmd_sp->handle;
-
-   if (vha->flags.qpairs_available && cmd_sp->qpair)
-   abt_iocb->u.abt.req_que_no =
-   cpu_to_le16(cmd_sp->qpair->req->id);
-   else
-   abt_iocb->u.abt.req_que_no = cpu_to_le16(vha->req->id);
+   abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id);
 
sp->done = qla24xx_abort_sp_done;
 
@@ -1781,8 +1776,8 @@ qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
goto done_free_sp;
 
ql_dbg(ql_dbg_async, vha, 0x507c,
-   "Abort command issued - hdl=%x, target_id=%x\n",
-   cmd_sp->handle, fcport->tgt_id);
+   "Abort command issued - hdl=%x, type=%x\n",
+   cmd_sp->handle, cmd_sp->type);
 
if (wait) {
wait_for_completion(_iocb->u.abt.comp);
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 119927220299..c699bbb8485b 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -3297,19 +3297,21 @@ qla24xx_abort_iocb(srb_t *sp, struct abort_entry_24xx 
*abt_iocb)
 {
struct srb_iocb *aio = >u.iocb_cmd;
scsi_qla_host_t *vha = sp->vha;
-   struct req_que *req = vha->req;
+   struct req_que *req = sp->qpair->req;
 
memset(abt_iocb, 0, sizeof(struct abort_entry_24xx));
abt_iocb->entry_type = ABORT_IOCB_TYPE;
abt_iocb->entry_count = 1;
abt_iocb->handle = cpu_to_le32(MAKE_HANDLE(req->id, sp->handle));
-   abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+   if (sp->fcport) {
+   abt_iocb->nport_handle = cpu_to_le16(sp->fcport->loop_id);
+   abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
+   abt_iocb->port_id[1] = sp->fcport->d_id.b.area;
+   abt_iocb->port_id[2] = sp->fcport->d_id.b.domain;
+   }
abt_iocb->handle_to_abort =
cpu_to_le32(MAKE_HANDLE(aio->u.abt.req_que_no,
aio->u.abt.cmd_hndl));
-   abt_iocb->port_id[0] = sp->fcport->d_id.b.al_pa;
-   abt_iocb->port_id[1] = sp->fcport->d_id.b.area;
-   abt_iocb->port_id[2] = sp->fcport->d_id.b.domain;
abt_iocb->vp_index = vha->vp_idx;
abt_iocb->req_que_no = cpu_to_le16(aio->u.abt.req_que_no);
/* Send the command to the firmware */
-- 
2.12.0



[PATCH v2 10/14] qla2xxx: Remove all rports if fabric scan retry fails

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

When all fabric scan retries fail, remove all RPorts, DMA resources
for the command otherwise we have stale Rports.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_gs.c | 128 +-
 1 file changed, 64 insertions(+), 64 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 1cb27eb46731..85cbe59b4f58 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3995,6 +3995,41 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, 
srb_t *sp)
}
 }
 
+static int qla2x00_post_gnnft_gpnft_done_work(struct scsi_qla_host *vha,
+srb_t *sp, int cmd)
+{
+   struct qla_work_evt *e;
+
+   if (cmd != QLA_EVT_GPNFT_DONE && cmd != QLA_EVT_GNNFT_DONE)
+   return QLA_PARAMETER_ERROR;
+
+   e = qla2x00_alloc_work(vha, cmd);
+   if (!e)
+   return QLA_FUNCTION_FAILED;
+
+   e->u.iosb.sp = sp;
+
+   return qla2x00_post_work(vha, e);
+}
+
+static int qla2x00_post_nvme_gpnft_done_work(struct scsi_qla_host *vha,
+srb_t *sp, int cmd)
+{
+   struct qla_work_evt *e;
+
+   if (cmd != QLA_EVT_GPNFT)
+   return QLA_PARAMETER_ERROR;
+
+   e = qla2x00_alloc_work(vha, cmd);
+   if (!e)
+   return QLA_FUNCTION_FAILED;
+
+   e->u.gpnft.fc4_type = FC4_TYPE_NVME;
+   e->u.gpnft.sp = sp;
+
+   return qla2x00_post_work(vha, e);
+}
+
 static void qla2x00_find_free_fcp_nvme_slot(struct scsi_qla_host *vha,
struct srb *sp)
 {
@@ -4095,22 +4130,36 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, 
int res)
 {
struct srb *sp = s;
struct scsi_qla_host *vha = sp->vha;
-   struct qla_work_evt *e;
struct ct_sns_req *ct_req =
(struct ct_sns_req *)sp->u.iocb_cmd.u.ctarg.req;
u16 cmd = be16_to_cpu(ct_req->command);
u8 fc4_type = sp->gen2;
unsigned long flags;
+   int rc;
 
/* gen2 field is holding the fc4type */
ql_dbg(ql_dbg_disc, vha, 0x,
"Async done-%s res %x FC4Type %x\n",
sp->name, res, sp->gen2);
 
+   sp->rc = res;
if (res) {
unsigned long flags;
+   const char *name = sp->name;
+
+   /*
+* We are in an Interrupt context, queue up this
+* sp for GNNFT_DONE work. This will allow all
+* the resource to get freed up.
+*/
+   rc = qla2x00_post_gnnft_gpnft_done_work(vha, sp,
+   QLA_EVT_GNNFT_DONE);
+   if (rc) {
+   /* Cleanup here to prevent memory leak */
+   qla24xx_sp_unmap(vha, sp);
+   sp->free(sp);
+   }
 
-   sp->free(sp);
spin_lock_irqsave(>work_lock, flags);
vha->scan.scan_flags &= ~SF_SCANNING;
vha->scan.scan_retry++;
@@ -4121,9 +4170,9 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, 
int res)
set_bit(LOOP_RESYNC_NEEDED, >dpc_flags);
qla2xxx_wake_dpc(vha);
} else {
-   ql_dbg(ql_dbg_disc, sp->vha, 0x,
-   "Async done-%s rescan failed on all retries\n",
-   sp->name);
+   ql_dbg(ql_dbg_disc, vha, 0x,
+   "Async done-%s rescan failed on all retries.\n",
+   name);
}
return;
}
@@ -4138,80 +4187,31 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, 
int res)
vha->scan.scan_flags &= ~SF_SCANNING;
spin_unlock_irqrestore(>work_lock, flags);
 
-   e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT);
-   if (!e) {
-   /*
-* please ignore kernel warning. Otherwise,
-* we have mem leak.
-*/
-   if (sp->u.iocb_cmd.u.ctarg.req) {
-   dma_free_coherent(>hw->pdev->dev,
-   sp->u.iocb_cmd.u.ctarg.req_allocated_size,
-   sp->u.iocb_cmd.u.ctarg.req,
-   sp->u.iocb_cmd.u.ctarg.req_dma);
-   sp->u.iocb_cmd.u.ctarg.req = NULL;
-   }
-   if (sp->u.iocb_cmd.u.ctarg.rsp) {
-   dma_free_coherent(>hw->pdev->dev,
-   sp->u.iocb_cmd.u.ctarg.rsp_allocated_size,
-   sp->u.iocb_cmd.u.ctarg.rsp,
-   sp->u.iocb_cmd.u.ctarg.rsp_dma);
-   sp->u.iocb_cmd.u.ctarg.rsp = NULL;
-   }
-
-   

[PATCH v2 11/14] qla2xxx: Fix iIDMA error

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

when switch responds with error for Get Port Speed Command (GPSC),
driver should not proceed with telling FW about the speed
of the remote port.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_gs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 85cbe59b4f58..902106f97020 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3272,7 +3272,7 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res)
ql_dbg(ql_dbg_disc, vha, 0x2019,
"GPSC command unsupported, disabling query.\n");
ha->flags.gpsc_supported = 0;
-   res = QLA_SUCCESS;
+   goto done;
}
} else {
switch (be16_to_cpu(ct_rsp->rsp.gpsc.speed)) {
@@ -3305,7 +3305,6 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res)
be16_to_cpu(ct_rsp->rsp.gpsc.speeds),
be16_to_cpu(ct_rsp->rsp.gpsc.speed));
}
-done:
memset(, 0, sizeof(ea));
ea.event = FCME_GPSC_DONE;
ea.rc = res;
@@ -3313,6 +3312,7 @@ static void qla24xx_async_gpsc_sp_done(void *s, int res)
ea.sp = sp;
qla2x00_fcport_event_handler(vha, );
 
+done:
sp->free(sp);
 }
 
-- 
2.12.0



[PATCH v2 14/14] qla2xxx: Update driver to version 10.00.00.09-k

2018-08-31 Thread Himanshu Madhani
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index 3850b28518e5..0dbba38c408f 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "10.00.00.08-k"
+#define QLA2XXX_VERSION  "10.00.00.09-k"
 
 #define QLA_DRIVER_MAJOR_VER   10
 #define QLA_DRIVER_MINOR_VER   0
-- 
2.12.0



[PATCH v2 05/14] qla2xxx: Remove redundant check for fcport deletion

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Remove redundant check for fcport is deleted or being delete.
The same check is already in the deletion routine.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_gs.c | 62 +++
 1 file changed, 9 insertions(+), 53 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index c0c738bbdace..6e95ba0d3c8b 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3442,26 +3442,10 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
if (ea->rc) {
/* cable is disconnected */
list_for_each_entry_safe(fcport, t, >vp_fcports, list) {
-   if (fcport->d_id.b24 == ea->id.b24) {
-   ql_dbg(ql_dbg_disc, vha, 0x,
-   "%s %d %8phC DS %d\n",
-   __func__, __LINE__,
-   fcport->port_name,
-   fcport->disc_state);
+   if (fcport->d_id.b24 == ea->id.b24)
fcport->scan_state = QLA_FCPORT_SCAN;
-   switch (fcport->disc_state) {
-   case DSC_DELETED:
-   case DSC_DELETE_PEND:
-   break;
-   default:
-   ql_dbg(ql_dbg_disc, vha, 0x,
-   "%s %d %8phC post del sess\n",
-   __func__, __LINE__,
-   fcport->port_name);
-   qlt_schedule_sess_for_deletion(fcport);
-   break;
-   }
-   }
+
+   qlt_schedule_sess_for_deletion(fcport);
}
} else {
/* cable is connected */
@@ -3470,32 +3454,16 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
list_for_each_entry_safe(conflict, t, >vp_fcports,
list) {
if ((conflict->d_id.b24 == ea->id.b24) &&
-   (fcport != conflict)) {
-   /* 2 fcports with conflict Nport ID or
+   (fcport != conflict))
+   /*
+* 2 fcports with conflict Nport ID or
 * an existing fcport is having nport ID
 * conflict with new fcport.
 */
 
-   ql_dbg(ql_dbg_disc, vha, 0x,
-   "%s %d %8phC DS %d\n",
-   __func__, __LINE__,
-   conflict->port_name,
-   conflict->disc_state);
conflict->scan_state = QLA_FCPORT_SCAN;
-   switch (conflict->disc_state) {
-   case DSC_DELETED:
-   case DSC_DELETE_PEND:
-   break;
-   default:
-   ql_dbg(ql_dbg_disc, vha, 0x,
-   "%s %d %8phC post del 
sess\n",
-   __func__, __LINE__,
-   conflict->port_name);
-   qlt_schedule_sess_for_deletion
-   (conflict);
-   break;
-   }
-   }
+
+   qlt_schedule_sess_for_deletion(conflict);
}
 
fcport->rscn_gen++;
@@ -3548,19 +3516,7 @@ void qla24xx_handle_gpnid_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
conflict->disc_state);
 
conflict->scan_state = QLA_FCPORT_SCAN;
-   switch (conflict->disc_state) {
-   case DSC_DELETED:
-   case DSC_DELETE_PEND:
-   break;
-   default:
-   ql_dbg(ql_dbg_disc, vha, 0x,
-

[PATCH v2 13/14] qla2xxx: Terminate Plogi/PRLI if WWN is 0

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

When driver receive PLOGI/PRLI from FW, the WWPN value
will be provided.  If it is not, then driver will terminate it.
The WWPN allows driver to locate the session or create a
new session.

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

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index 34fadd320f55..396c8a6d502c 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -4723,6 +4723,12 @@ static int qlt_handle_login(struct scsi_qla_host *vha,
sess = qlt_find_sess_invalidate_other(vha, wwn,
port_id, loop_id, _sess);
spin_unlock_irqrestore(>hw->tgt.sess_lock, flags);
+   } else {
+   ql_dbg(ql_dbg_disc, vha, 0x,
+   "%s %d Term INOT due to WWN=0 lid=%d, NportID %06X ",
+   __func__, __LINE__, loop_id, port_id.b24);
+   qlt_send_term_imm_notif(vha, iocb, 1);
+   goto out;
}
 
if (IS_SW_RESV_ADDR(port_id)) {
-- 
2.12.0



[PATCH v2 07/14] qla2xxx: Decrement login retry count for only plogi

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Decrement login retry count only for plogi, instead of
number of attempt made for login.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 39710ebd5950..0f069eb06d8b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1276,7 +1276,8 @@ static void qla_chk_n2n_b4_login(struct scsi_qla_host 
*vha, fc_port_t *fcport)
login = 1;
}
 
-   if (login) {
+   if (login && fcport->login_retry) {
+   fcport->login_retry--;
if (fcport->loop_id == FC_NO_LOOP_ID) {
fcport->fw_login_state = DSC_LS_PORT_UNAVAIL;
rc = qla2x00_find_new_loop_id(vha, fcport);
@@ -1302,13 +1303,12 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host 
*vha, fc_port_t *fcport)
u64 wwn;
u16 sec;
 
-   ql_dbg(ql_dbg_disc, vha, 0x20d8,
-   "%s %8phC DS %d LS %d P %d fl %x confl %p rscn %d|%d login %d retry 
%d lid %d scan %d\n",
+   ql_dbg(ql_dbg_disc + ql_dbg_verbose, vha, 0x20d8,
+   "%s %8phC DS %d LS %d P %d fl %x confl %p rscn %d|%d login %d lid 
%d scan %d\n",
__func__, fcport->port_name, fcport->disc_state,
fcport->fw_login_state, fcport->login_pause, fcport->flags,
fcport->conflict, fcport->last_rscn_gen, fcport->rscn_gen,
-   fcport->login_gen, fcport->login_retry,
-   fcport->loop_id, fcport->scan_state);
+   fcport->login_gen, fcport->loop_id, fcport->scan_state);
 
if (fcport->scan_state != QLA_FCPORT_FOUND)
return 0;
@@ -1407,10 +1407,6 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host 
*vha, fc_port_t *fcport)
break;
 
case DSC_LOGIN_FAILED:
-   fcport->login_retry--;
-   ql_dbg(ql_dbg_disc, vha, 0x20d0,
-   "%s %d %8phC post gidpn\n",
-   __func__, __LINE__, fcport->port_name);
if (N2N_TOPO(vha->hw))
qla_chk_n2n_b4_login(vha, fcport);
else
@@ -1419,10 +1415,6 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host 
*vha, fc_port_t *fcport)
 
case DSC_LOGIN_COMPLETE:
/* recheck login state */
-   ql_dbg(ql_dbg_disc, vha, 0x20d1,
-   "%s %d %8phC post adisc\n",
-   __func__, __LINE__, fcport->port_name);
-   fcport->login_retry--;
data[0] = data[1] = 0;
qla2x00_post_async_adisc_work(vha, fcport, data);
break;
-- 
2.12.0



[PATCH v2 09/14] qla2xxx: Force fw cleanup on ADISC error

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Turn ON logout_on_delete flag to make sure firmware
resource for fcport is cleaned up on ADISC error.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 0f069eb06d8b..f8f55184f542 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -396,6 +396,9 @@ void qla24xx_handle_adisc_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
ql_dbg(ql_dbg_disc, vha, 0x2066,
"%s %8phC: adisc fail: post delete\n",
__func__, ea->fcport->port_name);
+   /* deleted = 0 & logout_on_delete = force fw cleanup */
+   fcport->deleted = 0;
+   fcport->logout_on_delete = 1;
qlt_schedule_sess_for_deletion(ea->fcport);
return;
}
-- 
2.12.0



[PATCH v2 12/14] qla2xxx: Defer chip reset until target mode is enabled

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

For target mode, any chip reset is triggered before target mode
is enabled will be hold off until user is ready to enable.  This
prevents the chip from starting or running before it is intended.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_os.c | 28 +---
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1ae31a119a37..9628fe4a967f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -6047,12 +6047,27 @@ qla2x00_do_dpc(void *data)
if (test_and_clear_bit
(ISP_ABORT_NEEDED, _vha->dpc_flags) &&
!test_bit(UNLOADING, _vha->dpc_flags)) {
+   bool do_reset = true;
+
+   switch (ql2x_ini_mode) {
+   case QLA2XXX_INI_MODE_ENABLED:
+   break;
+   case QLA2XXX_INI_MODE_DISABLED:
+   if (!qla_tgt_mode_enabled(base_vha))
+   do_reset = false;
+   break;
+   case QLA2XXX_INI_MODE_DUAL:
+   if (!qla_dual_mode_enabled(base_vha))
+   do_reset = false;
+   break;
+   default:
+   break;
+   }
 
-   ql_dbg(ql_dbg_dpc, base_vha, 0x4007,
-   "ISP abort scheduled.\n");
-   if (!(test_and_set_bit(ABORT_ISP_ACTIVE,
+   if (do_reset && !(test_and_set_bit(ABORT_ISP_ACTIVE,
_vha->dpc_flags))) {
-
+   ql_dbg(ql_dbg_dpc, base_vha, 0x4007,
+   "ISP abort scheduled.\n");
if (ha->isp_ops->abort_isp(base_vha)) {
/* failed. retry later */
set_bit(ISP_ABORT_NEEDED,
@@ -6060,10 +6075,9 @@ qla2x00_do_dpc(void *data)
}
clear_bit(ABORT_ISP_ACTIVE,
_vha->dpc_flags);
+   ql_dbg(ql_dbg_dpc, base_vha, 0x4008,
+   "ISP abort end.\n");
}
-
-   ql_dbg(ql_dbg_dpc, base_vha, 0x4008,
-   "ISP abort end.\n");
}
 
if (test_and_clear_bit(FCPORT_UPDATE_NEEDED,
-- 
2.12.0



[PATCH v2 06/14] qla2xxx: Move rport registration out of internal work_list

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Currently, the rport registration is being called from a single
work element that is used to process QLA internal "work_list".
This work_list is meant for quick and simple task (ie no sleep).
The Rport registration process sometime can be delayed by upper
layer.  This causes back pressure with the internal queue where
other jobs are unable to move forward.

This patch will schedule the registration process with a new work
element (fc_port.reg_work).  While the RPort is being registered,
the current state of the fcport will not move forward until the
registration is done.  If the state of the fabric has changed, a new
field/next_disc_state will record the next action on whether to
'DELETE' or 'Reverify the session/ADISC'.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h|  6 ++-
 drivers/scsi/qla2xxx/qla_gbl.h|  5 ++-
 drivers/scsi/qla2xxx/qla_init.c   | 66 ++-
 drivers/scsi/qla2xxx/qla_os.c | 26 +++-
 drivers/scsi/qla2xxx/qla_target.c | 83 +++
 5 files changed, 147 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index c41d0dbbbd79..16dd59bcd60a 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2375,11 +2375,13 @@ typedef struct fc_port {
unsigned long expires;
struct list_head del_list_entry;
struct work_struct free_work;
-
+   struct work_struct reg_work;
+   uint64_t jiffies_at_registration;
struct qlt_plogi_ack_t *plogi_link[QLT_PLOGI_LINK_MAX];
 
uint16_t tgt_id;
uint16_t old_tgt_id;
+   uint16_t sec_since_registration;
 
uint8_t fcp_prio;
 
@@ -2412,6 +2414,7 @@ typedef struct fc_port {
struct qla_tgt_sess *tgt_session;
struct ct_sns_desc ct_desc;
enum discovery_state disc_state;
+   enum discovery_state next_disc_state;
enum login_state fw_login_state;
unsigned long dm_login_expire;
unsigned long plogi_nack_done_deadline;
@@ -3222,7 +3225,6 @@ enum qla_work_type {
QLA_EVT_GPDB,
QLA_EVT_PRLI,
QLA_EVT_GPSC,
-   QLA_EVT_UPD_FCPORT,
QLA_EVT_GNL,
QLA_EVT_NACK,
QLA_EVT_RELOGIN,
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 178974896b5c..b8e4abe804d5 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -54,7 +54,7 @@ extern void qla2x00_abort_isp_cleanup(scsi_qla_host_t *);
 extern void qla2x00_quiesce_io(scsi_qla_host_t *);
 
 extern void qla2x00_update_fcport(scsi_qla_host_t *, fc_port_t *);
-
+void qla_register_fcport_fn(struct work_struct *);
 extern void qla2x00_alloc_fw_dump(scsi_qla_host_t *);
 extern void qla2x00_try_to_stop_firmware(scsi_qla_host_t *);
 
@@ -109,6 +109,7 @@ int qla24xx_post_newsess_work(struct scsi_qla_host *, 
port_id_t *, u8 *, u8*,
 int qla24xx_fcport_handle_login(struct scsi_qla_host *, fc_port_t *);
 int qla24xx_detect_sfp(scsi_qla_host_t *vha);
 int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8);
+
 void qla2x00_async_prlo_done(struct scsi_qla_host *, fc_port_t *,
 uint16_t *);
 extern int qla2x00_post_async_prlo_work(struct scsi_qla_host *, fc_port_t *,
@@ -208,7 +209,7 @@ extern void qla2x00_disable_board_on_pci_error(struct 
work_struct *);
 extern void qla2x00_sp_compl(void *, int);
 extern void qla2xxx_qpair_sp_free_dma(void *);
 extern void qla2xxx_qpair_sp_compl(void *, int);
-extern int qla24xx_post_upd_fcport_work(struct scsi_qla_host *, fc_port_t *);
+extern void qla24xx_sched_upd_fcport(fc_port_t *);
 void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,
uint16_t *);
 int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 6d9c8a017ae9..39710ebd5950 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1182,11 +1182,7 @@ void __qla24xx_handle_gpdb_event(scsi_qla_host_t *vha, 
struct event_arg *ea)
vha->fcport_count++;
ea->fcport->login_succ = 1;
 
-   ql_dbg(ql_dbg_disc, vha, 0x20d6,
-   "%s %d %8phC post upd_fcport fcp_cnt %d\n",
-   __func__, __LINE__,  ea->fcport->port_name,
-   vha->fcport_count);
-   qla24xx_post_upd_fcport_work(vha, ea->fcport);
+   qla24xx_sched_upd_fcport(ea->fcport);
} else if (ea->fcport->login_succ) {
/*
 * We have an existing session. A late RSCN delivery
@@ -1304,6 +1300,7 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host 
*vha, fc_port_t *fcport)
 {
u16 data[2];
u64 wwn;
+   u16 sec;
 
ql_dbg(ql_dbg_disc, vha, 0x20d8,
"%s %8phC DS %d LS %d P %d fl %x confl %p rscn %d|%d login %d retry 

[PATCH v2 04/14] qla2xxx: Update rscn_rcvd field to more meaningful scan_needed

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Rename rscn_rcvd field to scan_needed to be more meaningful.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_def.h  |  2 +-
 drivers/scsi/qla2xxx/qla_gs.c   | 12 ++--
 drivers/scsi/qla2xxx/qla_init.c |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index a9dc9c4a6382..c41d0dbbbd79 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2351,7 +2351,7 @@ typedef struct fc_port {
unsigned int login_succ:1;
unsigned int query:1;
unsigned int id_changed:1;
-   unsigned int rscn_rcvd:1;
+   unsigned int scan_needed:1;
 
struct work_struct nvme_del_work;
struct completion nvme_del_done;
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index a0038d879b9d..c0c738bbdace 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -3951,7 +3951,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t 
*sp)
list_for_each_entry(fcport, >vp_fcports, list) {
if (memcmp(rp->port_name, fcport->port_name, WWN_SIZE))
continue;
-   fcport->rscn_rcvd = 0;
+   fcport->scan_needed = 0;
fcport->scan_state = QLA_FCPORT_FOUND;
found = true;
/*
@@ -3981,12 +3981,12 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, 
srb_t *sp)
 */
list_for_each_entry(fcport, >vp_fcports, list) {
if ((fcport->flags & FCF_FABRIC_DEVICE) == 0) {
-   fcport->rscn_rcvd = 0;
+   fcport->scan_needed = 0;
continue;
}
 
if (fcport->scan_state != QLA_FCPORT_FOUND) {
-   fcport->rscn_rcvd = 0;
+   fcport->scan_needed = 0;
if ((qla_dual_mode_enabled(vha) ||
qla_ini_mode_enabled(vha)) &&
atomic_read(>state) == FCS_ONLINE) {
@@ -4005,7 +4005,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t 
*sp)
}
}
} else {
-   if (fcport->rscn_rcvd ||
+   if (fcport->scan_needed ||
fcport->disc_state != DSC_LOGIN_COMPLETE) {
if (fcport->login_retry == 0) {
fcport->login_retry =
@@ -4015,7 +4015,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t 
*sp)
fcport->port_name, fcport->loop_id,
fcport->login_retry);
}
-   fcport->rscn_rcvd = 0;
+   fcport->scan_needed = 0;
qla24xx_fcport_handle_login(vha, fcport);
}
}
@@ -4030,7 +4030,7 @@ void qla24xx_async_gnnft_done(scsi_qla_host_t *vha, srb_t 
*sp)
 
if (recheck) {
list_for_each_entry(fcport, >vp_fcports, list) {
-   if (fcport->rscn_rcvd) {
+   if (fcport->scan_needed) {
set_bit(LOCAL_LOOP_UPDATE, >dpc_flags);
set_bit(LOOP_RESYNC_NEEDED, >dpc_flags);
break;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3eb3c4f554fa..6d9c8a017ae9 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1551,7 +1551,7 @@ void qla2x00_fcport_event_handler(scsi_qla_host_t *vha, 
struct event_arg *ea)
fcport = qla2x00_find_fcport_by_nportid
(vha, >id, 1);
if (fcport)
-   fcport->rscn_rcvd = 1;
+   fcport->scan_needed = 1;
 
spin_lock_irqsave(>work_lock, flags);
if (vha->scan.scan_flags == 0) {
-- 
2.12.0



[PATCH v2 08/14] qla2xxx: Turn off IOCB timeout timer on IOCB completion

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

Turn off IOCB timeout timer on IOCB completion instead of
turning it off in a deferred task.  This prevent false
alarm if the deferred task is stalled out.

Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_gs.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index 6e95ba0d3c8b..1cb27eb46731 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -4175,10 +4175,13 @@ static void qla2x00_async_gpnft_gnnft_sp_done(void *s, 
int res)
return;
}
 
-   if (cmd == GPN_FT_CMD)
+   if (cmd == GPN_FT_CMD) {
+   del_timer(>u.iocb_cmd.timer);
e = qla2x00_alloc_work(vha, QLA_EVT_GPNFT_DONE);
-   else
+   } else {
e = qla2x00_alloc_work(vha, QLA_EVT_GNNFT_DONE);
+   }
+
if (!e) {
/* please ignore kernel warning. Otherwise, we have mem leak. */
if (sp->u.iocb_cmd.u.ctarg.req) {
@@ -4307,7 +4310,6 @@ void qla24xx_async_gpnft_done(scsi_qla_host_t *vha, srb_t 
*sp)
 {
ql_dbg(ql_dbg_disc, vha, 0x,
"%s enter\n", __func__);
-   del_timer(>u.iocb_cmd.timer);
qla24xx_async_gnnft(vha, sp, sp->gen2);
 }
 
-- 
2.12.0



[PATCH v2 00/14] qla2xxx: Driver updates for scsi-misc

2018-08-31 Thread Himanshu Madhani
Hi Martin,

This series updates driver for ABTS handling and rport management.
  
Please queue this patches to 4.20/scsi-misc at your earliest convenience.

Changes from v1 -> v2
o Fixed sparse warning in patch #3.

Thanks,
Himanshu


Himanshu Madhani (2):
  qla2xxx: Fix incorrect port speed being set for FC adapters
  qla2xxx: Update driver to version 10.00.00.09-k

Quinn Tran (12):
  qla2xxx: Fix process response queue for ISP26XX and above
  qla2xxx: Use correct qpair for ABTS/CMD
  qla2xxx: Update rscn_rcvd field to more meaningful scan_needed
  qla2xxx: Remove redundant check for fcport deletion
  qla2xxx: Move rport registration out of internal work_list
  qla2xxx: Decrement login retry count for only plogi
  qla2xxx: Turn off IOCB timeout timer on IOCB completion
  qla2xxx: Force fw cleanup on ADISC error
  qla2xxx: Remove all rports if fabric scan retry fails
  qla2xxx: Fix iIDMA error
  qla2xxx: Defer chip reset until target mode is enabled
  qla2xxx: Terminate Plogi/PRLI if WWN is 0

 drivers/scsi/qla2xxx/qla_def.h |   8 +-
 drivers/scsi/qla2xxx/qla_gbl.h |   5 +-
 drivers/scsi/qla2xxx/qla_gs.c  | 212 +++--
 drivers/scsi/qla2xxx/qla_init.c| 106 +--
 drivers/scsi/qla2xxx/qla_iocb.c|  29 ++---
 drivers/scsi/qla2xxx/qla_mbx.c |   5 +-
 drivers/scsi/qla2xxx/qla_os.c  |  54 +++---
 drivers/scsi/qla2xxx/qla_target.c  |  89 +---
 drivers/scsi/qla2xxx/qla_version.h |   2 +-
 9 files changed, 283 insertions(+), 227 deletions(-)

-- 
2.12.0



[PATCH v2 01/14] qla2xxx: Fix process response queue for ISP26XX and above

2018-08-31 Thread Himanshu Madhani
From: Quinn Tran 

This patch improves performance for 16G and above adaper by
removing additional call to process_response_queue().

Cc: 
Signed-off-by: Quinn Tran 
Signed-off-by: Himanshu Madhani 
---
 drivers/scsi/qla2xxx/qla_init.c |  2 --
 drivers/scsi/qla2xxx/qla_iocb.c | 17 -
 2 files changed, 19 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index b934977c5c26..4686fb5f26aa 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -7142,7 +7142,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
}
icb->firmware_options_2 &= cpu_to_le32(
~(BIT_3 | BIT_2 | BIT_1 | BIT_0));
-   vha->flags.process_response_queue = 0;
if (ha->zio_mode != QLA_ZIO_DISABLED) {
ha->zio_mode = QLA_ZIO_MODE_6;
 
@@ -7153,7 +7152,6 @@ qla24xx_nvram_config(scsi_qla_host_t *vha)
icb->firmware_options_2 |= cpu_to_le32(
(uint32_t)ha->zio_mode);
icb->interrupt_delay_timer = cpu_to_le16(ha->zio_timer);
-   vha->flags.process_response_queue = 1;
}
 
if (rval) {
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 42ac8e097419..119927220299 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1526,12 +1526,6 @@ qla24xx_start_scsi(srb_t *sp)
 
/* Set chip new ring index. */
WRT_REG_DWORD(req->req_q_in, req->ring_index);
-   RD_REG_DWORD_RELAXED(>iobase->isp24.hccr);
-
-   /* Manage unprocessed RIO/ZIO commands in response queue. */
-   if (vha->flags.process_response_queue &&
-   rsp->ring_ptr->signature != RESPONSE_PROCESSED)
-   qla24xx_process_response_queue(vha, rsp);
 
spin_unlock_irqrestore(>hardware_lock, flags);
return QLA_SUCCESS;
@@ -1725,12 +1719,6 @@ qla24xx_dif_start_scsi(srb_t *sp)
 
/* Set chip new ring index. */
WRT_REG_DWORD(req->req_q_in, req->ring_index);
-   RD_REG_DWORD_RELAXED(>iobase->isp24.hccr);
-
-   /* Manage unprocessed RIO/ZIO commands in response queue. */
-   if (vha->flags.process_response_queue &&
-   rsp->ring_ptr->signature != RESPONSE_PROCESSED)
-   qla24xx_process_response_queue(vha, rsp);
 
spin_unlock_irqrestore(>hardware_lock, flags);
 
@@ -1880,11 +1868,6 @@ qla2xxx_start_scsi_mq(srb_t *sp)
/* Set chip new ring index. */
WRT_REG_DWORD(req->req_q_in, req->ring_index);
 
-   /* Manage unprocessed RIO/ZIO commands in response queue. */
-   if (vha->flags.process_response_queue &&
-   rsp->ring_ptr->signature != RESPONSE_PROCESSED)
-   qla24xx_process_response_queue(vha, rsp);
-
spin_unlock_irqrestore(>qp_lock, flags);
return QLA_SUCCESS;
 
-- 
2.12.0



Re: [PATCH 03/14] qla2xxx: Use correct qpair for ABTS/CMD

2018-08-31 Thread kbuild test robot
Hi Quinn,

Thank you for the patch! Perhaps something to improve:

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

url:
https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Driver-updates-for-scsi-misc/20180831-205814
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

   drivers/scsi/qla2xxx/qla_init.c:4921:22: sparse: expression using 
sizeof(void)
   drivers/scsi/qla2xxx/qla_init.c:4928:37: sparse: incorrect type in 
assignment (different base types) @@expected unsigned int [unsigned] 
[usertype]  @@got ed int [unsigned] [usertype]  @@
   drivers/scsi/qla2xxx/qla_init.c:4928:37:expected unsigned int [unsigned] 
[usertype] 
   drivers/scsi/qla2xxx/qla_init.c:4928:37:got restricted __be32 [usertype] 

   drivers/scsi/qla2xxx/qla_init.c:4981:35: sparse: cast to restricted __le16
   include/linux/slab.h:631:13: sparse: undefined identifier 
'__builtin_mul_overflow'
   drivers/scsi/qla2xxx/qla_init.c:422:5: sparse: symbol 
'qla_post_els_plogi_work' was not declared. Should it be static?
   drivers/scsi/qla2xxx/qla_init.c:796:39: sparse: restricted __le16 degrades 
to integer
   drivers/scsi/qla2xxx/qla_init.c:798:47: sparse: restricted __le16 degrades 
to integer
   drivers/scsi/qla2xxx/qla_init.c:800:28: sparse: incorrect type in assignment 
(different base types) @@expected unsigned short [unsigned] [short] 
 @@got unsigned] [short]  @@
   drivers/scsi/qla2xxx/qla_init.c:800:28:expected unsigned short 
[unsigned] [short] 
   drivers/scsi/qla2xxx/qla_init.c:800:28:got restricted __le16 
   drivers/scsi/qla2xxx/qla_init.c:918:12: sparse: incorrect type in assignment 
(different base types) @@expected unsigned short [usertype] *mb @@got  
short [usertype] *mb @@
   drivers/scsi/qla2xxx/qla_init.c:918:12:expected unsigned short 
[usertype] *mb
   drivers/scsi/qla2xxx/qla_init.c:918:12:got restricted __le16 *
   drivers/scsi/qla2xxx/qla_init.c:967:19: sparse: incorrect type in 
initializer (different base types) @@expected unsigned short [usertype] *mb 
@@got  short [usertype] *mb @@
   drivers/scsi/qla2xxx/qla_init.c:967:19:expected unsigned short 
[usertype] *mb
   drivers/scsi/qla2xxx/qla_init.c:967:19:got restricted __le16 *
   drivers/scsi/qla2xxx/qla_init.c:1136:12: sparse: incorrect type in 
assignment (different base types) @@expected unsigned short [usertype] *mb 
@@got  short [usertype] *mb @@
   drivers/scsi/qla2xxx/qla_init.c:1136:12:expected unsigned short 
[usertype] *mb
   drivers/scsi/qla2xxx/qla_init.c:1136:12:got restricted __le16 *
   drivers/scsi/qla2xxx/qla_init.c:1525:6: sparse: symbol 
'qla_handle_els_plogi_done' was not declared. Should it be static?
   drivers/scsi/qla2xxx/qla_init.c:1649:32: sparse: incorrect type in 
assignment (different base types) @@expected restricted __le16 [usertype] 
comp_status @@got e] comp_status @@
   drivers/scsi/qla2xxx/qla_init.c:1649:32:expected restricted __le16 
[usertype] comp_status
   drivers/scsi/qla2xxx/qla_init.c:1649:32:got int
   drivers/scsi/qla2xxx/qla_init.c:1729:32: sparse: incorrect type in 
assignment (different base types) @@expected restricted __le16 [usertype] 
comp_status @@got e] comp_status @@
   drivers/scsi/qla2xxx/qla_init.c:1729:32:expected restricted __le16 
[usertype] comp_status
   drivers/scsi/qla2xxx/qla_init.c:1729:32:got int
>> drivers/scsi/qla2xxx/qla_init.c:1771:36: sparse: incorrect type in 
>> assignment (different base types) @@expected restricted __le16 
>> [usertype] req_que_no @@got unsignedrestricted __le16 [usertype] 
>> req_que_no @@
   drivers/scsi/qla2xxx/qla_init.c:1771:36:expected restricted __le16 
[usertype] req_que_no
   drivers/scsi/qla2xxx/qla_init.c:1771:36:got unsigned short [unsigned] 
[usertype] id
   drivers/scsi/qla2xxx/qla_init.c:3221:46: sparse: incorrect type in 
assignment (different base types) @@expected unsigned int [unsigned] 
[usertype] version @@got ed int [unsigned] [usertype] version @@
   drivers/scsi/qla2xxx/qla_init.c:3221:46:expected unsigned int [unsigned] 
[usertype] version
   drivers/scsi/qla2xxx/qla_init.c:3221:46:got restricted __be32 [usertype] 

   drivers/scsi/qla2xxx/qla_init.c:3223:49: sparse: incorrect type in 
assignment (different base types) @@expected unsigned int [unsigned] 
[usertype] fixed_size @@got ed int [unsigned] [usertype] fixed_size @@
   drivers/scsi/qla2xxx/qla_init.c:3223:49:expected unsigned int [unsigned] 
[usertype] fixed_size
   drivers/scsi/qla2xxx/qla_init.c:3223:49:got restricted __be32 [usertype] 

   d

[Bug 200307] Read only file system after failed suspend

2018-08-31 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=200307

AntonĂ­n Dach (d...@protonmail.com) changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |PATCH_ALREADY_AVAILABLE

--- Comment #4 from AntonĂ­n Dach (d...@protonmail.com) ---
This seems to be fixed on kernel 4.19, I've tested and I am able to suspend and
resume flawlesly.


Hope this will be the best kernel series :) 


exact package in manjaro repo Version : 4.19rc1.0826.g5b394b2-1  this
works.

I am closing this, if the issue returns I will reopen and this time bisect the
commit that causes the issue of suspend.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


Re: [Patch v1 0/7] mpt3sas: Hot-Plug Surprise removal support on IOC.

2018-08-31 Thread Lukas Wunner
[cc += linux-pci, benh]

On Fri, Aug 31, 2018 at 7:37 AM Suganath Prabu S 
 wrote:
> Posting below set of patches to support PCIe Hot Plug surprise removal,
> and few defect fixes.

Please cross-post to linux-pci in the future.


Regarding [PATCH 1/7] mpt3sas: Introduce mpt3sas_base_pci_device_is_unplugged:
https://www.spinics.net/lists/linux-scsi/msg122962.html

* mpt3sas_base_pci_device_is_unplugged() is a duplication of the existing
  pci_device_is_present().

* Just reading the vendor ID may not be sufficient to detect unplug,
  it may also read as "all ones" if the link is down due to error
  recovery by DPC.


Regarding [PATCH 2/7] mpt3sas: Add HBA hot plug watchdog thread:
https://www.spinics.net/lists/linux-scsi/msg122963.html

* I don't see why you need to poll for the device's removal from a
  watchdog thread.  pciehp will invoke your driver's ->remove hook
  once the device is gone.

* A recent discussion initiated by Benjamin Herrenschmidt came to the
  conclusion that device removal should be treated as a type of
  error state (either pci_channel_io_perm_failure or another, newly
  introduced state).  It will then be possible to detect the device's
  inaccessibility with pci_channel_offline().  Please help work towards
  such a future solution in the PCI core instead of solutions localized
  to a single device driver.  Sorry, the discussion was lengthy, it is
  available here:
  https://www.spinics.net/lists/linux-pci/msg75425.html

Thanks,

Lukas


Re: [Patch v1 0/7] mpt3sas: Hot-Plug Surprise removal support on IOC.

2018-08-31 Thread Andy Shevchenko
+Cc: Lukas (I think he might be interested to look at this)

On Fri, Aug 31, 2018 at 7:37 AM Suganath Prabu S
 wrote:
>
> Posting below set of patches to support PCIe Hot Plug surprise removal,
> and few defect fixes.
>
> This is NOT the normal PCIe Hot Plug support, whereby the user informs the
> OS that a hot removal is desired, the OS does an orderly shutdown of the 
> driver
> on the device, special hot plug circuitry removes power from the PCIe slot,
> then the user can remove the device and replace it
> (where orderly bring-up of the device is done).
>
> With a true surprise removal (just removing HBA from a slot)
> there is a possibility to get all kinds of PCIe transaction errors,
> Below patches addresses those issues and remove HBA without bringing
> the system down.
>
> For surprise removal detection, driver does a PCI
> read of IOC's vendor field in IOC's PCI configuration space.
> If the read value is 0x this indicates that the device
> might have hot removed and the device will be removed from driver.
>
> V1 changes:
> In Patch 0001 - unlock mutex, if active reset is in progress.
>
> Suganath Prabu S (7):
>   mpt3sas: Introduce mpt3sas_base_pci_device_is_unplugged
>   mpt3sas: Add HBA hot plug watchdog thread.
>   mpt3sas: Seperate out  mpt3sas_wait_for_ioc_to_operational
>   mpt3sas: Introdude  _scsih_get_shost_and_ioc.
>   mpt3sas: Fix Sync cache command failure during driver  unload.
>   mpt3sas: Fix driver modifying NVRAM/persistent data.
>   mpt3sas: Bump driver version to 27.100.00.00.
>
>  drivers/scsi/mpt3sas/mpt3sas_base.c  | 248 
> ++-
>  drivers/scsi/mpt3sas/mpt3sas_base.h  |  17 ++-
>  drivers/scsi/mpt3sas/mpt3sas_config.c|  32 +---
>  drivers/scsi/mpt3sas/mpt3sas_ctl.c   |  26 +---
>  drivers/scsi/mpt3sas/mpt3sas_scsih.c | 188 ---
>  drivers/scsi/mpt3sas/mpt3sas_transport.c |  82 +++---
>  6 files changed, 414 insertions(+), 179 deletions(-)
>
> --
> 1.8.3.1
>


-- 
With Best Regards,
Andy Shevchenko