Skip to contentSkip to conversation

Misc EDiF bug fixes

PATCH Applied Nilesh Javali 2 participants 14 messages Jun 7, 2022 – Jun 10, 2022

Subsystems (2)
lore
Share & tools
lore

Nilesh Javali

author maintainer
#0 lore raw

cover Misc EDiF bug fixes

Martin,

Please apply the qla2xxx driver misc EDiF bug fixes to the scsi tree at your earliest convenience.

Thanks,
Nilesh

Nilesh Javali (1):
qla2xxx: Update version to 10.02.07.500-k

Quinn Tran (10):
qla2xxx: edif: Reduce Initiator-Initiator thrashing
qla2xxx: edif: bsg refactor
qla2xxx: edif: wait for app to ack on sess down
qla2xxx: edif: add bsg interface to read doorbell events
qla2xxx: edif: Fix potential stuck session in sa update
qla2xxx: edif: Synchronize NPIV deletion with authentication
application
qla2xxx: edif: add retry for els pass through
qla2xxx: edif: remove old doorbell interface
qla2xxx: edif: fix n2n discovery issue with secure target
qla2xxx: edif: fix n2n login retry for secure device

 drivers/scsi/qla2xxx/qla_attr.c     |   2 -
 drivers/scsi/qla2xxx/qla_dbg.h      |   2 +-
 drivers/scsi/qla2xxx/qla_def.h      |   4 +-
 drivers/scsi/qla2xxx/qla_edif.c     | 523 ++++++++++++++++++----------
 drivers/scsi/qla2xxx/qla_edif.h     |   3 +-
 drivers/scsi/qla2xxx/qla_edif_bsg.h | 106 ++++--
 drivers/scsi/qla2xxx/qla_gbl.h      |   4 +-
 drivers/scsi/qla2xxx/qla_gs.c       | 118 +++++--
 drivers/scsi/qla2xxx/qla_init.c     |  11 +-
 drivers/scsi/qla2xxx/qla_iocb.c     |   2 +-
 drivers/scsi/qla2xxx/qla_mid.c      |   6 +-
 drivers/scsi/qla2xxx/qla_os.c       |   2 +-
 drivers/scsi/qla2xxx/qla_target.c   |  35 +-
 drivers/scsi/qla2xxx/qla_version.h  |   4 +-
 14 files changed, 536 insertions(+), 286 deletions(-)

base-commit: f9f0a46141e2e39bedb4779c88380d1b5f018c14

Signature · 1 line
2.19.0.rc0
author maintainer
#1 lore raw

PATCH 1/11 qla2xxx: edif: Reduce Initiator-Initiator thrashing

From: Quinn Tran <[email protected]>

This patch uses GFFID switch command to scan for remote device is Target or Initiator mode. Based on that info, driver will not pass up Initiator info to authentication application. This help reduce unnecessary stress for authentication application to deal with unused connections.

Fixes 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs")
---
 drivers/scsi/qla2xxx/qla_def.h  |   2 +
 drivers/scsi/qla2xxx/qla_edif.c |  32 ++++++++-
 drivers/scsi/qla2xxx/qla_gbl.h  |   3 +-
 drivers/scsi/qla2xxx/qla_gs.c   | 118 +++++++++++++++++++++++---------
 drivers/scsi/qla2xxx/qla_iocb.c |   2 +-
 5 files changed, 120 insertions(+), 37 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
index e8f69c486be1..510fbeb04256 100644
@@ -3204,6 +3204,8 @@ struct ct_sns_rsp {
 #define GFF_NVME_OFFSET		23 /* type = 28h */
 		struct {
 			uint8_t fc4_features[128];
+#define FC4_FF_TARGET    BIT_0
+#define FC4_FF_INITIATOR BIT_1
 		} gff_id;
 		struct {
 			uint8_t reserved;
drivers/scsi/qla2xxx/qla_edif.c +29 -3
index cb8145a9ac09..e789f59395ce 100644
@@ -517,16 +517,28 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 			if (atomic_read(&vha->loop_state) == LOOP_DOWN)
 				break;
 
-			fcport->edif.app_started = 1;
 			fcport->login_retry = vha->hw->login_retry_count;
 
-			/* no activity */
 			fcport->edif.app_stop = 0;
+			fcport->edif.app_sess_online = 0;
+			fcport->edif.app_started = 1;
+
+			if (fcport->scan_state != QLA_FCPORT_FOUND)
+				continue;
+
+			if (fcport->port_type == FCT_UNKNOWN &&
+			    !fcport->fc4_features)
+				rval = qla24xx_async_gffid(vha, fcport, true);
+
+			if (!rval && !(fcport->fc4_features & FC4_FF_TARGET ||
+			    fcport->port_type & (FCT_TARGET|FCT_NVME_TARGET)))
+				continue;
+
+			rval = 0;
 
 			ql_dbg(ql_dbg_edif, vha, 0x911e,
 			       "%s wwpn %8phC calling qla_edif_reset_auth_wait\n",
 			       __func__, fcport->port_name);
-			fcport->edif.app_sess_online = 0;
 			qlt_schedule_sess_for_deletion(fcport);
 			qla_edif_sa_ctl_init(vha, fcport);
 		}
@@ -883,6 +895,20 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 			app_reply->ports[pcnt].rekey_count =
 				fcport->edif.rekey_cnt;
 
+			if (fcport->scan_state != QLA_FCPORT_FOUND)
+				continue;
+
+			if (fcport->port_type == FCT_UNKNOWN && !fcport->fc4_features)
+				rval = qla24xx_async_gffid(vha, fcport, true);
+
+			if (!rval &&
+			    !(fcport->fc4_features & FC4_FF_TARGET ||
+			      fcport->port_type &
+			      (FCT_TARGET | FCT_NVME_TARGET)))
+				continue;
+
+			rval = 0;
+
 			app_reply->ports[pcnt].remote_type =
 				VND_CMD_RTYPE_UNKNOWN;
 			if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET))
drivers/scsi/qla2xxx/qla_gbl.h +2 -1
index dac27b5ff0ac..84b44454c231 100644
@@ -335,6 +335,7 @@ extern int qla24xx_configure_prot_mode(srb_t *, uint16_t *);
 extern int qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha,
 	struct qla_work_evt *e);
 void qla2x00_sp_release(struct kref *kref);
+void qla2x00_els_dcmd2_iocb_timeout(void *data);
 
 /*
  * Global Function Prototypes in qla_mbx.c source file.
@@ -727,7 +728,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
 void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
 int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
 void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea);
-int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport);
+int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool);
 int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *);
 void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *);
 void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *);
drivers/scsi/qla2xxx/qla_gs.c +86 -32

182 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_iocb.c +1 -1
index e0fe9ddb4bd2..46c879923da1 100644
@@ -2819,7 +2819,7 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24xx *els_iocb)
 	sp->vha->qla_stats.control_requests++;
 }
 
-static void
+void
 qla2x00_els_dcmd2_iocb_timeout(void *data)
 {
 	srb_t *sp = data;
Signature · 1 line
2.19.0.rc0
author maintainer
#2 lore raw

PATCH 2/11 qla2xxx: edif: bsg refactor

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

- Add version field to edif bsg for future enhancement.
- Add version edif bsg version check
- remove unused interfaces and fields.

Fixes dd30706e73b70 ("scsi: qla2xxx: edif: Add key update")
---
 drivers/scsi/qla2xxx/qla_edif.c     | 32 +++++++---
 drivers/scsi/qla2xxx/qla_edif_bsg.h | 90 ++++++++++++++++++-----------
 2 files changed, 79 insertions(+), 43 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +23 -9
index e789f59395ce..0a49834198ca 100644
@@ -280,14 +280,19 @@ qla_edif_app_check(scsi_qla_host_t *vha, struct app_id appid)
 {
 	/* check that the app is allow/known to the driver */
 
-	if (appid.app_vid == EDIF_APP_ID) {
-		ql_dbg(ql_dbg_edif + ql_dbg_verbose, vha, 0x911d, "%s app id ok\n", __func__);
-		return true;
+	if (appid.app_vid != EDIF_APP_ID) {
+		ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app id not ok (%x)",
+		    __func__, appid.app_vid);
+		return false;
+	}
+
+	if (appid.version != EDIF_VERSION1) {
+		ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app version is not ok (%x)",
+		    __func__, appid.version);
+		return false;
 	}
-	ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app id not ok (%x)",
-	    __func__, appid.app_vid);
 
-	return false;
+	return true;
 }
 
 static void
@@ -555,6 +560,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	appreply.host_support_edif = vha->hw->flags.edif_enabled;
 	appreply.edif_enode_active = vha->pur_cinfo.enode_flags;
 	appreply.edif_edb_active = vha->e_dbell.db_flags;
+	appreply.version = EDIF_VERSION1;
 
 	bsg_job->reply_len = sizeof(struct fc_bsg_reply);
 
@@ -684,6 +690,7 @@ qla_edif_app_authok(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	portid.b.area   = appplogiok.u.d_id.b.area;
 	portid.b.al_pa  = appplogiok.u.d_id.b.al_pa;
 
+	appplogireply.version = EDIF_VERSION1;
 	switch (appplogiok.type) {
 	case PL_TYPE_WWPN:
 		fcport = qla2x00_find_fcport_by_wwpn(vha,
@@ -876,6 +883,8 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	} else {
 		struct fc_port	*fcport = NULL, *tf;
 
+		app_reply->version = EDIF_VERSION1;
+
 		list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) {
 			if (!(fcport->flags & FCF_FCSP_DEVICE))
 				continue;
@@ -892,9 +901,6 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 			if (tdid.b24 != 0 && tdid.b24 != fcport->d_id.b24)
 				continue;
 
-			app_reply->ports[pcnt].rekey_count =
-				fcport->edif.rekey_cnt;
-
 			if (fcport->scan_state != QLA_FCPORT_FOUND)
 				continue;
 
@@ -909,6 +915,7 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 
 			rval = 0;
 
+			app_reply->ports[pcnt].version = EDIF_VERSION1;
 			app_reply->ports[pcnt].remote_type =
 				VND_CMD_RTYPE_UNKNOWN;
 			if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET))
@@ -1005,6 +1012,8 @@ qla_edif_app_getstats(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	} else {
 		struct fc_port	*fcport = NULL, *tf;
 
+		app_reply->version = EDIF_VERSION1;
+
 		list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) {
 			if (fcport->edif.enable) {
 				if (pcnt > app_req.num_ports)
@@ -2036,6 +2045,7 @@ qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t dbtype,
 		edbnode->u.sa_aen.port_id = fcport->d_id;
 		edbnode->u.sa_aen.status =  data;
 		edbnode->u.sa_aen.key_type =  data2;
+		edbnode->u.sa_aen.version = EDIF_VERSION1;
 		break;
 	default:
 		ql_dbg(ql_dbg_edif, vha, 0x09102,
@@ -3379,6 +3389,10 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	port_id_t d_id;
 	struct qla_bsg_auth_els_request *p =
 	    (struct qla_bsg_auth_els_request *)bsg_job->request;
+	struct qla_bsg_auth_els_reply *rpl =
+	    (struct qla_bsg_auth_els_reply *)bsg_job->reply;
+
+	rpl->version = EDIF_VERSION1;
 
 	d_id.b.al_pa = bsg_request->rqst_data.h_els.port_id[2];
 	d_id.b.area = bsg_request->rqst_data.h_els.port_id[1];
drivers/scsi/qla2xxx/qla_edif_bsg.h +56 -34

192 lines not on this page · raw message

Signature · 1 line
2.19.0.rc0
author maintainer
#3 lore raw

PATCH 3/11 qla2xxx: edif: wait for app to ack on sess down

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

On session deletion, wait for app to acknowledge before moving on. This allow both app and driver to stay in sync. In addition, this give a chance for authentication app to do any type of cleanup before moving on.

Fixes dd30706e73b70 ("scsi: qla2xxx: edif: Add key update")
---
 drivers/scsi/qla2xxx/qla_def.h    |  2 +-
 drivers/scsi/qla2xxx/qla_edif.c   | 66 +++++++++++++++++++++++++------
 drivers/scsi/qla2xxx/qla_init.c   |  4 --
 drivers/scsi/qla2xxx/qla_target.c | 35 ++++++++--------
 4 files changed, 74 insertions(+), 33 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -1
index 510fbeb04256..3e78bafa4011 100644
@@ -2626,7 +2626,6 @@ typedef struct fc_port {
 	struct {
 		uint32_t	enable:1;	/* device is edif enabled/req'd */
 		uint32_t	app_stop:2;
-		uint32_t	app_started:1;
 		uint32_t	aes_gmac:1;
 		uint32_t	app_sess_online:1;
 		uint32_t	tx_sa_set:1;
@@ -2637,6 +2636,7 @@ typedef struct fc_port {
 		uint32_t	rx_rekey_cnt;
 		uint64_t	tx_bytes;
 		uint64_t	rx_bytes;
+		uint8_t		sess_down_acked;
 		uint8_t		auth_state;
 		uint16_t	authok:1;
 		uint16_t	rekey_cnt;
drivers/scsi/qla2xxx/qla_edif.c +54 -12

110 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_init.c +0 -4
index 3f3417a3e891..ec1722e86f10 100644
@@ -1480,7 +1480,6 @@ static int	qla_chk_secure_login(scsi_qla_host_t	*vha, fc_port_t *fcport,
 				ql_dbg(ql_dbg_disc, vha, 0x20ef,
 				    "%s %d %8phC EDIF: post DB_AUTH: AUTH needed\n",
 				    __func__, __LINE__, fcport->port_name);
-				fcport->edif.app_started = 1;
 				fcport->edif.app_sess_online = 1;
 
 				qla_edb_eventcreate(vha, VND_CMD_AUTH_STATE_NEEDED,
@@ -5273,9 +5272,6 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
 	INIT_LIST_HEAD(&fcport->edif.tx_sa_list);
 	INIT_LIST_HEAD(&fcport->edif.rx_sa_list);
 
-	if (vha->e_dbell.db_flags == EDB_ACTIVE)
-		fcport->edif.app_started = 1;
-
 	spin_lock_init(&fcport->edif.indx_list_lock);
 	INIT_LIST_HEAD(&fcport->edif.edif_indx_list);
 
drivers/scsi/qla2xxx/qla_target.c +19 -16
index 2d30578aebcf..56673b691e26 100644
@@ -988,22 +988,6 @@ void qlt_free_session_done(struct work_struct *work)
 		sess->send_els_logo);
 
 	if (!IS_SW_RESV_ADDR(sess->d_id)) {
-		if (ha->flags.edif_enabled &&
-		    (!own || own->iocb.u.isp24.status_subcode == ELS_PLOGI)) {
-			sess->edif.authok = 0;
-			if (!ha->flags.host_shutting_down) {
-				ql_dbg(ql_dbg_edif, vha, 0x911e,
-					"%s wwpn %8phC calling qla2x00_release_all_sadb\n",
-					__func__, sess->port_name);
-				qla2x00_release_all_sadb(vha, sess);
-			} else {
-				ql_dbg(ql_dbg_edif, vha, 0x911e,
-					"%s bypassing release_all_sadb\n",
-					__func__);
-			}
-			qla_edif_clear_appdata(vha, sess);
-			qla_edif_sess_down(vha, sess);
-		}
 		qla2x00_mark_device_lost(vha, sess, 0);
 
 		if (sess->send_els_logo) {
@@ -1049,6 +1033,25 @@ void qlt_free_session_done(struct work_struct *work)
 			sess->nvme_flag |= NVME_FLAG_DELETING;
 			qla_nvme_unregister_remote_port(sess);
 		}
+
+		if (ha->flags.edif_enabled &&
+		    (!own || (own &&
+			      own->iocb.u.isp24.status_subcode == ELS_PLOGI))) {
+			sess->edif.authok = 0;
+			if (!ha->flags.host_shutting_down) {
+				ql_dbg(ql_dbg_edif, vha, 0x911e,
+				       "%s wwpn %8phC calling qla2x00_release_all_sadb\n",
+				       __func__, sess->port_name);
+				qla2x00_release_all_sadb(vha, sess);
+			} else {
+				ql_dbg(ql_dbg_edif, vha, 0x911e,
+				       "%s bypassing release_all_sadb\n",
+				       __func__);
+			}
+
+			qla_edif_clear_appdata(vha, sess);
+			qla_edif_sess_down(vha, sess);
+		}
 	}
 
 	/*
Signature · 1 line
2.19.0.rc0
author maintainer
#4 lore raw

PATCH 4/11 qla2xxx: edif: add bsg interface to read doorbell events

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Add bsg interface for app to read doorbell events. This interface let driver knows how much app can read based on return buffer size. When the next event(s) occur driver will return the bsg_job with the event(s) in the return buffer.

If there is no event to read, driver will hold on to the bsg_job up to few seconds as a way to control the polling interval.

Fixes dd30706e73b70 ("scsi: qla2xxx: edif: Add key update")
---
 drivers/scsi/qla2xxx/qla_dbg.h      |   2 +-
 drivers/scsi/qla2xxx/qla_edif.c     | 249 ++++++++++++++++++++--------
 drivers/scsi/qla2xxx/qla_edif.h     |   3 +-
 drivers/scsi/qla2xxx/qla_edif_bsg.h |  14 ++
 4 files changed, 195 insertions(+), 73 deletions(-)
drivers/scsi/qla2xxx/qla_dbg.h +1 -1
index f1f6c740bdcd..feeb1666227f 100644
@@ -383,5 +383,5 @@ ql_mask_match(uint level)
 	if (ql2xextended_error_logging == 1)
 		ql2xextended_error_logging = QL_DBG_DEFAULT1_MASK;
 
-	return (level & ql2xextended_error_logging) == level;
+	return level && ((level & ql2xextended_error_logging) == level);
 }
drivers/scsi/qla2xxx/qla_edif.c +178 -71

345 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_edif.h +2 -1
index a965ca8e47ce..3561e22b8f0f 100644
@@ -51,7 +51,8 @@ struct edif_dbell {
 	enum db_flags_t		db_flags;
 	spinlock_t		db_lock;
 	struct  list_head	head;
-	struct	completion	dbell;
+	struct bsg_job *dbell_bsg_job;
+	unsigned long bsg_expire;
 };
 
 #define SA_UPDATE_IOCB_TYPE            0x71    /* Security Association Update IOCB entry */
drivers/scsi/qla2xxx/qla_edif_bsg.h +14 -0
index 301523e4f483..110843b13767 100644
@@ -183,6 +183,20 @@ struct qla_sa_update_frame {
 #define	QL_VND_SC_GET_FCINFO	7
 #define	QL_VND_SC_GET_STATS	8
 #define QL_VND_SC_AEN_COMPLETE  9
+#define QL_VND_SC_READ_DBELL	10
+
+/*
+ * bsg caller to provide empty buffer for doorbell events.
+ *
+ * sg_io_v4.din_xferp  = empty buffer for door bell events
+ * sg_io_v4.dout_xferp = struct edif_read_dbell *buf
+ */
+struct edif_read_dbell {
+	struct app_id app_info;
+	uint8_t version;
+	uint8_t pad[VND_CMD_PAD_SIZE];
+	uint8_t reserved[VND_CMD_APP_RESERVED_SIZE];
+};
 
 
 /* Application interface data structure for rtn data */
Signature · 1 line
2.19.0.rc0
author maintainer
#5 lore raw

PATCH 5/11 qla2xxx: edif: Fix potential stuck session in sa update

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

When a thread is in the process of reestablish
a session, a flag is set to prevent multiple threads/triggers from doing the same task. This flag was left on, where any attempt to relogin was locked out. Clear this flag, if the attempt has failed.

Fixes dd30706e73b70 ("scsi: qla2xxx: edif: Add key update")
---
 drivers/scsi/qla2xxx/qla_edif.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +14 -3
index dca54ece4726..c9f6ec49b0b4 100644
@@ -2331,6 +2331,7 @@ edif_doorbell_show(struct device *dev, struct device_attribute *attr,
 
 static void qla_noop_sp_done(srb_t *sp, int res)
 {
+	sp->fcport->flags &= ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE);
 	/* ref: INIT */
 	kref_put(&sp->cmd_kref, qla2x00_sp_release);
 }
@@ -2355,7 +2356,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
 	if (!sa_ctl) {
 		ql_dbg(ql_dbg_edif, vha, 0x70e6,
 		    "sa_ctl allocation failed\n");
-		return -ENOMEM;
+		rval =  -ENOMEM;
+		goto done;
 	}
 
 	fcport = sa_ctl->fcport;
@@ -2365,7 +2367,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
 	if (!sp) {
 		ql_dbg(ql_dbg_edif, vha, 0x70e6,
 		 "SRB allocation failed\n");
-		return -ENOMEM;
+		rval = -ENOMEM;
+		goto done;
 	}
 
 	fcport->flags |= FCF_ASYNC_SENT;
@@ -2394,9 +2397,17 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
 
 	rval = qla2x00_start_sp(sp);
 
-	if (rval != QLA_SUCCESS)
+	if (rval != QLA_SUCCESS) {
 		rval = QLA_FUNCTION_FAILED;
+		goto done_free_sp;
+	}
 
+	return rval;
+done_free_sp:
+	kref_put(&sp->cmd_kref, qla2x00_sp_release);
+	fcport->flags &= ~FCF_ASYNC_SENT;
+done:
+	fcport->flags &= ~FCF_ASYNC_ACTIVE;
 	return rval;
 }
 
Signature · 1 line
2.19.0.rc0
author maintainer
#6 lore raw

PATCH 6/11 qla2xxx: edif: Synchronize NPIV deletion with authentication application

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Notify authentication application of a NPIV deletion event is about to occur. This allows app to perform cleanup.

Fixes 9efea843a906c ("scsi: qla2xxx: edif: Add detection of secure device")
---
 drivers/scsi/qla2xxx/qla_edif_bsg.h | 2 ++
 drivers/scsi/qla2xxx/qla_mid.c      | 6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_edif_bsg.h +2 -0
index 110843b13767..0931f4e4e127 100644
@@ -253,4 +253,6 @@ struct aen_complete_cmd {
 
 #define RX_DELAY_DELETE_TIMEOUT 20
 
+#define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN  1
+
 #endif	/* QLA_EDIF_BSG_H */
drivers/scsi/qla2xxx/qla_mid.c +5 -1
index e6b5c4ccce97..eb43a5f1b399 100644
@@ -166,9 +166,13 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
 	int ret = QLA_SUCCESS;
 	fc_port_t *fcport;
 
-	if (vha->hw->flags.edif_enabled)
+	if (vha->hw->flags.edif_enabled) {
+		if (DBELL_ACTIVE(vha))
+			qla2x00_post_aen_work(vha, FCH_EVT_VENDOR_UNIQUE,
+			    FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN);
 		/* delete sessions and flush sa_indexes */
 		qla2x00_wait_for_sess_deletion(vha);
+	}
 
 	if (vha->hw->flags.fw_started)
 		ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
Signature · 1 line
2.19.0.rc0
author maintainer
#7 lore raw

PATCH 7/11 qla2xxx: edif: add retry for els pass through

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Relating to EDIF, when sending IKE message, updating key or deleting key, driver can encounter IOCB queue full. Add additional retries to reduce higher level recovery.

Fixes dd30706e73b70 ("scsi: qla2xxx: edif: Add key update")
---
 drivers/scsi/qla2xxx/qla_edif.c | 52 +++++++++++++++++++++++----------
 drivers/scsi/qla2xxx/qla_os.c   |  2 +-
 2 files changed, 38 insertions(+), 16 deletions(-)
drivers/scsi/qla2xxx/qla_edif.c +37 -15
index c9f6ec49b0b4..142feda0381f 100644
@@ -1467,6 +1467,8 @@ qla24xx_check_sadb_avail_slot(struct bsg_job *bsg_job, fc_port_t *fcport,
 
 #define QLA_SA_UPDATE_FLAGS_RX_KEY      0x0
 #define QLA_SA_UPDATE_FLAGS_TX_KEY      0x2
+#define EDIF_MSLEEP_INTERVAL 100
+#define EDIF_RETRY_COUNT  50
 
 int
 qla24xx_sadb_update(struct bsg_job *bsg_job)
@@ -1479,7 +1481,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job)
 	struct edif_list_entry *edif_entry = NULL;
 	int			found = 0;
 	int			rval = 0;
-	int result = 0;
+	int result = 0, cnt;
 	struct qla_sa_update_frame sa_frame;
 	struct srb_iocb *iocb_cmd;
 	port_id_t portid;
@@ -1720,11 +1722,23 @@ qla24xx_sadb_update(struct bsg_job *bsg_job)
 	sp->done = qla2x00_bsg_job_done;
 	iocb_cmd = &sp->u.iocb_cmd;
 	iocb_cmd->u.sa_update.sa_frame  = sa_frame;
-
+	cnt = 0;
+retry:
 	rval = qla2x00_start_sp(sp);
-	if (rval != QLA_SUCCESS) {
+	switch (rval) {
+	case QLA_SUCCESS:
+		break;
+	case EAGAIN:
+		msleep(EDIF_MSLEEP_INTERVAL);
+		cnt++;
+		if (cnt < EDIF_RETRY_COUNT)
+			goto retry;
+
+		fallthrough;
+	default:
 		ql_log(ql_dbg_edif, vha, 0x70e3,
-		    "qla2x00_start_sp failed=%d.\n", rval);
+		       "%s qla2x00_start_sp failed=%d.\n",
+		       __func__, rval);
 
 		qla2x00_rel_sp(sp);
 		rval = -EIO;
@@ -2398,7 +2412,6 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e)
 	rval = qla2x00_start_sp(sp);
 
 	if (rval != QLA_SUCCESS) {
-		rval = QLA_FUNCTION_FAILED;
 		goto done_free_sp;
 	}
 
@@ -3530,7 +3543,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	fc_port_t *fcport = NULL;
 	struct qla_hw_data *ha = vha->hw;
 	srb_t *sp;
-	int rval =  (DID_ERROR << 16);
+	int rval =  (DID_ERROR << 16), cnt;
 	port_id_t d_id;
 	struct qla_bsg_auth_els_request *p =
 	    (struct qla_bsg_auth_els_request *)bsg_job->request;
@@ -3625,17 +3638,26 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	sp->free = qla2x00_bsg_sp_free;
 	sp->done = qla2x00_bsg_job_done;
 
+	cnt = 0;
+retry:
 	rval = qla2x00_start_sp(sp);
-
-	ql_dbg(ql_dbg_edif, vha, 0x700a,
-	    "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n",
-	    __func__, sc_to_str(p->e.sub_cmd), fcport->port_name,
-	    p->e.extra_rx_xchg_address, p->e.extra_control_flags,
-	    sp->handle, sp->remap.req.len, bsg_job);
-
-	if (rval != QLA_SUCCESS) {
+	switch (rval) {
+	case QLA_SUCCESS:
+		ql_dbg(ql_dbg_edif, vha, 0x700a,
+		       "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n",
+		       __func__, sc_to_str(p->e.sub_cmd), fcport->port_name,
+		       p->e.extra_rx_xchg_address, p->e.extra_control_flags,
+		       sp->handle, sp->remap.req.len, bsg_job);
+		break;
+	case EAGAIN:
+		msleep(EDIF_MSLEEP_INTERVAL);
+		cnt++;
+		if (cnt < EDIF_RETRY_COUNT)
+			goto retry;
+		fallthrough;
+	default:
 		ql_log(ql_log_warn, vha, 0x700e,
-		    "qla2x00_start_sp failed = %d\n", rval);
+		    "%s qla2x00_start_sp failed = %d\n", __func__, rval);
 		SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY);
 		rval = -EIO;
 		goto done_free_remap_rsp;
drivers/scsi/qla2xxx/qla_os.c +1 -1
index 73073fb08369..4f3125b826c4 100644
@@ -5472,7 +5472,7 @@ qla2x00_do_work(struct scsi_qla_host *vha)
 			    e->u.fcport.fcport, false);
 			break;
 		case QLA_EVT_SA_REPLACE:
-			qla24xx_issue_sa_replace_iocb(vha, e);
+			rc = qla24xx_issue_sa_replace_iocb(vha, e);
 			break;
 		}
 
Signature · 1 line
2.19.0.rc0
author maintainer
#8 lore raw

PATCH 8/11 qla2xxx: edif: remove old doorbell interface

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

Recently driver has implemented a new doorbell mechanism via bsg. The new doorbell tells driver the exact buffer size application has where driver can fill it up with events. The old doorbell guestimated application buffer size is 256. This patch remove duplicate functionality. In addition, application has moved on to the new doorbell interface.

---
 drivers/scsi/qla2xxx/qla_attr.c |  2 -
 drivers/scsi/qla2xxx/qla_edif.c | 78 ---------------------------------
 drivers/scsi/qla2xxx/qla_gbl.h  |  1 -
 3 files changed, 81 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +0 -2
index 3b3e4234f37a..8b87fefda423 100644
@@ -2476,7 +2476,6 @@ static DEVICE_ATTR(port_speed, 0644, qla2x00_port_speed_show,
     qla2x00_port_speed_store);
 static DEVICE_ATTR(port_no, 0444, qla2x00_port_no_show, NULL);
 static DEVICE_ATTR(fw_attr, 0444, qla2x00_fw_attr_show, NULL);
-static DEVICE_ATTR_RO(edif_doorbell);
 
 static struct attribute *qla2x00_host_attrs[] = {
 	&dev_attr_driver_version.attr,
@@ -2521,7 +2520,6 @@ static struct attribute *qla2x00_host_attrs[] = {
 	&dev_attr_port_no.attr,
 	&dev_attr_fw_attr.attr,
 	&dev_attr_dport_diagnostics.attr,
-	&dev_attr_edif_doorbell.attr,
 	&dev_attr_mpi_pause.attr,
 	&dev_attr_qlini_mode.attr,
 	&dev_attr_ql2xiniexchg.attr,
drivers/scsi/qla2xxx/qla_edif.c +0 -78

84 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_gbl.h +0 -1
index 84b44454c231..08103efa170f 100644
@@ -990,7 +990,6 @@ fc_port_t *qla2x00_find_fcport_by_pid(scsi_qla_host_t *vha, port_id_t *id);
 void qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t dbtype, uint32_t data, uint32_t data2,
 		fc_port_t *fcport);
 void qla_edb_stop(scsi_qla_host_t *vha);
-ssize_t edif_doorbell_show(struct device *dev, struct device_attribute *attr, char *buf);
 int32_t qla_edif_app_mgmt(struct bsg_job *bsg_job);
 void qla_enode_init(scsi_qla_host_t *vha);
 void qla_enode_stop(scsi_qla_host_t *vha);
Signature · 1 line
2.19.0.rc0
author maintainer
#9 lore raw

PATCH 9/11 qla2xxx: edif: fix n2n discovery issue with secure target

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

User failed to see disk via n2n topology, driver used up all login retries before authentication application starts. When authentication application starts, driver did not have enough login retries to connect as secure. On app_start, driver will reset the login retry attempt count.

Fixes 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF")
---
 drivers/scsi/qla2xxx/qla_edif.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/scsi/qla2xxx/qla_edif.c +3 -0
index 7f2106f2d94d..18eb8d63e37c 100644
@@ -515,6 +515,9 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job *bsg_job)
 	}
 
 	if (N2N_TOPO(vha->hw)) {
+		list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list)
+			fcport->n2n_link_reset_cnt = 0;
+
 		if (vha->hw->flags.n2n_fw_acc_sec)
 			set_bit(N2N_LINK_RESET, &vha->dpc_flags);
 		else
Signature · 1 line
2.19.0.rc0
author maintainer
#10 lore raw

PATCH 10/11 qla2xxx: edif: fix n2n login retry for secure device

In reply to Nilesh Javali

From: Quinn Tran <[email protected]>

After initiator has burn up all login retry, target authentication application begins to run. This triggers a link bounce on target side. Initiator will attempt another login. Due to N2N, the prli [nvme | fcp] can fail because of the mode mismatch with target. This patch add a few more login retries to revive the connection.

Fixes 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF")
---
 drivers/scsi/qla2xxx/qla_init.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/scsi/qla2xxx/qla_init.c +7 -0
index ec1722e86f10..d915c1f85fa2 100644
@@ -2123,6 +2123,13 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host *vha, struct event_arg *ea)
 		}
 
 		if (N2N_TOPO(vha->hw)) {
+			if (ea->fcport->n2n_link_reset_cnt ==
+			    vha->hw->login_retry_count &&
+			    ea->fcport->flags & FCF_FCSP_DEVICE) {
+				/* remote authentication app just started */
+				ea->fcport->n2n_link_reset_cnt = 0;
+			}
+
 			if (ea->fcport->n2n_link_reset_cnt <
 			    vha->hw->login_retry_count) {
 				ea->fcport->n2n_link_reset_cnt++;
Signature · 1 line
2.19.0.rc0
author maintainer
#11 lore raw

PATCH 11/11 qla2xxx: Update version to 10.02.07.500-k

In reply to Nilesh Javali
---
 drivers/scsi/qla2xxx/qla_version.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +2 -2
index b09d7d2080c0..e5ce7599cae2 100644
@@ -6,9 +6,9 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "10.02.07.400-k"
+#define QLA2XXX_VERSION      "10.02.07.500-k"
 
 #define QLA_DRIVER_MAJOR_VER	10
 #define QLA_DRIVER_MINOR_VER	2
 #define QLA_DRIVER_PATCH_VER	7
-#define QLA_DRIVER_BETA_VER	400
+#define QLA_DRIVER_BETA_VER	500
Signature · 1 line
2.19.0.rc0
#12 lore raw
In reply to Nilesh Javali

Nilesh,

Quoted 2 lines

Please apply the qla2xxx driver misc EDiF bug fixes to the scsi tree at your earliest convenience.

Applied to Applied to 5.20/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#13 lore raw
In reply to Nilesh Javali
Quoted 9 lines · Nilesh Javali

Martin,

Please apply the qla2xxx driver misc EDiF bug fixes to the scsi tree at your earliest convenience.

Thanks,
Nilesh

[...]

Applied to 5.20/scsi-queue, thanks!

[01/11] qla2xxx: edif: Reduce Initiator-Initiator thrashing

        https://git.kernel.org/mkp/scsi/c/9c40c36e75ff
[02/11] qla2xxx: edif: bsg refactor
        https://git.kernel.org/mkp/scsi/c/7a7b0b4865d3
[03/11] qla2xxx: edif: wait for app to ack on sess down
        https://git.kernel.org/mkp/scsi/c/df648afa39da
[04/11] qla2xxx: edif: add bsg interface to read doorbell events
        https://git.kernel.org/mkp/scsi/c/5ecd241bd7b1
[05/11] qla2xxx: edif: Fix potential stuck session in sa update
        https://git.kernel.org/mkp/scsi/c/e0fb8ce2bb9e
[06/11] qla2xxx: edif: Synchronize NPIV deletion with authentication application
        https://git.kernel.org/mkp/scsi/c/cf79716e6636
[07/11] qla2xxx: edif: add retry for els pass through
        https://git.kernel.org/mkp/scsi/c/0b3f3143d473
[08/11] qla2xxx: edif: remove old doorbell interface
        https://git.kernel.org/mkp/scsi/c/1040e5f75ddf
[09/11] qla2xxx: edif: fix n2n discovery issue with secure target
        https://git.kernel.org/mkp/scsi/c/789d54a41786
[10/11] qla2xxx: edif: fix n2n login retry for secure device
        https://git.kernel.org/mkp/scsi/c/aec55325ddec
[11/11] qla2xxx: Update version to 10.02.07.500-k
        https://git.kernel.org/mkp/scsi/c/4dc48a107a14
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering