aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/linit.c
diff options
context:
space:
mode:
authorSalyzyn, Mark <mark_salyzyn@adaptec.com>2007-05-30 10:01:14 -0400
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2007-06-01 11:39:56 -0400
commit5c9cfeddbb49954b459fda91bf5479f5a0a4e409 (patch)
treefd105c924eacc1bbc2e5d8da07b0a21eb919dd16 /drivers/scsi/aacraid/linit.c
parent32fbac2256cedee62de5602b1703c15c150a6e14 (diff)
[SCSI] aacraid: Changeable queue depth
Inspired by Brian King's patch to the ibmvscsi driver. Adds support for a changeable queue depth to the aacraid driver. Signed-off-by: Mark Salyzyn <aacraid@adaptec.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aacraid/linit.c')
-rw-r--r--drivers/scsi/aacraid/linit.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index a270a3f00647..6f92d077679f 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -446,6 +446,43 @@ static int aac_slave_configure(struct scsi_device *sdev)
446 return 0; 446 return 0;
447} 447}
448 448
449/**
450 * aac_change_queue_depth - alter queue depths
451 * @sdev: SCSI device we are considering
452 * @depth: desired queue depth
453 *
454 * Alters queue depths for target device based on the host adapter's
455 * total capacity and the queue depth supported by the target device.
456 */
457
458static int aac_change_queue_depth(struct scsi_device *sdev, int depth)
459{
460 if (sdev->tagged_supported && (sdev->type == TYPE_DISK) &&
461 (sdev_channel(sdev) == CONTAINER_CHANNEL)) {
462 struct scsi_device * dev;
463 struct Scsi_Host *host = sdev->host;
464 unsigned num = 0;
465
466 __shost_for_each_device(dev, host) {
467 if (dev->tagged_supported && (dev->type == TYPE_DISK) &&
468 (sdev_channel(dev) == CONTAINER_CHANNEL))
469 ++num;
470 ++num;
471 }
472 if (num >= host->can_queue)
473 num = host->can_queue - 1;
474 if (depth > (host->can_queue - num))
475 depth = host->can_queue - num;
476 if (depth > 256)
477 depth = 256;
478 else if (depth < 2)
479 depth = 2;
480 scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG, depth);
481 } else
482 scsi_adjust_queue_depth(sdev, 0, 1);
483 return sdev->queue_depth;
484}
485
449static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg) 486static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg)
450{ 487{
451 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; 488 struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata;
@@ -844,6 +881,7 @@ static struct scsi_host_template aac_driver_template = {
844 .bios_param = aac_biosparm, 881 .bios_param = aac_biosparm,
845 .shost_attrs = aac_attrs, 882 .shost_attrs = aac_attrs,
846 .slave_configure = aac_slave_configure, 883 .slave_configure = aac_slave_configure,
884 .change_queue_depth = aac_change_queue_depth,
847 .eh_abort_handler = aac_eh_abort, 885 .eh_abort_handler = aac_eh_abort,
848 .eh_host_reset_handler = aac_eh_reset, 886 .eh_host_reset_handler = aac_eh_reset,
849 .can_queue = AAC_NUM_IO_FIB, 887 .can_queue = AAC_NUM_IO_FIB,