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

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

scsi: qla2xxx: Use IOCB path to submit Control VP MBX command



Use IOCB patch to submit Control VP MBX command to reduce
bottle-neck for mbx interface.

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 5c25d451
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -472,6 +472,10 @@ struct srb_iocb {
			uint32_t timeout_sec;
			struct	list_head   entry;
		} nvme;
		struct {
			u16 cmd;
			u16 vp_index;
		} ctrlvp;
	} u;

	struct timer_list timer;
@@ -500,6 +504,7 @@ struct srb_iocb {
#define SRB_NVME_CMD	19
#define SRB_NVME_LS	20
#define SRB_PRLI_CMD	21
#define SRB_CTRL_VP	22

enum {
	TYPE_SRB,
@@ -526,6 +531,8 @@ typedef struct srb {
	struct list_head elem;
	u32 gen1;	/* scratch */
	u32 gen2;	/* scratch */
	int rc;
	struct completion comp;
	union {
		struct srb_iocb iocb_cmd;
		struct bsg_job *bsg_job;
+1 −0
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ qla2x00_async_iocb_timeout(void *data)
	case SRB_NACK_PLOGI:
	case SRB_NACK_PRLI:
	case SRB_NACK_LOGO:
	case SRB_CTRL_VP:
		sp->done(sp, QLA_FUNCTION_TIMEOUT);
		break;
	}
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ qla2x00_init_timer(srb_t *sp, unsigned long tmo)
	sp->u.iocb_cmd.timer.expires = jiffies + tmo * HZ;
	add_timer(&sp->u.iocb_cmd.timer);
	sp->free = qla2x00_sp_free;
	init_completion(&sp->comp);
	if (IS_QLAFX00(sp->vha->hw) && (sp->type == SRB_FXIOCB_DCMD))
		init_completion(&sp->u.iocb_cmd.u.fxiocb.fxiocb_comp);
	if (sp->type == SRB_ELS_DCMD)
+23 −0
Original line number Diff line number Diff line
@@ -3368,6 +3368,26 @@ qla_nvme_ls(srb_t *sp, struct pt_ls4_request *cmd_pkt)
	return rval;
}

static void
qla25xx_ctrlvp_iocb(srb_t *sp, struct vp_ctrl_entry_24xx *vce)
{
	int map, pos;

	vce->entry_type = VP_CTRL_IOCB_TYPE;
	vce->handle = sp->handle;
	vce->entry_count = 1;
	vce->command = cpu_to_le16(sp->u.iocb_cmd.u.ctrlvp.cmd);
	vce->vp_count = cpu_to_le16(1);

	/*
	 * index map in firmware starts with 1; decrement index
	 * this is ok as we never use index 0
	 */
	map = (sp->u.iocb_cmd.u.ctrlvp.vp_index - 1) / 8;
	pos = (sp->u.iocb_cmd.u.ctrlvp.vp_index - 1) & 7;
	vce->vp_idx_map[map] |= 1 << pos;
}

int
qla2x00_start_sp(srb_t *sp)
{
@@ -3446,6 +3466,9 @@ qla2x00_start_sp(srb_t *sp)
	case SRB_NACK_LOGO:
		qla2x00_send_notify_ack_iocb(sp, pkt);
		break;
	case SRB_CTRL_VP:
		qla25xx_ctrlvp_iocb(sp, pkt);
		break;
	default:
		break;
	}
+35 −0
Original line number Diff line number Diff line
@@ -1937,6 +1937,37 @@ qla24xx_nvme_iocb_entry(scsi_qla_host_t *vha, struct req_que *req, void *tsk)
	sp->done(sp, ret);
}

static void qla_ctrlvp_completed(scsi_qla_host_t *vha, struct req_que *req,
    struct vp_ctrl_entry_24xx *vce)
{
	const char func[] = "CTRLVP-IOCB";
	srb_t *sp;
	int rval = QLA_SUCCESS;

	sp = qla2x00_get_sp_from_handle(vha, func, req, vce);
	if (!sp)
		return;

	if (vce->entry_status != 0) {
		ql_dbg(ql_dbg_vport, vha, 0x10c4,
		    "%s: Failed to complete IOCB -- error status (%x)\n",
		    sp->name, vce->entry_status);
		rval = QLA_FUNCTION_FAILED;
	} else if (vce->comp_status != cpu_to_le16(CS_COMPLETE)) {
		ql_dbg(ql_dbg_vport, vha, 0x10c5,
		    "%s: Failed to complete IOCB -- completion status (%x) vpidx %x\n",
		    sp->name, le16_to_cpu(vce->comp_status),
		    le16_to_cpu(vce->vp_idx_failed));
		rval = QLA_FUNCTION_FAILED;
	} else {
		ql_dbg(ql_dbg_vport, vha, 0x10c6,
		    "Done %s.\n", __func__);
	}

	sp->rc = rval;
	sp->done(sp, rval);
}

/**
 * qla2x00_process_response_queue() - Process response queue entries.
 * @ha: SCSI driver HA context
@@ -3001,6 +3032,10 @@ void qla24xx_process_response_queue(struct scsi_qla_host *vha,
			qla24xx_mbx_iocb_entry(vha, rsp->req,
			    (struct mbx_24xx_entry *)pkt);
			break;
		case VP_CTRL_IOCB_TYPE:
			qla_ctrlvp_completed(vha, rsp->req,
			    (struct vp_ctrl_entry_24xx *)pkt);
			break;
		default:
			/* Type Not Supported. */
			ql_dbg(ql_dbg_async, vha, 0x5042,
Loading