Skip to content

Commit 22b8d89

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

File tree

11 files changed

+452
-374
lines changed

11 files changed

+452
-374
lines changed

drivers/scsi/qla2xxx/qla_bsg.c

Lines changed: 58 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
324324
"request_sg_cnt=%x reply_sg_cnt=%x.\n",
325325
bsg_job->request_payload.sg_cnt,
326326
bsg_job->reply_payload.sg_cnt);
327-
rval = -EPERM;
327+
rval = -ENOBUFS;
328328
goto done;
329329
}
330330

@@ -3059,17 +3059,61 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)
30593059
return ret;
30603060
}
30613061

3062-
int
3063-
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
3062+
static bool qla_bsg_found(struct qla_qpair *qpair, struct bsg_job *bsg_job)
30643063
{
3064+
bool found = false;
30653065
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
30663066
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
30673067
struct qla_hw_data *ha = vha->hw;
3068-
srb_t *sp;
3069-
int cnt, que;
3068+
srb_t *sp = NULL;
3069+
int cnt;
30703070
unsigned long flags;
30713071
struct req_que *req;
30723072

3073+
spin_lock_irqsave(qpair->qp_lock_ptr, flags);
3074+
req = qpair->req;
3075+
3076+
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
3077+
sp = req->outstanding_cmds[cnt];
3078+
if (sp &&
3079+
(sp->type == SRB_CT_CMD ||
3080+
sp->type == SRB_ELS_CMD_HST ||
3081+
sp->type == SRB_ELS_CMD_HST_NOLOGIN) &&
3082+
sp->u.bsg_job == bsg_job) {
3083+
req->outstanding_cmds[cnt] = NULL;
3084+
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3085+
3086+
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
3087+
ql_log(ql_log_warn, vha, 0x7089,
3088+
"mbx abort_command failed.\n");
3089+
bsg_reply->result = -EIO;
3090+
} else {
3091+
ql_dbg(ql_dbg_user, vha, 0x708a,
3092+
"mbx abort_command success.\n");
3093+
bsg_reply->result = 0;
3094+
}
3095+
/* ref: INIT */
3096+
kref_put(&sp->cmd_kref, qla2x00_sp_release);
3097+
3098+
found = true;
3099+
goto done;
3100+
}
3101+
}
3102+
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
3103+
3104+
done:
3105+
return found;
3106+
}
3107+
3108+
int
3109+
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
3110+
{
3111+
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
3112+
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
3113+
struct qla_hw_data *ha = vha->hw;
3114+
int i;
3115+
struct qla_qpair *qpair;
3116+
30733117
ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n",
30743118
__func__, bsg_job);
30753119

@@ -3079,48 +3123,22 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
30793123
qla_pci_set_eeh_busy(vha);
30803124
}
30813125

3126+
if (qla_bsg_found(ha->base_qpair, bsg_job))
3127+
goto done;
3128+
30823129
/* find the bsg job from the active list of commands */
3083-
spin_lock_irqsave(&ha->hardware_lock, flags);
3084-
for (que = 0; que < ha->max_req_queues; que++) {
3085-
req = ha->req_q_map[que];
3086-
if (!req)
3130+
for (i = 0; i < ha->max_qpairs; i++) {
3131+
qpair = vha->hw->queue_pair_map[i];
3132+
if (!qpair)
30873133
continue;
3088-
3089-
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
3090-
sp = req->outstanding_cmds[cnt];
3091-
if (sp &&
3092-
(sp->type == SRB_CT_CMD ||
3093-
sp->type == SRB_ELS_CMD_HST ||
3094-
sp->type == SRB_ELS_CMD_HST_NOLOGIN ||
3095-
sp->type == SRB_FXIOCB_BCMD) &&
3096-
sp->u.bsg_job == bsg_job) {
3097-
req->outstanding_cmds[cnt] = NULL;
3098-
spin_unlock_irqrestore(&ha->hardware_lock, flags);
3099-
3100-
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
3101-
ql_log(ql_log_warn, vha, 0x7089,
3102-
"mbx abort_command failed.\n");
3103-
bsg_reply->result = -EIO;
3104-
} else {
3105-
ql_dbg(ql_dbg_user, vha, 0x708a,
3106-
"mbx abort_command success.\n");
3107-
bsg_reply->result = 0;
3108-
}
3109-
spin_lock_irqsave(&ha->hardware_lock, flags);
3110-
goto done;
3111-
3112-
}
3113-
}
3134+
if (qla_bsg_found(qpair, bsg_job))
3135+
goto done;
31143136
}
3115-
spin_unlock_irqrestore(&ha->hardware_lock, flags);
3137+
31163138
ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
31173139
bsg_reply->result = -ENXIO;
3118-
return 0;
31193140

31203141
done:
3121-
spin_unlock_irqrestore(&ha->hardware_lock, flags);
3122-
/* ref: INIT */
3123-
kref_put(&sp->cmd_kref, qla2x00_sp_release);
31243142
return 0;
31253143
}
31263144

drivers/scsi/qla2xxx/qla_def.h

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3309,9 +3309,20 @@ struct fab_scan_rp {
33093309
u8 node_name[8];
33103310
};
33113311

3312+
enum scan_step {
3313+
FAB_SCAN_START,
3314+
FAB_SCAN_GPNFT_FCP,
3315+
FAB_SCAN_GNNFT_FCP,
3316+
FAB_SCAN_GPNFT_NVME,
3317+
FAB_SCAN_GNNFT_NVME,
3318+
};
3319+
33123320
struct fab_scan {
33133321
struct fab_scan_rp *l;
33143322
u32 size;
3323+
u32 rscn_gen_start;
3324+
u32 rscn_gen_end;
3325+
enum scan_step step;
33153326
u16 scan_retry;
33163327
#define MAX_SCAN_RETRIES 5
33173328
enum scan_flags_t scan_flags;
@@ -3537,9 +3548,8 @@ enum qla_work_type {
35373548
QLA_EVT_RELOGIN,
35383549
QLA_EVT_ASYNC_PRLO,
35393550
QLA_EVT_ASYNC_PRLO_DONE,
3540-
QLA_EVT_GPNFT,
3541-
QLA_EVT_GPNFT_DONE,
3542-
QLA_EVT_GNNFT_DONE,
3551+
QLA_EVT_SCAN_CMD,
3552+
QLA_EVT_SCAN_FINISH,
35433553
QLA_EVT_GFPNID,
35443554
QLA_EVT_SP_RETRY,
35453555
QLA_EVT_IIDMA,
@@ -5030,6 +5040,7 @@ typedef struct scsi_qla_host {
50305040

50315041
/* Counter to detect races between ELS and RSCN events */
50325042
atomic_t generation_tick;
5043+
atomic_t rscn_gen;
50335044
/* Time when global fcport update has been scheduled */
50345045
int total_fcport_update_gen;
50355046
/* List of pending LOGOs, protected by tgt_mutex */

drivers/scsi/qla2xxx/qla_gbl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,9 +728,9 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
728728
void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
729729
int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
730730
int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool);
731-
int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *);
732-
void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *);
733-
void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *);
731+
int qla_fab_async_scan(scsi_qla_host_t *, srb_t *);
732+
void qla_fab_scan_start(struct scsi_qla_host *);
733+
void qla_fab_scan_finish(scsi_qla_host_t *, srb_t *);
734734
int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *);
735735
int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *);
736736
void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *);

0 commit comments

Comments
 (0)