diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 164 |
1 files changed, 126 insertions, 38 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 5625a8c2a8fd..b62a72dfab29 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2005 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -79,7 +79,7 @@ static ssize_t | |||
79 | lpfc_serialnum_show(struct class_device *cdev, char *buf) | 79 | lpfc_serialnum_show(struct class_device *cdev, char *buf) |
80 | { | 80 | { |
81 | struct Scsi_Host *host = class_to_shost(cdev); | 81 | struct Scsi_Host *host = class_to_shost(cdev); |
82 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 82 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
83 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber); | 83 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber); |
84 | } | 84 | } |
85 | 85 | ||
@@ -87,7 +87,7 @@ static ssize_t | |||
87 | lpfc_modeldesc_show(struct class_device *cdev, char *buf) | 87 | lpfc_modeldesc_show(struct class_device *cdev, char *buf) |
88 | { | 88 | { |
89 | struct Scsi_Host *host = class_to_shost(cdev); | 89 | struct Scsi_Host *host = class_to_shost(cdev); |
90 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 90 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
91 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelDesc); | 91 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelDesc); |
92 | } | 92 | } |
93 | 93 | ||
@@ -95,7 +95,7 @@ static ssize_t | |||
95 | lpfc_modelname_show(struct class_device *cdev, char *buf) | 95 | lpfc_modelname_show(struct class_device *cdev, char *buf) |
96 | { | 96 | { |
97 | struct Scsi_Host *host = class_to_shost(cdev); | 97 | struct Scsi_Host *host = class_to_shost(cdev); |
98 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 98 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
99 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelName); | 99 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ModelName); |
100 | } | 100 | } |
101 | 101 | ||
@@ -103,7 +103,7 @@ static ssize_t | |||
103 | lpfc_programtype_show(struct class_device *cdev, char *buf) | 103 | lpfc_programtype_show(struct class_device *cdev, char *buf) |
104 | { | 104 | { |
105 | struct Scsi_Host *host = class_to_shost(cdev); | 105 | struct Scsi_Host *host = class_to_shost(cdev); |
106 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 106 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
107 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ProgramType); | 107 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->ProgramType); |
108 | } | 108 | } |
109 | 109 | ||
@@ -111,7 +111,7 @@ static ssize_t | |||
111 | lpfc_portnum_show(struct class_device *cdev, char *buf) | 111 | lpfc_portnum_show(struct class_device *cdev, char *buf) |
112 | { | 112 | { |
113 | struct Scsi_Host *host = class_to_shost(cdev); | 113 | struct Scsi_Host *host = class_to_shost(cdev); |
114 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 114 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
115 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->Port); | 115 | return snprintf(buf, PAGE_SIZE, "%s\n",phba->Port); |
116 | } | 116 | } |
117 | 117 | ||
@@ -119,7 +119,7 @@ static ssize_t | |||
119 | lpfc_fwrev_show(struct class_device *cdev, char *buf) | 119 | lpfc_fwrev_show(struct class_device *cdev, char *buf) |
120 | { | 120 | { |
121 | struct Scsi_Host *host = class_to_shost(cdev); | 121 | struct Scsi_Host *host = class_to_shost(cdev); |
122 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 122 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
123 | char fwrev[32]; | 123 | char fwrev[32]; |
124 | lpfc_decode_firmware_rev(phba, fwrev, 1); | 124 | lpfc_decode_firmware_rev(phba, fwrev, 1); |
125 | return snprintf(buf, PAGE_SIZE, "%s\n",fwrev); | 125 | return snprintf(buf, PAGE_SIZE, "%s\n",fwrev); |
@@ -130,7 +130,7 @@ lpfc_hdw_show(struct class_device *cdev, char *buf) | |||
130 | { | 130 | { |
131 | char hdw[9]; | 131 | char hdw[9]; |
132 | struct Scsi_Host *host = class_to_shost(cdev); | 132 | struct Scsi_Host *host = class_to_shost(cdev); |
133 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 133 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
134 | lpfc_vpd_t *vp = &phba->vpd; | 134 | lpfc_vpd_t *vp = &phba->vpd; |
135 | lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); | 135 | lpfc_jedec_to_ascii(vp->rev.biuRev, hdw); |
136 | return snprintf(buf, PAGE_SIZE, "%s\n", hdw); | 136 | return snprintf(buf, PAGE_SIZE, "%s\n", hdw); |
@@ -139,16 +139,18 @@ static ssize_t | |||
139 | lpfc_option_rom_version_show(struct class_device *cdev, char *buf) | 139 | lpfc_option_rom_version_show(struct class_device *cdev, char *buf) |
140 | { | 140 | { |
141 | struct Scsi_Host *host = class_to_shost(cdev); | 141 | struct Scsi_Host *host = class_to_shost(cdev); |
142 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 142 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
143 | return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); | 143 | return snprintf(buf, PAGE_SIZE, "%s\n", phba->OptionROMVersion); |
144 | } | 144 | } |
145 | static ssize_t | 145 | static ssize_t |
146 | lpfc_state_show(struct class_device *cdev, char *buf) | 146 | lpfc_state_show(struct class_device *cdev, char *buf) |
147 | { | 147 | { |
148 | struct Scsi_Host *host = class_to_shost(cdev); | 148 | struct Scsi_Host *host = class_to_shost(cdev); |
149 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 149 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
150 | int len = 0; | 150 | int len = 0; |
151 | switch (phba->hba_state) { | 151 | switch (phba->hba_state) { |
152 | case LPFC_STATE_UNKNOWN: | ||
153 | case LPFC_WARM_START: | ||
152 | case LPFC_INIT_START: | 154 | case LPFC_INIT_START: |
153 | case LPFC_INIT_MBX_CMDS: | 155 | case LPFC_INIT_MBX_CMDS: |
154 | case LPFC_LINK_DOWN: | 156 | case LPFC_LINK_DOWN: |
@@ -194,7 +196,7 @@ static ssize_t | |||
194 | lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) | 196 | lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) |
195 | { | 197 | { |
196 | struct Scsi_Host *host = class_to_shost(cdev); | 198 | struct Scsi_Host *host = class_to_shost(cdev); |
197 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 199 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
198 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->fc_map_cnt + | 200 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->fc_map_cnt + |
199 | phba->fc_unmap_cnt); | 201 | phba->fc_unmap_cnt); |
200 | } | 202 | } |
@@ -203,7 +205,7 @@ lpfc_num_discovered_ports_show(struct class_device *cdev, char *buf) | |||
203 | static int | 205 | static int |
204 | lpfc_issue_lip(struct Scsi_Host *host) | 206 | lpfc_issue_lip(struct Scsi_Host *host) |
205 | { | 207 | { |
206 | struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata[0]; | 208 | struct lpfc_hba *phba = (struct lpfc_hba *) host->hostdata; |
207 | LPFC_MBOXQ_t *pmboxq; | 209 | LPFC_MBOXQ_t *pmboxq; |
208 | int mbxstatus = MBXERR_ERROR; | 210 | int mbxstatus = MBXERR_ERROR; |
209 | 211 | ||
@@ -235,7 +237,7 @@ static ssize_t | |||
235 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) | 237 | lpfc_nport_evt_cnt_show(struct class_device *cdev, char *buf) |
236 | { | 238 | { |
237 | struct Scsi_Host *host = class_to_shost(cdev); | 239 | struct Scsi_Host *host = class_to_shost(cdev); |
238 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 240 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
239 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); | 241 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->nport_event_cnt); |
240 | } | 242 | } |
241 | 243 | ||
@@ -243,7 +245,7 @@ static ssize_t | |||
243 | lpfc_board_online_show(struct class_device *cdev, char *buf) | 245 | lpfc_board_online_show(struct class_device *cdev, char *buf) |
244 | { | 246 | { |
245 | struct Scsi_Host *host = class_to_shost(cdev); | 247 | struct Scsi_Host *host = class_to_shost(cdev); |
246 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 248 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
247 | 249 | ||
248 | if (phba->fc_flag & FC_OFFLINE_MODE) | 250 | if (phba->fc_flag & FC_OFFLINE_MODE) |
249 | return snprintf(buf, PAGE_SIZE, "0\n"); | 251 | return snprintf(buf, PAGE_SIZE, "0\n"); |
@@ -256,7 +258,7 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf, | |||
256 | size_t count) | 258 | size_t count) |
257 | { | 259 | { |
258 | struct Scsi_Host *host = class_to_shost(cdev); | 260 | struct Scsi_Host *host = class_to_shost(cdev); |
259 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 261 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
260 | struct completion online_compl; | 262 | struct completion online_compl; |
261 | int val=0, status=0; | 263 | int val=0, status=0; |
262 | 264 | ||
@@ -279,10 +281,62 @@ lpfc_board_online_store(struct class_device *cdev, const char *buf, | |||
279 | } | 281 | } |
280 | 282 | ||
281 | static ssize_t | 283 | static ssize_t |
284 | lpfc_board_mode_show(struct class_device *cdev, char *buf) | ||
285 | { | ||
286 | struct Scsi_Host *host = class_to_shost(cdev); | ||
287 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | ||
288 | char * state; | ||
289 | |||
290 | if (phba->hba_state == LPFC_HBA_ERROR) | ||
291 | state = "error"; | ||
292 | else if (phba->hba_state == LPFC_WARM_START) | ||
293 | state = "warm start"; | ||
294 | else if (phba->hba_state == LPFC_INIT_START) | ||
295 | state = "offline"; | ||
296 | else | ||
297 | state = "online"; | ||
298 | |||
299 | return snprintf(buf, PAGE_SIZE, "%s\n", state); | ||
300 | } | ||
301 | |||
302 | static ssize_t | ||
303 | lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count) | ||
304 | { | ||
305 | struct Scsi_Host *host = class_to_shost(cdev); | ||
306 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; | ||
307 | struct completion online_compl; | ||
308 | int status=0; | ||
309 | |||
310 | init_completion(&online_compl); | ||
311 | |||
312 | if(strncmp(buf, "online", sizeof("online") - 1) == 0) | ||
313 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
314 | LPFC_EVT_ONLINE); | ||
315 | else if (strncmp(buf, "offline", sizeof("offline") - 1) == 0) | ||
316 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
317 | LPFC_EVT_OFFLINE); | ||
318 | else if (strncmp(buf, "warm", sizeof("warm") - 1) == 0) | ||
319 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
320 | LPFC_EVT_WARM_START); | ||
321 | else if (strncmp(buf, "error", sizeof("error") - 1) == 0) | ||
322 | lpfc_workq_post_event(phba, &status, &online_compl, | ||
323 | LPFC_EVT_KILL); | ||
324 | else | ||
325 | return -EINVAL; | ||
326 | |||
327 | wait_for_completion(&online_compl); | ||
328 | |||
329 | if (!status) | ||
330 | return strlen(buf); | ||
331 | else | ||
332 | return -EIO; | ||
333 | } | ||
334 | |||
335 | static ssize_t | ||
282 | lpfc_poll_show(struct class_device *cdev, char *buf) | 336 | lpfc_poll_show(struct class_device *cdev, char *buf) |
283 | { | 337 | { |
284 | struct Scsi_Host *host = class_to_shost(cdev); | 338 | struct Scsi_Host *host = class_to_shost(cdev); |
285 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 339 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
286 | 340 | ||
287 | return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); | 341 | return snprintf(buf, PAGE_SIZE, "%#x\n", phba->cfg_poll); |
288 | } | 342 | } |
@@ -292,7 +346,7 @@ lpfc_poll_store(struct class_device *cdev, const char *buf, | |||
292 | size_t count) | 346 | size_t count) |
293 | { | 347 | { |
294 | struct Scsi_Host *host = class_to_shost(cdev); | 348 | struct Scsi_Host *host = class_to_shost(cdev); |
295 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 349 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
296 | uint32_t creg_val; | 350 | uint32_t creg_val; |
297 | uint32_t old_val; | 351 | uint32_t old_val; |
298 | int val=0; | 352 | int val=0; |
@@ -349,7 +403,7 @@ static ssize_t \ | |||
349 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 403 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ |
350 | { \ | 404 | { \ |
351 | struct Scsi_Host *host = class_to_shost(cdev);\ | 405 | struct Scsi_Host *host = class_to_shost(cdev);\ |
352 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\ | 406 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
353 | int val = 0;\ | 407 | int val = 0;\ |
354 | val = phba->cfg_##attr;\ | 408 | val = phba->cfg_##attr;\ |
355 | return snprintf(buf, PAGE_SIZE, "%d\n",\ | 409 | return snprintf(buf, PAGE_SIZE, "%d\n",\ |
@@ -361,7 +415,7 @@ static ssize_t \ | |||
361 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ | 415 | lpfc_##attr##_show(struct class_device *cdev, char *buf) \ |
362 | { \ | 416 | { \ |
363 | struct Scsi_Host *host = class_to_shost(cdev);\ | 417 | struct Scsi_Host *host = class_to_shost(cdev);\ |
364 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\ | 418 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
365 | int val = 0;\ | 419 | int val = 0;\ |
366 | val = phba->cfg_##attr;\ | 420 | val = phba->cfg_##attr;\ |
367 | return snprintf(buf, PAGE_SIZE, "%#x\n",\ | 421 | return snprintf(buf, PAGE_SIZE, "%#x\n",\ |
@@ -404,7 +458,7 @@ static ssize_t \ | |||
404 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ | 458 | lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \ |
405 | { \ | 459 | { \ |
406 | struct Scsi_Host *host = class_to_shost(cdev);\ | 460 | struct Scsi_Host *host = class_to_shost(cdev);\ |
407 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0];\ | 461 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;\ |
408 | int val=0;\ | 462 | int val=0;\ |
409 | if (!isdigit(buf[0]))\ | 463 | if (!isdigit(buf[0]))\ |
410 | return -EINVAL;\ | 464 | return -EINVAL;\ |
@@ -480,6 +534,8 @@ static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show, | |||
480 | NULL); | 534 | NULL); |
481 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, | 535 | static CLASS_DEVICE_ATTR(board_online, S_IRUGO | S_IWUSR, |
482 | lpfc_board_online_show, lpfc_board_online_store); | 536 | lpfc_board_online_show, lpfc_board_online_store); |
537 | static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, | ||
538 | lpfc_board_mode_show, lpfc_board_mode_store); | ||
483 | 539 | ||
484 | static int lpfc_poll = 0; | 540 | static int lpfc_poll = 0; |
485 | module_param(lpfc_poll, int, 0); | 541 | module_param(lpfc_poll, int, 0); |
@@ -520,6 +576,16 @@ LPFC_ATTR_R(lun_queue_depth, 30, 1, 128, | |||
520 | "Max number of FCP commands we can queue to a specific LUN"); | 576 | "Max number of FCP commands we can queue to a specific LUN"); |
521 | 577 | ||
522 | /* | 578 | /* |
579 | # hba_queue_depth: This parameter is used to limit the number of outstanding | ||
580 | # commands per lpfc HBA. Value range is [32,8192]. If this parameter | ||
581 | # value is greater than the maximum number of exchanges supported by the HBA, | ||
582 | # then maximum number of exchanges supported by the HBA is used to determine | ||
583 | # the hba_queue_depth. | ||
584 | */ | ||
585 | LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192, | ||
586 | "Max number of FCP commands we can queue to a lpfc HBA"); | ||
587 | |||
588 | /* | ||
523 | # Some disk devices have a "select ID" or "select Target" capability. | 589 | # Some disk devices have a "select ID" or "select Target" capability. |
524 | # From a protocol standpoint "select ID" usually means select the | 590 | # From a protocol standpoint "select ID" usually means select the |
525 | # Fibre channel "ALPA". In the FC-AL Profile there is an "informative | 591 | # Fibre channel "ALPA". In the FC-AL Profile there is an "informative |
@@ -550,6 +616,7 @@ LPFC_ATTR_RW(nodev_tmo, 30, 0, 255, | |||
550 | /* | 616 | /* |
551 | # lpfc_topology: link topology for init link | 617 | # lpfc_topology: link topology for init link |
552 | # 0x0 = attempt loop mode then point-to-point | 618 | # 0x0 = attempt loop mode then point-to-point |
619 | # 0x01 = internal loopback mode | ||
553 | # 0x02 = attempt point-to-point mode only | 620 | # 0x02 = attempt point-to-point mode only |
554 | # 0x04 = attempt loop mode only | 621 | # 0x04 = attempt loop mode only |
555 | # 0x06 = attempt point-to-point mode then loop | 622 | # 0x06 = attempt point-to-point mode then loop |
@@ -557,7 +624,7 @@ LPFC_ATTR_RW(nodev_tmo, 30, 0, 255, | |||
557 | # Set loop mode if you want to run as an NL_Port. Value range is [0,0x6]. | 624 | # Set loop mode if you want to run as an NL_Port. Value range is [0,0x6]. |
558 | # Default value is 0. | 625 | # Default value is 0. |
559 | */ | 626 | */ |
560 | LPFC_ATTR_R(topology, 0, 0, 6, "Select Fibre Channel topology"); | 627 | LPFC_ATTR_RW(topology, 0, 0, 6, "Select Fibre Channel topology"); |
561 | 628 | ||
562 | /* | 629 | /* |
563 | # lpfc_link_speed: Link speed selection for initializing the Fibre Channel | 630 | # lpfc_link_speed: Link speed selection for initializing the Fibre Channel |
@@ -597,13 +664,21 @@ LPFC_ATTR_R(ack0, 0, 0, 1, "Enable ACK0 support"); | |||
597 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if | 664 | # is 0. Default value of cr_count is 1. The cr_count feature is disabled if |
598 | # cr_delay is set to 0. | 665 | # cr_delay is set to 0. |
599 | */ | 666 | */ |
600 | LPFC_ATTR_RW(cr_delay, 0, 0, 63, "A count of milliseconds after which an" | 667 | LPFC_ATTR_RW(cr_delay, 0, 0, 63, "A count of milliseconds after which an " |
601 | "interrupt response is generated"); | 668 | "interrupt response is generated"); |
602 | 669 | ||
603 | LPFC_ATTR_RW(cr_count, 1, 1, 255, "A count of I/O completions after which an" | 670 | LPFC_ATTR_RW(cr_count, 1, 1, 255, "A count of I/O completions after which an " |
604 | "interrupt response is generated"); | 671 | "interrupt response is generated"); |
605 | 672 | ||
606 | /* | 673 | /* |
674 | # lpfc_multi_ring_support: Determines how many rings to spread available | ||
675 | # cmd/rsp IOCB entries across. | ||
676 | # Value range is [1,2]. Default value is 1. | ||
677 | */ | ||
678 | LPFC_ATTR_R(multi_ring_support, 1, 1, 2, "Determines number of primary " | ||
679 | "SLI rings to spread IOCB entries across"); | ||
680 | |||
681 | /* | ||
607 | # lpfc_fdmi_on: controls FDMI support. | 682 | # lpfc_fdmi_on: controls FDMI support. |
608 | # 0 = no FDMI support | 683 | # 0 = no FDMI support |
609 | # 1 = support FDMI without attribute of hostname | 684 | # 1 = support FDMI without attribute of hostname |
@@ -616,7 +691,7 @@ LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support"); | |||
616 | # Specifies the maximum number of ELS cmds we can have outstanding (for | 691 | # Specifies the maximum number of ELS cmds we can have outstanding (for |
617 | # discovery). Value range is [1,64]. Default value = 32. | 692 | # discovery). Value range is [1,64]. Default value = 32. |
618 | */ | 693 | */ |
619 | LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands" | 694 | LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands " |
620 | "during discovery"); | 695 | "during discovery"); |
621 | 696 | ||
622 | /* | 697 | /* |
@@ -649,6 +724,7 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
649 | &class_device_attr_lpfc_drvr_version, | 724 | &class_device_attr_lpfc_drvr_version, |
650 | &class_device_attr_lpfc_log_verbose, | 725 | &class_device_attr_lpfc_log_verbose, |
651 | &class_device_attr_lpfc_lun_queue_depth, | 726 | &class_device_attr_lpfc_lun_queue_depth, |
727 | &class_device_attr_lpfc_hba_queue_depth, | ||
652 | &class_device_attr_lpfc_nodev_tmo, | 728 | &class_device_attr_lpfc_nodev_tmo, |
653 | &class_device_attr_lpfc_fcp_class, | 729 | &class_device_attr_lpfc_fcp_class, |
654 | &class_device_attr_lpfc_use_adisc, | 730 | &class_device_attr_lpfc_use_adisc, |
@@ -658,11 +734,13 @@ struct class_device_attribute *lpfc_host_attrs[] = { | |||
658 | &class_device_attr_lpfc_link_speed, | 734 | &class_device_attr_lpfc_link_speed, |
659 | &class_device_attr_lpfc_cr_delay, | 735 | &class_device_attr_lpfc_cr_delay, |
660 | &class_device_attr_lpfc_cr_count, | 736 | &class_device_attr_lpfc_cr_count, |
737 | &class_device_attr_lpfc_multi_ring_support, | ||
661 | &class_device_attr_lpfc_fdmi_on, | 738 | &class_device_attr_lpfc_fdmi_on, |
662 | &class_device_attr_lpfc_max_luns, | 739 | &class_device_attr_lpfc_max_luns, |
663 | &class_device_attr_nport_evt_cnt, | 740 | &class_device_attr_nport_evt_cnt, |
664 | &class_device_attr_management_version, | 741 | &class_device_attr_management_version, |
665 | &class_device_attr_board_online, | 742 | &class_device_attr_board_online, |
743 | &class_device_attr_board_mode, | ||
666 | &class_device_attr_lpfc_poll, | 744 | &class_device_attr_lpfc_poll, |
667 | &class_device_attr_lpfc_poll_tmo, | 745 | &class_device_attr_lpfc_poll_tmo, |
668 | NULL, | 746 | NULL, |
@@ -674,7 +752,7 @@ sysfs_ctlreg_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
674 | size_t buf_off; | 752 | size_t buf_off; |
675 | struct Scsi_Host *host = class_to_shost(container_of(kobj, | 753 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
676 | struct class_device, kobj)); | 754 | struct class_device, kobj)); |
677 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 755 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
678 | 756 | ||
679 | if ((off + count) > FF_REG_AREA_SIZE) | 757 | if ((off + count) > FF_REG_AREA_SIZE) |
680 | return -ERANGE; | 758 | return -ERANGE; |
@@ -707,7 +785,7 @@ sysfs_ctlreg_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
707 | uint32_t * tmp_ptr; | 785 | uint32_t * tmp_ptr; |
708 | struct Scsi_Host *host = class_to_shost(container_of(kobj, | 786 | struct Scsi_Host *host = class_to_shost(container_of(kobj, |
709 | struct class_device, kobj)); | 787 | struct class_device, kobj)); |
710 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 788 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
711 | 789 | ||
712 | if (off > FF_REG_AREA_SIZE) | 790 | if (off > FF_REG_AREA_SIZE) |
713 | return -ERANGE; | 791 | return -ERANGE; |
@@ -762,7 +840,7 @@ sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
762 | { | 840 | { |
763 | struct Scsi_Host * host = | 841 | struct Scsi_Host * host = |
764 | class_to_shost(container_of(kobj, struct class_device, kobj)); | 842 | class_to_shost(container_of(kobj, struct class_device, kobj)); |
765 | struct lpfc_hba * phba = (struct lpfc_hba*)host->hostdata[0]; | 843 | struct lpfc_hba * phba = (struct lpfc_hba*)host->hostdata; |
766 | struct lpfcMboxq * mbox = NULL; | 844 | struct lpfcMboxq * mbox = NULL; |
767 | 845 | ||
768 | if ((count + off) > MAILBOX_CMD_SIZE) | 846 | if ((count + off) > MAILBOX_CMD_SIZE) |
@@ -778,7 +856,7 @@ sysfs_mbox_write(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
778 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 856 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
779 | if (!mbox) | 857 | if (!mbox) |
780 | return -ENOMEM; | 858 | return -ENOMEM; |
781 | 859 | memset(mbox, 0, sizeof (LPFC_MBOXQ_t)); | |
782 | } | 860 | } |
783 | 861 | ||
784 | spin_lock_irq(host->host_lock); | 862 | spin_lock_irq(host->host_lock); |
@@ -815,7 +893,7 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
815 | struct Scsi_Host *host = | 893 | struct Scsi_Host *host = |
816 | class_to_shost(container_of(kobj, struct class_device, | 894 | class_to_shost(container_of(kobj, struct class_device, |
817 | kobj)); | 895 | kobj)); |
818 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata[0]; | 896 | struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata; |
819 | int rc; | 897 | int rc; |
820 | 898 | ||
821 | if (off > sizeof(MAILBOX_t)) | 899 | if (off > sizeof(MAILBOX_t)) |
@@ -872,8 +950,11 @@ sysfs_mbox_read(struct kobject *kobj, char *buf, loff_t off, size_t count) | |||
872 | case MBX_DUMP_MEMORY: | 950 | case MBX_DUMP_MEMORY: |
873 | case MBX_DOWN_LOAD: | 951 | case MBX_DOWN_LOAD: |
874 | case MBX_UPDATE_CFG: | 952 | case MBX_UPDATE_CFG: |
953 | case MBX_KILL_BOARD: | ||
875 | case MBX_LOAD_AREA: | 954 | case MBX_LOAD_AREA: |
876 | case MBX_LOAD_EXP_ROM: | 955 | case MBX_LOAD_EXP_ROM: |
956 | case MBX_BEACON: | ||
957 | case MBX_DEL_LD_ENTRY: | ||
877 | break; | 958 | break; |
878 | case MBX_READ_SPARM64: | 959 | case MBX_READ_SPARM64: |
879 | case MBX_READ_LA: | 960 | case MBX_READ_LA: |
@@ -990,7 +1071,7 @@ lpfc_free_sysfs_attr(struct lpfc_hba *phba) | |||
990 | static void | 1071 | static void |
991 | lpfc_get_host_port_id(struct Scsi_Host *shost) | 1072 | lpfc_get_host_port_id(struct Scsi_Host *shost) |
992 | { | 1073 | { |
993 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; | 1074 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
994 | /* note: fc_myDID already in cpu endianness */ | 1075 | /* note: fc_myDID already in cpu endianness */ |
995 | fc_host_port_id(shost) = phba->fc_myDID; | 1076 | fc_host_port_id(shost) = phba->fc_myDID; |
996 | } | 1077 | } |
@@ -998,7 +1079,7 @@ lpfc_get_host_port_id(struct Scsi_Host *shost) | |||
998 | static void | 1079 | static void |
999 | lpfc_get_host_port_type(struct Scsi_Host *shost) | 1080 | lpfc_get_host_port_type(struct Scsi_Host *shost) |
1000 | { | 1081 | { |
1001 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; | 1082 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
1002 | 1083 | ||
1003 | spin_lock_irq(shost->host_lock); | 1084 | spin_lock_irq(shost->host_lock); |
1004 | 1085 | ||
@@ -1023,7 +1104,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost) | |||
1023 | static void | 1104 | static void |
1024 | lpfc_get_host_port_state(struct Scsi_Host *shost) | 1105 | lpfc_get_host_port_state(struct Scsi_Host *shost) |
1025 | { | 1106 | { |
1026 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; | 1107 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
1027 | 1108 | ||
1028 | spin_lock_irq(shost->host_lock); | 1109 | spin_lock_irq(shost->host_lock); |
1029 | 1110 | ||
@@ -1031,6 +1112,8 @@ lpfc_get_host_port_state(struct Scsi_Host *shost) | |||
1031 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; | 1112 | fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; |
1032 | else { | 1113 | else { |
1033 | switch (phba->hba_state) { | 1114 | switch (phba->hba_state) { |
1115 | case LPFC_STATE_UNKNOWN: | ||
1116 | case LPFC_WARM_START: | ||
1034 | case LPFC_INIT_START: | 1117 | case LPFC_INIT_START: |
1035 | case LPFC_INIT_MBX_CMDS: | 1118 | case LPFC_INIT_MBX_CMDS: |
1036 | case LPFC_LINK_DOWN: | 1119 | case LPFC_LINK_DOWN: |
@@ -1064,7 +1147,7 @@ lpfc_get_host_port_state(struct Scsi_Host *shost) | |||
1064 | static void | 1147 | static void |
1065 | lpfc_get_host_speed(struct Scsi_Host *shost) | 1148 | lpfc_get_host_speed(struct Scsi_Host *shost) |
1066 | { | 1149 | { |
1067 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; | 1150 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
1068 | 1151 | ||
1069 | spin_lock_irq(shost->host_lock); | 1152 | spin_lock_irq(shost->host_lock); |
1070 | 1153 | ||
@@ -1091,7 +1174,7 @@ lpfc_get_host_speed(struct Scsi_Host *shost) | |||
1091 | static void | 1174 | static void |
1092 | lpfc_get_host_fabric_name (struct Scsi_Host *shost) | 1175 | lpfc_get_host_fabric_name (struct Scsi_Host *shost) |
1093 | { | 1176 | { |
1094 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata[0]; | 1177 | struct lpfc_hba *phba = (struct lpfc_hba*)shost->hostdata; |
1095 | u64 node_name; | 1178 | u64 node_name; |
1096 | 1179 | ||
1097 | spin_lock_irq(shost->host_lock); | 1180 | spin_lock_irq(shost->host_lock); |
@@ -1113,7 +1196,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost) | |||
1113 | static struct fc_host_statistics * | 1196 | static struct fc_host_statistics * |
1114 | lpfc_get_stats(struct Scsi_Host *shost) | 1197 | lpfc_get_stats(struct Scsi_Host *shost) |
1115 | { | 1198 | { |
1116 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata[0]; | 1199 | struct lpfc_hba *phba = (struct lpfc_hba *)shost->hostdata; |
1117 | struct lpfc_sli *psli = &phba->sli; | 1200 | struct lpfc_sli *psli = &phba->sli; |
1118 | struct fc_host_statistics *hs = &phba->link_stats; | 1201 | struct fc_host_statistics *hs = &phba->link_stats; |
1119 | LPFC_MBOXQ_t *pmboxq; | 1202 | LPFC_MBOXQ_t *pmboxq; |
@@ -1203,7 +1286,7 @@ static void | |||
1203 | lpfc_get_starget_port_id(struct scsi_target *starget) | 1286 | lpfc_get_starget_port_id(struct scsi_target *starget) |
1204 | { | 1287 | { |
1205 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1288 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1206 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; | 1289 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1207 | uint32_t did = -1; | 1290 | uint32_t did = -1; |
1208 | struct lpfc_nodelist *ndlp = NULL; | 1291 | struct lpfc_nodelist *ndlp = NULL; |
1209 | 1292 | ||
@@ -1224,7 +1307,7 @@ static void | |||
1224 | lpfc_get_starget_node_name(struct scsi_target *starget) | 1307 | lpfc_get_starget_node_name(struct scsi_target *starget) |
1225 | { | 1308 | { |
1226 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1309 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1227 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; | 1310 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1228 | u64 node_name = 0; | 1311 | u64 node_name = 0; |
1229 | struct lpfc_nodelist *ndlp = NULL; | 1312 | struct lpfc_nodelist *ndlp = NULL; |
1230 | 1313 | ||
@@ -1245,7 +1328,7 @@ static void | |||
1245 | lpfc_get_starget_port_name(struct scsi_target *starget) | 1328 | lpfc_get_starget_port_name(struct scsi_target *starget) |
1246 | { | 1329 | { |
1247 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); | 1330 | struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); |
1248 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata[0]; | 1331 | struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata; |
1249 | u64 port_name = 0; | 1332 | u64 port_name = 0; |
1250 | struct lpfc_nodelist *ndlp = NULL; | 1333 | struct lpfc_nodelist *ndlp = NULL; |
1251 | 1334 | ||
@@ -1366,6 +1449,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
1366 | lpfc_log_verbose_init(phba, lpfc_log_verbose); | 1449 | lpfc_log_verbose_init(phba, lpfc_log_verbose); |
1367 | lpfc_cr_delay_init(phba, lpfc_cr_delay); | 1450 | lpfc_cr_delay_init(phba, lpfc_cr_delay); |
1368 | lpfc_cr_count_init(phba, lpfc_cr_count); | 1451 | lpfc_cr_count_init(phba, lpfc_cr_count); |
1452 | lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support); | ||
1369 | lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); | 1453 | lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth); |
1370 | lpfc_fcp_class_init(phba, lpfc_fcp_class); | 1454 | lpfc_fcp_class_init(phba, lpfc_fcp_class); |
1371 | lpfc_use_adisc_init(phba, lpfc_use_adisc); | 1455 | lpfc_use_adisc_init(phba, lpfc_use_adisc); |
@@ -1411,5 +1495,9 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
1411 | default: | 1495 | default: |
1412 | phba->cfg_hba_queue_depth = LPFC_DFT_HBA_Q_DEPTH; | 1496 | phba->cfg_hba_queue_depth = LPFC_DFT_HBA_Q_DEPTH; |
1413 | } | 1497 | } |
1498 | |||
1499 | if (phba->cfg_hba_queue_depth > lpfc_hba_queue_depth) | ||
1500 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | ||
1501 | |||
1414 | return; | 1502 | return; |
1415 | } | 1503 | } |