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 | |
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')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 132 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 76 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 2 |
3 files changed, 9 insertions, 201 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); |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 34dd87f542c2..0d1e187b005d 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -6930,37 +6930,6 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
6930 | } | 6930 | } |
6931 | 6931 | ||
6932 | /** | 6932 | /** |
6933 | * lpfc_sli4_hba_down - PCI function resource cleanup for the SLI4 HBA | ||
6934 | * @phba: Pointer to HBA context object. | ||
6935 | * | ||
6936 | * This function cleans up all queues, iocb, buffers, mailbox commands while | ||
6937 | * shutting down the SLI4 HBA FCoE function. This function is called with no | ||
6938 | * lock held and always returns 1. | ||
6939 | * | ||
6940 | * This function does the following to cleanup driver FCoE function resources: | ||
6941 | * - Free discovery resources for each virtual port | ||
6942 | * - Cleanup any pending fabric iocbs | ||
6943 | * - Iterate through the iocb txq and free each entry in the list. | ||
6944 | * - Free up any buffer posted to the HBA. | ||
6945 | * - Clean up all the queue entries: WQ, RQ, MQ, EQ, CQ, etc. | ||
6946 | * - Free mailbox commands in the mailbox queue. | ||
6947 | **/ | ||
6948 | int | ||
6949 | lpfc_sli4_hba_down(struct lpfc_hba *phba) | ||
6950 | { | ||
6951 | /* Stop the SLI4 device port */ | ||
6952 | lpfc_stop_port(phba); | ||
6953 | |||
6954 | /* Tear down the queues in the HBA */ | ||
6955 | lpfc_sli4_queue_unset(phba); | ||
6956 | |||
6957 | /* unregister default FCFI from the HBA */ | ||
6958 | lpfc_sli4_fcfi_unreg(phba, phba->fcf.fcfi); | ||
6959 | |||
6960 | return 1; | ||
6961 | } | ||
6962 | |||
6963 | /** | ||
6964 | * lpfc_sli_pcimem_bcopy - SLI memory copy function | 6933 | * lpfc_sli_pcimem_bcopy - SLI memory copy function |
6965 | * @srcp: Source memory pointer. | 6934 | * @srcp: Source memory pointer. |
6966 | * @destp: Destination memory pointer. | 6935 | * @destp: Destination memory pointer. |
@@ -10788,51 +10757,6 @@ lpfc_sli4_post_sgl(struct lpfc_hba *phba, | |||
10788 | } | 10757 | } |
10789 | return 0; | 10758 | return 0; |
10790 | } | 10759 | } |
10791 | /** | ||
10792 | * lpfc_sli4_remove_all_sgl_pages - Post scatter gather list for an XRI to HBA | ||
10793 | * @phba: The virtual port for which this call being executed. | ||
10794 | * | ||
10795 | * This routine will remove all of the sgl pages registered with the hba. | ||
10796 | * | ||
10797 | * Return codes: | ||
10798 | * 0 - Success | ||
10799 | * -ENXIO, -ENOMEM - Failure | ||
10800 | **/ | ||
10801 | int | ||
10802 | lpfc_sli4_remove_all_sgl_pages(struct lpfc_hba *phba) | ||
10803 | { | ||
10804 | LPFC_MBOXQ_t *mbox; | ||
10805 | int rc; | ||
10806 | uint32_t shdr_status, shdr_add_status; | ||
10807 | union lpfc_sli4_cfg_shdr *shdr; | ||
10808 | |||
10809 | mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
10810 | if (!mbox) | ||
10811 | return -ENOMEM; | ||
10812 | |||
10813 | lpfc_sli4_config(phba, mbox, LPFC_MBOX_SUBSYSTEM_FCOE, | ||
10814 | LPFC_MBOX_OPCODE_FCOE_REMOVE_SGL_PAGES, 0, | ||
10815 | LPFC_SLI4_MBX_EMBED); | ||
10816 | if (!phba->sli4_hba.intr_enable) | ||
10817 | rc = lpfc_sli_issue_mbox(phba, mbox, MBX_POLL); | ||
10818 | else | ||
10819 | rc = lpfc_sli_issue_mbox_wait(phba, mbox, LPFC_MBOX_TMO); | ||
10820 | /* The IOCTL status is embedded in the mailbox subheader. */ | ||
10821 | shdr = (union lpfc_sli4_cfg_shdr *) | ||
10822 | &mbox->u.mqe.un.sli4_config.header.cfg_shdr; | ||
10823 | shdr_status = bf_get(lpfc_mbox_hdr_status, &shdr->response); | ||
10824 | shdr_add_status = bf_get(lpfc_mbox_hdr_add_status, &shdr->response); | ||
10825 | if (rc != MBX_TIMEOUT) | ||
10826 | mempool_free(mbox, phba->mbox_mem_pool); | ||
10827 | if (shdr_status || shdr_add_status || rc) { | ||
10828 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
10829 | "2512 REMOVE_ALL_SGL_PAGES mailbox failed with " | ||
10830 | "status x%x add_status x%x, mbx status x%x\n", | ||
10831 | shdr_status, shdr_add_status, rc); | ||
10832 | rc = -ENXIO; | ||
10833 | } | ||
10834 | return rc; | ||
10835 | } | ||
10836 | 10760 | ||
10837 | /** | 10761 | /** |
10838 | * lpfc_sli4_next_xritag - Get an xritag for the io | 10762 | * lpfc_sli4_next_xritag - Get an xritag for the io |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index a3b24d99a2a7..a0ca572ec28b 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -481,7 +481,6 @@ struct lpfc_rpi_hdr { | |||
481 | */ | 481 | */ |
482 | int lpfc_pci_function_reset(struct lpfc_hba *); | 482 | int lpfc_pci_function_reset(struct lpfc_hba *); |
483 | int lpfc_sli4_hba_setup(struct lpfc_hba *); | 483 | int lpfc_sli4_hba_setup(struct lpfc_hba *); |
484 | int lpfc_sli4_hba_down(struct lpfc_hba *); | ||
485 | int lpfc_sli4_config(struct lpfc_hba *, struct lpfcMboxq *, uint8_t, | 484 | int lpfc_sli4_config(struct lpfc_hba *, struct lpfcMboxq *, uint8_t, |
486 | uint8_t, uint32_t, bool); | 485 | uint8_t, uint32_t, bool); |
487 | void lpfc_sli4_mbox_cmd_free(struct lpfc_hba *, struct lpfcMboxq *); | 486 | void lpfc_sli4_mbox_cmd_free(struct lpfc_hba *, struct lpfcMboxq *); |
@@ -514,7 +513,6 @@ int lpfc_sli4_queue_setup(struct lpfc_hba *); | |||
514 | void lpfc_sli4_queue_unset(struct lpfc_hba *); | 513 | void lpfc_sli4_queue_unset(struct lpfc_hba *); |
515 | int lpfc_sli4_post_sgl(struct lpfc_hba *, dma_addr_t, dma_addr_t, uint16_t); | 514 | int lpfc_sli4_post_sgl(struct lpfc_hba *, dma_addr_t, dma_addr_t, uint16_t); |
516 | int lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *); | 515 | int lpfc_sli4_repost_scsi_sgl_list(struct lpfc_hba *); |
517 | int lpfc_sli4_remove_all_sgl_pages(struct lpfc_hba *); | ||
518 | uint16_t lpfc_sli4_next_xritag(struct lpfc_hba *); | 516 | uint16_t lpfc_sli4_next_xritag(struct lpfc_hba *); |
519 | int lpfc_sli4_post_async_mbox(struct lpfc_hba *); | 517 | int lpfc_sli4_post_async_mbox(struct lpfc_hba *); |
520 | int lpfc_sli4_post_sgl_list(struct lpfc_hba *phba); | 518 | int lpfc_sli4_post_sgl_list(struct lpfc_hba *phba); |