aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt2sas
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-11-12 18:09:11 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:07 -0500
commita93c6b45df57332b1703e0dc6f99a1bafc17f5e3 (patch)
tree2170abc929537a0542f7454a22da57428818ceea /drivers/scsi/mpt2sas
parent90d2a672250b9d6e5c700f2d2c07c19d6fad064a (diff)
[SCSI] mpt2sas: change queue depth with reason argument more appropriately
change_queue_depth callback API changed The change_queue_depth callback changed where there is now an additional parameter called reason, with SCSI_QDEPTH_DEFAULT, SCSI_QDEPTH_QFULL, and SCSI_QDEPTH_RAMP_UP codes. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/mpt2sas')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_scsih.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
index e4987dbbaa50..608e8ce6cc74 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
@@ -1102,28 +1102,24 @@ _scsih_build_scatter_gather(struct MPT2SAS_ADAPTER *ioc,
1102} 1102}
1103 1103
1104/** 1104/**
1105 * _scsih_change_queue_depth - setting device queue depth 1105 * _scsih_adjust_queue_depth - setting device queue depth
1106 * @sdev: scsi device struct 1106 * @sdev: scsi device struct
1107 * @qdepth: requested queue depth 1107 * @qdepth: requested queue depth
1108 * @reason: calling context
1109 * 1108 *
1110 * Returns queue depth. 1109 *
1110 * Returns nothing
1111 */ 1111 */
1112static int 1112static void
1113_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason) 1113_scsih_adjust_queue_depth(struct scsi_device *sdev, int qdepth)
1114{ 1114{
1115 struct Scsi_Host *shost = sdev->host; 1115 struct Scsi_Host *shost = sdev->host;
1116 int max_depth; 1116 int max_depth;
1117 int tag_type;
1118 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost); 1117 struct MPT2SAS_ADAPTER *ioc = shost_priv(shost);
1119 struct MPT2SAS_DEVICE *sas_device_priv_data; 1118 struct MPT2SAS_DEVICE *sas_device_priv_data;
1120 struct MPT2SAS_TARGET *sas_target_priv_data; 1119 struct MPT2SAS_TARGET *sas_target_priv_data;
1121 struct _sas_device *sas_device; 1120 struct _sas_device *sas_device;
1122 unsigned long flags; 1121 unsigned long flags;
1123 1122
1124 if (reason != SCSI_QDEPTH_DEFAULT)
1125 return -EOPNOTSUPP;
1126
1127 max_depth = shost->can_queue; 1123 max_depth = shost->can_queue;
1128 1124
1129 /* limit max device queue for SATA to 32 */ 1125 /* limit max device queue for SATA to 32 */
@@ -1149,8 +1145,27 @@ _scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
1149 max_depth = 1; 1145 max_depth = 1;
1150 if (qdepth > max_depth) 1146 if (qdepth > max_depth)
1151 qdepth = max_depth; 1147 qdepth = max_depth;
1152 tag_type = (qdepth == 1) ? 0 : MSG_SIMPLE_TAG; 1148 scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth);
1153 scsi_adjust_queue_depth(sdev, tag_type, qdepth); 1149}
1150
1151/**
1152 * _scsih_change_queue_depth - setting device queue depth
1153 * @sdev: scsi device struct
1154 * @qdepth: requested queue depth
1155 * @reason: SCSI_QDEPTH_DEFAULT/SCSI_QDEPTH_QFULL/SCSI_QDEPTH_RAMP_UP
1156 * (see include/scsi/scsi_host.h for definition)
1157 *
1158 * Returns queue depth.
1159 */
1160static int
1161_scsih_change_queue_depth(struct scsi_device *sdev, int qdepth, int reason)
1162{
1163 if (reason == SCSI_QDEPTH_DEFAULT || reason == SCSI_QDEPTH_RAMP_UP)
1164 _scsih_adjust_queue_depth(sdev, qdepth);
1165 else if (reason == SCSI_QDEPTH_QFULL)
1166 scsi_track_queue_full(sdev, qdepth);
1167 else
1168 return -EOPNOTSUPP;
1154 1169
1155 if (sdev->inquiry_len > 7) 1170 if (sdev->inquiry_len > 7)
1156 sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), " 1171 sdev_printk(KERN_INFO, sdev, "qdepth(%d), tagged(%d), "