Skip to content

Commit 530e86c

Browse files
Merge patch series "qla2xxx driver misc features"
Nilesh Javali <njavali@marvell.com> says: Martin, Please apply the qla2xxx driver miscellaneous features and bug fixes to the scsi tree at your earliest convenience. Link: https://lore.kernel.org/r/20230821130045.34850-1-njavali@marvell.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2 parents 749652a + 659d36c commit 530e86c

File tree

17 files changed

+1088
-96
lines changed

17 files changed

+1088
-96
lines changed

drivers/scsi/qla2xxx/qla_attr.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,8 +3093,6 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
30933093
vha->flags.difdix_supported = 1;
30943094
ql_dbg(ql_dbg_user, vha, 0x7082,
30953095
"Registered for DIF/DIX type 1 and 3 protection.\n");
3096-
if (ql2xenabledif == 1)
3097-
prot = SHOST_DIX_TYPE0_PROTECTION;
30983096
scsi_host_set_prot(vha->host,
30993097
prot | SHOST_DIF_TYPE1_PROTECTION
31003098
| SHOST_DIF_TYPE2_PROTECTION

drivers/scsi/qla2xxx/qla_dbg.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@
1212
* ----------------------------------------------------------------------
1313
* | Module Init and Probe | 0x0199 | |
1414
* | Mailbox commands | 0x1206 | 0x11a5-0x11ff |
15-
* | Device Discovery | 0x2134 | 0x210e-0x2115 |
16-
* | | | 0x211c-0x2128 |
17-
* | | | 0x212c-0x2134 |
15+
* | Device Discovery | 0x2134 | 0x2112-0x2115 |
16+
* | | | 0x2127-0x2128 |
1817
* | Queue Command and IO tracing | 0x3074 | 0x300b |
1918
* | | | 0x3027-0x3028 |
2019
* | | | 0x303d-0x3041 |
21-
* | | | 0x302d,0x3033 |
20+
* | | | 0x302e,0x3033 |
2221
* | | | 0x3036,0x3038 |
2322
* | | | 0x303a |
2423
* | DPC Thread | 0x4023 | 0x4002,0x4013 |

drivers/scsi/qla2xxx/qla_dbg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ ql_log_qp(uint32_t, struct qla_qpair *, int32_t, const char *fmt, ...);
368368
#define ql_dbg_tgt_tmr 0x00001000 /* Target mode task management */
369369
#define ql_dbg_tgt_dif 0x00000800 /* Target mode dif */
370370
#define ql_dbg_edif 0x00000400 /* edif and purex debug */
371+
#define ql_dbg_unsol 0x00000100 /* Unsolicited path debug */
371372

372373
extern int qla27xx_dump_mpi_ram(struct qla_hw_data *, uint32_t, uint32_t *,
373374
uint32_t, void **);

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,12 @@ struct name_list_extended {
346346
u8 sent;
347347
};
348348

349+
struct qla_nvme_fc_rjt {
350+
struct fcnvme_ls_rjt *c;
351+
dma_addr_t cdma;
352+
u16 size;
353+
};
354+
349355
struct els_reject {
350356
struct fc_els_ls_rjt *c;
351357
dma_addr_t cdma;
@@ -503,6 +509,20 @@ struct ct_arg {
503509
port_id_t id;
504510
};
505511

512+
struct qla_nvme_lsrjt_pt_arg {
513+
struct fc_port *fcport;
514+
u8 opcode;
515+
u8 vp_idx;
516+
u8 reason;
517+
u8 explanation;
518+
__le16 nport_handle;
519+
u16 control_flags;
520+
__le16 ox_id;
521+
__le32 xchg_address;
522+
u32 tx_byte_count, rx_byte_count;
523+
dma_addr_t tx_addr, rx_addr;
524+
};
525+
506526
/*
507527
* SRB extensions.
508528
*/
@@ -611,13 +631,16 @@ struct srb_iocb {
611631
void *desc;
612632

613633
/* These are only used with ls4 requests */
614-
int cmd_len;
615-
int rsp_len;
634+
__le32 cmd_len;
635+
__le32 rsp_len;
616636
dma_addr_t cmd_dma;
617637
dma_addr_t rsp_dma;
618638
enum nvmefc_fcp_datadir dir;
619639
uint32_t dl;
620640
uint32_t timeout_sec;
641+
__le32 exchange_address;
642+
__le16 nport_handle;
643+
__le16 ox_id;
621644
struct list_head entry;
622645
} nvme;
623646
struct {
@@ -707,6 +730,10 @@ typedef struct srb {
707730
struct fc_port *fcport;
708731
struct scsi_qla_host *vha;
709732
unsigned int start_timer:1;
733+
unsigned int abort:1;
734+
unsigned int aborted:1;
735+
unsigned int completed:1;
736+
unsigned int unsol_rsp:1;
710737

711738
uint32_t handle;
712739
uint16_t flags;
@@ -2542,6 +2569,7 @@ enum rscn_addr_format {
25422569
typedef struct fc_port {
25432570
struct list_head list;
25442571
struct scsi_qla_host *vha;
2572+
struct list_head unsol_ctx_head;
25452573

25462574
unsigned int conf_compl_supported:1;
25472575
unsigned int deleted:2;
@@ -3742,6 +3770,16 @@ struct qla_fw_resources {
37423770
u16 pad;
37433771
};
37443772

3773+
struct qla_fw_res {
3774+
u16 iocb_total;
3775+
u16 iocb_limit;
3776+
atomic_t iocb_used;
3777+
3778+
u16 exch_total;
3779+
u16 exch_limit;
3780+
atomic_t exch_used;
3781+
};
3782+
37453783
#define QLA_IOCB_PCT_LIMIT 95
37463784

37473785
struct qla_buf_pool {
@@ -3787,6 +3825,12 @@ struct qla_qpair {
37873825

37883826
uint16_t id; /* qp number used with FW */
37893827
uint16_t vp_idx; /* vport ID */
3828+
3829+
uint16_t dsd_inuse;
3830+
uint16_t dsd_avail;
3831+
struct list_head dsd_list;
3832+
#define NUM_DSD_CHAIN 4096
3833+
37903834
mempool_t *srb_mempool;
37913835

37923836
struct pci_dev *pdev;
@@ -4384,7 +4428,6 @@ struct qla_hw_data {
43844428
uint8_t aen_mbx_count;
43854429
atomic_t num_pend_mbx_stage1;
43864430
atomic_t num_pend_mbx_stage2;
4387-
atomic_t num_pend_mbx_stage3;
43884431
uint16_t frame_payload_size;
43894432

43904433
uint32_t login_retry_count;
@@ -4715,11 +4758,6 @@ struct qla_hw_data {
47154758
struct fw_blob *hablob;
47164759
struct qla82xx_legacy_intr_set nx_legacy_intr;
47174760

4718-
uint16_t gbl_dsd_inuse;
4719-
uint16_t gbl_dsd_avail;
4720-
struct list_head gbl_dsd_list;
4721-
#define NUM_DSD_CHAIN 4096
4722-
47234761
uint8_t fw_type;
47244762
uint32_t file_prd_off; /* File firmware product offset */
47254763

@@ -4801,6 +4839,8 @@ struct qla_hw_data {
48014839
struct els_reject elsrej;
48024840
u8 edif_post_stop_cnt_down;
48034841
struct qla_vp_map *vp_map;
4842+
struct qla_nvme_fc_rjt lsrjt;
4843+
struct qla_fw_res fwres ____cacheline_aligned;
48044844
};
48054845

48064846
#define RX_ELS_SIZE (roundup(sizeof(struct enode) + ELS_MAX_PAYLOAD, SMP_CACHE_BYTES))
@@ -4833,6 +4873,7 @@ struct active_regions {
48334873
* is variable) starting at "iocb".
48344874
*/
48354875
struct purex_item {
4876+
void *purls_context;
48364877
struct list_head list;
48374878
struct scsi_qla_host *vha;
48384879
void (*process_item)(struct scsi_qla_host *vha,

drivers/scsi/qla2xxx/qla_dfs.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,16 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
276276

277277
seq_printf(s, "estimate exchange used[%d] high water limit [%d] n",
278278
exch_used, ha->base_qpair->fwres.exch_limit);
279+
280+
if (ql2xenforce_iocb_limit == 2) {
281+
iocbs_used = atomic_read(&ha->fwres.iocb_used);
282+
exch_used = atomic_read(&ha->fwres.exch_used);
283+
seq_printf(s, " estimate iocb2 used [%d] high water limit [%d]\n",
284+
iocbs_used, ha->fwres.iocb_limit);
285+
286+
seq_printf(s, " estimate exchange2 used[%d] high water limit [%d] \n",
287+
exch_used, ha->fwres.exch_limit);
288+
}
279289
}
280290

281291
return 0;

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,11 @@ qla2xxx_msix_rsp_q_hs(int irq, void *dev_id);
603603
fc_port_t *qla2x00_find_fcport_by_loopid(scsi_qla_host_t *, uint16_t);
604604
fc_port_t *qla2x00_find_fcport_by_wwpn(scsi_qla_host_t *, u8 *, u8);
605605
fc_port_t *qla2x00_find_fcport_by_nportid(scsi_qla_host_t *, port_id_t *, u8);
606-
void __qla_consume_iocb(struct scsi_qla_host *vha, void **pkt, struct rsp_que **rsp);
606+
void qla24xx_queue_purex_item(scsi_qla_host_t *, struct purex_item *,
607+
void (*process_item)(struct scsi_qla_host *,
608+
struct purex_item *));
609+
void __qla_consume_iocb(struct scsi_qla_host *, void **, struct rsp_que **);
610+
void qla2xxx_process_purls_iocb(void **pkt, struct rsp_que **rsp);
607611

608612
/*
609613
* Global Function Prototypes in qla_sup.c source file.
@@ -666,9 +670,11 @@ extern int qla2xxx_get_vpd_field(scsi_qla_host_t *, char *, char *, size_t);
666670
extern void qla2xxx_flash_npiv_conf(scsi_qla_host_t *);
667671
extern int qla24xx_read_fcp_prio_cfg(scsi_qla_host_t *);
668672
extern int qla2x00_mailbox_passthru(struct bsg_job *bsg_job);
669-
int __qla_copy_purex_to_buffer(struct scsi_qla_host *vha, void **pkt,
670-
struct rsp_que **rsp, u8 *buf, u32 buf_len);
671-
673+
int qla2x00_sys_ld_info(struct bsg_job *bsg_job);
674+
int __qla_copy_purex_to_buffer(struct scsi_qla_host *, void **,
675+
struct rsp_que **, u8 *, u32);
676+
struct purex_item *qla27xx_copy_multiple_pkt(struct scsi_qla_host *vha,
677+
void **pkt, struct rsp_que **rsp, bool is_purls, bool byte_order);
672678
int qla_mailbox_passthru(scsi_qla_host_t *vha, uint16_t *mbx_in,
673679
uint16_t *mbx_out);
674680

drivers/scsi/qla2xxx/qla_init.c

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2223,6 +2223,8 @@ __qla2x00_async_tm_cmd(struct tmf_arg *arg)
22232223
rval = QLA_FUNCTION_FAILED;
22242224
}
22252225
}
2226+
if (tm_iocb->u.tmf.data)
2227+
rval = tm_iocb->u.tmf.data;
22262228

22272229
done_free_sp:
22282230
/* ref: INIT */
@@ -4203,7 +4205,7 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha)
42034205
u8 i;
42044206
struct qla_hw_data *ha = vha->hw;
42054207

4206-
__qla_adjust_iocb_limit(ha->base_qpair);
4208+
__qla_adjust_iocb_limit(ha->base_qpair);
42074209
ha->base_qpair->fwres.iocbs_used = 0;
42084210
ha->base_qpair->fwres.exch_used = 0;
42094211

@@ -4214,6 +4216,14 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha)
42144216
ha->queue_pair_map[i]->fwres.exch_used = 0;
42154217
}
42164218
}
4219+
4220+
ha->fwres.iocb_total = ha->orig_fw_iocb_count;
4221+
ha->fwres.iocb_limit = (ha->orig_fw_iocb_count * QLA_IOCB_PCT_LIMIT) / 100;
4222+
ha->fwres.exch_total = ha->orig_fw_xcb_count;
4223+
ha->fwres.exch_limit = (ha->orig_fw_xcb_count * QLA_IOCB_PCT_LIMIT) / 100;
4224+
4225+
atomic_set(&ha->fwres.iocb_used, 0);
4226+
atomic_set(&ha->fwres.exch_used, 0);
42174227
}
42184228

42194229
void qla_adjust_iocb_limit(scsi_qla_host_t *vha)
@@ -5554,6 +5564,7 @@ qla2x00_alloc_fcport(scsi_qla_host_t *vha, gfp_t flags)
55545564
INIT_WORK(&fcport->reg_work, qla_register_fcport_fn);
55555565
INIT_LIST_HEAD(&fcport->gnl_entry);
55565566
INIT_LIST_HEAD(&fcport->list);
5567+
INIT_LIST_HEAD(&fcport->unsol_ctx_head);
55575568

55585569
INIT_LIST_HEAD(&fcport->sess_cmd_list);
55595570
spin_lock_init(&fcport->sess_cmd_lock);
@@ -5596,7 +5607,7 @@ static void qla_get_login_template(scsi_qla_host_t *vha)
55965607
__be32 *q;
55975608

55985609
memset(ha->init_cb, 0, ha->init_cb_size);
5599-
sz = min_t(int, sizeof(struct fc_els_csp), ha->init_cb_size);
5610+
sz = min_t(int, sizeof(struct fc_els_flogi), ha->init_cb_size);
56005611
rval = qla24xx_get_port_login_templ(vha, ha->init_cb_dma,
56015612
ha->init_cb, sz);
56025613
if (rval != QLA_SUCCESS) {
@@ -7390,14 +7401,15 @@ qla2x00_abort_isp_cleanup(scsi_qla_host_t *vha)
73907401
}
73917402

73927403
/* purge MBox commands */
7393-
if (atomic_read(&ha->num_pend_mbx_stage3)) {
7404+
spin_lock_irqsave(&ha->hardware_lock, flags);
7405+
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags)) {
73947406
clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
73957407
complete(&ha->mbx_intr_comp);
73967408
}
7409+
spin_unlock_irqrestore(&ha->hardware_lock, flags);
73977410

73987411
i = 0;
7399-
while (atomic_read(&ha->num_pend_mbx_stage3) ||
7400-
atomic_read(&ha->num_pend_mbx_stage2) ||
7412+
while (atomic_read(&ha->num_pend_mbx_stage2) ||
74017413
atomic_read(&ha->num_pend_mbx_stage1)) {
74027414
msleep(20);
74037415
i++;
@@ -9643,6 +9655,7 @@ struct qla_qpair *qla2xxx_create_qpair(struct scsi_qla_host *vha, int qos,
96439655
qpair->vp_idx = vp_idx;
96449656
qpair->fw_started = ha->flags.fw_started;
96459657
INIT_LIST_HEAD(&qpair->hints_list);
9658+
INIT_LIST_HEAD(&qpair->dsd_list);
96469659
qpair->chip_reset = ha->base_qpair->chip_reset;
96479660
qpair->enable_class_2 = ha->base_qpair->enable_class_2;
96489661
qpair->enable_explicit_conf =
@@ -9771,6 +9784,19 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair)
97719784
if (ret != QLA_SUCCESS)
97729785
goto fail;
97739786

9787+
if (!list_empty(&qpair->dsd_list)) {
9788+
struct dsd_dma *dsd_ptr, *tdsd_ptr;
9789+
9790+
/* clean up allocated prev pool */
9791+
list_for_each_entry_safe(dsd_ptr, tdsd_ptr,
9792+
&qpair->dsd_list, list) {
9793+
dma_pool_free(ha->dl_dma_pool, dsd_ptr->dsd_addr,
9794+
dsd_ptr->dsd_list_dma);
9795+
list_del(&dsd_ptr->list);
9796+
kfree(dsd_ptr);
9797+
}
9798+
}
9799+
97749800
mutex_lock(&ha->mq_lock);
97759801
ha->queue_pair_map[qpair->id] = NULL;
97769802
clear_bit(qpair->id, ha->qpair_qid_map);

0 commit comments

Comments
 (0)