Commit 22b8d89b authored by Martin K. Petersen's avatar Martin K. Petersen

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.comSigned-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents af8e69ef a1392b19
...@@ -324,7 +324,7 @@ qla2x00_process_els(struct bsg_job *bsg_job) ...@@ -324,7 +324,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
"request_sg_cnt=%x reply_sg_cnt=%x.\n", "request_sg_cnt=%x reply_sg_cnt=%x.\n",
bsg_job->request_payload.sg_cnt, bsg_job->request_payload.sg_cnt,
bsg_job->reply_payload.sg_cnt); bsg_job->reply_payload.sg_cnt);
rval = -EPERM; rval = -ENOBUFS;
goto done; goto done;
} }
...@@ -3059,17 +3059,61 @@ qla24xx_bsg_request(struct bsg_job *bsg_job) ...@@ -3059,17 +3059,61 @@ qla24xx_bsg_request(struct bsg_job *bsg_job)
return ret; return ret;
} }
int static bool qla_bsg_found(struct qla_qpair *qpair, struct bsg_job *bsg_job)
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
{ {
bool found = false;
struct fc_bsg_reply *bsg_reply = bsg_job->reply; struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job)); scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
srb_t *sp; srb_t *sp = NULL;
int cnt, que; int cnt;
unsigned long flags; unsigned long flags;
struct req_que *req; struct req_que *req;
spin_lock_irqsave(qpair->qp_lock_ptr, flags);
req = qpair->req;
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
sp = req->outstanding_cmds[cnt];
if (sp &&
(sp->type == SRB_CT_CMD ||
sp->type == SRB_ELS_CMD_HST ||
sp->type == SRB_ELS_CMD_HST_NOLOGIN) &&
sp->u.bsg_job == bsg_job) {
req->outstanding_cmds[cnt] = NULL;
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
ql_log(ql_log_warn, vha, 0x7089,
"mbx abort_command failed.\n");
bsg_reply->result = -EIO;
} else {
ql_dbg(ql_dbg_user, vha, 0x708a,
"mbx abort_command success.\n");
bsg_reply->result = 0;
}
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
found = true;
goto done;
}
}
spin_unlock_irqrestore(qpair->qp_lock_ptr, flags);
done:
return found;
}
int
qla24xx_bsg_timeout(struct bsg_job *bsg_job)
{
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(fc_bsg_to_shost(bsg_job));
struct qla_hw_data *ha = vha->hw;
int i;
struct qla_qpair *qpair;
ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n", ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n",
__func__, bsg_job); __func__, bsg_job);
...@@ -3079,48 +3123,22 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job) ...@@ -3079,48 +3123,22 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_job)
qla_pci_set_eeh_busy(vha); qla_pci_set_eeh_busy(vha);
} }
if (qla_bsg_found(ha->base_qpair, bsg_job))
goto done;
/* find the bsg job from the active list of commands */ /* find the bsg job from the active list of commands */
spin_lock_irqsave(&ha->hardware_lock, flags); for (i = 0; i < ha->max_qpairs; i++) {
for (que = 0; que < ha->max_req_queues; que++) { qpair = vha->hw->queue_pair_map[i];
req = ha->req_q_map[que]; if (!qpair)
if (!req)
continue; continue;
if (qla_bsg_found(qpair, bsg_job))
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { goto done;
sp = req->outstanding_cmds[cnt];
if (sp &&
(sp->type == SRB_CT_CMD ||
sp->type == SRB_ELS_CMD_HST ||
sp->type == SRB_ELS_CMD_HST_NOLOGIN ||
sp->type == SRB_FXIOCB_BCMD) &&
sp->u.bsg_job == bsg_job) {
req->outstanding_cmds[cnt] = NULL;
spin_unlock_irqrestore(&ha->hardware_lock, flags);
if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) {
ql_log(ql_log_warn, vha, 0x7089,
"mbx abort_command failed.\n");
bsg_reply->result = -EIO;
} else {
ql_dbg(ql_dbg_user, vha, 0x708a,
"mbx abort_command success.\n");
bsg_reply->result = 0;
}
spin_lock_irqsave(&ha->hardware_lock, flags);
goto done;
}
}
} }
spin_unlock_irqrestore(&ha->hardware_lock, flags);
ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n"); ql_log(ql_log_info, vha, 0x708b, "SRB not found to abort.\n");
bsg_reply->result = -ENXIO; bsg_reply->result = -ENXIO;
return 0;
done: done:
spin_unlock_irqrestore(&ha->hardware_lock, flags);
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
return 0; return 0;
} }
......
...@@ -3309,9 +3309,20 @@ struct fab_scan_rp { ...@@ -3309,9 +3309,20 @@ struct fab_scan_rp {
u8 node_name[8]; u8 node_name[8];
}; };
enum scan_step {
FAB_SCAN_START,
FAB_SCAN_GPNFT_FCP,
FAB_SCAN_GNNFT_FCP,
FAB_SCAN_GPNFT_NVME,
FAB_SCAN_GNNFT_NVME,
};
struct fab_scan { struct fab_scan {
struct fab_scan_rp *l; struct fab_scan_rp *l;
u32 size; u32 size;
u32 rscn_gen_start;
u32 rscn_gen_end;
enum scan_step step;
u16 scan_retry; u16 scan_retry;
#define MAX_SCAN_RETRIES 5 #define MAX_SCAN_RETRIES 5
enum scan_flags_t scan_flags; enum scan_flags_t scan_flags;
...@@ -3537,9 +3548,8 @@ enum qla_work_type { ...@@ -3537,9 +3548,8 @@ enum qla_work_type {
QLA_EVT_RELOGIN, QLA_EVT_RELOGIN,
QLA_EVT_ASYNC_PRLO, QLA_EVT_ASYNC_PRLO,
QLA_EVT_ASYNC_PRLO_DONE, QLA_EVT_ASYNC_PRLO_DONE,
QLA_EVT_GPNFT, QLA_EVT_SCAN_CMD,
QLA_EVT_GPNFT_DONE, QLA_EVT_SCAN_FINISH,
QLA_EVT_GNNFT_DONE,
QLA_EVT_GFPNID, QLA_EVT_GFPNID,
QLA_EVT_SP_RETRY, QLA_EVT_SP_RETRY,
QLA_EVT_IIDMA, QLA_EVT_IIDMA,
...@@ -5030,6 +5040,7 @@ typedef struct scsi_qla_host { ...@@ -5030,6 +5040,7 @@ typedef struct scsi_qla_host {
/* Counter to detect races between ELS and RSCN events */ /* Counter to detect races between ELS and RSCN events */
atomic_t generation_tick; atomic_t generation_tick;
atomic_t rscn_gen;
/* Time when global fcport update has been scheduled */ /* Time when global fcport update has been scheduled */
int total_fcport_update_gen; int total_fcport_update_gen;
/* List of pending LOGOs, protected by tgt_mutex */ /* List of pending LOGOs, protected by tgt_mutex */
......
...@@ -728,9 +728,9 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *); ...@@ -728,9 +728,9 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *);
void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *); void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *);
int qla2x00_mgmt_svr_login(scsi_qla_host_t *); int qla2x00_mgmt_svr_login(scsi_qla_host_t *);
int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool); int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool);
int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *); int qla_fab_async_scan(scsi_qla_host_t *, srb_t *);
void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *); void qla_fab_scan_start(struct scsi_qla_host *);
void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *); void qla_fab_scan_finish(scsi_qla_host_t *, srb_t *);
int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *); int qla24xx_post_gfpnid_work(struct scsi_qla_host *, fc_port_t *);
int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *); int qla24xx_async_gfpnid(scsi_qla_host_t *, fc_port_t *);
void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *); void qla24xx_handle_gfpnid_event(scsi_qla_host_t *, struct event_arg *);
......
This diff is collapsed.
...@@ -1842,10 +1842,18 @@ int qla24xx_post_newsess_work(struct scsi_qla_host *vha, port_id_t *id, ...@@ -1842,10 +1842,18 @@ int qla24xx_post_newsess_work(struct scsi_qla_host *vha, port_id_t *id,
return qla2x00_post_work(vha, e); return qla2x00_post_work(vha, e);
} }
static void qla_rscn_gen_tick(scsi_qla_host_t *vha, u32 *ret_rscn_gen)
{
*ret_rscn_gen = atomic_inc_return(&vha->rscn_gen);
/* memory barrier */
wmb();
}
void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)
{ {
fc_port_t *fcport; fc_port_t *fcport;
unsigned long flags; unsigned long flags;
u32 rscn_gen;
switch (ea->id.b.rsvd_1) { switch (ea->id.b.rsvd_1) {
case RSCN_PORT_ADDR: case RSCN_PORT_ADDR:
...@@ -1875,15 +1883,16 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1875,15 +1883,16 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)
* Otherwise we're already in the middle of a relogin * Otherwise we're already in the middle of a relogin
*/ */
fcport->scan_needed = 1; fcport->scan_needed = 1;
fcport->rscn_gen++; qla_rscn_gen_tick(vha, &fcport->rscn_gen);
} }
} else { } else {
fcport->scan_needed = 1; fcport->scan_needed = 1;
fcport->rscn_gen++; qla_rscn_gen_tick(vha, &fcport->rscn_gen);
} }
} }
break; break;
case RSCN_AREA_ADDR: case RSCN_AREA_ADDR:
qla_rscn_gen_tick(vha, &rscn_gen);
list_for_each_entry(fcport, &vha->vp_fcports, list) { list_for_each_entry(fcport, &vha->vp_fcports, list) {
if (fcport->flags & FCF_FCP2_DEVICE && if (fcport->flags & FCF_FCP2_DEVICE &&
atomic_read(&fcport->state) == FCS_ONLINE) atomic_read(&fcport->state) == FCS_ONLINE)
...@@ -1891,11 +1900,12 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1891,11 +1900,12 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)
if ((ea->id.b24 & 0xffff00) == (fcport->d_id.b24 & 0xffff00)) { if ((ea->id.b24 & 0xffff00) == (fcport->d_id.b24 & 0xffff00)) {
fcport->scan_needed = 1; fcport->scan_needed = 1;
fcport->rscn_gen++; fcport->rscn_gen = rscn_gen;
} }
} }
break; break;
case RSCN_DOM_ADDR: case RSCN_DOM_ADDR:
qla_rscn_gen_tick(vha, &rscn_gen);
list_for_each_entry(fcport, &vha->vp_fcports, list) { list_for_each_entry(fcport, &vha->vp_fcports, list) {
if (fcport->flags & FCF_FCP2_DEVICE && if (fcport->flags & FCF_FCP2_DEVICE &&
atomic_read(&fcport->state) == FCS_ONLINE) atomic_read(&fcport->state) == FCS_ONLINE)
...@@ -1903,19 +1913,20 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1903,19 +1913,20 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)
if ((ea->id.b24 & 0xff0000) == (fcport->d_id.b24 & 0xff0000)) { if ((ea->id.b24 & 0xff0000) == (fcport->d_id.b24 & 0xff0000)) {
fcport->scan_needed = 1; fcport->scan_needed = 1;
fcport->rscn_gen++; fcport->rscn_gen = rscn_gen;
} }
} }
break; break;
case RSCN_FAB_ADDR: case RSCN_FAB_ADDR:
default: default:
qla_rscn_gen_tick(vha, &rscn_gen);
list_for_each_entry(fcport, &vha->vp_fcports, list) { list_for_each_entry(fcport, &vha->vp_fcports, list) {
if (fcport->flags & FCF_FCP2_DEVICE && if (fcport->flags & FCF_FCP2_DEVICE &&
atomic_read(&fcport->state) == FCS_ONLINE) atomic_read(&fcport->state) == FCS_ONLINE)
continue; continue;
fcport->scan_needed = 1; fcport->scan_needed = 1;
fcport->rscn_gen++; fcport->rscn_gen = rscn_gen;
} }
break; break;
} }
...@@ -1924,6 +1935,7 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea) ...@@ -1924,6 +1935,7 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct event_arg *ea)
if (vha->scan.scan_flags == 0) { if (vha->scan.scan_flags == 0) {
ql_dbg(ql_dbg_disc, vha, 0xffff, "%s: schedule\n", __func__); ql_dbg(ql_dbg_disc, vha, 0xffff, "%s: schedule\n", __func__);
vha->scan.scan_flags |= SF_QUEUED; vha->scan.scan_flags |= SF_QUEUED;
vha->scan.rscn_gen_start = atomic_read(&vha->rscn_gen);
schedule_delayed_work(&vha->scan.scan_work, 5); schedule_delayed_work(&vha->scan.scan_work, 5);
} }
spin_unlock_irqrestore(&vha->work_lock, flags); spin_unlock_irqrestore(&vha->work_lock, flags);
...@@ -6393,10 +6405,9 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha) ...@@ -6393,10 +6405,9 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
qlt_do_generation_tick(vha, &discovery_gen); qlt_do_generation_tick(vha, &discovery_gen);
if (USE_ASYNC_SCAN(ha)) { if (USE_ASYNC_SCAN(ha)) {
rval = qla24xx_async_gpnft(vha, FC4_TYPE_FCP_SCSI, /* start of scan begins here */
NULL); vha->scan.rscn_gen_end = atomic_read(&vha->rscn_gen);
if (rval) qla_fab_scan_start(vha);
set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
} else { } else {
list_for_each_entry(fcport, &vha->vp_fcports, list) list_for_each_entry(fcport, &vha->vp_fcports, list)
fcport->scan_state = QLA_FCPORT_SCAN; fcport->scan_state = QLA_FCPORT_SCAN;
...@@ -8207,15 +8218,21 @@ qla28xx_get_aux_images( ...@@ -8207,15 +8218,21 @@ qla28xx_get_aux_images(
struct qla27xx_image_status pri_aux_image_status, sec_aux_image_status; struct qla27xx_image_status pri_aux_image_status, sec_aux_image_status;
bool valid_pri_image = false, valid_sec_image = false; bool valid_pri_image = false, valid_sec_image = false;
bool active_pri_image = false, active_sec_image = false; bool active_pri_image = false, active_sec_image = false;
int rc;
if (!ha->flt_region_aux_img_status_pri) { if (!ha->flt_region_aux_img_status_pri) {
ql_dbg(ql_dbg_init, vha, 0x018a, "Primary aux image not addressed\n"); ql_dbg(ql_dbg_init, vha, 0x018a, "Primary aux image not addressed\n");
goto check_sec_image; goto check_sec_image;
} }
qla24xx_read_flash_data(vha, (uint32_t *)&pri_aux_image_status, rc = qla24xx_read_flash_data(vha, (uint32_t *)&pri_aux_image_status,
ha->flt_region_aux_img_status_pri, ha->flt_region_aux_img_status_pri,
sizeof(pri_aux_image_status) >> 2); sizeof(pri_aux_image_status) >> 2);
if (rc) {
ql_log(ql_log_info, vha, 0x01a1,
"Unable to read Primary aux image(%x).\n", rc);
goto check_sec_image;
}
qla27xx_print_image(vha, "Primary aux image", &pri_aux_image_status); qla27xx_print_image(vha, "Primary aux image", &pri_aux_image_status);
if (qla28xx_check_aux_image_status_signature(&pri_aux_image_status)) { if (qla28xx_check_aux_image_status_signature(&pri_aux_image_status)) {
...@@ -8246,9 +8263,15 @@ qla28xx_get_aux_images( ...@@ -8246,9 +8263,15 @@ qla28xx_get_aux_images(
goto check_valid_image; goto check_valid_image;
} }
qla24xx_read_flash_data(vha, (uint32_t *)&sec_aux_image_status, rc = qla24xx_read_flash_data(vha, (uint32_t *)&sec_aux_image_status,
ha->flt_region_aux_img_status_sec, ha->flt_region_aux_img_status_sec,
sizeof(sec_aux_image_status) >> 2); sizeof(sec_aux_image_status) >> 2);
if (rc) {
ql_log(ql_log_info, vha, 0x01a2,
"Unable to read Secondary aux image(%x).\n", rc);
goto check_valid_image;
}
qla27xx_print_image(vha, "Secondary aux image", &sec_aux_image_status); qla27xx_print_image(vha, "Secondary aux image", &sec_aux_image_status);
if (qla28xx_check_aux_image_status_signature(&sec_aux_image_status)) { if (qla28xx_check_aux_image_status_signature(&sec_aux_image_status)) {
...@@ -8306,6 +8329,7 @@ qla27xx_get_active_image(struct scsi_qla_host *vha, ...@@ -8306,6 +8329,7 @@ qla27xx_get_active_image(struct scsi_qla_host *vha,
struct qla27xx_image_status pri_image_status, sec_image_status; struct qla27xx_image_status pri_image_status, sec_image_status;
bool valid_pri_image = false, valid_sec_image = false; bool valid_pri_image = false, valid_sec_image = false;
bool active_pri_image = false, active_sec_image = false; bool active_pri_image = false, active_sec_image = false;
int rc;
if (!ha->flt_region_img_status_pri) { if (!ha->flt_region_img_status_pri) {
ql_dbg(ql_dbg_init, vha, 0x018a, "Primary image not addressed\n"); ql_dbg(ql_dbg_init, vha, 0x018a, "Primary image not addressed\n");
...@@ -8347,8 +8371,14 @@ qla27xx_get_active_image(struct scsi_qla_host *vha, ...@@ -8347,8 +8371,14 @@ qla27xx_get_active_image(struct scsi_qla_host *vha,
goto check_valid_image; goto check_valid_image;
} }
qla24xx_read_flash_data(vha, (uint32_t *)(&sec_image_status), rc = qla24xx_read_flash_data(vha, (uint32_t *)(&sec_image_status),
ha->flt_region_img_status_sec, sizeof(sec_image_status) >> 2); ha->flt_region_img_status_sec, sizeof(sec_image_status) >> 2);
if (rc) {
ql_log(ql_log_info, vha, 0x01a3,
"Unable to read Secondary image status(%x).\n", rc);
goto check_valid_image;
}
qla27xx_print_image(vha, "Secondary image", &sec_image_status); qla27xx_print_image(vha, "Secondary image", &sec_image_status);
if (qla27xx_check_image_status_signature(&sec_image_status)) { if (qla27xx_check_image_status_signature(&sec_image_status)) {
...@@ -8420,11 +8450,10 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -8420,11 +8450,10 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
"FW: Loading firmware from flash (%x).\n", faddr); "FW: Loading firmware from flash (%x).\n", faddr);
dcode = (uint32_t *)req->ring; dcode = (uint32_t *)req->ring;
qla24xx_read_flash_data(vha, dcode, faddr, 8); rval = qla24xx_read_flash_data(vha, dcode, faddr, 8);
if (qla24xx_risc_firmware_invalid(dcode)) { if (rval || qla24xx_risc_firmware_invalid(dcode)) {
ql_log(ql_log_fatal, vha, 0x008c, ql_log(ql_log_fatal, vha, 0x008c,
"Unable to verify the integrity of flash firmware " "Unable to verify the integrity of flash firmware image (rval %x).\n", rval);
"image.\n");
ql_log(ql_log_fatal, vha, 0x008d, ql_log(ql_log_fatal, vha, 0x008d,
"Firmware data: %08x %08x %08x %08x.\n", "Firmware data: %08x %08x %08x %08x.\n",
dcode[0], dcode[1], dcode[2], dcode[3]); dcode[0], dcode[1], dcode[2], dcode[3]);
...@@ -8438,7 +8467,12 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -8438,7 +8467,12 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
for (j = 0; j < segments; j++) { for (j = 0; j < segments; j++) {
ql_dbg(ql_dbg_init, vha, 0x008d, ql_dbg(ql_dbg_init, vha, 0x008d,
"-> Loading segment %u...\n", j); "-> Loading segment %u...\n", j);
qla24xx_read_flash_data(vha, dcode, faddr, 10); rval = qla24xx_read_flash_data(vha, dcode, faddr, 10);
if (rval) {
ql_log(ql_log_fatal, vha, 0x016a,
"-> Unable to read segment addr + size .\n");
return QLA_FUNCTION_FAILED;
}
risc_addr = be32_to_cpu((__force __be32)dcode[2]); risc_addr = be32_to_cpu((__force __be32)dcode[2]);
risc_size = be32_to_cpu((__force __be32)dcode[3]); risc_size = be32_to_cpu((__force __be32)dcode[3]);
if (!*srisc_addr) { if (!*srisc_addr) {
...@@ -8454,7 +8488,13 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -8454,7 +8488,13 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
ql_dbg(ql_dbg_init, vha, 0x008e, ql_dbg(ql_dbg_init, vha, 0x008e,
"-> Loading fragment %u: %#x <- %#x (%#lx dwords)...\n", "-> Loading fragment %u: %#x <- %#x (%#lx dwords)...\n",
fragment, risc_addr, faddr, dlen); fragment, risc_addr, faddr, dlen);
qla24xx_read_flash_data(vha, dcode, faddr, dlen); rval = qla24xx_read_flash_data(vha, dcode, faddr, dlen);
if (rval) {
ql_log(ql_log_fatal, vha, 0x016b,
"-> Unable to read fragment(faddr %#x dlen %#lx).\n",
faddr, dlen);
return QLA_FUNCTION_FAILED;
}
for (i = 0; i < dlen; i++) for (i = 0; i < dlen; i++)
dcode[i] = swab32(dcode[i]); dcode[i] = swab32(dcode[i]);
...@@ -8483,7 +8523,14 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -8483,7 +8523,14 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
fwdt->length = 0; fwdt->length = 0;
dcode = (uint32_t *)req->ring; dcode = (uint32_t *)req->ring;
qla24xx_read_flash_data(vha, dcode, faddr, 7);
rval = qla24xx_read_flash_data(vha, dcode, faddr, 7);
if (rval) {
ql_log(ql_log_fatal, vha, 0x016c,
"-> Unable to read template size.\n");
goto failed;
}
risc_size = be32_to_cpu((__force __be32)dcode[2]); risc_size = be32_to_cpu((__force __be32)dcode[2]);
ql_dbg(ql_dbg_init, vha, 0x0161, ql_dbg(ql_dbg_init, vha, 0x0161,
"-> fwdt%u template array at %#x (%#x dwords)\n", "-> fwdt%u template array at %#x (%#x dwords)\n",
...@@ -8509,11 +8556,12 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr, ...@@ -8509,11 +8556,12 @@ qla24xx_load_risc_flash(scsi_qla_host_t *vha, uint32_t *srisc_addr,
} }
dcode = fwdt->template; dcode = fwdt->template;
qla24xx_read_flash_data(vha, dcode, faddr, risc_size); rval = qla24xx_read_flash_data(vha, dcode, faddr, risc_size);
if (!qla27xx_fwdt_template_valid(dcode)) { if (rval || !qla27xx_fwdt_template_valid(dcode)) {
ql_log(ql_log_warn, vha, 0x0165, ql_log(ql_log_warn, vha, 0x0165,
"-> fwdt%u failed template validate\n", j); "-> fwdt%u failed template validate (rval %x)\n",
j, rval);
goto failed; goto failed;
} }
......
...@@ -631,3 +631,11 @@ static inline int qla_mapq_alloc_qp_cpu_map(struct qla_hw_data *ha) ...@@ -631,3 +631,11 @@ static inline int qla_mapq_alloc_qp_cpu_map(struct qla_hw_data *ha)
} }
return 0; return 0;
} }
static inline bool val_is_in_range(u32 val, u32 start, u32 end)
{
if (val >= start && val <= end)
return true;
else
return false;
}
...@@ -180,7 +180,7 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) ...@@ -180,7 +180,7 @@ qla24xx_disable_vp(scsi_qla_host_t *vha)
atomic_set(&vha->loop_state, LOOP_DOWN); atomic_set(&vha->loop_state, LOOP_DOWN);
atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
list_for_each_entry(fcport, &vha->vp_fcports, list) list_for_each_entry(fcport, &vha->vp_fcports, list)
fcport->logout_on_delete = 0; fcport->logout_on_delete = 1;
if (!vha->hw->flags.edif_enabled) if (!vha->hw->flags.edif_enabled)
qla2x00_wait_for_sess_deletion(vha); qla2x00_wait_for_sess_deletion(vha);
......
...@@ -49,7 +49,10 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport) ...@@ -49,7 +49,10 @@ int qla_nvme_register_remote(struct scsi_qla_host *vha, struct fc_port *fcport)
return 0; return 0;
} }
if (!vha->nvme_local_port && qla_nvme_register_hba(vha)) if (qla_nvme_register_hba(vha))
return 0;
if (!vha->nvme_local_port)
return 0; return 0;
if (!(fcport->nvme_prli_service_param & if (!(fcport->nvme_prli_service_param &
......
...@@ -1875,14 +1875,9 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res) ...@@ -1875,14 +1875,9 @@ __qla2x00_abort_all_cmds(struct qla_qpair *qp, int res)
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) { for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
sp = req->outstanding_cmds[cnt]; sp = req->outstanding_cmds[cnt];
if (sp) { if (sp) {
/*
* perform lockless completion during driver unload
*/
if (qla2x00_chip_is_down(vha)) { if (qla2x00_chip_is_down(vha)) {
req->outstanding_cmds[cnt] = NULL; req->outstanding_cmds[cnt] = NULL;
spin_unlock_irqrestore(qp->qp_lock_ptr, flags);
sp->done(sp, res); sp->done(sp, res);
spin_lock_irqsave(qp->qp_lock_ptr, flags);
continue; continue;
} }
...@@ -4689,7 +4684,7 @@ static void ...@@ -4689,7 +4684,7 @@ static void
qla2x00_number_of_exch(scsi_qla_host_t *vha, u32 *ret_cnt, u16 max_cnt) qla2x00_number_of_exch(scsi_qla_host_t *vha, u32 *ret_cnt, u16 max_cnt)
{ {
u32 temp; u32 temp;
struct init_cb_81xx *icb = (struct init_cb_81xx *)&vha->hw->init_cb; struct init_cb_81xx *icb = (struct init_cb_81xx *)vha->hw->init_cb;
*ret_cnt = FW_DEF_EXCHANGES_CNT; *ret_cnt = FW_DEF_EXCHANGES_CNT;
if (max_cnt > vha->hw->max_exchg) if (max_cnt > vha->hw->max_exchg)
...@@ -5563,15 +5558,11 @@ qla2x00_do_work(struct scsi_qla_host *vha) ...@@ -5563,15 +5558,11 @@ qla2x00_do_work(struct scsi_qla_host *vha)
qla2x00_async_prlo_done(vha, e->u.logio.fcport, qla2x00_async_prlo_done(vha, e->u.logio.fcport,
e->u.logio.data); e->u.logio.data);
break; break;
case QLA_EVT_GPNFT: case QLA_EVT_SCAN_CMD:
qla24xx_async_gpnft(vha, e->u.gpnft.fc4_type, qla_fab_async_scan(vha, e->u.iosb.sp);
e->u.gpnft.sp);
break;
case QLA_EVT_GPNFT_DONE:
qla24xx_async_gpnft_done(vha, e->u.iosb.sp);
break; break;
case QLA_EVT_GNNFT_DONE: case QLA_EVT_SCAN_FINISH:
qla24xx_async_gnnft_done(vha, e->u.iosb.sp); qla_fab_scan_finish(vha, e->u.iosb.sp);
break; break;
case QLA_EVT_GFPNID: case QLA_EVT_GFPNID:
qla24xx_async_gfpnid(vha, e->u.fcport.fcport); qla24xx_async_gfpnid(vha, e->u.fcport.fcport);
......
...@@ -555,6 +555,7 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start) ...@@ -555,6 +555,7 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
struct qla_flt_location *fltl = (void *)req->ring; struct qla_flt_location *fltl = (void *)req->ring;
uint32_t *dcode = (uint32_t *)req->ring; uint32_t *dcode = (uint32_t *)req->ring;
uint8_t *buf = (void *)req->ring, *bcode, last_image; uint8_t *buf = (void *)req->ring, *bcode, last_image;
int rc;
/* /*
* FLT-location structure resides after the last PCI region. * FLT-location structure resides after the last PCI region.
...@@ -584,14 +585,24 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start) ...@@ -584,14 +585,24 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
pcihdr = 0; pcihdr = 0;
do { do {
/* Verify PCI expansion ROM header. */ /* Verify PCI expansion ROM header. */
qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, 0x20); rc = qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, 0x20);
if (rc) {
ql_log(ql_log_info, vha, 0x016d,
"Unable to read PCI Expansion Rom Header (%x).\n", rc);
return QLA_FUNCTION_FAILED;
}
bcode = buf + (pcihdr % 4); bcode = buf + (pcihdr % 4);
if (bcode[0x0] != 0x55 || bcode[0x1] != 0xaa) if (bcode[0x0] != 0x55 || bcode[0x1] != 0xaa)
goto end; goto end;
/* Locate PCI data structure. */ /* Locate PCI data structure. */
pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]); pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]);
qla24xx_read_flash_data(vha, dcode, pcids >> 2, 0x20); rc = qla24xx_read_flash_data(vha, dcode, pcids >> 2, 0x20);
if (rc) {
ql_log(ql_log_info, vha, 0x0179,
"Unable to read PCI Data Structure (%x).\n", rc);
return QLA_FUNCTION_FAILED;
}
bcode = buf + (pcihdr % 4); bcode = buf + (pcihdr % 4);
/* Validate signature of PCI data structure. */ /* Validate signature of PCI data structure. */
...@@ -606,7 +617,12 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start) ...@@ -606,7 +617,12 @@ qla2xxx_find_flt_start(scsi_qla_host_t *vha, uint32_t *start)
} while (!last_image); } while (!last_image);
/* Now verify FLT-location structure. */ /* Now verify FLT-location structure. */
qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, sizeof(*fltl) >> 2); rc = qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, sizeof(*fltl) >> 2);
if (rc) {
ql_log(ql_log_info, vha, 0x017a,
"Unable to read FLT (%x).\n", rc);
return QLA_FUNCTION_FAILED;
}
if (memcmp(fltl->sig, "QFLT", 4)) if (memcmp(fltl->sig, "QFLT", 4))
goto end; goto end;
...@@ -2605,13 +2621,18 @@ qla24xx_read_optrom_data(struct scsi_qla_host *vha, void *buf, ...@@ -2605,13 +2621,18 @@ qla24xx_read_optrom_data(struct scsi_qla_host *vha, void *buf,
uint32_t offset, uint32_t length) uint32_t offset, uint32_t length)
{ {
struct qla_hw_data *ha = vha->hw; struct qla_hw_data *ha = vha->hw;
int rc;
/* Suspend HBA. */ /* Suspend HBA. */
scsi_block_requests(vha->host); scsi_block_requests(vha->host);
set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); set_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
/* Go with read. */ /* Go with read. */
qla24xx_read_flash_data(vha, buf, offset >> 2, length >> 2); rc = qla24xx_read_flash_data(vha, buf, offset >> 2, length >> 2);
if (rc) {
ql_log(ql_log_info, vha, 0x01a0,
"Unable to perform optrom read(%x).\n", rc);
}
/* Resume HBA. */ /* Resume HBA. */
clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags); clear_bit(MBX_UPDATE_FLASH_ACTIVE, &ha->mbx_cmd_flags);
...@@ -3412,7 +3433,7 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3412,7 +3433,7 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
struct active_regions active_regions = { }; struct active_regions active_regions = { };
if (IS_P3P_TYPE(ha)) if (IS_P3P_TYPE(ha))
return ret; return QLA_SUCCESS;
if (!mbuf) if (!mbuf)
return QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
...@@ -3432,20 +3453,31 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3432,20 +3453,31 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
do { do {
/* Verify PCI expansion ROM header. */ /* Verify PCI expansion ROM header. */
qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, 0x20); ret = qla24xx_read_flash_data(vha, dcode, pcihdr >> 2, 0x20);
if (ret) {
ql_log(ql_log_info, vha, 0x017d,
"Unable to read PCI EXP Rom Header(%x).\n", ret);
return QLA_FUNCTION_FAILED;
}
bcode = mbuf + (pcihdr % 4); bcode = mbuf + (pcihdr % 4);
if (memcmp(bcode, "\x55\xaa", 2)) { if (memcmp(bcode, "\x55\xaa", 2)) {
/* No signature */ /* No signature */
ql_log(ql_log_fatal, vha, 0x0059, ql_log(ql_log_fatal, vha, 0x0059,
"No matching ROM signature.\n"); "No matching ROM signature.\n");
ret = QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
break;
} }
/* Locate PCI data structure. */ /* Locate PCI data structure. */
pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]); pcids = pcihdr + ((bcode[0x19] << 8) | bcode[0x18]);
qla24xx_read_flash_data(vha, dcode, pcids >> 2, 0x20); ret = qla24xx_read_flash_data(vha, dcode, pcids >> 2, 0x20);
if (ret) {
ql_log(ql_log_info, vha, 0x018e,
"Unable to read PCI Data Structure (%x).\n", ret);
return QLA_FUNCTION_FAILED;
}
bcode = mbuf + (pcihdr % 4); bcode = mbuf + (pcihdr % 4);
/* Validate signature of PCI data structure. */ /* Validate signature of PCI data structure. */
...@@ -3454,8 +3486,7 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3454,8 +3486,7 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
ql_log(ql_log_fatal, vha, 0x005a, ql_log(ql_log_fatal, vha, 0x005a,
"PCI data struct not found pcir_adr=%x.\n", pcids); "PCI data struct not found pcir_adr=%x.\n", pcids);
ql_dump_buffer(ql_dbg_init, vha, 0x0059, dcode, 32); ql_dump_buffer(ql_dbg_init, vha, 0x0059, dcode, 32);
ret = QLA_FUNCTION_FAILED; return QLA_FUNCTION_FAILED;
break;
} }
/* Read version */ /* Read version */
...@@ -3507,20 +3538,26 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3507,20 +3538,26 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
faddr = ha->flt_region_fw_sec; faddr = ha->flt_region_fw_sec;
} }
qla24xx_read_flash_data(vha, dcode, faddr, 8); ret = qla24xx_read_flash_data(vha, dcode, faddr, 8);
if (qla24xx_risc_firmware_invalid(dcode)) { if (ret) {
ql_log(ql_log_warn, vha, 0x005f, ql_log(ql_log_info, vha, 0x019e,
"Unrecognized fw revision at %x.\n", "Unable to read FW version (%x).\n", ret);
ha->flt_region_fw * 4); return ret;
ql_dump_buffer(ql_dbg_init, vha, 0x005f, dcode, 32);
} else { } else {
for (i = 0; i < 4; i++) if (qla24xx_risc_firmware_invalid(dcode)) {
ha->fw_revision[i] = ql_log(ql_log_warn, vha, 0x005f,
"Unrecognized fw revision at %x.\n",
ha->flt_region_fw * 4);
ql_dump_buffer(ql_dbg_init, vha, 0x005f, dcode, 32);
} else {
for (i = 0; i < 4; i++)
ha->fw_revision[i] =
be32_to_cpu((__force __be32)dcode[4+i]); be32_to_cpu((__force __be32)dcode[4+i]);
ql_dbg(ql_dbg_init, vha, 0x0060, ql_dbg(ql_dbg_init, vha, 0x0060,
"Firmware revision (flash) %u.%u.%u (%x).\n", "Firmware revision (flash) %u.%u.%u (%x).\n",
ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[0], ha->fw_revision[1],
ha->fw_revision[2], ha->fw_revision[3]); ha->fw_revision[2], ha->fw_revision[3]);
}
} }
/* Check for golden firmware and get version if available */ /* Check for golden firmware and get version if available */
...@@ -3531,18 +3568,23 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf) ...@@ -3531,18 +3568,23 @@ qla24xx_get_flash_version(scsi_qla_host_t *vha, void *mbuf)
memset(ha->gold_fw_version, 0, sizeof(ha->gold_fw_version)); memset(ha->gold_fw_version, 0, sizeof(ha->gold_fw_version));
faddr = ha->flt_region_gold_fw; faddr = ha->flt_region_gold_fw;
qla24xx_read_flash_data(vha, dcode, ha->flt_region_gold_fw, 8); ret = qla24xx_read_flash_data(vha, dcode, ha->flt_region_gold_fw, 8);
if (qla24xx_risc_firmware_invalid(dcode)) { if (ret) {
ql_log(ql_log_warn, vha, 0x0056, ql_log(ql_log_info, vha, 0x019f,
"Unrecognized golden fw at %#x.\n", faddr); "Unable to read Gold FW version (%x).\n", ret);
ql_dump_buffer(ql_dbg_init, vha, 0x0056, dcode, 32);
return ret; return ret;
} } else {
if (qla24xx_risc_firmware_invalid(dcode)) {
for (i = 0; i < 4; i++) ql_log(ql_log_warn, vha, 0x0056,
ha->gold_fw_version[i] = "Unrecognized golden fw at %#x.\n", faddr);
be32_to_cpu((__force __be32)dcode[4+i]); ql_dump_buffer(ql_dbg_init, vha, 0x0056, dcode, 32);
return QLA_FUNCTION_FAILED;
}
for (i = 0; i < 4; i++)
ha->gold_fw_version[i] =
be32_to_cpu((__force __be32)dcode[4+i]);
}
return ret; return ret;
} }
......
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
/* /*
* Driver version * Driver version
*/ */
#define QLA2XXX_VERSION "10.02.09.200-k" #define QLA2XXX_VERSION "10.02.09.300-k"
#define QLA_DRIVER_MAJOR_VER 10 #define QLA_DRIVER_MAJOR_VER 10
#define QLA_DRIVER_MINOR_VER 2 #define QLA_DRIVER_MINOR_VER 2
#define QLA_DRIVER_PATCH_VER 9 #define QLA_DRIVER_PATCH_VER 9
#define QLA_DRIVER_BETA_VER 200 #define QLA_DRIVER_BETA_VER 300
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment