All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] qla2xxx: Fixes for scsi misc
@ 2017-08-30 17:16 Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 1/3] qla2xxx: Clear fc4f_nvme flag Himanshu Madhani
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Himanshu Madhani @ 2017-08-30 17:16 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen; +Cc: himanshu.madhani, linux-scsi

Hi Martin, 

These patches are small fixes for the driver. Please apply
to 4.14/scsi-queue at your earliest convenience.

Thanks,
Himanshu

Darren Trap (1):
  qla2xxx: Clear fc4f_nvme flag

Quinn Tran (2):
  qla2xxx: Fix slow mem alloc behind lock
  qla2xxx: Reset the logo flag, after target re-login.

 drivers/scsi/qla2xxx/qla_gbl.h    |  1 +
 drivers/scsi/qla2xxx/qla_init.c   |  2 ++
 drivers/scsi/qla2xxx/qla_os.c     | 33 ++++++++++++++++++++++++++++++++-
 drivers/scsi/qla2xxx/qla_target.c |  4 +++-
 4 files changed, 38 insertions(+), 2 deletions(-)

-- 
2.12.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] qla2xxx: Clear fc4f_nvme flag
  2017-08-30 17:16 [PATCH 0/3] qla2xxx: Fixes for scsi misc Himanshu Madhani
@ 2017-08-30 17:16 ` Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 2/3] qla2xxx: Fix slow mem alloc behind lock Himanshu Madhani
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Himanshu Madhani @ 2017-08-30 17:16 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen; +Cc: himanshu.madhani, linux-scsi

From: Darren Trap <darren.trap@cavium.com>

Signed-off-by: Darren Trap <darren.trap@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 30b3acacbfca..73a6c3abb115 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4937,6 +4937,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *vha)
 				new_fcport->fc4_type = swl[swl_idx].fc4_type;
 
 				new_fcport->nvme_flag = 0;
+				new_fcport->fc4f_nvme = 0;
 				if (vha->flags.nvme_enabled &&
 				    swl[swl_idx].fc4f_nvme) {
 					new_fcport->fc4f_nvme =
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] qla2xxx: Fix slow mem alloc behind lock
  2017-08-30 17:16 [PATCH 0/3] qla2xxx: Fixes for scsi misc Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 1/3] qla2xxx: Clear fc4f_nvme flag Himanshu Madhani
@ 2017-08-30 17:16 ` Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 3/3] qla2xxx: Reset the logo flag, after target re-login Himanshu Madhani
  2017-08-31  2:16 ` [PATCH 0/3] qla2xxx: Fixes for scsi misc Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Himanshu Madhani @ 2017-08-30 17:16 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen; +Cc: himanshu.madhani, linux-scsi

From: Quinn Tran <quinn.tran@qlogic.com>

Call Trace:
 [<ffffffff81341687>] dump_stack+0x6b/0xa4
 [<ffffffff810c3e30>] ? print_irqtrace_events+0xd0/0xe0
 [<ffffffff8109e3c3>] ___might_sleep+0x183/0x240
 [<ffffffff8109e4d2>] __might_sleep+0x52/0x90
 [<ffffffff811fe17b>] kmem_cache_alloc_trace+0x5b/0x300
 [<ffffffff810c666b>] ? __lock_acquired+0x30b/0x420
 [<ffffffffa0733c28>] qla2x00_alloc_fcport+0x38/0x2a0 [qla2xxx]
 [<ffffffffa07217f4>] ? qla2x00_do_work+0x34/0x2b0 [qla2xxx]
 [<ffffffff816cc82b>] ? _raw_spin_lock_irqsave+0x7b/0x90
 [<ffffffffa072169a>] ? qla24xx_create_new_sess+0x3a/0x160 [qla2xxx]
 [<ffffffffa0721723>] qla24xx_create_new_sess+0xc3/0x160 [qla2xxx]
 [<ffffffff810c91ed>] ? trace_hardirqs_on+0xd/0x10
 [<ffffffffa07218f8>] qla2x00_do_work+0x138/0x2b0 [qla2xxx]

Signed-off-by: Quinn Tran <quinn.tran@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_gbl.h    |  1 +
 drivers/scsi/qla2xxx/qla_os.c     | 33 ++++++++++++++++++++++++++++++++-
 drivers/scsi/qla2xxx/qla_target.c |  2 +-
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 0b219b3ca653..f852ca60c49f 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -113,6 +113,7 @@ int qla24xx_post_gpdb_work(struct scsi_qla_host *, fc_port_t *, u8);
 extern char qla2x00_version_str[];
 
 extern struct kmem_cache *srb_cachep;
+extern struct kmem_cache *qla_tgt_plogi_cachep;
 
 extern int ql2xlogintimeout;
 extern int qlport_down_retry;
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 56bd086b79ea..5b2437a5ea44 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4677,9 +4677,10 @@ static
 void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 {
 	unsigned long flags;
-	fc_port_t *fcport =  NULL;
+	fc_port_t *fcport =  NULL, *tfcp;
 	struct qlt_plogi_ack_t *pla =
 	    (struct qlt_plogi_ack_t *)e->u.new_sess.pla;
+	uint8_t free_fcport = 0;
 
 	spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
 	fcport = qla2x00_find_fcport_by_wwpn(vha, e->u.new_sess.port_name, 1);
@@ -4694,6 +4695,7 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 			pla->ref_count--;
 		}
 	} else {
+		spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
 		fcport = qla2x00_alloc_fcport(vha, GFP_KERNEL);
 		if (fcport) {
 			fcport->d_id = e->u.new_sess.id;
@@ -4703,6 +4705,29 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 
 			memcpy(fcport->port_name, e->u.new_sess.port_name,
 			    WWN_SIZE);
+		} else {
+			ql_dbg(ql_dbg_disc, vha, 0xffff,
+				   "%s %8phC mem alloc fail.\n",
+				   __func__, e->u.new_sess.port_name);
+
+			if (pla)
+				kmem_cache_free(qla_tgt_plogi_cachep, pla);
+			return;
+		}
+
+		spin_lock_irqsave(&vha->hw->tgt.sess_lock, flags);
+		/* search again to make sure one else got ahead */
+		tfcp = qla2x00_find_fcport_by_wwpn(vha,
+		    e->u.new_sess.port_name, 1);
+		if (tfcp) {
+			/* should rarily happen */
+			ql_dbg(ql_dbg_disc, vha, 0xffff,
+			    "%s %8phC found existing fcport b4 add. DS %d LS %d\n",
+			    __func__, tfcp->port_name, tfcp->disc_state,
+			    tfcp->fw_login_state);
+
+			free_fcport = 1;
+		} else {
 			list_add_tail(&fcport->list, &vha->vp_fcports);
 
 			if (pla) {
@@ -4720,6 +4745,12 @@ void qla24xx_create_new_sess(struct scsi_qla_host *vha, struct qla_work_evt *e)
 		else
 			qla24xx_async_gnl(vha, fcport);
 	}
+
+	if (free_fcport) {
+		qla2x00_free_fcport(fcport);
+		if (pla)
+			kmem_cache_free(qla_tgt_plogi_cachep, pla);
+	}
 }
 
 void
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 43113d52893b..192554b1536f 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -145,7 +145,7 @@ static void qlt_send_busy(struct qla_qpair *, struct atio_from_isp *,
  * Global Variables
  */
 static struct kmem_cache *qla_tgt_mgmt_cmd_cachep;
-static struct kmem_cache *qla_tgt_plogi_cachep;
+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);
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] qla2xxx: Reset the logo flag, after target re-login.
  2017-08-30 17:16 [PATCH 0/3] qla2xxx: Fixes for scsi misc Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 1/3] qla2xxx: Clear fc4f_nvme flag Himanshu Madhani
  2017-08-30 17:16 ` [PATCH 2/3] qla2xxx: Fix slow mem alloc behind lock Himanshu Madhani
@ 2017-08-30 17:16 ` Himanshu Madhani
  2017-08-31  2:16 ` [PATCH 0/3] qla2xxx: Fixes for scsi misc Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Himanshu Madhani @ 2017-08-30 17:16 UTC (permalink / raw)
  To: James.Bottomley, martin.petersen; +Cc: himanshu.madhani, linux-scsi

From: Quinn Tran <quinn.tran@cavium.com>

After relogin is sucessful, "send_els_logo" flag
needs to be reinitialized. This will allow next
re-login to happen successfully.

In target mode, this flag was not reset correctly,
causing IO's failure during reset recovery and port
ON/OFF test cases from initiator.

Signed-off-by: Quinn Tran <quinn.tran@cavium.com>
Signed-off-by: Sawan Chandak <sawan.chandak@cavium.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
---
 drivers/scsi/qla2xxx/qla_init.c   | 1 +
 drivers/scsi/qla2xxx/qla_target.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 73a6c3abb115..b5b48ddca962 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1464,6 +1464,7 @@ qla24xx_handle_plogi_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
 				__func__, __LINE__, ea->fcport->port_name);
 			ea->fcport->chip_reset = vha->hw->base_qpair->chip_reset;
 			ea->fcport->logout_on_delete = 1;
+			ea->fcport->send_els_logo = 0;
 			qla24xx_post_gpdb_work(vha, ea->fcport, 0);
 		}
 		break;
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 192554b1536f..f05cfc83c9c8 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -585,11 +585,13 @@ void qla2x00_async_nack_sp_done(void *s, int res)
 		sp->fcport->fw_login_state = DSC_LS_PLOGI_COMP;
 		sp->fcport->logout_on_delete = 1;
 		sp->fcport->plogi_nack_done_deadline = jiffies + HZ;
+		sp->fcport->send_els_logo = 0;
 		break;
 
 	case SRB_NACK_PRLI:
 		sp->fcport->fw_login_state = DSC_LS_PRLI_COMP;
 		sp->fcport->deleted = 0;
+		sp->fcport->send_els_logo = 0;
 
 		if (!sp->fcport->login_succ &&
 		    !IS_SW_RESV_ADDR(sp->fcport->d_id)) {
-- 
2.12.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] qla2xxx: Fixes for scsi misc
  2017-08-30 17:16 [PATCH 0/3] qla2xxx: Fixes for scsi misc Himanshu Madhani
                   ` (2 preceding siblings ...)
  2017-08-30 17:16 ` [PATCH 3/3] qla2xxx: Reset the logo flag, after target re-login Himanshu Madhani
@ 2017-08-31  2:16 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2017-08-31  2:16 UTC (permalink / raw)
  To: Himanshu Madhani; +Cc: James.Bottomley, martin.petersen, linux-scsi


Himanshu,

> These patches are small fixes for the driver. Please apply to
> 4.14/scsi-queue at your earliest convenience.

Done, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-08-31  2:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 17:16 [PATCH 0/3] qla2xxx: Fixes for scsi misc Himanshu Madhani
2017-08-30 17:16 ` [PATCH 1/3] qla2xxx: Clear fc4f_nvme flag Himanshu Madhani
2017-08-30 17:16 ` [PATCH 2/3] qla2xxx: Fix slow mem alloc behind lock Himanshu Madhani
2017-08-30 17:16 ` [PATCH 3/3] qla2xxx: Reset the logo flag, after target re-login Himanshu Madhani
2017-08-31  2:16 ` [PATCH 0/3] qla2xxx: Fixes for scsi misc Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.