From: Tony Battersby <tonyb@cybernetics.com>
To: Nilesh Javali <njavali@marvell.com>,
GR-QLogic-Storage-Upstream@marvell.com,
"James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>
Cc: linux-scsi <linux-scsi@vger.kernel.org>,
target-devel@vger.kernel.org, scst-devel@lists.sourceforge.net,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Dmitry Bogdanov <d.bogdanov@yadro.com>,
Xose Vazquez Perez <xose.vazquez@gmail.com>
Subject: [SCST PATCH v2] qla2x00t-32gbit: add on_abort_cmd callback
Date: Mon, 29 Sep 2025 10:54:09 -0400 [thread overview]
Message-ID: <4ff0e0d0-755c-498a-a852-b59800a122d5@cybernetics.com> (raw)
In-Reply-To: <e95ee7d0-3580-4124-b854-7f73ca3a3a84@cybernetics.com>
This enables the initiator to abort commands that are stuck pending in
the HW without waiting for a timeout.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
v1 -> v2: no changes
This patch applies to the out-of-tree SCST project, not to the Linux
kernel. Apply after all the other qla2xxx patches.
qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c
index 07aee6e81..cb58fae20 100644
--- a/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c
+++ b/qla2x00t-32gbit/qla2x00-target/scst_qla2xxx.c
@@ -81,6 +81,7 @@ static int sqa_xmit_response(struct scst_cmd *scst_cmd);
static int sqa_rdy_to_xfer(struct scst_cmd *scst_cmd);
static void sqa_on_free_cmd(struct scst_cmd *scst_cmd);
static void sqa_task_mgmt_fn_done(struct scst_mgmt_cmd *mcmd);
+static void sqa_on_abort_cmd(struct scst_cmd *scst_cmd);
static int sqa_get_initiator_port_transport_id(struct scst_tgt *tgt,
struct scst_session *scst_sess,
uint8_t **transport_id);
@@ -1255,6 +1256,7 @@ static struct scst_tgt_template sqa_scst_template = {
.on_free_cmd = sqa_on_free_cmd,
.task_mgmt_fn_done = sqa_task_mgmt_fn_done,
+ .on_abort_cmd = sqa_on_abort_cmd,
.close_session = sqa_close_session,
.get_initiator_port_transport_id = sqa_get_initiator_port_transport_id,
@@ -1926,6 +1928,46 @@ out_unlock:
TRACE_EXIT();
}
+struct sqa_abort_work {
+ struct scst_cmd *scst_cmd;
+ struct work_struct abort_work;
+};
+
+static void sqa_on_abort_cmd_work(struct work_struct *work)
+{
+ struct sqa_abort_work *abort_work =
+ container_of(work, struct sqa_abort_work, abort_work);
+ struct scst_cmd *scst_cmd = abort_work->scst_cmd;
+ struct qla_tgt_cmd *cmd = scst_cmd_get_tgt_priv(scst_cmd);
+
+ TRACE_ENTRY();
+
+ kfree(abort_work);
+ qlt_abort_cmd(cmd);
+ scst_cmd_put(scst_cmd);
+
+ TRACE_EXIT();
+}
+
+static void sqa_on_abort_cmd(struct scst_cmd *scst_cmd)
+{
+ struct sqa_abort_work *abort_work;
+
+ /*
+ * The caller holds sess->sess_list_lock, but qlt_abort_cmd() needs to
+ * acquire qpair->qp_lock_ptr (ha->hardware_lock); these locks are
+ * acquired in the reverse order elsewhere. Use a workqueue to avoid
+ * acquiring the locks in the wrong order here.
+ */
+ abort_work = kmalloc(sizeof(*abort_work), GFP_ATOMIC);
+ if (!abort_work)
+ return;
+ scst_cmd_get(scst_cmd);
+ abort_work->scst_cmd = scst_cmd;
+ INIT_WORK(&abort_work->abort_work, sqa_on_abort_cmd_work);
+ schedule_work(&abort_work->abort_work);
+}
+
/*
* The following structure defines the callbacks which will be executed
* from functions in the qla_target.c file back to this interface
--
2.43.0
next prev parent reply other threads:[~2025-09-29 14:54 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-29 14:28 [PATCH v2 00/16] qla2xxx target mode improvements Tony Battersby
2025-09-29 14:30 ` [PATCH v2 01/16] Revert "scsi: qla2xxx: Perform lockless command completion in abort path" Tony Battersby
2025-09-29 14:32 ` [PATCH v2 02/16] scsi: qla2xxx: fix initiator mode with qlini_mode=exclusive Tony Battersby
2025-09-29 14:33 ` [PATCH v2 03/16] scsi: qla2xxx: fix lost interrupts with qlini_mode=disabled Tony Battersby
2025-09-29 14:34 ` [PATCH v2 04/16] scsi: qla2xxx: use reinit_completion on mbx_intr_comp Tony Battersby
2025-09-29 14:35 ` [PATCH v2 05/16] scsi: qla2xxx: remove code for unsupported hardware Tony Battersby
2025-09-29 14:36 ` [PATCH v2 06/16] scsi: qla2xxx: improve debug output for term exchange Tony Battersby
2025-09-29 14:37 ` [PATCH v2 07/16] scsi: qla2xxx: fix term exchange when cmd_sent_to_fw == 1 Tony Battersby
2025-09-29 14:38 ` [PATCH v2 08/16] scsi: qla2xxx: clear cmds after chip reset Tony Battersby
2025-09-29 14:39 ` [PATCH v2 09/16] scsi: qla2xxx: fix races with aborting commands Tony Battersby
2025-09-29 14:41 ` [SCST PATCH " Tony Battersby
2025-09-29 14:42 ` [PATCH v2 10/16] scsi: qla2xxx: improve checks in qlt_xmit_response / qlt_rdy_to_xfer Tony Battersby
2025-09-29 14:43 ` [PATCH v2 11/16] scsi: qla2xxx: fix TMR failure handling Tony Battersby
2025-10-03 8:40 ` Dan Carpenter
2025-10-03 14:38 ` [PATCH v3 " Tony Battersby
2025-09-29 14:44 ` [PATCH v2 12/16] scsi: qla2xxx: fix invalid memory access with big CDBs Tony Battersby
2025-09-29 14:45 ` [SCST PATCH " Tony Battersby
2025-09-29 14:47 ` [PATCH v2 13/16] scsi: qla2xxx: add cmd->rsp_sent Tony Battersby
2025-09-29 14:48 ` [SCST PATCH " Tony Battersby
2025-09-29 14:49 ` [PATCH v2 14/16] scsi: qla2xxx: improve cmd logging Tony Battersby
2025-09-29 14:50 ` [PATCH v2 15/16] scsi: qla2xxx: add back SRR support Tony Battersby
2025-09-29 14:51 ` [SCST PATCH " Tony Battersby
2025-09-29 14:53 ` [PATCH v2 16/16] scsi: qla2xxx: improve safety of cmd lookup by handle Tony Battersby
2025-09-29 14:54 ` Tony Battersby [this message]
2025-11-03 15:44 ` [PATCH v2 00/16] qla2xxx target mode improvements Tony Battersby
2025-11-08 17:03 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ff0e0d0-755c-498a-a852-b59800a122d5@cybernetics.com \
--to=tonyb@cybernetics.com \
--cc=GR-QLogic-Storage-Upstream@marvell.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=d.bogdanov@yadro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=njavali@marvell.com \
--cc=scst-devel@lists.sourceforge.net \
--cc=target-devel@vger.kernel.org \
--cc=xose.vazquez@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®