Commit d058bea1 authored by Martin K. Petersen's avatar Martin K. Petersen
Browse files

Merge patch series "Misc. qla2xxx driver bug fixes"

Nilesh Javali <njavali@marvell.com> says:

Please apply the miscellaneous qla2xxx driver bug fixes to the SCSI
tree at your earliest convenience.

Link: https://lore.kernel.org/r/20221219110748.7039-1-njavali@marvell.com


Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parents 3d2f12b4 f590c255
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -278,8 +278,8 @@ qla2x00_process_els(struct bsg_job *bsg_job)
	const char *type;
	int req_sg_cnt, rsp_sg_cnt;
	int rval =  (DID_ERROR << 16);
	uint16_t nextlid = 0;
	uint32_t els_cmd = 0;
	int qla_port_allocated = 0;

	if (bsg_request->msgcode == FC_BSG_RPT_ELS) {
		rport = fc_bsg_to_rport(bsg_job);
@@ -329,9 +329,9 @@ qla2x00_process_els(struct bsg_job *bsg_job)
		/* make sure the rport is logged in,
		 * if not perform fabric login
		 */
		if (qla2x00_fabric_login(vha, fcport, &nextlid)) {
		if (atomic_read(&fcport->state) != FCS_ONLINE) {
			ql_dbg(ql_dbg_user, vha, 0x7003,
			    "Failed to login port %06X for ELS passthru.\n",
			    "Port %06X is not online for ELS passthru.\n",
			    fcport->d_id.b24);
			rval = -EIO;
			goto done;
@@ -348,6 +348,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
			goto done;
		}

		qla_port_allocated = 1;
		/* Initialize all required  fields of fcport */
		fcport->vha = vha;
		fcport->d_id.b.al_pa =
@@ -432,7 +433,7 @@ qla2x00_process_els(struct bsg_job *bsg_job)
	goto done_free_fcport;

done_free_fcport:
	if (bsg_request->msgcode != FC_BSG_RPT_ELS)
	if (qla_port_allocated)
		qla2x00_free_fcport(fcport);
done:
	return rval;
+5 −1
Original line number Diff line number Diff line
@@ -660,7 +660,7 @@ enum {

struct iocb_resource {
	u8 res_type;
	u8 pad;
	u8  exch_cnt;
	u16 iocb_cnt;
};

@@ -3721,6 +3721,10 @@ struct qla_fw_resources {
	u16 iocbs_limit;
	u16 iocbs_qp_limit;
	u16 iocbs_used;
	u16 exch_total;
	u16 exch_limit;
	u16 exch_used;
	u16 pad;
};

#define QLA_IOCB_PCT_LIMIT 95
+8 −2
Original line number Diff line number Diff line
@@ -235,7 +235,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
	uint16_t mb[MAX_IOCB_MB_REG];
	int rc;
	struct qla_hw_data *ha = vha->hw;
	u16 iocbs_used, i;
	u16 iocbs_used, i, exch_used;

	rc = qla24xx_res_count_wait(vha, mb, SIZEOF_IOCB_MB_REG);
	if (rc != QLA_SUCCESS) {
@@ -263,13 +263,19 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)
	if (ql2xenforce_iocb_limit) {
		/* lock is not require. It's an estimate. */
		iocbs_used = ha->base_qpair->fwres.iocbs_used;
		exch_used = ha->base_qpair->fwres.exch_used;
		for (i = 0; i < ha->max_qpairs; i++) {
			if (ha->queue_pair_map[i])
			if (ha->queue_pair_map[i]) {
				iocbs_used += ha->queue_pair_map[i]->fwres.iocbs_used;
				exch_used += ha->queue_pair_map[i]->fwres.exch_used;
			}
		}

		seq_printf(s, "Driver: estimate iocb used [%d] high water limit [%d]\n",
			   iocbs_used, ha->base_qpair->fwres.iocbs_limit);

		seq_printf(s, "estimate exchange used[%d] high water limit [%d] n",
			   exch_used, ha->base_qpair->fwres.exch_limit);
	}

	return 0;
+4 −3
Original line number Diff line number Diff line
@@ -2989,9 +2989,10 @@ qla28xx_start_scsi_edif(srb_t *sp)
	tot_dsds = nseg;
	req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);

	sp->iores.res_type = RESOURCE_INI;
	sp->iores.res_type = RESOURCE_IOCB | RESOURCE_EXCH;
	sp->iores.exch_cnt = 1;
	sp->iores.iocb_cnt = req_cnt;
	if (qla_get_iocbs(sp->qpair, &sp->iores))
	if (qla_get_fw_resources(sp->qpair, &sp->iores))
		goto queuing_error;

	if (req->cnt < (req_cnt + 2)) {
@@ -3185,7 +3186,7 @@ qla28xx_start_scsi_edif(srb_t *sp)
		mempool_free(sp->u.scmd.ct6_ctx, ha->ctx_mempool);
		sp->u.scmd.ct6_ctx = NULL;
	}
	qla_put_iocbs(sp->qpair, &sp->iores);
	qla_put_fw_resources(sp->qpair, &sp->iores);
	spin_unlock_irqrestore(lock, flags);

	return QLA_FUNCTION_FAILED;
+19 −1
Original line number Diff line number Diff line
@@ -128,12 +128,14 @@ static void qla24xx_abort_iocb_timeout(void *data)
		    sp->cmd_sp)) {
			qpair->req->outstanding_cmds[handle] = NULL;
			cmdsp_found = 1;
			qla_put_fw_resources(qpair, &sp->cmd_sp->iores);
		}

		/* removing the abort */
		if (qpair->req->outstanding_cmds[handle] == sp) {
			qpair->req->outstanding_cmds[handle] = NULL;
			sp_found = 1;
			qla_put_fw_resources(qpair, &sp->iores);
			break;
		}
	}
@@ -388,6 +390,12 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_t *fcport,
	fcport->flags &= ~FCF_ASYNC_SENT;
done:
	fcport->flags &= ~FCF_ASYNC_ACTIVE;

	/*
	 * async login failed. Could be due to iocb/exchange resource
	 * being low. Set state DELETED for re-login process to start again.
	 */
	qla2x00_set_fcport_disc_state(fcport, DSC_DELETED);
	return rval;
}

@@ -2000,6 +2008,7 @@ qla2x00_tmf_iocb_timeout(void *data)
		for (h = 1; h < sp->qpair->req->num_outstanding_cmds; h++) {
			if (sp->qpair->req->outstanding_cmds[h] == sp) {
				sp->qpair->req->outstanding_cmds[h] = NULL;
				qla_put_fw_resources(sp->qpair, &sp->iores);
				break;
			}
		}
@@ -2073,7 +2082,6 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint32_t lun,
done_free_sp:
	/* ref: INIT */
	kref_put(&sp->cmd_kref, qla2x00_sp_release);
	fcport->flags &= ~FCF_ASYNC_SENT;
done:
	return rval;
}
@@ -3943,6 +3951,12 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha)
	ha->base_qpair->fwres.iocbs_limit = limit;
	ha->base_qpair->fwres.iocbs_qp_limit = limit / num_qps;
	ha->base_qpair->fwres.iocbs_used = 0;

	ha->base_qpair->fwres.exch_total = ha->orig_fw_xcb_count;
	ha->base_qpair->fwres.exch_limit = (ha->orig_fw_xcb_count *
					    QLA_IOCB_PCT_LIMIT) / 100;
	ha->base_qpair->fwres.exch_used  = 0;

	for (i = 0; i < ha->max_qpairs; i++) {
		if (ha->queue_pair_map[i])  {
			ha->queue_pair_map[i]->fwres.iocbs_total =
@@ -3951,6 +3965,10 @@ void qla_init_iocb_limit(scsi_qla_host_t *vha)
			ha->queue_pair_map[i]->fwres.iocbs_qp_limit =
				limit / num_qps;
			ha->queue_pair_map[i]->fwres.iocbs_used = 0;
			ha->queue_pair_map[i]->fwres.exch_total = ha->orig_fw_xcb_count;
			ha->queue_pair_map[i]->fwres.exch_limit =
				(ha->orig_fw_xcb_count * QLA_IOCB_PCT_LIMIT) / 100;
			ha->queue_pair_map[i]->fwres.exch_used = 0;
		}
	}
}
Loading