diff options
author | James Smart <james.smart@emulex.com> | 2010-09-29 11:19:14 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-10-07 18:30:36 -0400 |
commit | 3677a3a76e190f801af0778df3b8efa1fe161a6e (patch) | |
tree | 1a1ebb2267f27963a5699ff27f04b88bec2533c8 /drivers/scsi/lpfc/lpfc_init.c | |
parent | eee8877ee5e8a879f78034001b5e7c04db005ab2 (diff) |
[SCSI] lpfc 8.3.17: Replace function reset methodology
Replace graceful teardown steps with the singular function reset command.
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 132 |
1 files changed, 9 insertions, 123 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 053eaef09005..295c7ddb36c1 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -2888,65 +2888,6 @@ lpfc_stop_port(struct lpfc_hba *phba) | |||
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | /** | 2890 | /** |
2891 | * lpfc_sli4_remove_dflt_fcf - Remove the driver default fcf record from the port. | ||
2892 | * @phba: pointer to lpfc hba data structure. | ||
2893 | * | ||
2894 | * This routine is invoked to remove the driver default fcf record from | ||
2895 | * the port. This routine currently acts on FCF Index 0. | ||
2896 | * | ||
2897 | **/ | ||
2898 | void | ||
2899 | lpfc_sli_remove_dflt_fcf(struct lpfc_hba *phba) | ||
2900 | { | ||
2901 | int rc = 0; | ||
2902 | LPFC_MBOXQ_t *mboxq; | ||
2903 | struct lpfc_mbx_del_fcf_tbl_entry *del_fcf_record; | ||
2904 | uint32_t mbox_tmo, req_len; | ||
2905 | uint32_t shdr_status, shdr_add_status; | ||
2906 | |||
2907 | mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
2908 | if (!mboxq) { | ||
2909 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
2910 | "2020 Failed to allocate mbox for ADD_FCF cmd\n"); | ||
2911 | return; | ||
2912 | } | ||
2913 | |||
2914 | req_len = sizeof(struct lpfc_mbx_del_fcf_tbl_entry) - | ||
2915 | sizeof(struct lpfc_sli4_cfg_mhdr); | ||
2916 | rc = lpfc_sli4_config(phba, mboxq, LPFC_MBOX_SUBSYSTEM_FCOE, | ||
2917 | LPFC_MBOX_OPCODE_FCOE_DELETE_FCF, | ||
2918 | req_len, LPFC_SLI4_MBX_EMBED); | ||
2919 | /* | ||
2920 | * In phase 1, there is a single FCF index, 0. In phase2, the driver | ||
2921 | * supports multiple FCF indices. | ||
2922 | */ | ||
2923 | del_fcf_record = &mboxq->u.mqe.un.del_fcf_entry; | ||
2924 | bf_set(lpfc_mbx_del_fcf_tbl_count, del_fcf_record, 1); | ||
2925 | bf_set(lpfc_mbx_del_fcf_tbl_index, del_fcf_record, | ||
2926 | phba->fcf.current_rec.fcf_indx); | ||
2927 | |||
2928 | if (!phba->sli4_hba.intr_enable) | ||
2929 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
2930 | else { | ||
2931 | mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); | ||
2932 | rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); | ||
2933 | } | ||
2934 | /* The IOCTL status is embedded in the mailbox subheader. */ | ||
2935 | shdr_status = bf_get(lpfc_mbox_hdr_status, | ||
2936 | &del_fcf_record->header.cfg_shdr.response); | ||
2937 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, | ||
2938 | &del_fcf_record->header.cfg_shdr.response); | ||
2939 | if (shdr_status || shdr_add_status || rc != MBX_SUCCESS) { | ||
2940 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
2941 | "2516 DEL FCF of default FCF Index failed " | ||
2942 | "mbx status x%x, status x%x add_status x%x\n", | ||
2943 | rc, shdr_status, shdr_add_status); | ||
2944 | } | ||
2945 | if (rc != MBX_TIMEOUT) | ||
2946 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
2947 | } | ||
2948 | |||
2949 | /** | ||
2950 | * lpfc_fcf_redisc_wait_start_timer - Start fcf rediscover wait timer | 2891 | * lpfc_fcf_redisc_wait_start_timer - Start fcf rediscover wait timer |
2951 | * @phba: Pointer to hba for which this call is being executed. | 2892 | * @phba: Pointer to hba for which this call is being executed. |
2952 | * | 2893 | * |
@@ -4288,12 +4229,6 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) | |||
4288 | { | 4229 | { |
4289 | struct lpfc_fcf_conn_entry *conn_entry, *next_conn_entry; | 4230 | struct lpfc_fcf_conn_entry *conn_entry, *next_conn_entry; |
4290 | 4231 | ||
4291 | /* unregister default FCFI from the HBA */ | ||
4292 | lpfc_sli4_fcfi_unreg(phba, phba->fcf.fcfi); | ||
4293 | |||
4294 | /* Free the default FCR table */ | ||
4295 | lpfc_sli_remove_dflt_fcf(phba); | ||
4296 | |||
4297 | /* Free memory allocated for msi-x interrupt vector entries */ | 4232 | /* Free memory allocated for msi-x interrupt vector entries */ |
4298 | kfree(phba->sli4_hba.msix_entries); | 4233 | kfree(phba->sli4_hba.msix_entries); |
4299 | 4234 | ||
@@ -4321,9 +4256,6 @@ lpfc_sli4_driver_resource_unset(struct lpfc_hba *phba) | |||
4321 | lpfc_sli4_cq_event_release_all(phba); | 4256 | lpfc_sli4_cq_event_release_all(phba); |
4322 | lpfc_sli4_cq_event_pool_destroy(phba); | 4257 | lpfc_sli4_cq_event_pool_destroy(phba); |
4323 | 4258 | ||
4324 | /* Reset SLI4 HBA FCoE function */ | ||
4325 | lpfc_pci_function_reset(phba); | ||
4326 | |||
4327 | /* Free the bsmbx region. */ | 4259 | /* Free the bsmbx region. */ |
4328 | lpfc_destroy_bootstrap_mbox(phba); | 4260 | lpfc_destroy_bootstrap_mbox(phba); |
4329 | 4261 | ||
@@ -4550,7 +4482,6 @@ lpfc_free_sgl_list(struct lpfc_hba *phba) | |||
4550 | { | 4482 | { |
4551 | struct lpfc_sglq *sglq_entry = NULL, *sglq_next = NULL; | 4483 | struct lpfc_sglq *sglq_entry = NULL, *sglq_next = NULL; |
4552 | LIST_HEAD(sglq_list); | 4484 | LIST_HEAD(sglq_list); |
4553 | int rc = 0; | ||
4554 | 4485 | ||
4555 | spin_lock_irq(&phba->hbalock); | 4486 | spin_lock_irq(&phba->hbalock); |
4556 | list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &sglq_list); | 4487 | list_splice_init(&phba->sli4_hba.lpfc_sgl_list, &sglq_list); |
@@ -4563,11 +4494,6 @@ lpfc_free_sgl_list(struct lpfc_hba *phba) | |||
4563 | kfree(sglq_entry); | 4494 | kfree(sglq_entry); |
4564 | phba->sli4_hba.total_sglq_bufs--; | 4495 | phba->sli4_hba.total_sglq_bufs--; |
4565 | } | 4496 | } |
4566 | rc = lpfc_sli4_remove_all_sgl_pages(phba); | ||
4567 | if (rc) { | ||
4568 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
4569 | "2005 Unable to deregister pages from HBA: %x\n", rc); | ||
4570 | } | ||
4571 | kfree(phba->sli4_hba.lpfc_els_sgl_array); | 4497 | kfree(phba->sli4_hba.lpfc_els_sgl_array); |
4572 | } | 4498 | } |
4573 | 4499 | ||
@@ -6597,50 +6523,6 @@ lpfc_sli4_send_nop_mbox_cmds(struct lpfc_hba *phba, uint32_t cnt) | |||
6597 | } | 6523 | } |
6598 | 6524 | ||
6599 | /** | 6525 | /** |
6600 | * lpfc_sli4_fcfi_unreg - Unregister fcfi to device | ||
6601 | * @phba: pointer to lpfc hba data structure. | ||
6602 | * @fcfi: fcf index. | ||
6603 | * | ||
6604 | * This routine is invoked to unregister a FCFI from device. | ||
6605 | **/ | ||
6606 | void | ||
6607 | lpfc_sli4_fcfi_unreg(struct lpfc_hba *phba, uint16_t fcfi) | ||
6608 | { | ||
6609 | LPFC_MBOXQ_t *mbox; | ||
6610 | uint32_t mbox_tmo; | ||
6611 | int rc; | ||
6612 | unsigned long flags; | ||
6613 | |||
6614 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
6615 | |||
6616 | if (!mbox) | ||
6617 | return; | ||
6618 | |||
6619 | lpfc_unreg_fcfi(mbox, fcfi); | ||
6620 | |||
6621 | if (!phba->sli4_hba.intr_enable) | ||
6622 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | ||
6623 | else { | ||
6624 | mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_SLI4_CONFIG); | ||
6625 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, mbox_tmo); | ||
6626 | } | ||
6627 | if (rc != MBX_TIMEOUT) | ||
6628 | mempool_free(mbox, phba->mbox_mem_pool); | ||
6629 | if (rc != MBX_SUCCESS) | ||
6630 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | ||
6631 | "2517 Unregister FCFI command failed " | ||
6632 | "status %d, mbxStatus x%x\n", rc, | ||
6633 | bf_get(lpfc_mqe_status, &mbox->u.mqe)); | ||
6634 | else { | ||
6635 | spin_lock_irqsave(&phba->hbalock, flags); | ||
6636 | /* Mark the FCFI is no longer registered */ | ||
6637 | phba->fcf.fcf_flag &= | ||
6638 | ~(FCF_AVAILABLE | FCF_REGISTERED | FCF_SCAN_DONE); | ||
6639 | spin_unlock_irqrestore(&phba->hbalock, flags); | ||
6640 | } | ||
6641 | } | ||
6642 | |||
6643 | /** | ||
6644 | * lpfc_sli4_pci_mem_setup - Setup SLI4 HBA PCI memory space. | 6526 | * lpfc_sli4_pci_mem_setup - Setup SLI4 HBA PCI memory space. |
6645 | * @phba: pointer to lpfc hba data structure. | 6527 | * @phba: pointer to lpfc hba data structure. |
6646 | * | 6528 | * |
@@ -7377,10 +7259,14 @@ lpfc_sli4_unset_hba(struct lpfc_hba *phba) | |||
7377 | 7259 | ||
7378 | phba->pport->work_port_events = 0; | 7260 | phba->pport->work_port_events = 0; |
7379 | 7261 | ||
7380 | lpfc_sli4_hba_down(phba); | 7262 | /* Stop the SLI4 device port */ |
7263 | lpfc_stop_port(phba); | ||
7381 | 7264 | ||
7382 | lpfc_sli4_disable_intr(phba); | 7265 | lpfc_sli4_disable_intr(phba); |
7383 | 7266 | ||
7267 | /* Reset SLI4 HBA FCoE function */ | ||
7268 | lpfc_pci_function_reset(phba); | ||
7269 | |||
7384 | return; | 7270 | return; |
7385 | } | 7271 | } |
7386 | 7272 | ||
@@ -7429,15 +7315,15 @@ lpfc_sli4_hba_unset(struct lpfc_hba *phba) | |||
7429 | spin_unlock_irq(&phba->hbalock); | 7315 | spin_unlock_irq(&phba->hbalock); |
7430 | } | 7316 | } |
7431 | 7317 | ||
7432 | /* Tear down the queues in the HBA */ | ||
7433 | lpfc_sli4_queue_unset(phba); | ||
7434 | |||
7435 | /* Disable PCI subsystem interrupt */ | 7318 | /* Disable PCI subsystem interrupt */ |
7436 | lpfc_sli4_disable_intr(phba); | 7319 | lpfc_sli4_disable_intr(phba); |
7437 | 7320 | ||
7438 | /* Stop kthread signal shall trigger work_done one more time */ | 7321 | /* Stop kthread signal shall trigger work_done one more time */ |
7439 | kthread_stop(phba->worker_thread); | 7322 | kthread_stop(phba->worker_thread); |
7440 | 7323 | ||
7324 | /* Reset SLI4 HBA FCoE function */ | ||
7325 | lpfc_pci_function_reset(phba); | ||
7326 | |||
7441 | /* Stop the SLI4 device port */ | 7327 | /* Stop the SLI4 device port */ |
7442 | phba->pport->work_port_events = 0; | 7328 | phba->pport->work_port_events = 0; |
7443 | } | 7329 | } |
@@ -8373,7 +8259,7 @@ lpfc_pci_remove_one_s4(struct pci_dev *pdev) | |||
8373 | list_del_init(&vport->listentry); | 8259 | list_del_init(&vport->listentry); |
8374 | spin_unlock_irq(&phba->hbalock); | 8260 | spin_unlock_irq(&phba->hbalock); |
8375 | 8261 | ||
8376 | /* Call scsi_free before lpfc_sli4_driver_resource_unset since scsi | 8262 | /* Perform scsi free before driver resource_unset since scsi |
8377 | * buffers are released to their corresponding pools here. | 8263 | * buffers are released to their corresponding pools here. |
8378 | */ | 8264 | */ |
8379 | lpfc_scsi_free(phba); | 8265 | lpfc_scsi_free(phba); |