Skip to content

Commit d204087

Browse files
Merge patch series "qla2xxx target mode improvements"
Tony Battersby <tonyb@cybernetics.com> says: This patch series improves the qla2xxx FC driver in target mode. I developed these patches using the out-of-tree SCST target-mode subsystem (https://scst.sourceforge.net/), although most of the improvements will also apply to the other target-mode subsystems such as the in-tree LIO. Unfortunately qla2xxx+LIO does not pass all of my tests, but my patches do not make it any worse (results below). These patches have been well-tested at my employer with qla2xxx+SCST in both initiator mode and target mode and with a variety of FC HBAs and initiators. Since SCST is out-of-tree, some of the patches have parts that apply in-tree and other parts that apply out-of-tree to SCST. The SCST patches can be found in the v2 posting linked above. All patches apply to linux 6.17 and SCST 3.10 master branch. Summary of patches: - bugfixes - cleanups - improve handling of aborts and task management requests - improve log message - add back SLER / SRR support (removed in 2017) Some of these patches improve handling of aborts and task management requests. This is some of the testing that I did: Test 1: Use /dev/sg to queue random disk I/O with short timeouts; make sure cmds are aborted successfully. Test 2: Queue lots of disk I/O, then use "sg_reset -N -d /dev/sg" on initiator to reset logical unit. Test 3: Queue lots of disk I/O, then use "sg_reset -N -t /dev/sg" on initiator to reset target. Test 4: Queue lots of disk I/O, then use "sg_reset -N -b /dev/sg" on initiator to reset bus. Test 5: Queue lots of disk I/O, then use "sg_reset -N -H /dev/sg" on initiator to reset host. Test 6: Use fiber channel attenuator to trigger SRR during write/read/compare test; check data integrity. With my patches, SCST passes all of these tests. Results with in-tree LIO target-mode subsystem: Test 1: Seems to abort the same cmd multiple times (both qlt_24xx_retry_term_exchange() and __qlt_send_term_exchange()). But cmds get aborted, so give it a pass? Test 2: Seems to work; cmds are aborted. Test 3: Target reset doesn't seem to abort cmds, instead, a few seconds later: qla2xxx [0000:04:00.0]-f058:9: qla_target(0): tag 1314312, op 2a: CTIO with TIMEOUT status 0xb received (state 1, port 51:40:2e:c0:18:1d:9f:cc, LUN 0) Tests 4 and 5: The initiator is unable to log back in to the target; the following messages are repeated over and over on the target: qla2xxx [0000:04:00.0]-e01c:9: Sending TERM ELS CTIO (ha=00000000f8811390) qla2xxx [0000:04:00.0]-f097:9: Linking sess 000000008df5aba8 [0] wwn 51:40:2e:c0:18:1d:9f:cc with PLOGI ACK to wwn 51:40:2e:c0:18:1d:9f:cc s_id 00:00:01, ref=2 pla 00000000835a9271 link 0 Test 6: passes with my patches; SRR not supported previously. So qla2xxx+LIO seems a bit flaky when handling exceptions, but my patches do not make it any worse. Perhaps someone who is more familiar with LIO can look at the difference between LIO and SCST and figure out how to improve it. Tony Battersby https://www.cybernetics.com/ v1: https://lore.kernel.org/r/f8977250-638c-4d7d-ac0c-65f742b8d535@cybernetics.com/ v2: https://lore.kernel.org/linux-scsi/e95ee7d0-3580-4124-b854-7f73ca3a3a84@cybernetics.com/ Link: https://patch.msgid.link/aaea0ab0-da8b-4153-9369-60db7507ff7a@cybernetics.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents ab57a18 + 4f5eb50 commit d204087

11 files changed

Lines changed: 1655 additions & 345 deletions

File tree

drivers/scsi/qla2xxx/qla_dbg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,11 @@
5454
* | Misc | 0xd303 | 0xd031-0xd0ff |
5555
* | | | 0xd101-0xd1fe |
5656
* | | | 0xd214-0xd2fe |
57-
* | Target Mode | 0xe081 | |
57+
* | Target Mode | 0xe089 | |
5858
* | Target Mode Management | 0xf09b | 0xf002 |
5959
* | | | 0xf046-0xf049 |
6060
* | Target Mode Task Management | 0x1000d | |
61+
* | Target Mode SRR | 0x11038 | |
6162
* ----------------------------------------------------------------------
6263
*/
6364

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3503,7 +3503,6 @@ struct isp_operations {
35033503
#define QLA_MSIX_RSP_Q 0x01
35043504
#define QLA_ATIO_VECTOR 0x02
35053505
#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q 0x03
3506-
#define QLA_MSIX_QPAIR_MULTIQ_RSP_Q_HS 0x04
35073506

35083507
#define QLA_MIDX_DEFAULT 0
35093508
#define QLA_MIDX_RSP_Q 1

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ extern int qla2x00_dfs_remove(scsi_qla_host_t *);
766766

767767
/* Globa function prototypes for multi-q */
768768
extern int qla25xx_request_irq(struct qla_hw_data *, struct qla_qpair *,
769-
struct qla_msix_entry *, int);
769+
struct qla_msix_entry *);
770770
extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
771771
extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
772772
extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,7 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
43694369
ha->max_npiv_vports =
43704370
MIN_MULTI_ID_FABRIC - 1;
43714371
}
4372+
qlt_config_nvram_with_fw_version(vha);
43724373
qla2x00_get_resource_cnts(vha);
43734374
qla_init_iocb_limit(vha);
43744375

drivers/scsi/qla2xxx/qla_isr.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4467,32 +4467,6 @@ qla2xxx_msix_rsp_q(int irq, void *dev_id)
44674467
return IRQ_HANDLED;
44684468
}
44694469

4470-
irqreturn_t
4471-
qla2xxx_msix_rsp_q_hs(int irq, void *dev_id)
4472-
{
4473-
struct qla_hw_data *ha;
4474-
struct qla_qpair *qpair;
4475-
struct device_reg_24xx __iomem *reg;
4476-
unsigned long flags;
4477-
4478-
qpair = dev_id;
4479-
if (!qpair) {
4480-
ql_log(ql_log_info, NULL, 0x505b,
4481-
"%s: NULL response queue pointer.\n", __func__);
4482-
return IRQ_NONE;
4483-
}
4484-
ha = qpair->hw;
4485-
4486-
reg = &ha->iobase->isp24;
4487-
spin_lock_irqsave(&ha->hardware_lock, flags);
4488-
wrt_reg_dword(&reg->hccr, HCCRX_CLR_RISC_INT);
4489-
spin_unlock_irqrestore(&ha->hardware_lock, flags);
4490-
4491-
queue_work(ha->wq, &qpair->q_work);
4492-
4493-
return IRQ_HANDLED;
4494-
}
4495-
44964470
/* Interrupt handling helpers. */
44974471

44984472
struct qla_init_msix_entry {
@@ -4505,7 +4479,6 @@ static const struct qla_init_msix_entry msix_entries[] = {
45054479
{ "rsp_q", qla24xx_msix_rsp_q },
45064480
{ "atio_q", qla83xx_msix_atio_q },
45074481
{ "qpair_multiq", qla2xxx_msix_rsp_q },
4508-
{ "qpair_multiq_hs", qla2xxx_msix_rsp_q_hs },
45094482
};
45104483

45114484
static const struct qla_init_msix_entry qla82xx_msix_entries[] = {
@@ -4792,9 +4765,10 @@ qla2x00_free_irqs(scsi_qla_host_t *vha)
47924765
}
47934766

47944767
int qla25xx_request_irq(struct qla_hw_data *ha, struct qla_qpair *qpair,
4795-
struct qla_msix_entry *msix, int vector_type)
4768+
struct qla_msix_entry *msix)
47964769
{
4797-
const struct qla_init_msix_entry *intr = &msix_entries[vector_type];
4770+
const struct qla_init_msix_entry *intr =
4771+
&msix_entries[QLA_MSIX_QPAIR_MULTIQ_RSP_Q];
47984772
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
47994773
int ret;
48004774

drivers/scsi/qla2xxx/qla_mbx.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
253253
/* Issue set host interrupt command to send cmd out. */
254254
ha->flags.mbox_int = 0;
255255
clear_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
256+
reinit_completion(&ha->mbx_intr_comp);
256257

257258
/* Unlock mbx registers and wait for interrupt */
258259
ql_dbg(ql_dbg_mbx, vha, 0x100f,
@@ -279,6 +280,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *vha, mbx_cmd_t *mcp)
279280
"cmd=%x Timeout.\n", command);
280281
spin_lock_irqsave(&ha->hardware_lock, flags);
281282
clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
283+
reinit_completion(&ha->mbx_intr_comp);
282284
spin_unlock_irqrestore(&ha->hardware_lock, flags);
283285

284286
if (chip_reset != ha->chip_reset) {

drivers/scsi/qla2xxx/qla_mid.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,9 +899,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
899899
rsp->options, rsp->id, rsp->rsp_q_in,
900900
rsp->rsp_q_out);
901901

902-
ret = qla25xx_request_irq(ha, qpair, qpair->msix,
903-
ha->flags.disable_msix_handshake ?
904-
QLA_MSIX_QPAIR_MULTIQ_RSP_Q : QLA_MSIX_QPAIR_MULTIQ_RSP_Q_HS);
902+
ret = qla25xx_request_irq(ha, qpair, qpair->msix);
905903
if (ret)
906904
goto que_failed;
907905

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1862,12 +1862,6 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
18621862
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
18631863
sp = req->outstanding_cmds[cnt];
18641864
if (sp) {
1865-
if (qla2x00_chip_is_down(vha)) {
1866-
req->outstanding_cmds[cnt] = NULL;
1867-
sp->done(sp, res);
1868-
continue;
1869-
}
1870-
18711865
switch (sp->cmd_type) {
18721866
case TYPE_SRB:
18731867
qla2x00_abort_srb(qp, sp, res, &flags);
@@ -1881,10 +1875,26 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
18811875
continue;
18821876
}
18831877
cmd = (struct qla_tgt_cmd *)sp;
1884-
cmd->aborted = 1;
1878+
1879+
if (cmd->sg_mapped)
1880+
qlt_unmap_sg(vha, cmd);
1881+
1882+
if (cmd->state == QLA_TGT_STATE_NEED_DATA) {
1883+
cmd->aborted = 1;
1884+
cmd->write_data_transferred = 0;
1885+
cmd->state = QLA_TGT_STATE_DATA_IN;
1886+
ha->tgt.tgt_ops->handle_data(cmd);
1887+
} else {
1888+
ha->tgt.tgt_ops->free_cmd(cmd);
1889+
}
18851890
break;
18861891
case TYPE_TGT_TMCMD:
1887-
/* Skip task management functions. */
1892+
/*
1893+
* Currently, only ABTS response gets on the
1894+
* outstanding_cmds[]
1895+
*/
1896+
qlt_free_ul_mcmd(ha,
1897+
(struct qla_tgt_mgmt_cmd *) sp);
18881898
break;
18891899
default:
18901900
break;
@@ -3444,13 +3454,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
34443454
ha->mqenable = 0;
34453455

34463456
if (ha->mqenable) {
3447-
bool startit = false;
3448-
3449-
if (QLA_TGT_MODE_ENABLED())
3450-
startit = false;
3451-
3452-
if (ql2x_ini_mode == QLA2XXX_INI_MODE_ENABLED)
3453-
startit = true;
3457+
bool startit = !!(host->active_mode & MODE_INITIATOR);
34543458

34553459
/* Create start of day qpairs for Block MQ */
34563460
for (i = 0; i < ha->max_qpairs; i++)
@@ -7244,6 +7248,7 @@ qla2xxx_wake_dpc(struct scsi_qla_host *vha)
72447248
if (!test_bit(UNLOADING, &vha->dpc_flags) && t)
72457249
wake_up_process(t);
72467250
}
7251+
EXPORT_SYMBOL(qla2xxx_wake_dpc);
72477252

72487253
/*
72497254
* qla2x00_rst_aen

0 commit comments

Comments
 (0)