]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/scsi-ibmvscsi-can_queue_fix.patch
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / scsi-ibmvscsi-can_queue_fix.patch
1 Subject: Make max_requests module parameter more accurate
2 From: Brian King <brking@linux.vnet.ibm.com>
3 References: 458499 - LTC50637
4
5 In a previous patch to fix an issue with error recovery,
6 the behavior of the max_requests module paramater was also
7 changed. If, for some reason, max_requests is set to one by
8 the user, we will end up with a negative number for can_queue.
9 Fix this by making max_requests not include the two event structs
10 needed to do error recovery.
11
12 Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
13 Signed-off-by: Olaf Hering <olh@suse.de>
14
15 ---
16 drivers/scsi/ibmvscsi/ibmvscsi.c | 17 +++++++++++------
17 1 file changed, 11 insertions(+), 6 deletions(-)
18
19 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
20 +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
21 @@ -89,6 +89,8 @@ static int max_id = 64;
22 static int max_channel = 3;
23 static int init_timeout = 5;
24 static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT;
25 +static int max_events = IBMVSCSI_MAX_REQUESTS_DEFAULT + 2;
26 +
27 /*host data buffer size*/
28 #define buff_size 4096
29
30 @@ -1635,7 +1637,7 @@ static struct scsi_host_template driver_
31 static unsigned long ibmvscsi_get_desired_dma(struct vio_dev *vdev)
32 {
33 /* iu_storage data allocated in initialize_event_pool */
34 - unsigned long desired_io = max_requests * sizeof(union viosrp_iu);
35 + unsigned long desired_io = max_events * sizeof(union viosrp_iu);
36
37 /* add io space for sg data */
38 desired_io += (IBMVSCSI_MAX_SECTORS_DEFAULT * 512 *
39 @@ -1659,7 +1661,6 @@ static int ibmvscsi_probe(struct vio_dev
40
41 vdev->dev.driver_data = NULL;
42
43 - driver_template.can_queue = max_requests;
44 host = scsi_host_alloc(&driver_template, sizeof(*hostdata));
45 if (!host) {
46 dev_err(&vdev->dev, "couldn't allocate host data\n");
47 @@ -1675,12 +1676,12 @@ static int ibmvscsi_probe(struct vio_dev
48 atomic_set(&hostdata->request_limit, -1);
49 hostdata->host->max_sectors = IBMVSCSI_MAX_SECTORS_DEFAULT;
50
51 - rc = ibmvscsi_ops->init_crq_queue(&hostdata->queue, hostdata, max_requests);
52 + rc = ibmvscsi_ops->init_crq_queue(&hostdata->queue, hostdata, max_events);
53 if (rc != 0 && rc != H_RESOURCE) {
54 dev_err(&vdev->dev, "couldn't initialize crq. rc=%d\n", rc);
55 goto init_crq_failed;
56 }
57 - if (initialize_event_pool(&hostdata->pool, max_requests, hostdata) != 0) {
58 + if (initialize_event_pool(&hostdata->pool, max_events, hostdata) != 0) {
59 dev_err(&vdev->dev, "couldn't initialize event pool\n");
60 goto init_pool_failed;
61 }
62 @@ -1732,7 +1733,7 @@ static int ibmvscsi_probe(struct vio_dev
63 add_host_failed:
64 release_event_pool(&hostdata->pool, hostdata);
65 init_pool_failed:
66 - ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata, max_requests);
67 + ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata, max_events);
68 init_crq_failed:
69 scsi_host_put(host);
70 scsi_host_alloc_failed:
71 @@ -1744,7 +1745,7 @@ static int ibmvscsi_remove(struct vio_de
72 struct ibmvscsi_host_data *hostdata = vdev->dev.driver_data;
73 release_event_pool(&hostdata->pool, hostdata);
74 ibmvscsi_ops->release_crq_queue(&hostdata->queue, hostdata,
75 - max_requests);
76 + max_events);
77
78 srp_remove_host(hostdata->host);
79 scsi_remove_host(hostdata->host);
80 @@ -1781,6 +1782,10 @@ int __init ibmvscsi_module_init(void)
81 {
82 int ret;
83
84 + /* Ensure we have two requests to do error recovery */
85 + driver_template.can_queue = max_requests;
86 + max_events = max_requests + 2;
87 +
88 if (firmware_has_feature(FW_FEATURE_ISERIES))
89 ibmvscsi_ops = &iseriesvscsi_ops;
90 else if (firmware_has_feature(FW_FEATURE_VIO))