]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.16.3/drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.16.3 / drivers-scsi-storvsc-change-the-limits-to-reflect-the-values-on-the-host.patch
1 From 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e Mon Sep 17 00:00:00 2001
2 From: "K. Y. Srinivasan" <kys@microsoft.com>
3 Date: Sat, 12 Jul 2014 09:48:26 -0700
4 Subject: Drivers: scsi: storvsc: Change the limits to reflect the values on the host
5
6 From: "K. Y. Srinivasan" <kys@microsoft.com>
7
8 commit 4cd83ecdac20d30725b4f96e5d7814a1e290bc7e upstream.
9
10 Hyper-V hosts can support multiple targets and multiple channels and larger number of
11 LUNs per target. Update the code to reflect this. With this patch we can correctly
12 enumerate all the paths in a multi-path storage environment.
13
14 Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
15 Reviewed-by: Hannes Reinecke <hare@suse.de>
16 Signed-off-by: Christoph Hellwig <hch@lst.de>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18
19 ---
20 drivers/scsi/storvsc_drv.c | 51 +++++++++++++++++++++++++++++----------------
21 1 file changed, 33 insertions(+), 18 deletions(-)
22
23 --- a/drivers/scsi/storvsc_drv.c
24 +++ b/drivers/scsi/storvsc_drv.c
25 @@ -331,17 +331,17 @@ static int storvsc_timeout = 180;
26
27 static void storvsc_on_channel_callback(void *context);
28
29 -/*
30 - * In Hyper-V, each port/path/target maps to 1 scsi host adapter. In
31 - * reality, the path/target is not used (ie always set to 0) so our
32 - * scsi host adapter essentially has 1 bus with 1 target that contains
33 - * up to 256 luns.
34 - */
35 -#define STORVSC_MAX_LUNS_PER_TARGET 64
36 -#define STORVSC_MAX_TARGETS 1
37 -#define STORVSC_MAX_CHANNELS 1
38 -
39 -
40 +#define STORVSC_MAX_LUNS_PER_TARGET 255
41 +#define STORVSC_MAX_TARGETS 2
42 +#define STORVSC_MAX_CHANNELS 8
43 +
44 +#define STORVSC_FC_MAX_LUNS_PER_TARGET 255
45 +#define STORVSC_FC_MAX_TARGETS 128
46 +#define STORVSC_FC_MAX_CHANNELS 8
47 +
48 +#define STORVSC_IDE_MAX_LUNS_PER_TARGET 64
49 +#define STORVSC_IDE_MAX_TARGETS 1
50 +#define STORVSC_IDE_MAX_CHANNELS 1
51
52 struct storvsc_cmd_request {
53 struct list_head entry;
54 @@ -1713,7 +1713,6 @@ static struct scsi_host_template scsi_dr
55 .slave_destroy = storvsc_device_destroy,
56 .slave_configure = storvsc_device_configure,
57 .cmd_per_lun = 1,
58 - /* 64 max_queue * 1 target */
59 .can_queue = STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS,
60 .this_id = -1,
61 /* no use setting to 0 since ll_blk_rw reset it to 1 */
62 @@ -1778,6 +1777,9 @@ static int storvsc_probe(struct hv_devic
63 }
64
65
66 + if (dev_id->driver_data == SFC_GUID)
67 + scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS *
68 + STORVSC_FC_MAX_TARGETS);
69 host = scsi_host_alloc(&scsi_driver,
70 sizeof(struct hv_host_device));
71 if (!host)
72 @@ -1811,12 +1813,25 @@ static int storvsc_probe(struct hv_devic
73 host_dev->path = stor_device->path_id;
74 host_dev->target = stor_device->target_id;
75
76 - /* max # of devices per target */
77 - host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
78 - /* max # of targets per channel */
79 - host->max_id = STORVSC_MAX_TARGETS;
80 - /* max # of channels */
81 - host->max_channel = STORVSC_MAX_CHANNELS - 1;
82 + switch (dev_id->driver_data) {
83 + case SFC_GUID:
84 + host->max_lun = STORVSC_FC_MAX_LUNS_PER_TARGET;
85 + host->max_id = STORVSC_FC_MAX_TARGETS;
86 + host->max_channel = STORVSC_FC_MAX_CHANNELS - 1;
87 + break;
88 +
89 + case SCSI_GUID:
90 + host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
91 + host->max_id = STORVSC_MAX_TARGETS;
92 + host->max_channel = STORVSC_MAX_CHANNELS - 1;
93 + break;
94 +
95 + default:
96 + host->max_lun = STORVSC_IDE_MAX_LUNS_PER_TARGET;
97 + host->max_id = STORVSC_IDE_MAX_TARGETS;
98 + host->max_channel = STORVSC_IDE_MAX_CHANNELS - 1;
99 + break;
100 + }
101 /* max cmd length */
102 host->max_cmd_len = STORVSC_MAX_CMD_LEN;
103