diff options
author | James Smart <james.smart@emulex.com> | 2011-12-13 13:20:45 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-12-15 01:57:43 -0500 |
commit | 026abb87a5586c838a47aca7198d78e356b6351e (patch) | |
tree | 39c99398f8aab41fd7623f1d9a79197565a8f2e2 /drivers/scsi/lpfc/lpfc_sli.c | |
parent | 2cb6fc8c014b9b00c4487a79b8f6ed0da4121f45 (diff) |
[SCSI] lpfc 8.3.28: Miscellaneous fixes in sysfs and mgmt interfaces
Miscellaneous fixes in sysfs and mgmt interfaces:
- Added SLI4 INTF_TYPE and SLI_FAMILY as sub-field to the fwrev sysfs
attribute (CR 124103)
- Added a sysfs attribute "protocol" to report SLI4 port link protocol
type (CR 124102)
- Increment mix-and-match minor number by 1 for added "protocol" sysfs
attribute. (124102)
- Move the link speed check into the generic sli3/sli4 code
path. (CR 124185, 124122)
- Deleted check for inExtWLen (CR 122523)
- Add the word "offline" to message 2889 (CR 124385)
- Conditionalize the firmware upgrade/downgrade so that it is only
attempted for SLI4 type 2 boards (CR 124406)
- Return an error if the mbox sysfs is called. (CR 124210)
- When port_state is less than LPFC_VPORT_READY, report
FC_PORTSTATE_BYPASSED (CR 120018)
- Added driver support for performing persistent linkdown based on
configure region 23 (CR 124534)
- Added restore state and error log when sysfs board_mode attribute
access failed (CR 124158)
- Added support for SLI4_CONFIG non-embedded COMN_GET_CNTL_ADDL_ATTR
pass-through (CR 124466)
- Rejecting un-supported multi-buffer mailbox commands (CR 124771)
- Byte swap the extended data request and response data for extended
mailbox data (CR 125081)
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 149 |
1 files changed, 122 insertions, 27 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 4d4104f38c98..1be13e757eda 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -4566,7 +4566,7 @@ lpfc_sli4_read_fcoe_params(struct lpfc_hba *phba, | |||
4566 | phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; | 4566 | phba->fc_map[2] = LPFC_FCOE_FCF_MAP2; |
4567 | 4567 | ||
4568 | mqe = &mboxq->u.mqe; | 4568 | mqe = &mboxq->u.mqe; |
4569 | if (lpfc_dump_fcoe_param(phba, mboxq)) | 4569 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) |
4570 | return -ENOMEM; | 4570 | return -ENOMEM; |
4571 | 4571 | ||
4572 | mp = (struct lpfc_dmabuf *) mboxq->context1; | 4572 | mp = (struct lpfc_dmabuf *) mboxq->context1; |
@@ -6205,7 +6205,11 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
6205 | rc = 0; | 6205 | rc = 0; |
6206 | phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_fcfi, | 6206 | phba->fcf.fcfi = bf_get(lpfc_reg_fcfi_fcfi, |
6207 | &mboxq->u.mqe.un.reg_fcfi); | 6207 | &mboxq->u.mqe.un.reg_fcfi); |
6208 | |||
6209 | /* Check if the port is configured to be disabled */ | ||
6210 | lpfc_sli_read_link_ste(phba); | ||
6208 | } | 6211 | } |
6212 | |||
6209 | /* | 6213 | /* |
6210 | * The port is ready, set the host's link state to LINK_DOWN | 6214 | * The port is ready, set the host's link state to LINK_DOWN |
6211 | * in preparation for link interrupts. | 6215 | * in preparation for link interrupts. |
@@ -6213,7 +6217,19 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
6213 | spin_lock_irq(&phba->hbalock); | 6217 | spin_lock_irq(&phba->hbalock); |
6214 | phba->link_state = LPFC_LINK_DOWN; | 6218 | phba->link_state = LPFC_LINK_DOWN; |
6215 | spin_unlock_irq(&phba->hbalock); | 6219 | spin_unlock_irq(&phba->hbalock); |
6216 | if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { | 6220 | if (!(phba->hba_flag & HBA_FCOE_MODE) && |
6221 | (phba->hba_flag & LINK_DISABLED)) { | ||
6222 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_SLI, | ||
6223 | "3103 Adapter Link is disabled.\n"); | ||
6224 | lpfc_down_link(phba, mboxq); | ||
6225 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
6226 | if (rc != MBX_SUCCESS) { | ||
6227 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_SLI, | ||
6228 | "3104 Adapter failed to issue " | ||
6229 | "DOWN_LINK mbox cmd, rc:x%x\n", rc); | ||
6230 | goto out_unset_queue; | ||
6231 | } | ||
6232 | } else if (phba->cfg_suppress_link_up == LPFC_INITIALIZE_LINK) { | ||
6217 | rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); | 6233 | rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); |
6218 | if (rc) | 6234 | if (rc) |
6219 | goto out_unset_queue; | 6235 | goto out_unset_queue; |
@@ -15252,45 +15268,42 @@ lpfc_sli4_fcf_dead_failthrough(struct lpfc_hba *phba) | |||
15252 | } | 15268 | } |
15253 | 15269 | ||
15254 | /** | 15270 | /** |
15255 | * lpfc_sli_read_link_ste - Read region 23 to decide if link is disabled. | 15271 | * lpfc_sli_get_config_region23 - Get sli3 port region 23 data. |
15256 | * @phba: pointer to lpfc hba data structure. | 15272 | * @phba: pointer to lpfc hba data structure. |
15273 | * @rgn23_data: pointer to configure region 23 data. | ||
15257 | * | 15274 | * |
15258 | * This function read region 23 and parse TLV for port status to | 15275 | * This function gets SLI3 port configure region 23 data through memory dump |
15259 | * decide if the user disaled the port. If the TLV indicates the | 15276 | * mailbox command. When it successfully retrieves data, the size of the data |
15260 | * port is disabled, the hba_flag is set accordingly. | 15277 | * will be returned, otherwise, 0 will be returned. |
15261 | **/ | 15278 | **/ |
15262 | void | 15279 | static uint32_t |
15263 | lpfc_sli_read_link_ste(struct lpfc_hba *phba) | 15280 | lpfc_sli_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) |
15264 | { | 15281 | { |
15265 | LPFC_MBOXQ_t *pmb = NULL; | 15282 | LPFC_MBOXQ_t *pmb = NULL; |
15266 | MAILBOX_t *mb; | 15283 | MAILBOX_t *mb; |
15267 | uint8_t *rgn23_data = NULL; | 15284 | uint32_t offset = 0; |
15268 | uint32_t offset = 0, data_size, sub_tlv_len, tlv_offset; | ||
15269 | int rc; | 15285 | int rc; |
15270 | 15286 | ||
15287 | if (!rgn23_data) | ||
15288 | return 0; | ||
15289 | |||
15271 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 15290 | pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
15272 | if (!pmb) { | 15291 | if (!pmb) { |
15273 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 15292 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
15274 | "2600 lpfc_sli_read_serdes_param failed to" | 15293 | "2600 failed to allocate mailbox memory\n"); |
15275 | " allocate mailbox memory\n"); | 15294 | return 0; |
15276 | goto out; | ||
15277 | } | 15295 | } |
15278 | mb = &pmb->u.mb; | 15296 | mb = &pmb->u.mb; |
15279 | 15297 | ||
15280 | /* Get adapter Region 23 data */ | ||
15281 | rgn23_data = kzalloc(DMP_RGN23_SIZE, GFP_KERNEL); | ||
15282 | if (!rgn23_data) | ||
15283 | goto out; | ||
15284 | |||
15285 | do { | 15298 | do { |
15286 | lpfc_dump_mem(phba, pmb, offset, DMP_REGION_23); | 15299 | lpfc_dump_mem(phba, pmb, offset, DMP_REGION_23); |
15287 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); | 15300 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL); |
15288 | 15301 | ||
15289 | if (rc != MBX_SUCCESS) { | 15302 | if (rc != MBX_SUCCESS) { |
15290 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, | 15303 | lpfc_printf_log(phba, KERN_INFO, LOG_INIT, |
15291 | "2601 lpfc_sli_read_link_ste failed to" | 15304 | "2601 failed to read config " |
15292 | " read config region 23 rc 0x%x Status 0x%x\n", | 15305 | "region 23, rc 0x%x Status 0x%x\n", |
15293 | rc, mb->mbxStatus); | 15306 | rc, mb->mbxStatus); |
15294 | mb->un.varDmp.word_cnt = 0; | 15307 | mb->un.varDmp.word_cnt = 0; |
15295 | } | 15308 | } |
15296 | /* | 15309 | /* |
@@ -15303,13 +15316,96 @@ lpfc_sli_read_link_ste(struct lpfc_hba *phba) | |||
15303 | mb->un.varDmp.word_cnt = DMP_RGN23_SIZE - offset; | 15316 | mb->un.varDmp.word_cnt = DMP_RGN23_SIZE - offset; |
15304 | 15317 | ||
15305 | lpfc_sli_pcimem_bcopy(((uint8_t *)mb) + DMP_RSP_OFFSET, | 15318 | lpfc_sli_pcimem_bcopy(((uint8_t *)mb) + DMP_RSP_OFFSET, |
15306 | rgn23_data + offset, | 15319 | rgn23_data + offset, |
15307 | mb->un.varDmp.word_cnt); | 15320 | mb->un.varDmp.word_cnt); |
15308 | offset += mb->un.varDmp.word_cnt; | 15321 | offset += mb->un.varDmp.word_cnt; |
15309 | } while (mb->un.varDmp.word_cnt && offset < DMP_RGN23_SIZE); | 15322 | } while (mb->un.varDmp.word_cnt && offset < DMP_RGN23_SIZE); |
15310 | 15323 | ||
15311 | data_size = offset; | 15324 | mempool_free(pmb, phba->mbox_mem_pool); |
15312 | offset = 0; | 15325 | return offset; |
15326 | } | ||
15327 | |||
15328 | /** | ||
15329 | * lpfc_sli4_get_config_region23 - Get sli4 port region 23 data. | ||
15330 | * @phba: pointer to lpfc hba data structure. | ||
15331 | * @rgn23_data: pointer to configure region 23 data. | ||
15332 | * | ||
15333 | * This function gets SLI4 port configure region 23 data through memory dump | ||
15334 | * mailbox command. When it successfully retrieves data, the size of the data | ||
15335 | * will be returned, otherwise, 0 will be returned. | ||
15336 | **/ | ||
15337 | static uint32_t | ||
15338 | lpfc_sli4_get_config_region23(struct lpfc_hba *phba, char *rgn23_data) | ||
15339 | { | ||
15340 | LPFC_MBOXQ_t *mboxq = NULL; | ||
15341 | struct lpfc_dmabuf *mp = NULL; | ||
15342 | struct lpfc_mqe *mqe; | ||
15343 | uint32_t data_length = 0; | ||
15344 | int rc; | ||
15345 | |||
15346 | if (!rgn23_data) | ||
15347 | return 0; | ||
15348 | |||
15349 | mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
15350 | if (!mboxq) { | ||
15351 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
15352 | "3105 failed to allocate mailbox memory\n"); | ||
15353 | return 0; | ||
15354 | } | ||
15355 | |||
15356 | if (lpfc_sli4_dump_cfg_rg23(phba, mboxq)) | ||
15357 | goto out; | ||
15358 | mqe = &mboxq->u.mqe; | ||
15359 | mp = (struct lpfc_dmabuf *) mboxq->context1; | ||
15360 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
15361 | if (rc) | ||
15362 | goto out; | ||
15363 | data_length = mqe->un.mb_words[5]; | ||
15364 | if (data_length == 0) | ||
15365 | goto out; | ||
15366 | if (data_length > DMP_RGN23_SIZE) { | ||
15367 | data_length = 0; | ||
15368 | goto out; | ||
15369 | } | ||
15370 | lpfc_sli_pcimem_bcopy((char *)mp->virt, rgn23_data, data_length); | ||
15371 | out: | ||
15372 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
15373 | if (mp) { | ||
15374 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
15375 | kfree(mp); | ||
15376 | } | ||
15377 | return data_length; | ||
15378 | } | ||
15379 | |||
15380 | /** | ||
15381 | * lpfc_sli_read_link_ste - Read region 23 to decide if link is disabled. | ||
15382 | * @phba: pointer to lpfc hba data structure. | ||
15383 | * | ||
15384 | * This function read region 23 and parse TLV for port status to | ||
15385 | * decide if the user disaled the port. If the TLV indicates the | ||
15386 | * port is disabled, the hba_flag is set accordingly. | ||
15387 | **/ | ||
15388 | void | ||
15389 | lpfc_sli_read_link_ste(struct lpfc_hba *phba) | ||
15390 | { | ||
15391 | uint8_t *rgn23_data = NULL; | ||
15392 | uint32_t if_type, data_size, sub_tlv_len, tlv_offset; | ||
15393 | uint32_t offset = 0; | ||
15394 | |||
15395 | /* Get adapter Region 23 data */ | ||
15396 | rgn23_data = kzalloc(DMP_RGN23_SIZE, GFP_KERNEL); | ||
15397 | if (!rgn23_data) | ||
15398 | goto out; | ||
15399 | |||
15400 | if (phba->sli_rev < LPFC_SLI_REV4) | ||
15401 | data_size = lpfc_sli_get_config_region23(phba, rgn23_data); | ||
15402 | else { | ||
15403 | if_type = bf_get(lpfc_sli_intf_if_type, | ||
15404 | &phba->sli4_hba.sli_intf); | ||
15405 | if (if_type == LPFC_SLI_INTF_IF_TYPE_0) | ||
15406 | goto out; | ||
15407 | data_size = lpfc_sli4_get_config_region23(phba, rgn23_data); | ||
15408 | } | ||
15313 | 15409 | ||
15314 | if (!data_size) | 15410 | if (!data_size) |
15315 | goto out; | 15411 | goto out; |
@@ -15373,9 +15469,8 @@ lpfc_sli_read_link_ste(struct lpfc_hba *phba) | |||
15373 | goto out; | 15469 | goto out; |
15374 | } | 15470 | } |
15375 | } | 15471 | } |
15472 | |||
15376 | out: | 15473 | out: |
15377 | if (pmb) | ||
15378 | mempool_free(pmb, phba->mbox_mem_pool); | ||
15379 | kfree(rgn23_data); | 15474 | kfree(rgn23_data); |
15380 | return; | 15475 | return; |
15381 | } | 15476 | } |