aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/storvsc_drv.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2014-07-12 12:48:26 -0400
committerChristoph Hellwig <hch@lst.de>2014-07-25 17:17:02 -0400
commit4cd83ecdac20d30725b4f96e5d7814a1e290bc7e (patch)
tree8c5be90980b9dda8982339521af290bff372b121 /drivers/scsi/storvsc_drv.c
parentca3d7bf9c646e976d33027d65dfd60124e3dc7e9 (diff)
Drivers: scsi: storvsc: Change the limits to reflect the values on the host
Hyper-V hosts can support multiple targets and multiple channels and larger number of LUNs per target. Update the code to reflect this. With this patch we can correctly enumerate all the paths in a multi-path storage environment. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Cc: <stable@vger.kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/storvsc_drv.c')
-rw-r--r--drivers/scsi/storvsc_drv.c47
1 files changed, 31 insertions, 16 deletions
diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 9969fa1ef7c4..8938b133faa8 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -330,17 +330,17 @@ static int storvsc_timeout = 180;
330 330
331static void storvsc_on_channel_callback(void *context); 331static void storvsc_on_channel_callback(void *context);
332 332
333/* 333#define STORVSC_MAX_LUNS_PER_TARGET 255
334 * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In 334#define STORVSC_MAX_TARGETS 2
335 * reality, the path/target is not used (ie always set to 0) so our 335#define STORVSC_MAX_CHANNELS 8
336 * scsi host adapter essentially has 1 bus with 1 target that contains
337 * up to 256 luns.
338 */
339#define STORVSC_MAX_LUNS_PER_TARGET 64
340#define STORVSC_MAX_TARGETS 1
341#define STORVSC_MAX_CHANNELS 1
342 336
337#define STORVSC_FC_MAX_LUNS_PER_TARGET 255
338#define STORVSC_FC_MAX_TARGETS 128
339#define STORVSC_FC_MAX_CHANNELS 8
343 340
341#define STORVSC_IDE_MAX_LUNS_PER_TARGET 64
342#define STORVSC_IDE_MAX_TARGETS 1
343#define STORVSC_IDE_MAX_CHANNELS 1
344 344
345struct storvsc_cmd_request { 345struct storvsc_cmd_request {
346 struct list_head entry; 346 struct list_head entry;
@@ -1691,7 +1691,6 @@ static struct scsi_host_template scsi_driver = {
1691 .slave_destroy = storvsc_device_destroy, 1691 .slave_destroy = storvsc_device_destroy,
1692 .slave_configure = storvsc_device_configure, 1692 .slave_configure = storvsc_device_configure,
1693 .cmd_per_lun = 1, 1693 .cmd_per_lun = 1,
1694 /* 64 max_queue * 1 target */
1695 .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, 1694 .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS,
1696 .this_id = -1, 1695 .this_id = -1,
1697 /* no use setting to 0 since ll_blk_rw reset it to 1 */ 1696 /* no use setting to 0 since ll_blk_rw reset it to 1 */
@@ -1756,6 +1755,9 @@ static int storvsc_probe(struct hv_device *device,
1756 } 1755 }
1757 1756
1758 1757
1758 if (dev_id->driver_data == SFC_GUID)
1759 scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS *
1760 STORVSC_FC_MAX_TARGETS);
1759 host = scsi_host_alloc(&scsi_driver, 1761 host = scsi_host_alloc(&scsi_driver,
1760 sizeof(struct hv_host_device)); 1762 sizeof(struct hv_host_device));
1761 if (!host) 1763 if (!host)
@@ -1789,12 +1791,25 @@ static int storvsc_probe(struct hv_device *device,
1789 host_dev->path = stor_device->path_id; 1791 host_dev->path = stor_device->path_id;
1790 host_dev->target = stor_device->target_id; 1792 host_dev->target = stor_device->target_id;
1791 1793
1792 /* max # of devices per target */ 1794 switch (dev_id->driver_data) {
1793 host->max_lun = STORVSC_MAX_LUNS_PER_TARGET; 1795 case SFC_GUID:
1794 /* max # of targets per channel */ 1796 host->max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET;
1795 host->max_id = STORVSC_MAX_TARGETS; 1797 host->max_id = STORVSC_FC_MAX_TARGETS;
1796 /* max # of channels */ 1798 host->max_channel = STORVSC_FC_MAX_CHANNELS - 1;
1797 host->max_channel = STORVSC_MAX_CHANNELS - 1; 1799 break;
1800
1801 case SCSI_GUID:
1802 host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
1803 host->max_id = STORVSC_MAX_TARGETS;
1804 host->max_channel = STORVSC_MAX_CHANNELS - 1;
1805 break;
1806
1807 default:
1808 host->max_lun = STORVSC_IDE_MAX_LUNS_PER_TARGET;
1809 host->max_id = STORVSC_IDE_MAX_TARGETS;
1810 host->max_channel = STORVSC_IDE_MAX_CHANNELS - 1;
1811 break;
1812 }
1798 /* max cmd length */ 1813 /* max cmd length */
1799 host->max_cmd_len = STORVSC_MAX_CMD_LEN; 1814 host->max_cmd_len = STORVSC_MAX_CMD_LEN;
1800 1815