Blame SOURCES/0130-scsi-scsi-qla2xxx-Make-qla24xx_async_abort_cmd-stati.patch

3c6e85
From 85a4f5412689ab8b2d60af510a501eb865fc7ef9 Mon Sep 17 00:00:00 2001
3c6e85
From: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Date: Thu, 21 Nov 2019 16:36:40 -0500
3c6e85
Subject: [PATCH 130/155] [scsi] scsi: qla2xxx: Make qla24xx_async_abort_cmd()
3c6e85
 static
3c6e85
3c6e85
Message-id: <20191121163701.43688-6-hmadhani@redhat.com>
3c6e85
Patchwork-id: 287869
3c6e85
O-Subject: [RHLE 7.8 e-stor PATCH v3 05/26] scsi: qla2xxx: Make qla24xx_async_abort_cmd() static
3c6e85
Bugzilla: 1731581
3c6e85
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
3c6e85
RH-Acked-by: Ewan Milne <emilne@redhat.com>
3c6e85
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
3c6e85
3c6e85
From: Bart Van Assche <bvanassche@acm.org>
3c6e85
3c6e85
Bugzilla 1731581
3c6e85
3c6e85
Since qla24xx_async_abort_cmd() is only called from inside qla_init.c,
3c6e85
declare that function static. Reorder a few functions to avoid that any
3c6e85
forward declarations are needed.
3c6e85
3c6e85
Cc: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Cc: Giridhar Malavali <gmalavali@marvell.com>
3c6e85
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
3c6e85
Acked-by: Himanshu Madhani <hmadhani@marvell.com>
3c6e85
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
3c6e85
(cherry picked from commit 1956eee58872e622cfe03f060a5d8a20d24afe47)
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
3c6e85
Conflicts:
3c6e85
	drivers/scsi/qla2xxx/qla_init.c
3c6e85
3c6e85
[ hmadhani: RHEL 7.8 submission via bz1729270 included commit ]
3c6e85
[           0c6df59061b23c7a951836d23977be34e896d3da earlier  ]
3c6e85
[           than this patch which moves qla24xx_abort_iocb_timeout() ]
3c6e85
[	    to make it static. This patch preserves changes and ]
3c6e85
[ 	    moves the function. No change in acutal source due to ]
3c6e85
[ 	    this patch is introduced. ]
3c6e85
3c6e85
Signed-off-by: Himanshu Madhani <hmadhani@redhat.com>
3c6e85
Signed-off-by: Jan Stancek <jstancek@redhat.com>
3c6e85
---
3c6e85
 drivers/scsi/qla2xxx/qla_gbl.h  |   1 -
3c6e85
 drivers/scsi/qla2xxx/qla_init.c | 177 ++++++++++++++++++++--------------------
3c6e85
 2 files changed, 87 insertions(+), 91 deletions(-)
3c6e85
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
index 5075d447c69e..6d59359e0d21 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
3c6e85
@@ -219,7 +219,6 @@ extern void qla24xx_sched_upd_fcport(fc_port_t *);
3c6e85
 void qla2x00_handle_login_done_event(struct scsi_qla_host *, fc_port_t *,
3c6e85
 	uint16_t *);
3c6e85
 int qla24xx_post_gnl_work(struct scsi_qla_host *, fc_port_t *);
3c6e85
-int qla24xx_async_abort_cmd(srb_t *, bool);
3c6e85
 int qla24xx_post_relogin_work(struct scsi_qla_host *vha);
3c6e85
 void qla2x00_wait_for_sess_deletion(scsi_qla_host_t *);
3c6e85
 
3c6e85
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
3c6e85
index 3eecb873a84e..8da5ef9e19f5 100644
3c6e85
--- a/drivers/scsi/qla2xxx/qla_init.c
3c6e85
+++ b/drivers/scsi/qla2xxx/qla_init.c
3c6e85
@@ -95,6 +95,93 @@ qla2x00_get_async_timeout(struct scsi_qla_host *vha)
3c6e85
 	return tmo;
3c6e85
 }
3c6e85
 
3c6e85
+static void qla24xx_abort_iocb_timeout(void *data)
3c6e85
+{
3c6e85
+	srb_t *sp = data;
3c6e85
+	struct srb_iocb *abt = &sp->u.iocb_cmd;
3c6e85
+	struct qla_qpair *qpair = sp->qpair;
3c6e85
+	u32 handle;
3c6e85
+	unsigned long flags;
3c6e85
+
3c6e85
+	spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3c6e85
+	for (handle = 1; handle < qpair->req->num_outstanding_cmds; handle++) {
3c6e85
+		/* removing the abort */
3c6e85
+		if (qpair->req->outstanding_cmds[handle] == sp) {
3c6e85
+			qpair->req->outstanding_cmds[handle] = NULL;
3c6e85
+			break;
3c6e85
+		}
3c6e85
+	}
3c6e85
+	spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3c6e85
+
3c6e85
+	abt->u.abt.comp_status = CS_TIMEOUT;
3c6e85
+	sp->done(sp, QLA_OS_TIMER_EXPIRED);
3c6e85
+}
3c6e85
+
3c6e85
+static void qla24xx_abort_sp_done(void *ptr, int res)
3c6e85
+{
3c6e85
+	srb_t *sp = ptr;
3c6e85
+	struct srb_iocb *abt = &sp->u.iocb_cmd;
3c6e85
+
3c6e85
+	if ((res == QLA_OS_TIMER_EXPIRED) ||
3c6e85
+	    del_timer(&sp->u.iocb_cmd.timer)) {
3c6e85
+		if (sp->flags & SRB_WAKEUP_ON_COMP)
3c6e85
+			complete(&abt->u.abt.comp);
3c6e85
+		else
3c6e85
+			sp->free(sp);
3c6e85
+	}
3c6e85
+}
3c6e85
+
3c6e85
+static int qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
3c6e85
+{
3c6e85
+	scsi_qla_host_t *vha = cmd_sp->vha;
3c6e85
+	struct srb_iocb *abt_iocb;
3c6e85
+	srb_t *sp;
3c6e85
+	int rval = QLA_FUNCTION_FAILED;
3c6e85
+
3c6e85
+	sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport,
3c6e85
+	    GFP_ATOMIC);
3c6e85
+	if (!sp)
3c6e85
+		goto done;
3c6e85
+
3c6e85
+	abt_iocb = &sp->u.iocb_cmd;
3c6e85
+	sp->type = SRB_ABT_CMD;
3c6e85
+	sp->name = "abort";
3c6e85
+	sp->qpair = cmd_sp->qpair;
3c6e85
+	if (wait)
3c6e85
+		sp->flags = SRB_WAKEUP_ON_COMP;
3c6e85
+
3c6e85
+	abt_iocb->timeout = qla24xx_abort_iocb_timeout;
3c6e85
+	init_completion(&abt_iocb->u.abt.comp);
3c6e85
+	/* FW can send 2 x ABTS's timeout/20s */
3c6e85
+	qla2x00_init_timer(sp, 42);
3c6e85
+
3c6e85
+	abt_iocb->u.abt.cmd_hndl = cmd_sp->handle;
3c6e85
+	abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id);
3c6e85
+
3c6e85
+	sp->done = qla24xx_abort_sp_done;
3c6e85
+
3c6e85
+	ql_dbg(ql_dbg_async, vha, 0x507c,
3c6e85
+	    "Abort command issued - hdl=%x, type=%x\n",
3c6e85
+	    cmd_sp->handle, cmd_sp->type);
3c6e85
+
3c6e85
+	rval = qla2x00_start_sp(sp);
3c6e85
+	if (rval != QLA_SUCCESS)
3c6e85
+		goto done_free_sp;
3c6e85
+
3c6e85
+	if (wait) {
3c6e85
+		wait_for_completion(&abt_iocb->u.abt.comp);
3c6e85
+		rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ?
3c6e85
+			QLA_SUCCESS : QLA_FUNCTION_FAILED;
3c6e85
+	} else {
3c6e85
+		goto done;
3c6e85
+	}
3c6e85
+
3c6e85
+done_free_sp:
3c6e85
+	sp->free(sp);
3c6e85
+done:
3c6e85
+	return rval;
3c6e85
+}
3c6e85
+
3c6e85
 void
3c6e85
 qla2x00_async_iocb_timeout(void *data)
3c6e85
 {
3c6e85
@@ -1791,96 +1878,6 @@ done:
3c6e85
 	return rval;
3c6e85
 }
3c6e85
 
3c6e85
-static void
3c6e85
-qla24xx_abort_iocb_timeout(void *data)
3c6e85
-{
3c6e85
-	srb_t *sp = data;
3c6e85
-	struct srb_iocb *abt = &sp->u.iocb_cmd;
3c6e85
-	struct qla_qpair *qpair = sp->qpair;
3c6e85
-	u32 handle;
3c6e85
-	unsigned long flags;
3c6e85
-
3c6e85
-	spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3c6e85
-	for (handle = 1; handle < qpair->req->num_outstanding_cmds; handle++) {
3c6e85
-		/* removing the abort */
3c6e85
-		if (qpair->req->outstanding_cmds[handle] == sp) {
3c6e85
-			qpair->req->outstanding_cmds[handle] = NULL;
3c6e85
-			break;
3c6e85
-		}
3c6e85
-	}
3c6e85
-	spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3c6e85
-
3c6e85
-	abt->u.abt.comp_status = CS_TIMEOUT;
3c6e85
-	sp->done(sp, QLA_OS_TIMER_EXPIRED);
3c6e85
-}
3c6e85
-
3c6e85
-static void
3c6e85
-qla24xx_abort_sp_done(void *ptr, int res)
3c6e85
-{
3c6e85
-	srb_t *sp = ptr;
3c6e85
-	struct srb_iocb *abt = &sp->u.iocb_cmd;
3c6e85
-
3c6e85
-	if ((res == QLA_OS_TIMER_EXPIRED) ||
3c6e85
-	    del_timer(&sp->u.iocb_cmd.timer)) {
3c6e85
-		if (sp->flags & SRB_WAKEUP_ON_COMP)
3c6e85
-			complete(&abt->u.abt.comp);
3c6e85
-		else
3c6e85
-			sp->free(sp);
3c6e85
-	}
3c6e85
-}
3c6e85
-
3c6e85
-int
3c6e85
-qla24xx_async_abort_cmd(srb_t *cmd_sp, bool wait)
3c6e85
-{
3c6e85
-	scsi_qla_host_t *vha = cmd_sp->vha;
3c6e85
-	struct srb_iocb *abt_iocb;
3c6e85
-	srb_t *sp;
3c6e85
-	int rval = QLA_FUNCTION_FAILED;
3c6e85
-
3c6e85
-	sp = qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport,
3c6e85
-	    GFP_ATOMIC);
3c6e85
-	if (!sp)
3c6e85
-		goto done;
3c6e85
-
3c6e85
-	abt_iocb = &sp->u.iocb_cmd;
3c6e85
-	sp->type = SRB_ABT_CMD;
3c6e85
-	sp->name = "abort";
3c6e85
-	sp->qpair = cmd_sp->qpair;
3c6e85
-	if (wait)
3c6e85
-		sp->flags = SRB_WAKEUP_ON_COMP;
3c6e85
-
3c6e85
-	abt_iocb->timeout = qla24xx_abort_iocb_timeout;
3c6e85
-	init_completion(&abt_iocb->u.abt.comp);
3c6e85
-	/* FW can send 2 x ABTS's timeout/20s */
3c6e85
-	qla2x00_init_timer(sp, 42);
3c6e85
-
3c6e85
-	abt_iocb->u.abt.cmd_hndl = cmd_sp->handle;
3c6e85
-	abt_iocb->u.abt.req_que_no = cpu_to_le16(cmd_sp->qpair->req->id);
3c6e85
-
3c6e85
-	sp->done = qla24xx_abort_sp_done;
3c6e85
-
3c6e85
-	ql_dbg(ql_dbg_async, vha, 0x507c,
3c6e85
-	    "Abort command issued - hdl=%x, type=%x\n",
3c6e85
-	    cmd_sp->handle, cmd_sp->type);
3c6e85
-
3c6e85
-	rval = qla2x00_start_sp(sp);
3c6e85
-	if (rval != QLA_SUCCESS)
3c6e85
-		goto done_free_sp;
3c6e85
-
3c6e85
-	if (wait) {
3c6e85
-		wait_for_completion(&abt_iocb->u.abt.comp);
3c6e85
-		rval = abt_iocb->u.abt.comp_status == CS_COMPLETE ?
3c6e85
-			QLA_SUCCESS : QLA_FUNCTION_FAILED;
3c6e85
-	} else {
3c6e85
-		goto done;
3c6e85
-	}
3c6e85
-
3c6e85
-done_free_sp:
3c6e85
-	sp->free(sp);
3c6e85
-done:
3c6e85
-	return rval;
3c6e85
-}
3c6e85
-
3c6e85
 int
3c6e85
 qla24xx_async_abort_command(srb_t *sp)
3c6e85
 {
3c6e85
-- 
3c6e85
2.13.6
3c6e85