diff options
author | Mike Miller <mike.miller@hp.com> | 2006-12-06 23:35:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 11:39:29 -0500 |
commit | f880632f963c3611d096d9373d16663c076310c7 (patch) | |
tree | f1e287ce43b1dd08cb7d5f8be661f48d99b902ed /drivers/block | |
parent | 4ff9a9a4baff2627d7bcf65d0ec07d647bc1ad29 (diff) |
[PATCH] cciss: increase number of commands on controller
Remove #define NR_CMDS and replace it w/hba[i]->nr_cmds. Most Smart Array
controllers can support up to 1024 commands but the E200 family can only
support 128. To prevent annoying "fifo full" messages we define nr_cmds on a
per controller basis by adding it the product table.
Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 74 | ||||
-rw-r--r-- | drivers/block/cciss.h | 2 |
2 files changed, 40 insertions, 36 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index d1f65def8ebb..0f976aaaf049 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -93,28 +93,29 @@ MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); | |||
93 | /* board_id = Subsystem Device ID & Vendor ID | 93 | /* board_id = Subsystem Device ID & Vendor ID |
94 | * product = Marketing Name for the board | 94 | * product = Marketing Name for the board |
95 | * access = Address of the struct of function pointers | 95 | * access = Address of the struct of function pointers |
96 | * nr_cmds = Number of commands supported by controller | ||
96 | */ | 97 | */ |
97 | static struct board_type products[] = { | 98 | static struct board_type products[] = { |
98 | {0x40700E11, "Smart Array 5300", &SA5_access}, | 99 | {0x40700E11, "Smart Array 5300", &SA5_access, 512}, |
99 | {0x40800E11, "Smart Array 5i", &SA5B_access}, | 100 | {0x40800E11, "Smart Array 5i", &SA5B_access, 512}, |
100 | {0x40820E11, "Smart Array 532", &SA5B_access}, | 101 | {0x40820E11, "Smart Array 532", &SA5B_access, 512}, |
101 | {0x40830E11, "Smart Array 5312", &SA5B_access}, | 102 | {0x40830E11, "Smart Array 5312", &SA5B_access, 512}, |
102 | {0x409A0E11, "Smart Array 641", &SA5_access}, | 103 | {0x409A0E11, "Smart Array 641", &SA5_access, 512}, |
103 | {0x409B0E11, "Smart Array 642", &SA5_access}, | 104 | {0x409B0E11, "Smart Array 642", &SA5_access, 512}, |
104 | {0x409C0E11, "Smart Array 6400", &SA5_access}, | 105 | {0x409C0E11, "Smart Array 6400", &SA5_access, 512}, |
105 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, | 106 | {0x409D0E11, "Smart Array 6400 EM", &SA5_access, 512}, |
106 | {0x40910E11, "Smart Array 6i", &SA5_access}, | 107 | {0x40910E11, "Smart Array 6i", &SA5_access, 512}, |
107 | {0x3225103C, "Smart Array P600", &SA5_access}, | 108 | {0x3225103C, "Smart Array P600", &SA5_access, 512}, |
108 | {0x3223103C, "Smart Array P800", &SA5_access}, | 109 | {0x3223103C, "Smart Array P800", &SA5_access, 512}, |
109 | {0x3234103C, "Smart Array P400", &SA5_access}, | 110 | {0x3234103C, "Smart Array P400", &SA5_access, 512}, |
110 | {0x3235103C, "Smart Array P400i", &SA5_access}, | 111 | {0x3235103C, "Smart Array P400i", &SA5_access, 512}, |
111 | {0x3211103C, "Smart Array E200i", &SA5_access}, | 112 | {0x3211103C, "Smart Array E200i", &SA5_access, 120}, |
112 | {0x3212103C, "Smart Array E200", &SA5_access}, | 113 | {0x3212103C, "Smart Array E200", &SA5_access, 120}, |
113 | {0x3213103C, "Smart Array E200i", &SA5_access}, | 114 | {0x3213103C, "Smart Array E200i", &SA5_access, 120}, |
114 | {0x3214103C, "Smart Array E200i", &SA5_access}, | 115 | {0x3214103C, "Smart Array E200i", &SA5_access, 120}, |
115 | {0x3215103C, "Smart Array E200i", &SA5_access}, | 116 | {0x3215103C, "Smart Array E200i", &SA5_access, 120}, |
116 | {0x3233103C, "Smart Array E500", &SA5_access}, | 117 | {0x3233103C, "Smart Array E500", &SA5_access, 512}, |
117 | {0xFFFF103C, "Unknown Smart Array", &SA5_access}, | 118 | {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, |
118 | }; | 119 | }; |
119 | 120 | ||
120 | /* How long to wait (in milliseconds) for board to go into simple mode */ | 121 | /* How long to wait (in milliseconds) for board to go into simple mode */ |
@@ -125,7 +126,6 @@ static struct board_type products[] = { | |||
125 | #define MAX_CMD_RETRIES 3 | 126 | #define MAX_CMD_RETRIES 3 |
126 | 127 | ||
127 | #define READ_AHEAD 1024 | 128 | #define READ_AHEAD 1024 |
128 | #define NR_CMDS 384 /* #commands that can be outstanding */ | ||
129 | #define MAX_CTLR 32 | 129 | #define MAX_CTLR 32 |
130 | 130 | ||
131 | /* Originally cciss driver only supports 8 major numbers */ | 131 | /* Originally cciss driver only supports 8 major numbers */ |
@@ -404,8 +404,8 @@ static CommandList_struct *cmd_alloc(ctlr_info_t *h, int get_from_pool) | |||
404 | } else { /* get it out of the controllers pool */ | 404 | } else { /* get it out of the controllers pool */ |
405 | 405 | ||
406 | do { | 406 | do { |
407 | i = find_first_zero_bit(h->cmd_pool_bits, NR_CMDS); | 407 | i = find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds); |
408 | if (i == NR_CMDS) | 408 | if (i == h->nr_cmds) |
409 | return NULL; | 409 | return NULL; |
410 | } while (test_and_set_bit | 410 | } while (test_and_set_bit |
411 | (i & (BITS_PER_LONG - 1), | 411 | (i & (BITS_PER_LONG - 1), |
@@ -1247,7 +1247,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1247 | * in case the interrupt we serviced was from an ioctl and did not | 1247 | * in case the interrupt we serviced was from an ioctl and did not |
1248 | * free any new commands. | 1248 | * free any new commands. |
1249 | */ | 1249 | */ |
1250 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) | 1250 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) |
1251 | return; | 1251 | return; |
1252 | 1252 | ||
1253 | /* We have room on the queue for more commands. Now we need to queue | 1253 | /* We have room on the queue for more commands. Now we need to queue |
@@ -1266,7 +1266,7 @@ static void cciss_check_queues(ctlr_info_t *h) | |||
1266 | /* check to see if we have maxed out the number of commands | 1266 | /* check to see if we have maxed out the number of commands |
1267 | * that can be placed on the queue. | 1267 | * that can be placed on the queue. |
1268 | */ | 1268 | */ |
1269 | if ((find_first_zero_bit(h->cmd_pool_bits, NR_CMDS)) == NR_CMDS) { | 1269 | if ((find_first_zero_bit(h->cmd_pool_bits, h->nr_cmds)) == h->nr_cmds) { |
1270 | if (curr_queue == start_queue) { | 1270 | if (curr_queue == start_queue) { |
1271 | h->next_to_run = | 1271 | h->next_to_run = |
1272 | (start_queue + 1) % (h->highest_lun + 1); | 1272 | (start_queue + 1) % (h->highest_lun + 1); |
@@ -2140,7 +2140,7 @@ static int add_sendcmd_reject(__u8 cmd, int ctlr, unsigned long complete) | |||
2140 | 2140 | ||
2141 | /* We've sent down an abort or reset, but something else | 2141 | /* We've sent down an abort or reset, but something else |
2142 | has completed */ | 2142 | has completed */ |
2143 | if (srl->ncompletions >= (NR_CMDS + 2)) { | 2143 | if (srl->ncompletions >= (hba[ctlr]->nr_cmds + 2)) { |
2144 | /* Uh oh. No room to save it for later... */ | 2144 | /* Uh oh. No room to save it for later... */ |
2145 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " | 2145 | printk(KERN_WARNING "cciss%d: Sendcmd: Invalid command addr, " |
2146 | "reject list overflow, command lost!\n", ctlr); | 2146 | "reject list overflow, command lost!\n", ctlr); |
@@ -2677,7 +2677,7 @@ static irqreturn_t do_cciss_intr(int irq, void *dev_id) | |||
2677 | a1 = a; | 2677 | a1 = a; |
2678 | if ((a & 0x04)) { | 2678 | if ((a & 0x04)) { |
2679 | a2 = (a >> 3); | 2679 | a2 = (a >> 3); |
2680 | if (a2 >= NR_CMDS) { | 2680 | if (a2 >= h->nr_cmds) { |
2681 | printk(KERN_WARNING | 2681 | printk(KERN_WARNING |
2682 | "cciss: controller cciss%d failed, stopping.\n", | 2682 | "cciss: controller cciss%d failed, stopping.\n", |
2683 | h->ctlr); | 2683 | h->ctlr); |
@@ -2960,6 +2960,7 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2960 | if (board_id == products[i].board_id) { | 2960 | if (board_id == products[i].board_id) { |
2961 | c->product_name = products[i].product_name; | 2961 | c->product_name = products[i].product_name; |
2962 | c->access = *(products[i].access); | 2962 | c->access = *(products[i].access); |
2963 | c->nr_cmds = products[i].nr_cmds; | ||
2963 | break; | 2964 | break; |
2964 | } | 2965 | } |
2965 | } | 2966 | } |
@@ -2979,6 +2980,7 @@ static int cciss_pci_init(ctlr_info_t *c, struct pci_dev *pdev) | |||
2979 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { | 2980 | if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { |
2980 | c->product_name = products[i-1].product_name; | 2981 | c->product_name = products[i-1].product_name; |
2981 | c->access = *(products[i-1].access); | 2982 | c->access = *(products[i-1].access); |
2983 | c->nr_cmds = products[i-1].nr_cmds; | ||
2982 | printk(KERN_WARNING "cciss: This is an unknown " | 2984 | printk(KERN_WARNING "cciss: This is an unknown " |
2983 | "Smart Array controller.\n" | 2985 | "Smart Array controller.\n" |
2984 | "cciss: Please update to the latest driver " | 2986 | "cciss: Please update to the latest driver " |
@@ -3286,15 +3288,15 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3286 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); | 3288 | hba[i]->intr[SIMPLE_MODE_INT], dac ? "" : " not"); |
3287 | 3289 | ||
3288 | hba[i]->cmd_pool_bits = | 3290 | hba[i]->cmd_pool_bits = |
3289 | kmalloc(((NR_CMDS + BITS_PER_LONG - | 3291 | kmalloc(((hba[i]->nr_cmds + BITS_PER_LONG - |
3290 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); | 3292 | 1) / BITS_PER_LONG) * sizeof(unsigned long), GFP_KERNEL); |
3291 | hba[i]->cmd_pool = (CommandList_struct *) | 3293 | hba[i]->cmd_pool = (CommandList_struct *) |
3292 | pci_alloc_consistent(hba[i]->pdev, | 3294 | pci_alloc_consistent(hba[i]->pdev, |
3293 | NR_CMDS * sizeof(CommandList_struct), | 3295 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3294 | &(hba[i]->cmd_pool_dhandle)); | 3296 | &(hba[i]->cmd_pool_dhandle)); |
3295 | hba[i]->errinfo_pool = (ErrorInfo_struct *) | 3297 | hba[i]->errinfo_pool = (ErrorInfo_struct *) |
3296 | pci_alloc_consistent(hba[i]->pdev, | 3298 | pci_alloc_consistent(hba[i]->pdev, |
3297 | NR_CMDS * sizeof(ErrorInfo_struct), | 3299 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3298 | &(hba[i]->errinfo_pool_dhandle)); | 3300 | &(hba[i]->errinfo_pool_dhandle)); |
3299 | if ((hba[i]->cmd_pool_bits == NULL) | 3301 | if ((hba[i]->cmd_pool_bits == NULL) |
3300 | || (hba[i]->cmd_pool == NULL) | 3302 | || (hba[i]->cmd_pool == NULL) |
@@ -3305,7 +3307,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3305 | #ifdef CONFIG_CISS_SCSI_TAPE | 3307 | #ifdef CONFIG_CISS_SCSI_TAPE |
3306 | hba[i]->scsi_rejects.complete = | 3308 | hba[i]->scsi_rejects.complete = |
3307 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * | 3309 | kmalloc(sizeof(hba[i]->scsi_rejects.complete[0]) * |
3308 | (NR_CMDS + 5), GFP_KERNEL); | 3310 | (hba[i]->nr_cmds + 5), GFP_KERNEL); |
3309 | if (hba[i]->scsi_rejects.complete == NULL) { | 3311 | if (hba[i]->scsi_rejects.complete == NULL) { |
3310 | printk(KERN_ERR "cciss: out of memory"); | 3312 | printk(KERN_ERR "cciss: out of memory"); |
3311 | goto clean4; | 3313 | goto clean4; |
@@ -3319,7 +3321,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3319 | /* command and error info recs zeroed out before | 3321 | /* command and error info recs zeroed out before |
3320 | they are used */ | 3322 | they are used */ |
3321 | memset(hba[i]->cmd_pool_bits, 0, | 3323 | memset(hba[i]->cmd_pool_bits, 0, |
3322 | ((NR_CMDS + BITS_PER_LONG - | 3324 | ((hba[i]->nr_cmds + BITS_PER_LONG - |
3323 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); | 3325 | 1) / BITS_PER_LONG) * sizeof(unsigned long)); |
3324 | 3326 | ||
3325 | #ifdef CCISS_DEBUG | 3327 | #ifdef CCISS_DEBUG |
@@ -3388,11 +3390,11 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3388 | kfree(hba[i]->cmd_pool_bits); | 3390 | kfree(hba[i]->cmd_pool_bits); |
3389 | if (hba[i]->cmd_pool) | 3391 | if (hba[i]->cmd_pool) |
3390 | pci_free_consistent(hba[i]->pdev, | 3392 | pci_free_consistent(hba[i]->pdev, |
3391 | NR_CMDS * sizeof(CommandList_struct), | 3393 | hba[i]->nr_cmds * sizeof(CommandList_struct), |
3392 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3394 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3393 | if (hba[i]->errinfo_pool) | 3395 | if (hba[i]->errinfo_pool) |
3394 | pci_free_consistent(hba[i]->pdev, | 3396 | pci_free_consistent(hba[i]->pdev, |
3395 | NR_CMDS * sizeof(ErrorInfo_struct), | 3397 | hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3396 | hba[i]->errinfo_pool, | 3398 | hba[i]->errinfo_pool, |
3397 | hba[i]->errinfo_pool_dhandle); | 3399 | hba[i]->errinfo_pool_dhandle); |
3398 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); | 3400 | free_irq(hba[i]->intr[SIMPLE_MODE_INT], hba[i]); |
@@ -3459,9 +3461,9 @@ static void __devexit cciss_remove_one(struct pci_dev *pdev) | |||
3459 | } | 3461 | } |
3460 | } | 3462 | } |
3461 | 3463 | ||
3462 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(CommandList_struct), | 3464 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(CommandList_struct), |
3463 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); | 3465 | hba[i]->cmd_pool, hba[i]->cmd_pool_dhandle); |
3464 | pci_free_consistent(hba[i]->pdev, NR_CMDS * sizeof(ErrorInfo_struct), | 3466 | pci_free_consistent(hba[i]->pdev, hba[i]->nr_cmds * sizeof(ErrorInfo_struct), |
3465 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); | 3467 | hba[i]->errinfo_pool, hba[i]->errinfo_pool_dhandle); |
3466 | kfree(hba[i]->cmd_pool_bits); | 3468 | kfree(hba[i]->cmd_pool_bits); |
3467 | #ifdef CONFIG_CISS_SCSI_TAPE | 3469 | #ifdef CONFIG_CISS_SCSI_TAPE |
diff --git a/drivers/block/cciss.h b/drivers/block/cciss.h index 562235c1445a..0d765f9237be 100644 --- a/drivers/block/cciss.h +++ b/drivers/block/cciss.h | |||
@@ -60,6 +60,7 @@ struct ctlr_info | |||
60 | __u32 board_id; | 60 | __u32 board_id; |
61 | void __iomem *vaddr; | 61 | void __iomem *vaddr; |
62 | unsigned long paddr; | 62 | unsigned long paddr; |
63 | int nr_cmds; /* Number of commands allowed on this controller */ | ||
63 | CfgTable_struct __iomem *cfgtable; | 64 | CfgTable_struct __iomem *cfgtable; |
64 | int interrupts_enabled; | 65 | int interrupts_enabled; |
65 | int major; | 66 | int major; |
@@ -282,6 +283,7 @@ struct board_type { | |||
282 | __u32 board_id; | 283 | __u32 board_id; |
283 | char *product_name; | 284 | char *product_name; |
284 | struct access_method *access; | 285 | struct access_method *access; |
286 | int nr_cmds; /* Max cmds this kind of ctlr can handle. */ | ||
285 | }; | 287 | }; |
286 | 288 | ||
287 | #define CCISS_LOCK(i) (&hba[i]->lock) | 289 | #define CCISS_LOCK(i) (&hba[i]->lock) |