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

Commit d743de66 authored by Andrew Vasquez's avatar Andrew Vasquez Committed by James Bottomley
Browse files

[SCSI] qla2xxx: Reduce request queue-size overhead with recent ISPs.



The original code to 'resize request-queues' based on iocb-counts
and employed during early ISP23xx testing was too
overly-pessimistic with regards to latencies in the firmware
pulling requests.  Recent ISPs can easily keep up processing a
stream of commands from an abbreviated (effectively, half the
original size) queue.

Signed-off-by: default avatarAndrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
parent 3d79038f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -176,8 +176,7 @@
/* ISP request and response entry counts (37-65535) */
#define REQUEST_ENTRY_CNT_2100		128	/* Number of request entries. */
#define REQUEST_ENTRY_CNT_2200		2048	/* Number of request entries. */
#define REQUEST_ENTRY_CNT_2XXX_EXT_MEM	4096	/* Number of request entries. */
#define REQUEST_ENTRY_CNT_24XX		4096	/* Number of request entries. */
#define REQUEST_ENTRY_CNT_24XX		2048	/* Number of request entries. */
#define RESPONSE_ENTRY_CNT_2100		64	/* Number of response entries.*/
#define RESPONSE_ENTRY_CNT_2300		512	/* Number of response entries.*/

+5 −62
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
*  QLogic ISP2x00 Hardware Support Function Prototypes.
*/
static int qla2x00_isp_firmware(scsi_qla_host_t *);
static void qla2x00_resize_request_q(scsi_qla_host_t *);
static int qla2x00_setup_chip(scsi_qla_host_t *);
static int qla2x00_init_rings(scsi_qla_host_t *);
static int qla2x00_fw_ready(scsi_qla_host_t *);
@@ -892,62 +891,6 @@ cont_alloc:
	    htonl(offsetof(struct qla2xxx_fw_dump, isp));
}

/**
 * qla2x00_resize_request_q() - Resize request queue given available ISP memory.
 * @ha: HA context
 *
 * Returns 0 on success.
 */
static void
qla2x00_resize_request_q(scsi_qla_host_t *vha)
{
	int rval;
	uint16_t fw_iocb_cnt = 0;
	uint16_t request_q_length = REQUEST_ENTRY_CNT_2XXX_EXT_MEM;
	dma_addr_t request_dma;
	request_t *request_ring;
	struct qla_hw_data *ha = vha->hw;
	struct req_que *req = ha->req_q_map[0];

	/* Valid only on recent ISPs. */
	if (IS_QLA2100(ha) || IS_QLA2200(ha))
		return;

	/* Retrieve IOCB counts available to the firmware. */
	rval = qla2x00_get_resource_cnts(vha, NULL, NULL, NULL, &fw_iocb_cnt,
					&ha->max_npiv_vports);
	if (rval)
		return;
	/* No point in continuing if current settings are sufficient. */
	if (fw_iocb_cnt < 1024)
		return;
	if (req->length >= request_q_length)
		return;

	/* Attempt to claim larger area for request queue. */
	request_ring = dma_alloc_coherent(&ha->pdev->dev,
	    (request_q_length + 1) * sizeof(request_t), &request_dma,
	    GFP_KERNEL);
	if (request_ring == NULL)
		return;

	/* Resize successful, report extensions. */
	qla_printk(KERN_INFO, ha, "Extended memory detected (%d KB)...\n",
	    (ha->fw_memory_size + 1) / 1024);
	qla_printk(KERN_INFO, ha, "Resizing request queue depth "
	    "(%d -> %d)...\n", req->length, request_q_length);

	/* Clear old allocations. */
	dma_free_coherent(&ha->pdev->dev,
	    (req->length + 1) * sizeof(request_t), req->ring,
	    req->dma);

	/* Begin using larger queue. */
	req->length = request_q_length;
	req->ring = request_ring;
	req->dma = request_dma;
}

/**
 * qla2x00_setup_chip() - Load and start RISC firmware.
 * @ha: HA context
@@ -1005,12 +948,12 @@ qla2x00_setup_chip(scsi_qla_host_t *vha)
						ha->max_npiv_vports =
						    MIN_MULTI_ID_FABRIC - 1;
				}
				if (!fw_major_version) {
					qla2x00_resize_request_q(vha);
					if (ql2xallocfwdump)
				qla2x00_get_resource_cnts(vha, NULL, NULL,
				    NULL, NULL, &ha->max_npiv_vports);

				if (!fw_major_version && ql2xallocfwdump)
					qla2x00_alloc_fw_dump(vha);
			}
			}
		} else {
			DEBUG2(printk(KERN_INFO
			    "scsi(%ld): ISP Firmware failed checksum.\n",