diff options
author | Mark Haverkamp <markh@osdl.org> | 2005-05-16 21:28:42 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 16:48:00 -0400 |
commit | 7c00ffa314bf0fb0e23858bbebad33b48b6abbb9 (patch) | |
tree | 4d6b65bb5a2c8fecf48a8c6402c2cc867aa2fe6c /drivers/scsi/aacraid/comminit.c | |
parent | 672b2d38da4fff4c4452685a25fb88b65243d1a6 (diff) |
[SCSI] 2.6 aacraid: Variable FIB size (updated patch)
New code from the Adaptec driver. Performance enhancement for newer
adapters. I hope that this isn't too big for a single patch. I believe
that other than the few small cleanups mentioned, that the changes are
all related.
- Added Variable FIB size negotiation for new adapters.
- Added support to maximize scatter gather tables and thus permit
requests larger than 64KB/each.
- Limit Scatter Gather to 34 elements for ROMB platforms.
- aac_printf is only enabled with AAC_QUIRK_34SG
- Large FIB ioctl support
- some minor cleanup
Passes sparse check.
I have tested it on x86 and ppc64 machines.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/aacraid/comminit.c')
-rw-r--r-- | drivers/scsi/aacraid/comminit.c | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c index 34a4feb1dc0d..43557bf661f6 100644 --- a/drivers/scsi/aacraid/comminit.c +++ b/drivers/scsi/aacraid/comminit.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/blkdev.h> | 39 | #include <linux/blkdev.h> |
40 | #include <linux/completion.h> | 40 | #include <linux/completion.h> |
41 | #include <linux/mm.h> | 41 | #include <linux/mm.h> |
42 | #include <scsi/scsi_host.h> | ||
42 | #include <asm/semaphore.h> | 43 | #include <asm/semaphore.h> |
43 | 44 | ||
44 | #include "aacraid.h" | 45 | #include "aacraid.h" |
@@ -49,8 +50,8 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
49 | { | 50 | { |
50 | unsigned char *base; | 51 | unsigned char *base; |
51 | unsigned long size, align; | 52 | unsigned long size, align; |
52 | unsigned long fibsize = 4096; | 53 | const unsigned long fibsize = 4096; |
53 | unsigned long printfbufsiz = 256; | 54 | const unsigned long printfbufsiz = 256; |
54 | struct aac_init *init; | 55 | struct aac_init *init; |
55 | dma_addr_t phys; | 56 | dma_addr_t phys; |
56 | 57 | ||
@@ -74,6 +75,8 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
74 | init = dev->init; | 75 | init = dev->init; |
75 | 76 | ||
76 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION); | 77 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION); |
78 | if (dev->max_fib_size != sizeof(struct hw_fib)) | ||
79 | init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4); | ||
77 | init->MiniPortRevision = cpu_to_le32(Sa_MINIPORT_REVISION); | 80 | init->MiniPortRevision = cpu_to_le32(Sa_MINIPORT_REVISION); |
78 | init->fsrev = cpu_to_le32(dev->fsrev); | 81 | init->fsrev = cpu_to_le32(dev->fsrev); |
79 | 82 | ||
@@ -110,6 +113,10 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co | |||
110 | init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); | 113 | init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); |
111 | } | 114 | } |
112 | 115 | ||
116 | init->InitFlags = 0; | ||
117 | init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); | ||
118 | init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9); | ||
119 | init->MaxFibSize = cpu_to_le32(dev->max_fib_size); | ||
113 | 120 | ||
114 | /* | 121 | /* |
115 | * Increment the base address by the amount already used | 122 | * Increment the base address by the amount already used |
@@ -173,6 +180,8 @@ int aac_send_shutdown(struct aac_dev * dev) | |||
173 | int status; | 180 | int status; |
174 | 181 | ||
175 | fibctx = fib_alloc(dev); | 182 | fibctx = fib_alloc(dev); |
183 | if (!fibctx) | ||
184 | return -ENOMEM; | ||
176 | fib_init(fibctx); | 185 | fib_init(fibctx); |
177 | 186 | ||
178 | cmd = (struct aac_close *) fib_data(fibctx); | 187 | cmd = (struct aac_close *) fib_data(fibctx); |
@@ -293,6 +302,79 @@ static int aac_comm_init(struct aac_dev * dev) | |||
293 | 302 | ||
294 | struct aac_dev *aac_init_adapter(struct aac_dev *dev) | 303 | struct aac_dev *aac_init_adapter(struct aac_dev *dev) |
295 | { | 304 | { |
305 | u32 status[5]; | ||
306 | struct Scsi_Host * host = dev->scsi_host_ptr; | ||
307 | |||
308 | /* | ||
309 | * Check the preferred comm settings, defaults from template. | ||
310 | */ | ||
311 | dev->max_fib_size = sizeof(struct hw_fib); | ||
312 | dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size | ||
313 | - sizeof(struct aac_fibhdr) | ||
314 | - sizeof(struct aac_write) + sizeof(struct sgmap)) | ||
315 | / sizeof(struct sgmap); | ||
316 | if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS, | ||
317 | 0, 0, 0, 0, 0, 0, | ||
318 | status+0, status+1, status+2, status+3, status+4)) | ||
319 | && (status[0] == 0x00000001)) { | ||
320 | /* | ||
321 | * status[1] >> 16 maximum command size in KB | ||
322 | * status[1] & 0xFFFF maximum FIB size | ||
323 | * status[2] >> 16 maximum SG elements to driver | ||
324 | * status[2] & 0xFFFF maximum SG elements from driver | ||
325 | * status[3] & 0xFFFF maximum number FIBs outstanding | ||
326 | */ | ||
327 | host->max_sectors = (status[1] >> 16) << 1; | ||
328 | dev->max_fib_size = status[1] & 0xFFFF; | ||
329 | host->sg_tablesize = status[2] >> 16; | ||
330 | dev->sg_tablesize = status[2] & 0xFFFF; | ||
331 | host->can_queue = (status[3] & 0xFFFF) - AAC_NUM_MGT_FIB; | ||
332 | /* | ||
333 | * NOTE: | ||
334 | * All these overrides are based on a fixed internal | ||
335 | * knowledge and understanding of existing adapters, | ||
336 | * acbsize should be set with caution. | ||
337 | */ | ||
338 | if (acbsize == 512) { | ||
339 | host->max_sectors = AAC_MAX_32BIT_SGBCOUNT; | ||
340 | dev->max_fib_size = 512; | ||
341 | dev->sg_tablesize = host->sg_tablesize | ||
342 | = (512 - sizeof(struct aac_fibhdr) | ||
343 | - sizeof(struct aac_write) + sizeof(struct sgmap)) | ||
344 | / sizeof(struct sgmap); | ||
345 | host->can_queue = AAC_NUM_IO_FIB; | ||
346 | } else if (acbsize == 2048) { | ||
347 | host->max_sectors = 512; | ||
348 | dev->max_fib_size = 2048; | ||
349 | host->sg_tablesize = 65; | ||
350 | dev->sg_tablesize = 81; | ||
351 | host->can_queue = 512 - AAC_NUM_MGT_FIB; | ||
352 | } else if (acbsize == 4096) { | ||
353 | host->max_sectors = 1024; | ||
354 | dev->max_fib_size = 4096; | ||
355 | host->sg_tablesize = 129; | ||
356 | dev->sg_tablesize = 166; | ||
357 | host->can_queue = 256 - AAC_NUM_MGT_FIB; | ||
358 | } else if (acbsize == 8192) { | ||
359 | host->max_sectors = 2048; | ||
360 | dev->max_fib_size = 8192; | ||
361 | host->sg_tablesize = 257; | ||
362 | dev->sg_tablesize = 337; | ||
363 | host->can_queue = 128 - AAC_NUM_MGT_FIB; | ||
364 | } else if (acbsize > 0) { | ||
365 | printk("Illegal acbsize=%d ignored\n", acbsize); | ||
366 | } | ||
367 | } | ||
368 | { | ||
369 | |||
370 | if (numacb > 0) { | ||
371 | if (numacb < host->can_queue) | ||
372 | host->can_queue = numacb; | ||
373 | else | ||
374 | printk("numacb=%d ignored\n", numacb); | ||
375 | } | ||
376 | } | ||
377 | |||
296 | /* | 378 | /* |
297 | * Ok now init the communication subsystem | 379 | * Ok now init the communication subsystem |
298 | */ | 380 | */ |