Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5419e26 authored by Quinn Tran's avatar Quinn Tran Committed by Martin K. Petersen
Browse files

scsi: qla2xxx: Combine Active command arrays.



Merge active/outstanding cmd arrays from target side and initiator side
together in prepration for Target Multi Queue support.

Signed-off-by: default avatarQuinn Tran <quinn.tran@cavium.com>
Signed-off-by: default avatarHimanshu Madhani <himanshu.madhani@cavium.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 8ba1ddb3
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -437,7 +437,18 @@ struct srb_iocb {
#define SRB_NACK_PRLI	17
#define SRB_NACK_LOGO	18

enum {
	TYPE_SRB,
	TYPE_TGT_CMD,
};

typedef struct srb {
	/*
	 * Do not move cmd_type field, it needs to
	 * line up with qla_tgt_cmd->cmd_type
	 */
	uint8_t cmd_type;
	uint8_t pad[3];
	atomic_t ref_count;
	struct fc_port *fcport;
	struct scsi_qla_host *vha;
@@ -3287,9 +3298,6 @@ struct qlt_hw_data {
	uint32_t __iomem *atio_q_out;

	struct qla_tgt_func_tmpl *tgt_ops;
	struct qla_tgt_cmd *cmds[DEFAULT_OUTSTANDING_COMMANDS];
	uint16_t current_handle;

	struct qla_tgt_vp_map *tgt_vp_map;

	int saved_set;
@@ -4258,6 +4266,7 @@ enum nexus_wait_type {
	WAIT_LUN,
};

#include "qla_target.h"
#include "qla_gbl.h"
#include "qla_dbg.h"
#include "qla_inline.h"
+0 −2
Original line number Diff line number Diff line
@@ -834,8 +834,6 @@ extern irqreturn_t qla8044_intr_handler(int, void *);
extern void qla82xx_mbx_completion(scsi_qla_host_t *, uint16_t);
extern int qla8044_abort_isp(scsi_qla_host_t *);
extern int qla8044_check_fw_alive(struct scsi_qla_host *);

extern void qlt_host_reset_handler(struct qla_hw_data *ha);
extern int qla_get_exlogin_status(scsi_qla_host_t *, uint16_t *,
	uint16_t *);
extern int qla_set_exlogin_mem_cfg(scsi_qla_host_t *vha, dma_addr_t phys_addr);
+1 −0
Original line number Diff line number Diff line
@@ -250,6 +250,7 @@ qla2x00_get_sp(scsi_qla_host_t *vha, fc_port_t *fcport, gfp_t flag)

	memset(sp, 0, sizeof(*sp));
	sp->fcport = fcport;
	sp->cmd_type = TYPE_SRB;
	sp->iocbs = 1;
	sp->vha = vha;
done:
+36 −12
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
static void qla2x00_status_entry(scsi_qla_host_t *, struct rsp_que *, void *);
static void qla2x00_status_cont_entry(struct rsp_que *, sts_cont_entry_t *);
static void qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *,
static int qla2x00_error_entry(scsi_qla_host_t *, struct rsp_que *,
	sts_entry_t *);

/**
@@ -2280,6 +2280,14 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, void *pkt)
		return;
	}

	if (sp->cmd_type != TYPE_SRB) {
		req->outstanding_cmds[handle] = NULL;
		ql_dbg(ql_dbg_io, vha, 0x3015,
		    "Unknown sp->cmd_type %x %p).\n",
		    sp->cmd_type, sp);
		return;
	}

	if (unlikely((state_flags & BIT_1) && (sp->type == SRB_BIDI_CMD))) {
		qla25xx_process_bidir_status_iocb(vha, pkt, req, handle);
		return;
@@ -2632,8 +2640,9 @@ qla2x00_status_cont_entry(struct rsp_que *rsp, sts_cont_entry_t *pkt)
 * qla2x00_error_entry() - Process an error entry.
 * @ha: SCSI driver HA context
 * @pkt: Entry pointer
 * return : 1=allow further error analysis. 0=no additional error analysis.
 */
static void
static int
qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt)
{
	srb_t *sp;
@@ -2654,18 +2663,35 @@ qla2x00_error_entry(scsi_qla_host_t *vha, struct rsp_que *rsp, sts_entry_t *pkt)
	if (pkt->entry_status & RF_BUSY)
		res = DID_BUS_BUSY << 16;

	if (pkt->entry_type == NOTIFY_ACK_TYPE &&
	    pkt->handle == QLA_TGT_SKIP_HANDLE)
		return;
	if ((pkt->handle & ~QLA_TGT_HANDLE_MASK) == QLA_TGT_SKIP_HANDLE)
		return 0;

	switch (pkt->entry_type) {
	case NOTIFY_ACK_TYPE:
	case STATUS_TYPE:
	case STATUS_CONT_TYPE:
	case LOGINOUT_PORT_IOCB_TYPE:
	case CT_IOCB_TYPE:
	case ELS_IOCB_TYPE:
	case ABORT_IOCB_TYPE:
	case MBX_IOCB_TYPE:
		sp = qla2x00_get_sp_from_handle(vha, func, req, pkt);
		if (sp) {
			sp->done(sp, res);
		return;
			return 0;
		}
		break;

	case ABTS_RESP_24XX:
	case CTIO_TYPE7:
	case CTIO_CRC2:
	default:
		return 1;
	}
fatal:
	ql_log(ql_log_warn, vha, 0x5030,
	    "Error entry - invalid handle/queue (%04x).\n", que);
	return 0;
}

/**
@@ -2746,9 +2772,7 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
		}

		if (pkt->entry_status != 0) {
			qla2x00_error_entry(vha, rsp, (sts_entry_t *) pkt);

			if (qlt_24xx_process_response_error(vha, pkt))
			if (qla2x00_error_entry(vha, rsp, (sts_entry_t *) pkt))
				goto process_err;

			((response_t *)pkt)->signature = RESPONSE_PROCESSED;
+54 −21
Original line number Diff line number Diff line
@@ -1649,8 +1649,9 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
	srb_t *sp;
	struct qla_hw_data *ha = vha->hw;
	struct req_que *req;

	qlt_host_reset_handler(ha);
	struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
	struct qla_tgt_cmd *cmd;
	uint8_t trace = 0;

	spin_lock_irqsave(&ha->hardware_lock, flags);
	for (que = 0; que < ha->max_req_queues; que++) {
@@ -1662,27 +1663,57 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
		for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
			sp = req->outstanding_cmds[cnt];
			if (sp) {
				/* Don't abort commands in adapter during EEH
				 * recovery as it's not accessible/responding.
				req->outstanding_cmds[cnt] = NULL;
				if (sp->cmd_type == TYPE_SRB) {
					/*
					 * Don't abort commands in adapter
					 * during EEH recovery as it's not
					 * accessible/responding.
					 */
				if (GET_CMD_SP(sp) && !ha->flags.eeh_busy &&
					if (GET_CMD_SP(sp) &&
					    !ha->flags.eeh_busy &&
					    (sp->type == SRB_SCSI_CMD)) {
					/* Get a reference to the sp and drop the lock.
					 * The reference ensures this sp->done() call
					 * - and not the call in qla2xxx_eh_abort() -
					 * ends the SCSI command (with result 'res').
						/*
						 * Get a reference to the sp
						 * and drop the lock. The
						 * reference ensures this
						 * sp->done() call and not the
						 * call in qla2xxx_eh_abort()
						 * ends the SCSI command (with
						 * result 'res').
						 */
						sp_get(sp);
					spin_unlock_irqrestore(&ha->hardware_lock, flags);
					status = qla2xxx_eh_abort(GET_CMD_SP(sp));
					spin_lock_irqsave(&ha->hardware_lock, flags);
					/* Get rid of extra reference if immediate exit
					 * from ql2xxx_eh_abort */
					if (status == FAILED && (qla2x00_isp_reg_stat(ha)))
						atomic_dec(&sp->ref_count);
						spin_unlock_irqrestore(
						    &ha->hardware_lock, flags);
						status = qla2xxx_eh_abort(
						    GET_CMD_SP(sp));
						spin_lock_irqsave(
						    &ha->hardware_lock, flags);
						/*
						 * Get rid of extra reference
						 * if immediate exit from
						 * ql2xxx_eh_abort
						 */
						if (status == FAILED &&
						    (qla2x00_isp_reg_stat(ha)))
							atomic_dec(
							    &sp->ref_count);
					}
				req->outstanding_cmds[cnt] = NULL;
					sp->done(sp, res);
				} else {
					if (!vha->hw->tgt.tgt_ops || !tgt ||
					    qla_ini_mode_enabled(vha)) {
						if (!trace)
							ql_dbg(ql_dbg_tgt_mgt,
							    vha, 0xf003,
							    "HOST-ABORT-HNDLR: dpc_flags=%lx. Target mode disabled\n",
							    vha->dpc_flags);
						continue;
					}
					cmd = (struct qla_tgt_cmd *)sp;
					qlt_abort_cmd_on_host_reset(cmd->vha,
					    cmd);
				}
			}
		}
	}
@@ -5862,6 +5893,8 @@ qla2x00_timer(scsi_qla_host_t *vha)
					sp = req->outstanding_cmds[index];
					if (!sp)
						continue;
					if (sp->cmd_type != TYPE_SRB)
						continue;
					if (sp->type != SRB_SCSI_CMD)
						continue;
					sfcp = sp->fcport;
Loading