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

Commit 68ca949c authored by Anirban Chakraborty's avatar Anirban Chakraborty Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Add CPU affinity support.



Set the module parameter ql2xmultique_tag to 1 to enable this
feature. In this mode, the total number of response queues
created is equal to the number of online cpus. Turning the block
layer's rq_affinity mode on enables requests to be routed to the
proper cpu and at the same time it enables completion of the IO
in a response queue that is affined to the cpu in the request
path.

Signed-off-by: default avatarAnirban Chakraborty <anirban.chakraborty@qlogic.com>
Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 2afa19a9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1531,7 +1531,7 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
	qla24xx_vport_disable(fc_vport, disable);

	ret = 0;
	if (ha->cur_vport_count <= ha->flex_port_count
	if (ha->cur_vport_count <= ha->flex_port_count || ql2xmultique_tag
		|| ha->max_req_queues == 1 || !ha->npiv_info)
		goto vport_queue;
	/* Create a request queue in QoS mode for the vport */
@@ -1599,7 +1599,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
		    vha->host_no, vha->vp_idx, vha));
        }

	if (vha->req->id) {
	if (vha->req->id && !ql2xmultique_tag) {
		if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
			qla_printk(KERN_WARNING, ha,
				"Queue delete failed.\n");
+2 −0
Original line number Diff line number Diff line
@@ -2171,6 +2171,7 @@ struct rsp_que {
	struct qla_msix_entry *msix;
	struct req_que *req;
	srb_t *status_srb; /* status continuation entry */
	struct work_struct q_work;
};

/* Request queue data structure */
@@ -2539,6 +2540,7 @@ struct qla_hw_data {
	struct qla_chip_state_84xx *cs84xx;
	struct qla_statistics qla_stats;
	struct isp_operations *isp_ops;
	struct workqueue_struct *wq;
};

/*
+20 −2
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ static request_t *qla2x00_req_pkt(struct scsi_qla_host *, struct req_que *,
							struct rsp_que *rsp);
static void qla2x00_isp_cmd(struct scsi_qla_host *, struct req_que *);

static void qla25xx_set_que(srb_t *, struct req_que **, struct rsp_que **);
/**
 * qla2x00_get_cmd_direction() - Determine control_flag data direction.
 * @cmd: SCSI command
@@ -726,8 +727,7 @@ qla24xx_start_scsi(srb_t *sp)
	/* Setup device pointers. */
	ret = 0;

	req = vha->req;
	rsp = ha->rsp_q_map[0];
	qla25xx_set_que(sp, &req, &rsp);
	sp->que = req;

	/* So we know we haven't pci_map'ed anything yet */
@@ -850,3 +850,21 @@ qla24xx_start_scsi(srb_t *sp)

	return QLA_FUNCTION_FAILED;
}

static void qla25xx_set_que(srb_t *sp, struct req_que **req,
	struct rsp_que **rsp)
{
	struct scsi_cmnd *cmd = sp->cmd;
	struct scsi_qla_host *vha = sp->fcport->vha;
	struct qla_hw_data *ha = sp->fcport->vha->hw;
	int affinity = cmd->request->cpu;

	if (ql2xmultique_tag && affinity >= 0 &&
		affinity < ha->max_rsp_queues - 1) {
		*rsp = ha->rsp_q_map[affinity + 1];
		*req = ha->req_q_map[1];
	} else {
		*req = vha->req;
		*rsp = ha->rsp_q_map[0];
	}
}
+21 −1
Original line number Diff line number Diff line
@@ -1717,6 +1717,25 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
	return IRQ_HANDLED;
}

static irqreturn_t
qla25xx_msix_rsp_q(int irq, void *dev_id)
{
	struct qla_hw_data *ha;
	struct rsp_que *rsp;

	rsp = (struct rsp_que *) dev_id;
	if (!rsp) {
		printk(KERN_INFO
			"%s(): NULL response queue pointer\n", __func__);
		return IRQ_NONE;
	}
	ha = rsp->hw;

	queue_work_on((int) (rsp->id - 1), ha->wq, &rsp->q_work);

	return IRQ_HANDLED;
}

static irqreturn_t
qla24xx_msix_default(int irq, void *dev_id)
{
@@ -1806,9 +1825,10 @@ struct qla_init_msix_entry {
	irq_handler_t handler;
};

static struct qla_init_msix_entry msix_entries[2] = {
static struct qla_init_msix_entry msix_entries[3] = {
	{ "qla2xxx (default)", qla24xx_msix_default },
	{ "qla2xxx (rsp_q)", qla24xx_msix_rsp_q },
	{ "qla2xxx (multiq)", qla25xx_msix_rsp_q },
};

static void
+8 −2
Original line number Diff line number Diff line
@@ -1497,6 +1497,9 @@ qla24xx_login_fabric(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain,

	DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));

	if (ql2xmultique_tag)
		req = ha->req_q_map[0];
	else
		req = vha->req;
	rsp = req->rsp;

@@ -2311,6 +2314,9 @@ __qla24xx_issue_tmf(char *name, uint32_t type, struct fc_port *fcport,
	vha = fcport->vha;
	ha = vha->hw;
	req = vha->req;
	if (ql2xmultique_tag)
		rsp = ha->rsp_q_map[tag + 1];
	else
		rsp = req->rsp;
	tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
	if (tsk == NULL) {
Loading