Skip to contentSkip to conversation

scsi: qla2xxx: Bug fixes

PATCH Applied Roman Bolshakov 3 participants 24 messages Nov 25, 2019 – Dec 9, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover scsi: qla2xxx: Bug fixes

Hi Martin,

The patch series contains fixes for qla2xxx and solves two visible issues:
- Target port in N2N topology doesn't perform login if it has higher WWPN than initiator
- ABORT TASK TMF leads to crash if it's received shortly after ACL of an initiator is deleted and there's active I/O from the initiator

It also contains reliability improvements and cleanups.

Changes since v2 (https://patchwork.kernel.org/cover/11254937/):
- Target is allowed to perform PLOGI only if it detects N2N mode;
- Dropped patches to improve ABTS handling for ports that are not currently logged in. They will go into a separate patch series.
Changes since v1 (https://patchwork.kernel.org/cover/11141979/):
- Fixes target port in N2N mode were added (patches 5-11);
- Target port makes explicit LOGO on session teardown in the patch made by Quinn. Together with patch 1, it helps to immediately turn fc_remote_port to the Blocked stated on client side and avoids visibly stuck session;
- The last three patches address violation of FCP specification with regards to handling of ABTS-LS from ports that are not currently logged in.

Thank you,
Roman

Quinn Tran (1):
scsi: qla2xxx: Use explicit LOGO in target mode

Roman Bolshakov (12):
scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd
scsi: qla2xxx: Initialize free_work before flushing it
scsi: qla2xxx: Drop superfluous INIT_WORK of del_work
scsi: qla2xxx: Change discovery state before PLOGI
scsi: qla2xxx: Allow PLOGI in target mode
scsi: qla2xxx: Don't call qlt_async_event twice
scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length
scsi: qla2xxx: Configure local loop for N2N target
scsi: qla2xxx: Send Notify ACK after N2N PLOGI
scsi: qla2xxx: Don't defer relogin unconditonally
scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI
scsi: qla2xxx: Add debug dump of LOGO payload and ELS IOCB

 drivers/scsi/qla2xxx/qla_def.h     |  1 +
 drivers/scsi/qla2xxx/qla_init.c    | 21 ++++++++++----------
 drivers/scsi/qla2xxx/qla_iocb.c    | 31 ++++++++++++++++++++++++------
 drivers/scsi/qla2xxx/qla_isr.c     |  4 ----
 drivers/scsi/qla2xxx/qla_mbx.c     |  3 ++-
 drivers/scsi/qla2xxx/qla_target.c  |  4 ++--
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |  3 +++
 7 files changed, 43 insertions(+), 24 deletions(-)
Signature · 1 line
2.24.0
#1 lore raw

PATCH v3 1/13 scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd

If ABTS cannot be completed in target mode, the driver attempts to free related management command and crashes:

NIP [d000000019181ee8] tcm_qla2xxx_free_mcmd+0x40/0x80 [tcm_qla2xxx] LR [d00000001dc1e6f8] qlt_response_pkt+0x190/0xa10 [qla2xxx]

  Call Trace:
  [c000003fff27bb50] [c000003fff27bc10] 0xc000003fff27bc10 (unreliable)
  [c000003fff27bb70] [d00000001dc1e6f8] qlt_response_pkt+0x190/0xa10 [qla2xxx]
  [c000003fff27bc10] [d00000001dbc2be0] qla24xx_process_response_queue+0x5d8/0xbd0 [qla2xxx]
  [c000003fff27bd50] [d00000001dbc632c] qla24xx_msix_rsp_q+0x64/0x150 [qla2xxx]
  [c000003fff27bde0] [c000000000187200] __handle_irq_event_percpu+0x90/0x310
  [c000003fff27bea0] [c0000000001874b8] handle_irq_event_percpu+0x38/0x90
  [c000003fff27bee0] [c000000000187574] handle_irq_event+0x64/0xb0
  [c000003fff27bf10] [c00000000018cd38] handle_fasteoi_irq+0xe8/0x280
  [c000003fff27bf40] [c000000000185ccc] generic_handle_irq+0x4c/0x70
  [c000003fff27bf60] [c000000000016cec] __do_irq+0x7c/0x1d0
  [c000003fff27bf90] [c00000000002a530] call_do_irq+0x14/0x24
  [c00000207d2cba90] [c000000000016edc] do_IRQ+0x9c/0x130
  [c00000207d2cbae0] [c000000000008bf4] hardware_interrupt_common+0x114/0x120
  --- interrupt: 501 at arch_local_irq_restore+0x74/0x90
      LR = arch_local_irq_restore+0x74/0x90
  [c00000207d2cbdd0] [c0000000001c64fc] tick_broadcast_oneshot_control+0x4c/0x60 (unreliable)
  [c00000207d2cbdf0] [c0000000007ac840] cpuidle_enter_state+0xf0/0x450
  [c00000207d2cbe50] [c00000000016b81c] call_cpuidle+0x4c/0x90
  [c00000207d2cbe70] [c00000000016bc30] do_idle+0x2b0/0x330
  [c00000207d2cbec0] [c00000000016beec] cpu_startup_entry+0x3c/0x50
  [c00000207d2cbef0] [c00000000004a06c] start_secondary+0x63c/0x670
  [c00000207d2cbf90] [c00000000000aa6c] start_secondary_prolog+0x10/0x14

The crash can be triggered by ACL deletion when there's active I/O.

During ACL deletion, qla2xxx performs implicit LOGO that's invisible for the initiator. Only the driver and firmware are aware of the logout. Therefore the initiator continues to send SCSI commands and the target always responds with SAM STATUS BUSY as it can't find the session.

The command times out after a while and initiator invokes ABORT TASK TMF for the command. The TMF is mapped to ABTS-LS in FCP. The target can't find session for S_ID originating ABTS-LS so it never allocates mcmd. And since N_Port handle was deleted after LOGO, it is no longer valid and ABTS Response IOCB is returned from firmware with status 31. Then free_mcmd is invoked on NULL pointer and the kernel crashes.

[ 7734.578642] qla2xxx [0000:00:0c.0]-e837:6: ABTS_RECV_24XX: instance 0
[ 7734.578644] qla2xxx [0000:00:0c.0]-f811:6: qla_target(0): task abort (s_id=1:2:0, tag09504, param=0)
[ 7734.578645] find_sess_by_s_id: 0x010200
[ 7734.578645] Unable to locate s_id: 0x010200
[ 7734.578646] qla2xxx [0000:00:0c.0]-f812:6: qla_target(0): task abort for non-existent session
[ 7734.578648] qla2xxx [0000:00:0c.0]-e806:6: Sending task mgmt ABTS response (ha�000000d5819000, atio�000000d3fd4700, status=4
[ 7734.578730] qla2xxx [0000:00:0c.0]-e838:6: ABTS_RESP_24XX: compl_status 31
[ 7734.578732] qla2xxx [0000:00:0c.0]-e863:6: qla_target(0): ABTS_RESP_24XX failed 31 (subcode 19:a)
[ 7734.578740] Unable to handle kernel paging request for data at address 0x00000200
Fixes 6b0431d6fa20b ("scsi: qla2xxx: Fix out of order Termination and ABTS response")
Cc Quinn Tran <[email protected]>
Cc Bart Van Assche <[email protected]>
Cc Thomas Abraham <[email protected]>
---
 drivers/scsi/qla2xxx/tcm_qla2xxx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/scsi/qla2xxx/tcm_qla2xxx.c +2 -0
index 042a24314edc..bab2073c1f72 100644
@@ -246,6 +246,8 @@ static void tcm_qla2xxx_complete_mcmd(struct work_struct *work)
  */
 static void tcm_qla2xxx_free_mcmd(struct qla_tgt_mgmt_cmd *mcmd)
 {
+	if (!mcmd)
+		return;
 	INIT_WORK(&mcmd->free_work, tcm_qla2xxx_complete_mcmd);
 	queue_work(tcm_qla2xxx_free_wq, &mcmd->free_work);
 }
Signature · 1 line
2.24.0
Reviewed-by on v3 1/13
#2 lore raw

Re: [PATCH v3 01/13] scsi: qla2xxx: Ignore NULL pointer in tcm_qla2xxx_free_mcmd

Quoted 1 line · Roman Bolshakov

If ABTS cannot be completed in target mode, the driver attempts to free [ ... ]

#3 lore raw

PATCH v3 2/13 scsi: qla2xxx: Use explicit LOGO in target mode

In reply to Roman Bolshakov

From: Quinn Tran <[email protected]>

Target makes implicit LOGO on session teardown. LOGO ELS is not send on the wire and initiator is not aware that target no longer wants talking to it. Initiator keeps sending I/O requests, target responds with BA_RJT, they time out and then initiator sends ABORT TASK (ABTS-LS).

Current behaviour incurs unneeded I/O timeout and can be fixed for some initiators by making explicit LOGO on session deletion.

---
 drivers/scsi/qla2xxx/qla_def.h     |  1 +
 drivers/scsi/qla2xxx/qla_iocb.c    | 16 ++++++++++++----
 drivers/scsi/qla2xxx/qla_target.c  |  1 +
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |  1 +
 4 files changed, 15 insertions(+), 4 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -0
index 460f443f6471..2edd9f7b3074 100644
@@ -2401,6 +2401,7 @@ typedef struct fc_port {
 	unsigned int id_changed:1;
 	unsigned int scan_needed:1;
 	unsigned int n2n_flag:1;
+	unsigned int explicit_logout:1;
 
 	struct completion nvme_del_done;
 	uint32_t nvme_prli_service_param;
drivers/scsi/qla2xxx/qla_iocb.c +12 -3
index b25f87ff8cde..c5a7736c45be 100644
@@ -2405,11 +2405,19 @@ qla2x00_login_iocb(srb_t *sp, struct mbx_entry *mbx)
 static void
 qla24xx_logout_iocb(srb_t *sp, struct logio_entry_24xx *logio)
 {
+	u16 control_flags = LCF_COMMAND_LOGO;
 	logio->entry_type = LOGINOUT_PORT_IOCB_TYPE;
-	logio->control_flags -	    cpu_to_le16(LCF_COMMAND_LOGO|LCF_IMPL_LOGO);
-	if (!sp->fcport->keep_nport_handle)
-		logio->control_flags |= cpu_to_le16(LCF_FREE_NPORT);
+
+	if (sp->fcport->explicit_logout) {
+		control_flags |= LCF_EXPL_LOGO|LCF_FREE_NPORT;
+	} else {
+		control_flags |= LCF_IMPL_LOGO;
+
+		if (!sp->fcport->keep_nport_handle)
+			control_flags |= LCF_FREE_NPORT;
+	}
+
+	logio->control_flags = cpu_to_le16(control_flags);
 	logio->nport_handle = cpu_to_le16(sp->fcport->loop_id);
 	logio->port_id[0] = sp->fcport->d_id.b.al_pa;
 	logio->port_id[1] = sp->fcport->d_id.b.area;
drivers/scsi/qla2xxx/qla_target.c +1 -0
index 51b275a575a5..f94afb3fe448 100644
@@ -1104,6 +1104,7 @@ void qlt_free_session_done(struct work_struct *work)
 		}
 	}
 
+	sess->explicit_logout = 0;
 	spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
 	sess->free_pending = 0;
 
drivers/scsi/qla2xxx/tcm_qla2xxx.c +1 -0
index bab2073c1f72..abe7f79bb789 100644
@@ -350,6 +350,7 @@ static void tcm_qla2xxx_close_session(struct se_session *se_sess)
 	target_sess_cmd_list_set_waiting(se_sess);
 	spin_unlock_irqrestore(&vha->hw->tgt.sess_lock, flags);
 
+	sess->explicit_logout = 1;
 	tcm_qla2xxx_put_sess(sess);
 }
 
Signature · 1 line
2.24.0
#4 lore raw

PATCH v3 3/13 scsi: qla2xxx: Initialize free_work before flushing it

In reply to Roman Bolshakov

Target creation triggers a new BUG_ON introduced in in 4d43d395fed12 ("workqueue: Try to catch flush_work() without INIT_WORK()."). The BUG_ON reveals an attempt to flush free_work in qla24xx_do_nack_work before it's initialized in qlt_unreg_sess:

  WARNING: CPU: 7 PID: 211 at kernel/workqueue.c:3031 __flush_work.isra.38+0x40/0x2e0
  CPU: 7 PID: 211 Comm: kworker/7:1 Kdump: loaded Tainted: G            E     5.3.0-rc7-vanilla+ #2
  Workqueue: qla2xxx_wq qla2x00_iocb_work_fn [qla2xxx]
  NIP:  c000000000159620 LR: c0080000009d91b0 CTR: c0000000001598c0
  REGS: c000000005f3f730 TRAP: 0700   Tainted: G            E      (5.3.0-rc7-vanilla+)
  MSR:  800000000282b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 24002222  XER: 00000000
  CFAR: c0000000001598d0 IRQMASK: 0
  GPR00: c0080000009d91b0 c000000005f3f9c0 c000000001670a00 c0000003f8655ca8
  GPR04: c0000003f8655c00 000000000000ffff 0000000000000011 ffffffffffffffff
  GPR08: c008000000949228 0000000000000000 0000000000000001 c0080000009e7780
  GPR12: 0000000000002200 c00000003fff6200 c000000000161bc8 0000000000000004
  GPR16: c0000003f9d68280 0000000002000000 0000000000000005 0000000000000003
  GPR20: 0000000000000002 000000000000ffff 0000000000000000 fffffffffffffef7
  GPR24: c000000004f73848 c000000004f73838 c000000004f73f28 c000000005f3fb60
  GPR28: c000000004f73e48 c000000004f73c80 c000000004f73818 c0000003f9d68280
  NIP [c000000000159620] __flush_work.isra.38+0x40/0x2e0
  LR [c0080000009d91b0] qla24xx_do_nack_work+0x88/0x180 [qla2xxx]
  Call Trace:
  [c000000005f3f9c0] [c000000000159644] __flush_work.isra.38+0x64/0x2e0 (unreliable)
  [c000000005f3fa50] [c0080000009d91a0] qla24xx_do_nack_work+0x78/0x180 [qla2xxx]
  [c000000005f3fae0] [c0080000009496ec] qla2x00_do_work+0x604/0xb90 [qla2xxx]
  [c000000005f3fc40] [c008000000949cd8] qla2x00_iocb_work_fn+0x60/0xe0 [qla2xxx]
  [c000000005f3fc80] [c000000000157bb8] process_one_work+0x2c8/0x5b0
  [c000000005f3fd10] [c000000000157f28] worker_thread+0x88/0x660
  [c000000005f3fdb0] [c000000000161d64] kthread+0x1a4/0x1b0
  [c000000005f3fe20] [c00000000000b960] ret_from_kernel_thread+0x5c/0x7c
  Instruction dump:
  3d22001d 892966b1 7d908026 91810008 f821ff71 69290001 0b090000 2e290000
  40920200 e9230018 7d2a0074 794ad182 <0b0a0000> 2fa90000 419e01e8 7c0802a6
  ---[ end trace 5ccf335d4f90fcb8 ]---
Fixes 1021f0bc2f3d6 ("scsi: qla2xxx: allow session delete to finish before create.")
Cc Quinn Tran <[email protected]>
---
 drivers/scsi/qla2xxx/qla_init.c   | 1 +
 drivers/scsi/qla2xxx/qla_target.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +1 -0
index 1dbee8800218..4f3da968163e 100644
@@ -4852,6 +4852,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
 	}
 
 	INIT_WORK(&fcport->del_work, qla24xx_delete_sess_fn);
+	INIT_WORK(&fcport->free_work, qlt_free_session_done);
 	INIT_WORK(&fcport->reg_work, qla_register_fcport_fn);
 	INIT_LIST_HEAD(&fcport->gnl_entry);
 	INIT_LIST_HEAD(&fcport->list);
drivers/scsi/qla2xxx/qla_target.c +0 -1
index f94afb3fe448..74cfcb13fe8a 100644
@@ -1161,7 +1161,6 @@ void qlt_unreg_sess(struct fc_port *sess)
 	sess->last_rscn_gen = sess->rscn_gen;
 	sess->last_login_gen = sess->login_gen;
 
-	INIT_WORK(&sess->free_work, qlt_free_session_done);
 	queue_work(sess->vha->hw->wq, &sess->free_work);
 }
 EXPORT_SYMBOL(qlt_unreg_sess);
Signature · 1 line
2.24.0
Reviewed-by on v3 3/13
#5 lore raw

Re: [PATCH v3 03/13] scsi: qla2xxx: Initialize free_work before flushing it

Quoted 4 lines · Roman Bolshakov

Target creation triggers a new BUG_ON introduced in in 4d43d395fed12 ("workqueue: Try to catch flush_work() without INIT_WORK()."). The BUG_ON reveals an attempt to flush free_work in qla24xx_do_nack_work before it's initialized in qlt_unreg_sess: [ ... ]

#6 lore raw

PATCH v3 4/13 scsi: qla2xxx: Drop superfluous INIT_WORK of del_work

In reply to Roman Bolshakov

del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list.

Fixes a01c77d2cbc45 ("scsi: qla2xxx: Move session delete to driver work queue")
Cc Quinn Tran <[email protected]>
---
 drivers/scsi/qla2xxx/qla_target.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_target.c +0 -1
index 74cfcb13fe8a..eeb069d52f3d 100644
@@ -1265,7 +1265,6 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
 	    "Scheduling sess %p for deletion %8phC\n",
 	    sess, sess->port_name);
 
-	INIT_WORK(&sess->del_work, qla24xx_delete_sess_fn);
 	WARN_ON(!queue_work(sess->vha->hw->wq, &sess->del_work));
 }
 
Signature · 1 line
2.24.0
Reviewed-by on v3 4/13
#7 lore raw

Re: [PATCH v3 04/13] scsi: qla2xxx: Drop superfluous INIT_WORK of del_work

Quoted 3 lines · Roman Bolshakov

del_work is already initialized inside qla2x00_alloc_fcport, there's no need to overwrite it. Indeed, it might prevent complete traversal of workqueue list.

#8 lore raw

PATCH v3 5/13 scsi: qla2xxx: Change discovery state before PLOGI

In reply to Roman Bolshakov

When a port sends PLOGI, discovery state should be changed to login pending, otherwise RELOGIN_NEEDED bit is set in qla24xx_handle_plogi_done_event(). RELOGIN_NEEDED triggers another PLOGI, and it never goes out of the loop until login timer expires.

Fixes 8777e4314d397 ("scsi: qla2xxx: Migrate NVME N2N handling into state machine")
Fixes 8b5292bcfcacf ("scsi: qla2xxx: Fix Relogin to prevent modifying scan_state flag")
Cc Quinn Tran <[email protected]>
---
 drivers/scsi/qla2xxx/qla_init.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_init.c +1 -0
index 4f3da968163e..fcb309be50d9 100644
@@ -533,6 +533,7 @@ static int qla_post_els_plogi_work(struct scsi_qla_host *vha, fc_port_t *fcport)
 
 	e->u.fcport.fcport = fcport;
 	fcport->flags |= FCF_ASYNC_ACTIVE;
+	fcport->disc_state = DSC_LOGIN_PEND;
 	return qla2x00_post_work(vha, e);
 }
 
Signature · 1 line
2.24.0
#9 lore raw

PATCH v3 6/13 scsi: qla2xxx: Allow PLOGI in target mode

In reply to Roman Bolshakov

According to FC-LS-3 (Fibre Channel Link Services) 6.3.2.4 "N_Port Login - No Fabric present", if both parties in the point-to-point connection know N_Port_Names of each other, Nx_Port with the highest N_Port_name shall transmit PLOGI. The specification sets no restrictions on the port role that should send PLOGI.

However, FCP-4 (Fibre Channel Protocol for SCSI, Fourth Version) 6.2 "Overview of Process Login and Process Logout", instructs that in point-to-point topology, initiator shall send explicit PRLI ELS.

The change fixes stuck P2P login, when target WWPN is higher than initiator WWPN.

Cc Quinn Tran <[email protected]>
Cc Himanshu Madhani <[email protected]>
---
 drivers/scsi/qla2xxx/qla_init.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +6 -2
index fcb309be50d9..b4283a3126d0 100644
@@ -1527,8 +1527,8 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host *vha, fc_port_t *fcport)
 		}
 	}
 
-	/* for pure Target Mode. Login will not be initiated */
-	if (vha->host->active_mode = MODE_TARGET)
+	/* Target won't initiate port login if fabric is present */
+	if (vha->host->active_mode = MODE_TARGET && !N2N_TOPO(vha->hw))
 		return 0;
 
 	if (fcport->flags & FCF_ASYNC_SENT) {
@@ -1720,6 +1720,10 @@ void qla24xx_handle_relogin_event(scsi_qla_host_t *vha,
 void qla_handle_els_plogi_done(scsi_qla_host_t *vha,
 				      struct event_arg *ea)
 {
+	/* for pure Target Mode, PRLI will not be initiated */
+	if (vha->host->active_mode = MODE_TARGET)
+		return;
+
 	ql_dbg(ql_dbg_disc, vha, 0x2118,
 	    "%s %d %8phC post PRLI\n",
 	    __func__, __LINE__, ea->fcport->port_name);
Signature · 1 line
2.24.0
#10 lore raw

PATCH v3 7/13 scsi: qla2xxx: Don't call qlt_async_event twice

In reply to Roman Bolshakov

MBA_PORT_UPDATE generates duplicate log lines in target mode because qlt_async_event is called twice. Drop the calls within the case as the function will be called right after the switch statement.

---
 drivers/scsi/qla2xxx/qla_isr.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +0 -4
index 1b8f297449cf..c6274178b0b0 100644
@@ -1061,8 +1061,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
 			ql_dbg(ql_dbg_async, vha, 0x5011,
 			    "Asynchronous PORT UPDATE ignored %04x/%04x/%04x.\n",
 			    mb[1], mb[2], mb[3]);
-
-			qlt_async_event(mb[0], vha, mb);
 			break;
 		}
 
@@ -1079,8 +1077,6 @@ qla2x00_async_event(scsi_qla_host_t *vha, struct rsp_que *rsp, uint16_t *mb)
 		set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
 		set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags);
 		set_bit(VP_CONFIG_OK, &vha->vp_flags);
-
-		qlt_async_event(mb[0], vha, mb);
 		break;
 
 	case MBA_RSCN_UPDATE:		/* State Change Registration */
Signature · 1 line
2.24.0
author Acked-by Himanshu Madhani on v3 7/13
#11 lore raw

Re: [PATCH v3 07/13] scsi: qla2xxx: Don't call qlt_async_event twice

Quoted 10 lines · Roman Bolshakov

MBA_PORT_UPDATE generates duplicate log lines in target mode because qlt_async_event is called twice. Drop the calls within the case as the function will be called right after the switch statement.

---

The Acked-by tag should contain:

#12 lore raw

PATCH v3 8/13 scsi: qla2xxx: Fix PLOGI payload and ELS IOCB dump length

In reply to Roman Bolshakov

The size of the buffer is hardcoded as 0x70 or 112 bytes, while the size of ELS IOCB is 0x40 and the size of PLOGI payload returned by Get Parameters command is 0x74.

---
 drivers/scsi/qla2xxx/qla_iocb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_iocb.c +2 -1
index c5a7736c45be..53ccbd6b71ed 100644
@@ -2684,7 +2684,8 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
 		ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3073,
 		    "PLOGI ELS IOCB:\n");
 		ql_dump_buffer(ql_log_info, vha, 0x0109,
-		    (uint8_t *)els_iocb, 0x70);
+		    (uint8_t *)els_iocb,
+		    sizeof(*els_iocb));
 	} else {
 		els_iocb->control_flags = 1 << 13;
 		els_iocb->tx_byte_count @@ -2942,7 +2943,8 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_opcode,

ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3073, "PLOGI buffer:\n"); ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x0109,

-	    (uint8_t *)elsio->u.els_plogi.els_plogi_pyld, 0x70);
+	    (uint8_t *)elsio->u.els_plogi.els_plogi_pyld,
+	    sizeof(*elsio->u.els_plogi.els_plogi_pyld));

rval = qla2x00_start_sp(sp);
if (rval != QLA_SUCCESS) {

Signature · 1 line
2.24.0
#13 lore raw

PATCH v3 9/13 scsi: qla2xxx: Configure local loop for N2N target

In reply to Roman Bolshakov

qla2x00_configure_local_loop initializes PLOGI payload for PLOGI ELS using Get Parameters mailbox command.

In the case when the driver is running in target mode, the topology is N2N and the target port has higher WWPN, LOCAL_LOOP_UPDATE bit is cleared too early and PLOGI payload is not initialized by the Get Parameters command. That causes a failure of ELS IOCB carrying the PLOGI with 0x15 aka Data Underrun error.

LOCAL_LOOP_UPDATE has to be set to initialize PLOGI payload.

---
 drivers/scsi/qla2xxx/qla_init.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +2 -8
index b4283a3126d0..bc3695dc9b9e 100644
@@ -4936,14 +4936,8 @@ qla2x00_configure_loop(scsi_qla_host_t *vha)
 		set_bit(RSCN_UPDATE, &flags);
 		clear_bit(LOCAL_LOOP_UPDATE, &flags);
 
-	} else if (ha->current_topology = ISP_CFG_N) {
-		clear_bit(RSCN_UPDATE, &flags);
-		if (qla_tgt_mode_enabled(vha)) {
-			/* allow the other side to start the login */
-			clear_bit(LOCAL_LOOP_UPDATE, &flags);
-			set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
-		}
-	} else if (ha->current_topology = ISP_CFG_NL) {
+	} else if (ha->current_topology = ISP_CFG_NL ||
+		   ha->current_topology = ISP_CFG_N) {
 		clear_bit(RSCN_UPDATE, &flags);
 		set_bit(LOCAL_LOOP_UPDATE, &flags);
 	} else if (!vha->flags.online ||
Signature · 1 line
2.24.0
#14 lore raw

PATCH v3 10/13 scsi: qla2xxx: Send Notify ACK after N2N PLOGI

In reply to Roman Bolshakov

qlt_handle_login schedules session for deletion even if a login is in progress. That causes login bouncing, i.e. a few logins are made before it settles down.

Complete the first login by sending Notify Acknowledge IOCB via qlt_plogi_ack_unref if the session is pending login completion.

Fixes 9cd883f07a54 ("scsi: qla2xxx: Fix session cleanup for N2N")
Cc Krishna Kant <[email protected]>
Cc Alexei Potashnik <[email protected]>
---
 drivers/scsi/qla2xxx/qla_target.c | 1 +
 1 file changed, 1 insertion(+)
drivers/scsi/qla2xxx/qla_target.c +1 -0
index eeb069d52f3d..68c14143e50e 100644
@@ -4803,6 +4803,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha,
 
 	switch (sess->disc_state) {
 	case DSC_DELETED:
+	case DSC_LOGIN_PEND:
 		qlt_plogi_ack_unref(vha, pla);
 		break;
 
Signature · 1 line
2.24.0
#15 lore raw

PATCH v3 11/13 scsi: qla2xxx: Don't defer relogin unconditonally

In reply to Roman Bolshakov

qla2x00_configure_local_loop sets RELOGIN_NEEDED bit and calls qla24xx_fcport_handle_login to perform the login. This bit triggers a wake up of DPC later after a successful login.

The deferred call is not needed if login succeeds, and it's set in qla24xx_fcport_handle_login in case of errors, hence it should be safe to drop.

---
 drivers/scsi/qla2xxx/qla_init.c | 1 -
 1 file changed, 1 deletion(-)
drivers/scsi/qla2xxx/qla_init.c +0 -1
index bc3695dc9b9e..31551e8ac5df 100644
@@ -5054,7 +5054,6 @@ qla2x00_configure_local_loop(scsi_qla_host_t *vha)
 				memcpy(&ha->plogi_els_payld.data,
 				    (void *)ha->init_cb,
 				    sizeof(ha->plogi_els_payld.data));
-				set_bit(RELOGIN_NEEDED, &vha->dpc_flags);
 			} else {
 				ql_dbg(ql_dbg_init, vha, 0x00d1,
 				    "PLOGI ELS param read fail.\n");
Signature · 1 line
2.24.0
#16 lore raw

PATCH v3 12/13 scsi: qla2xxx: Ignore PORT UPDATE after N2N PLOGI

In reply to Roman Bolshakov

PORT UPDATE asynchronous event is generated on the host that issues PLOGI ELS (in the case of higher WWPN). In that case, the event shouldn't be handled as it sets unwanted DPC flags (i.e. LOOP_RESYNC_NEEDED) that trigger link flap.

Ignore the event if the host has higher WWPN, but handle otherwise.

---
 drivers/scsi/qla2xxx/qla_mbx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +2 -1
index 4eb88c3ee08e..bb6811b94683 100644
@@ -3920,6 +3920,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 					vha->d_id.b24 = 0;
 					vha->d_id.b.al_pa = 1;
 					ha->flags.n2n_bigger = 1;
+					ha->flags.n2n_ae = 0;
 
 					id.b.al_pa = 2;
 					ql_dbg(ql_dbg_async, vha, 0x5075,
@@ -3930,6 +3931,7 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 					    "Format 1: Remote login - Waiting for WWPN %8phC.\n",
 					    rptid_entry->u.f1.port_name);
 					ha->flags.n2n_bigger = 0;
+					ha->flags.n2n_ae = 1;
 				}
 				qla24xx_post_newsess_work(vha, &id,
 				    rptid_entry->u.f1.port_name,
@@ -3941,7 +3943,6 @@ qla24xx_report_id_acquisition(scsi_qla_host_t *vha,
 			/* if our portname is higher then initiate N2N login */
 
 			set_bit(N2N_LOGIN_NEEDED, &vha->dpc_flags);
-			ha->flags.n2n_ae = 1;
 			return;
 			break;
 		case TOPO_FL:
Signature · 1 line
2.24.0
#17 lore raw

PATCH v3 13/13 scsi: qla2xxx: Add debug dump of LOGO payload and ELS IOCB

In reply to Roman Bolshakov

The change adds a way to debug LOGO ELS, likewise PLOGI.

---
 drivers/scsi/qla2xxx/qla_iocb.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/scsi/qla2xxx/qla_iocb.c +9 -0
index 53ccbd6b71ed..8b050f0b4333 100644
@@ -2625,6 +2625,10 @@ qla24xx_els_dcmd_iocb(scsi_qla_host_t *vha, int els_opcode,
 
 	memcpy(elsio->u.els_logo.els_logo_pyld, &logo_pyld,
 	    sizeof(struct els_logo_payload));
+	ql_dbg(ql_dbg_disc + ql_dbg_buffer, vha, 0x3075, "LOGO buffer:");
+	ql_dump_buffer(ql_dbg_disc + ql_dbg_buffer, vha, 0x010a,
+		       elsio->u.els_logo.els_logo_pyld,
+		       sizeof(*elsio->u.els_logo.els_logo_pyld));
 
 	rval = qla2x00_start_sp(sp);
 	if (rval != QLA_SUCCESS) {
@@ -2697,6 +2701,11 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
 		els_iocb->rx_byte_count = 0;
 		els_iocb->rx_address = 0;
 		els_iocb->rx_len = 0;
+		ql_dbg(ql_dbg_io + ql_dbg_buffer, vha, 0x3076,
+		       "LOGO ELS IOCB:");
+		ql_dump_buffer(ql_log_info, vha, 0x010b,
+			       els_iocb,
+			       sizeof(*els_iocb));
 	}
 
 	sp->vha->qla_stats.control_requests++;
Signature · 1 line
2.24.0
#19 lore raw
In reply to Roman Bolshakov
Quoted 2 lines · Roman Bolshakov

The patch series contains fixes for qla2xxx and solves two visible
issues: [ ... ]

As explained in Documentation/process/2.Process.rst, please post patches outside the merge window.

Thanks,

Bart.

#20 lore raw
Quoted 10 lines · Bart Van Assche
Quoted 2 lines · Roman Bolshakov

The patch series contains fixes for qla2xxx and solves two visible
issues: [ ... ]

As explained in Documentation/process/2.Process.rst, please post patches outside the merge window.

Thanks,

Bart.

Hi Bart,

Thank you for the reference. Could you please assess if my understanding of the document is correct:
The fixes might go into 5.5-rc2 after the release of rc1 which closes the merge window.

No patches except critical for -rc1 should be posted when the merge window is opened.

Best regards,
Roman

#21 lore raw
Quoted 8 lines · Roman Bolshakov
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Roman Bolshakov

The patch series contains fixes for qla2xxx and solves two visible
issues: [ ... ]

As explained in Documentation/process/2.Process.rst, please post patches outside the merge window.

Quoted 7 lines

Thank you for the reference. Could you please assess if my understanding of the document is correct:
The fixes might go into 5.5-rc2 after the release of rc1 which closes the merge window.

No patches except critical for -rc1 should be posted when the merge window is opened.

Hi Roman,

During the merge window many maintainers and core contributors are busy with identifying and addressing regressions introduced during the merge window. I think that is why the merge window is not the best time to post patches and why that text was added to the kernel documentation.

What happens with patches posted during the merge window depends on the maintainer (Martin Petersen). Sometimes patches posted during the merge window are ignored. Sometimes such patches are queued after the merge window has closed. Sometimes contributors are asked after the merge window has closed to rebase their patch series, to retest it and to repost it. The latter makes sense because the changes accepted during the merge window (e.g. core kernel API changes) may require matching changes in a patch series. You may want to ask Martin directly which approach he prefers after the merge window has closed.

Bart.

#22 lore raw

Bart,

Quoted 6 lines

What happens with patches posted during the merge window depends on the maintainer (Martin Petersen). Sometimes patches posted during the merge window are ignored. Sometimes such patches are queued after the merge window has closed. Sometimes contributors are asked after the merge window has closed to rebase their patch series, to retest it and to repost it.

Bug fixes are OK at any time, as far as I'm concerned. Although this series is a bit big to deal with given that we're now in the merge window.

As a rule of thumb, I won't look closely at anything resembling new feature series until -rc1 is out.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#23 lore raw
In reply to Roman Bolshakov

Roman,

Quoted 6 lines

The patch series contains fixes for qla2xxx and solves two visible issues:
- Target port in N2N topology doesn't perform login if it has higher WWPN than initiator
- ABORT TASK TMF leads to crash if it's received shortly after ACL of an initiator is deleted and there's active I/O from the initiator

I was concerned about the churn in this series but the actual code changes are mostly simple and to the point.

Applied to 5.5/scsi-fixes with a couple of checkpatch tweaks. Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering