cciss: read config to obtain max outstanding commands per controller

This patch changes the way we determine the maximum number of outstanding
commands for each controller.

Most Smart Array controllers can support up to 1024 commands, the notable
exceptions are the E200 and E200i.

The next generation of controllers which were just added support a mode of
operation called Zero Memory Raid (ZMR). In this mode they only support
64 outstanding commands. In Full Function Raid (FFR) mode they support
1024.

We have been setting the queue depth by arbitrarily assigning some value
for each controller. We needed a better way to set the queue depth to
avoid lots of annoying "fifo full" messages. So we made the driver a
little smarter. We now read the config table and subtract 4 from the
returned value. The -4 is to allow some room for ioctl calls which are
not tracked the same way as io commands are tracked.

Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Mike Miller and committed by Linus Torvalds 49153998 8deacee4

+37 -29
+37 -29
drivers/block/cciss.c
··· 106 106 /* board_id = Subsystem Device ID & Vendor ID 107 107 * product = Marketing Name for the board 108 108 * access = Address of the struct of function pointers 109 - * nr_cmds = Number of commands supported by controller 110 109 */ 111 110 static struct board_type products[] = { 112 - {0x40700E11, "Smart Array 5300", &SA5_access, 512}, 113 - {0x40800E11, "Smart Array 5i", &SA5B_access, 512}, 114 - {0x40820E11, "Smart Array 532", &SA5B_access, 512}, 115 - {0x40830E11, "Smart Array 5312", &SA5B_access, 512}, 116 - {0x409A0E11, "Smart Array 641", &SA5_access, 512}, 117 - {0x409B0E11, "Smart Array 642", &SA5_access, 512}, 118 - {0x409C0E11, "Smart Array 6400", &SA5_access, 512}, 119 - {0x409D0E11, "Smart Array 6400 EM", &SA5_access, 512}, 120 - {0x40910E11, "Smart Array 6i", &SA5_access, 512}, 121 - {0x3225103C, "Smart Array P600", &SA5_access, 512}, 122 - {0x3223103C, "Smart Array P800", &SA5_access, 512}, 123 - {0x3234103C, "Smart Array P400", &SA5_access, 512}, 124 - {0x3235103C, "Smart Array P400i", &SA5_access, 512}, 125 - {0x3211103C, "Smart Array E200i", &SA5_access, 120}, 126 - {0x3212103C, "Smart Array E200", &SA5_access, 120}, 127 - {0x3213103C, "Smart Array E200i", &SA5_access, 120}, 128 - {0x3214103C, "Smart Array E200i", &SA5_access, 120}, 129 - {0x3215103C, "Smart Array E200i", &SA5_access, 120}, 130 - {0x3237103C, "Smart Array E500", &SA5_access, 512}, 131 - {0x323D103C, "Smart Array P700m", &SA5_access, 512}, 132 - {0x3241103C, "Smart Array P212", &SA5_access, 384}, 133 - {0x3243103C, "Smart Array P410", &SA5_access, 384}, 134 - {0x3245103C, "Smart Array P410i", &SA5_access, 384}, 135 - {0x3247103C, "Smart Array P411", &SA5_access, 384}, 136 - {0x3249103C, "Smart Array P812", &SA5_access, 384}, 137 - {0xFFFF103C, "Unknown Smart Array", &SA5_access, 120}, 111 + {0x40700E11, "Smart Array 5300", &SA5_access}, 112 + {0x40800E11, "Smart Array 5i", &SA5B_access}, 113 + {0x40820E11, "Smart Array 532", &SA5B_access}, 114 + {0x40830E11, "Smart Array 5312", &SA5B_access}, 115 + {0x409A0E11, "Smart Array 641", &SA5_access}, 116 + {0x409B0E11, "Smart Array 642", &SA5_access}, 117 + {0x409C0E11, "Smart Array 6400", &SA5_access}, 118 + {0x409D0E11, "Smart Array 6400 EM", &SA5_access}, 119 + {0x40910E11, "Smart Array 6i", &SA5_access}, 120 + {0x3225103C, "Smart Array P600", &SA5_access}, 121 + {0x3223103C, "Smart Array P800", &SA5_access}, 122 + {0x3234103C, "Smart Array P400", &SA5_access}, 123 + {0x3235103C, "Smart Array P400i", &SA5_access}, 124 + {0x3211103C, "Smart Array E200i", &SA5_access}, 125 + {0x3212103C, "Smart Array E200", &SA5_access}, 126 + {0x3213103C, "Smart Array E200i", &SA5_access}, 127 + {0x3214103C, "Smart Array E200i", &SA5_access}, 128 + {0x3215103C, "Smart Array E200i", &SA5_access}, 129 + {0x3237103C, "Smart Array E500", &SA5_access}, 130 + {0x323D103C, "Smart Array P700m", &SA5_access}, 131 + {0x3241103C, "Smart Array P212", &SA5_access}, 132 + {0x3243103C, "Smart Array P410", &SA5_access}, 133 + {0x3245103C, "Smart Array P410i", &SA5_access}, 134 + {0x3247103C, "Smart Array P411", &SA5_access}, 135 + {0x3249103C, "Smart Array P812", &SA5_access}, 136 + {0xFFFF103C, "Unknown Smart Array", &SA5_access}, 138 137 }; 139 138 140 139 /* How long to wait (in milliseconds) for board to go into simple mode */ ··· 3085 3086 print_cfg_table(c->cfgtable); 3086 3087 #endif /* CCISS_DEBUG */ 3087 3088 3089 + /* Some controllers support Zero Memory Raid (ZMR). 3090 + * When configured in ZMR mode the number of supported 3091 + * commands drops to 64. So instead of just setting an 3092 + * arbitrary value we make the driver a little smarter. 3093 + * We read the config table to tell us how many commands 3094 + * are supported on the controller then subtract 4 to 3095 + * leave a little room for ioctl calls. 3096 + */ 3097 + c->max_commands = readl(&(c->cfgtable->CmdsOutMax)); 3088 3098 for (i = 0; i < ARRAY_SIZE(products); i++) { 3089 3099 if (board_id == products[i].board_id) { 3090 3100 c->product_name = products[i].product_name; 3091 3101 c->access = *(products[i].access); 3092 - c->nr_cmds = products[i].nr_cmds; 3102 + c->nr_cmds = c->max_commands - 4; 3093 3103 break; 3094 3104 } 3095 3105 } ··· 3118 3110 if (subsystem_vendor_id == PCI_VENDOR_ID_HP) { 3119 3111 c->product_name = products[i-1].product_name; 3120 3112 c->access = *(products[i-1].access); 3121 - c->nr_cmds = products[i-1].nr_cmds; 3113 + c->nr_cmds = c->max_commands - 4; 3122 3114 printk(KERN_WARNING "cciss: This is an unknown " 3123 3115 "Smart Array controller.\n" 3124 3116 "cciss: Please update to the latest driver "