diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 401 |
1 files changed, 234 insertions, 167 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index a36a120561e2..eb5c75c45ba4 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -68,7 +68,7 @@ typedef enum _lpfc_iocb_type { | |||
68 | } lpfc_iocb_type; | 68 | } lpfc_iocb_type; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * lpfc_cmd_iocb: Get next command iocb entry in the ring. | 71 | * lpfc_cmd_iocb - Get next command iocb entry in the ring |
72 | * @phba: Pointer to HBA context object. | 72 | * @phba: Pointer to HBA context object. |
73 | * @pring: Pointer to driver SLI ring object. | 73 | * @pring: Pointer to driver SLI ring object. |
74 | * | 74 | * |
@@ -85,7 +85,7 @@ lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * lpfc_resp_iocb: Get next response iocb entry in the ring. | 88 | * lpfc_resp_iocb - Get next response iocb entry in the ring |
89 | * @phba: Pointer to HBA context object. | 89 | * @phba: Pointer to HBA context object. |
90 | * @pring: Pointer to driver SLI ring object. | 90 | * @pring: Pointer to driver SLI ring object. |
91 | * | 91 | * |
@@ -102,7 +102,7 @@ lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * __lpfc_sli_get_iocbq: Allocates an iocb object from iocb pool. | 105 | * __lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool |
106 | * @phba: Pointer to HBA context object. | 106 | * @phba: Pointer to HBA context object. |
107 | * | 107 | * |
108 | * This function is called with hbalock held. This function | 108 | * This function is called with hbalock held. This function |
@@ -121,7 +121,7 @@ __lpfc_sli_get_iocbq(struct lpfc_hba *phba) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * lpfc_sli_get_iocbq: Allocates an iocb object from iocb pool. | 124 | * lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool |
125 | * @phba: Pointer to HBA context object. | 125 | * @phba: Pointer to HBA context object. |
126 | * | 126 | * |
127 | * This function is called with no lock held. This function | 127 | * This function is called with no lock held. This function |
@@ -142,7 +142,7 @@ lpfc_sli_get_iocbq(struct lpfc_hba *phba) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * __lpfc_sli_release_iocbq: Release iocb to the iocb pool. | 145 | * __lpfc_sli_release_iocbq - Release iocb to the iocb pool |
146 | * @phba: Pointer to HBA context object. | 146 | * @phba: Pointer to HBA context object. |
147 | * @iocbq: Pointer to driver iocb object. | 147 | * @iocbq: Pointer to driver iocb object. |
148 | * | 148 | * |
@@ -164,7 +164,7 @@ __lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | /** | 166 | /** |
167 | * lpfc_sli_release_iocbq: Release iocb to the iocb pool. | 167 | * lpfc_sli_release_iocbq - Release iocb to the iocb pool |
168 | * @phba: Pointer to HBA context object. | 168 | * @phba: Pointer to HBA context object. |
169 | * @iocbq: Pointer to driver iocb object. | 169 | * @iocbq: Pointer to driver iocb object. |
170 | * | 170 | * |
@@ -185,8 +185,40 @@ lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | /** | 187 | /** |
188 | * lpfc_sli_iocb_cmd_type: Get the iocb type. | 188 | * lpfc_sli_cancel_iocbs - Cancel all iocbs from a list. |
189 | * @iocb_cmnd : iocb command code. | 189 | * @phba: Pointer to HBA context object. |
190 | * @iocblist: List of IOCBs. | ||
191 | * @ulpstatus: ULP status in IOCB command field. | ||
192 | * @ulpWord4: ULP word-4 in IOCB command field. | ||
193 | * | ||
194 | * This function is called with a list of IOCBs to cancel. It cancels the IOCB | ||
195 | * on the list by invoking the complete callback function associated with the | ||
196 | * IOCB with the provided @ulpstatus and @ulpword4 set to the IOCB commond | ||
197 | * fields. | ||
198 | **/ | ||
199 | void | ||
200 | lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head *iocblist, | ||
201 | uint32_t ulpstatus, uint32_t ulpWord4) | ||
202 | { | ||
203 | struct lpfc_iocbq *piocb; | ||
204 | |||
205 | while (!list_empty(iocblist)) { | ||
206 | list_remove_head(iocblist, piocb, struct lpfc_iocbq, list); | ||
207 | |||
208 | if (!piocb->iocb_cmpl) | ||
209 | lpfc_sli_release_iocbq(phba, piocb); | ||
210 | else { | ||
211 | piocb->iocb.ulpStatus = ulpstatus; | ||
212 | piocb->iocb.un.ulpWord[4] = ulpWord4; | ||
213 | (piocb->iocb_cmpl) (phba, piocb, piocb); | ||
214 | } | ||
215 | } | ||
216 | return; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * lpfc_sli_iocb_cmd_type - Get the iocb type | ||
221 | * @iocb_cmnd: iocb command code. | ||
190 | * | 222 | * |
191 | * This function is called by ring event handler function to get the iocb type. | 223 | * This function is called by ring event handler function to get the iocb type. |
192 | * This function translates the iocb command to an iocb command type used to | 224 | * This function translates the iocb command to an iocb command type used to |
@@ -295,7 +327,7 @@ lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd) | |||
295 | } | 327 | } |
296 | 328 | ||
297 | /** | 329 | /** |
298 | * lpfc_sli_ring_map: Issue config_ring mbox for all rings. | 330 | * lpfc_sli_ring_map - Issue config_ring mbox for all rings |
299 | * @phba: Pointer to HBA context object. | 331 | * @phba: Pointer to HBA context object. |
300 | * | 332 | * |
301 | * This function is called from SLI initialization code | 333 | * This function is called from SLI initialization code |
@@ -338,7 +370,7 @@ lpfc_sli_ring_map(struct lpfc_hba *phba) | |||
338 | } | 370 | } |
339 | 371 | ||
340 | /** | 372 | /** |
341 | * lpfc_sli_ringtxcmpl_put: Adds new iocb to the txcmplq. | 373 | * lpfc_sli_ringtxcmpl_put - Adds new iocb to the txcmplq |
342 | * @phba: Pointer to HBA context object. | 374 | * @phba: Pointer to HBA context object. |
343 | * @pring: Pointer to driver SLI ring object. | 375 | * @pring: Pointer to driver SLI ring object. |
344 | * @piocb: Pointer to the driver iocb object. | 376 | * @piocb: Pointer to the driver iocb object. |
@@ -370,7 +402,7 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
370 | } | 402 | } |
371 | 403 | ||
372 | /** | 404 | /** |
373 | * lpfc_sli_ringtx_get: Get first element of the txq. | 405 | * lpfc_sli_ringtx_get - Get first element of the txq |
374 | * @phba: Pointer to HBA context object. | 406 | * @phba: Pointer to HBA context object. |
375 | * @pring: Pointer to driver SLI ring object. | 407 | * @pring: Pointer to driver SLI ring object. |
376 | * | 408 | * |
@@ -391,7 +423,7 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
391 | } | 423 | } |
392 | 424 | ||
393 | /** | 425 | /** |
394 | * lpfc_sli_next_iocb_slot: Get next iocb slot in the ring. | 426 | * lpfc_sli_next_iocb_slot - Get next iocb slot in the ring |
395 | * @phba: Pointer to HBA context object. | 427 | * @phba: Pointer to HBA context object. |
396 | * @pring: Pointer to driver SLI ring object. | 428 | * @pring: Pointer to driver SLI ring object. |
397 | * | 429 | * |
@@ -445,7 +477,7 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
445 | } | 477 | } |
446 | 478 | ||
447 | /** | 479 | /** |
448 | * lpfc_sli_next_iotag: Get an iotag for the iocb. | 480 | * lpfc_sli_next_iotag - Get an iotag for the iocb |
449 | * @phba: Pointer to HBA context object. | 481 | * @phba: Pointer to HBA context object. |
450 | * @iocbq: Pointer to driver iocb object. | 482 | * @iocbq: Pointer to driver iocb object. |
451 | * | 483 | * |
@@ -520,7 +552,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
520 | } | 552 | } |
521 | 553 | ||
522 | /** | 554 | /** |
523 | * lpfc_sli_submit_iocb: Submit an iocb to the firmware. | 555 | * lpfc_sli_submit_iocb - Submit an iocb to the firmware |
524 | * @phba: Pointer to HBA context object. | 556 | * @phba: Pointer to HBA context object. |
525 | * @pring: Pointer to driver SLI ring object. | 557 | * @pring: Pointer to driver SLI ring object. |
526 | * @iocb: Pointer to iocb slot in the ring. | 558 | * @iocb: Pointer to iocb slot in the ring. |
@@ -577,7 +609,7 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
577 | } | 609 | } |
578 | 610 | ||
579 | /** | 611 | /** |
580 | * lpfc_sli_update_full_ring: Update the chip attention register. | 612 | * lpfc_sli_update_full_ring - Update the chip attention register |
581 | * @phba: Pointer to HBA context object. | 613 | * @phba: Pointer to HBA context object. |
582 | * @pring: Pointer to driver SLI ring object. | 614 | * @pring: Pointer to driver SLI ring object. |
583 | * | 615 | * |
@@ -608,7 +640,7 @@ lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
608 | } | 640 | } |
609 | 641 | ||
610 | /** | 642 | /** |
611 | * lpfc_sli_update_ring: Update chip attention register. | 643 | * lpfc_sli_update_ring - Update chip attention register |
612 | * @phba: Pointer to HBA context object. | 644 | * @phba: Pointer to HBA context object. |
613 | * @pring: Pointer to driver SLI ring object. | 645 | * @pring: Pointer to driver SLI ring object. |
614 | * | 646 | * |
@@ -632,7 +664,7 @@ lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
632 | } | 664 | } |
633 | 665 | ||
634 | /** | 666 | /** |
635 | * lpfc_sli_resume_iocb: Process iocbs in the txq. | 667 | * lpfc_sli_resume_iocb - Process iocbs in the txq |
636 | * @phba: Pointer to HBA context object. | 668 | * @phba: Pointer to HBA context object. |
637 | * @pring: Pointer to driver SLI ring object. | 669 | * @pring: Pointer to driver SLI ring object. |
638 | * | 670 | * |
@@ -672,7 +704,7 @@ lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
672 | } | 704 | } |
673 | 705 | ||
674 | /** | 706 | /** |
675 | * lpfc_sli_next_hbq_slot: Get next hbq entry for the HBQ. | 707 | * lpfc_sli_next_hbq_slot - Get next hbq entry for the HBQ |
676 | * @phba: Pointer to HBA context object. | 708 | * @phba: Pointer to HBA context object. |
677 | * @hbqno: HBQ number. | 709 | * @hbqno: HBQ number. |
678 | * | 710 | * |
@@ -717,7 +749,7 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno) | |||
717 | } | 749 | } |
718 | 750 | ||
719 | /** | 751 | /** |
720 | * lpfc_sli_hbqbuf_free_all: Free all the hbq buffers. | 752 | * lpfc_sli_hbqbuf_free_all - Free all the hbq buffers |
721 | * @phba: Pointer to HBA context object. | 753 | * @phba: Pointer to HBA context object. |
722 | * | 754 | * |
723 | * This function is called with no lock held to free all the | 755 | * This function is called with no lock held to free all the |
@@ -771,7 +803,7 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba) | |||
771 | } | 803 | } |
772 | 804 | ||
773 | /** | 805 | /** |
774 | * lpfc_sli_hbq_to_firmware: Post the hbq buffer to firmware. | 806 | * lpfc_sli_hbq_to_firmware - Post the hbq buffer to firmware |
775 | * @phba: Pointer to HBA context object. | 807 | * @phba: Pointer to HBA context object. |
776 | * @hbqno: HBQ number. | 808 | * @hbqno: HBQ number. |
777 | * @hbq_buf: Pointer to HBQ buffer. | 809 | * @hbq_buf: Pointer to HBQ buffer. |
@@ -818,8 +850,8 @@ static struct lpfc_hbq_init lpfc_els_hbq = { | |||
818 | .profile = 0, | 850 | .profile = 0, |
819 | .ring_mask = (1 << LPFC_ELS_RING), | 851 | .ring_mask = (1 << LPFC_ELS_RING), |
820 | .buffer_count = 0, | 852 | .buffer_count = 0, |
821 | .init_count = 20, | 853 | .init_count = 40, |
822 | .add_count = 5, | 854 | .add_count = 40, |
823 | }; | 855 | }; |
824 | 856 | ||
825 | /* HBQ for the extra ring if needed */ | 857 | /* HBQ for the extra ring if needed */ |
@@ -841,7 +873,7 @@ struct lpfc_hbq_init *lpfc_hbq_defs[] = { | |||
841 | }; | 873 | }; |
842 | 874 | ||
843 | /** | 875 | /** |
844 | * lpfc_sli_hbqbuf_fill_hbqs: Post more hbq buffers to HBQ. | 876 | * lpfc_sli_hbqbuf_fill_hbqs - Post more hbq buffers to HBQ |
845 | * @phba: Pointer to HBA context object. | 877 | * @phba: Pointer to HBA context object. |
846 | * @hbqno: HBQ number. | 878 | * @hbqno: HBQ number. |
847 | * @count: Number of HBQ buffers to be posted. | 879 | * @count: Number of HBQ buffers to be posted. |
@@ -901,7 +933,7 @@ err: | |||
901 | } | 933 | } |
902 | 934 | ||
903 | /** | 935 | /** |
904 | * lpfc_sli_hbqbuf_add_hbqs: Post more HBQ buffers to firmware. | 936 | * lpfc_sli_hbqbuf_add_hbqs - Post more HBQ buffers to firmware |
905 | * @phba: Pointer to HBA context object. | 937 | * @phba: Pointer to HBA context object. |
906 | * @qno: HBQ number. | 938 | * @qno: HBQ number. |
907 | * | 939 | * |
@@ -917,7 +949,7 @@ lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno) | |||
917 | } | 949 | } |
918 | 950 | ||
919 | /** | 951 | /** |
920 | * lpfc_sli_hbqbuf_init_hbqs: Post initial buffers to the HBQ. | 952 | * lpfc_sli_hbqbuf_init_hbqs - Post initial buffers to the HBQ |
921 | * @phba: Pointer to HBA context object. | 953 | * @phba: Pointer to HBA context object. |
922 | * @qno: HBQ queue number. | 954 | * @qno: HBQ queue number. |
923 | * | 955 | * |
@@ -933,7 +965,7 @@ lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno) | |||
933 | } | 965 | } |
934 | 966 | ||
935 | /** | 967 | /** |
936 | * lpfc_sli_hbqbuf_find: Find the hbq buffer associated with a tag. | 968 | * lpfc_sli_hbqbuf_find - Find the hbq buffer associated with a tag |
937 | * @phba: Pointer to HBA context object. | 969 | * @phba: Pointer to HBA context object. |
938 | * @tag: Tag of the hbq buffer. | 970 | * @tag: Tag of the hbq buffer. |
939 | * | 971 | * |
@@ -966,7 +998,7 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag) | |||
966 | } | 998 | } |
967 | 999 | ||
968 | /** | 1000 | /** |
969 | * lpfc_sli_free_hbq: Give back the hbq buffer to firmware. | 1001 | * lpfc_sli_free_hbq - Give back the hbq buffer to firmware |
970 | * @phba: Pointer to HBA context object. | 1002 | * @phba: Pointer to HBA context object. |
971 | * @hbq_buffer: Pointer to HBQ buffer. | 1003 | * @hbq_buffer: Pointer to HBQ buffer. |
972 | * | 1004 | * |
@@ -988,7 +1020,7 @@ lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer) | |||
988 | } | 1020 | } |
989 | 1021 | ||
990 | /** | 1022 | /** |
991 | * lpfc_sli_chk_mbx_command: Check if the mailbox is a legitimate mailbox. | 1023 | * lpfc_sli_chk_mbx_command - Check if the mailbox is a legitimate mailbox |
992 | * @mbxCommand: mailbox command code. | 1024 | * @mbxCommand: mailbox command code. |
993 | * | 1025 | * |
994 | * This function is called by the mailbox event handler function to verify | 1026 | * This function is called by the mailbox event handler function to verify |
@@ -1064,8 +1096,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand) | |||
1064 | } | 1096 | } |
1065 | 1097 | ||
1066 | /** | 1098 | /** |
1067 | * lpfc_sli_wake_mbox_wait: Completion handler for mbox issued from | 1099 | * lpfc_sli_wake_mbox_wait - lpfc_sli_issue_mbox_wait mbox completion handler |
1068 | * lpfc_sli_issue_mbox_wait. | ||
1069 | * @phba: Pointer to HBA context object. | 1100 | * @phba: Pointer to HBA context object. |
1070 | * @pmboxq: Pointer to mailbox command. | 1101 | * @pmboxq: Pointer to mailbox command. |
1071 | * | 1102 | * |
@@ -1096,7 +1127,7 @@ lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq) | |||
1096 | 1127 | ||
1097 | 1128 | ||
1098 | /** | 1129 | /** |
1099 | * lpfc_sli_def_mbox_cmpl: Default mailbox completion handler. | 1130 | * lpfc_sli_def_mbox_cmpl - Default mailbox completion handler |
1100 | * @phba: Pointer to HBA context object. | 1131 | * @phba: Pointer to HBA context object. |
1101 | * @pmb: Pointer to mailbox object. | 1132 | * @pmb: Pointer to mailbox object. |
1102 | * | 1133 | * |
@@ -1140,7 +1171,7 @@ lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1140 | } | 1171 | } |
1141 | 1172 | ||
1142 | /** | 1173 | /** |
1143 | * lpfc_sli_handle_mb_event: Handle mailbox completions from firmware. | 1174 | * lpfc_sli_handle_mb_event - Handle mailbox completions from firmware |
1144 | * @phba: Pointer to HBA context object. | 1175 | * @phba: Pointer to HBA context object. |
1145 | * | 1176 | * |
1146 | * This function is called with no lock held. This function processes all | 1177 | * This function is called with no lock held. This function processes all |
@@ -1260,7 +1291,7 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba) | |||
1260 | } | 1291 | } |
1261 | 1292 | ||
1262 | /** | 1293 | /** |
1263 | * lpfc_sli_get_buff: Get the buffer associated with the buffer tag. | 1294 | * lpfc_sli_get_buff - Get the buffer associated with the buffer tag |
1264 | * @phba: Pointer to HBA context object. | 1295 | * @phba: Pointer to HBA context object. |
1265 | * @pring: Pointer to driver SLI ring object. | 1296 | * @pring: Pointer to driver SLI ring object. |
1266 | * @tag: buffer tag. | 1297 | * @tag: buffer tag. |
@@ -1288,7 +1319,7 @@ lpfc_sli_get_buff(struct lpfc_hba *phba, | |||
1288 | 1319 | ||
1289 | 1320 | ||
1290 | /** | 1321 | /** |
1291 | * lpfc_sli_process_unsol_iocb: Unsolicited iocb handler. | 1322 | * lpfc_sli_process_unsol_iocb - Unsolicited iocb handler |
1292 | * @phba: Pointer to HBA context object. | 1323 | * @phba: Pointer to HBA context object. |
1293 | * @pring: Pointer to driver SLI ring object. | 1324 | * @pring: Pointer to driver SLI ring object. |
1294 | * @saveq: Pointer to the unsolicited iocb. | 1325 | * @saveq: Pointer to the unsolicited iocb. |
@@ -1484,7 +1515,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1484 | } | 1515 | } |
1485 | 1516 | ||
1486 | /** | 1517 | /** |
1487 | * lpfc_sli_iocbq_lookup: Find command iocb for the given response iocb. | 1518 | * lpfc_sli_iocbq_lookup - Find command iocb for the given response iocb |
1488 | * @phba: Pointer to HBA context object. | 1519 | * @phba: Pointer to HBA context object. |
1489 | * @pring: Pointer to driver SLI ring object. | 1520 | * @pring: Pointer to driver SLI ring object. |
1490 | * @prspiocb: Pointer to response iocb object. | 1521 | * @prspiocb: Pointer to response iocb object. |
@@ -1521,7 +1552,7 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
1521 | } | 1552 | } |
1522 | 1553 | ||
1523 | /** | 1554 | /** |
1524 | * lpfc_sli_process_sol_iocb: process solicited iocb completion. | 1555 | * lpfc_sli_process_sol_iocb - process solicited iocb completion |
1525 | * @phba: Pointer to HBA context object. | 1556 | * @phba: Pointer to HBA context object. |
1526 | * @pring: Pointer to driver SLI ring object. | 1557 | * @pring: Pointer to driver SLI ring object. |
1527 | * @saveq: Pointer to the response iocb to be processed. | 1558 | * @saveq: Pointer to the response iocb to be processed. |
@@ -1597,7 +1628,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1597 | * Ring <ringno> handler: unexpected completion IoTag | 1628 | * Ring <ringno> handler: unexpected completion IoTag |
1598 | * <IoTag> | 1629 | * <IoTag> |
1599 | */ | 1630 | */ |
1600 | lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI, | 1631 | lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, |
1601 | "0322 Ring %d handler: " | 1632 | "0322 Ring %d handler: " |
1602 | "unexpected completion IoTag x%x " | 1633 | "unexpected completion IoTag x%x " |
1603 | "Data: x%x x%x x%x x%x\n", | 1634 | "Data: x%x x%x x%x x%x\n", |
@@ -1614,7 +1645,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1614 | } | 1645 | } |
1615 | 1646 | ||
1616 | /** | 1647 | /** |
1617 | * lpfc_sli_rsp_pointers_error: Response ring pointer error handler. | 1648 | * lpfc_sli_rsp_pointers_error - Response ring pointer error handler |
1618 | * @phba: Pointer to HBA context object. | 1649 | * @phba: Pointer to HBA context object. |
1619 | * @pring: Pointer to driver SLI ring object. | 1650 | * @pring: Pointer to driver SLI ring object. |
1620 | * | 1651 | * |
@@ -1652,7 +1683,7 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1652 | } | 1683 | } |
1653 | 1684 | ||
1654 | /** | 1685 | /** |
1655 | * lpfc_poll_eratt: Error attention polling timer timeout handler. | 1686 | * lpfc_poll_eratt - Error attention polling timer timeout handler |
1656 | * @ptr: Pointer to address of HBA context object. | 1687 | * @ptr: Pointer to address of HBA context object. |
1657 | * | 1688 | * |
1658 | * This function is invoked by the Error Attention polling timer when the | 1689 | * This function is invoked by the Error Attention polling timer when the |
@@ -1682,7 +1713,7 @@ void lpfc_poll_eratt(unsigned long ptr) | |||
1682 | } | 1713 | } |
1683 | 1714 | ||
1684 | /** | 1715 | /** |
1685 | * lpfc_sli_poll_fcp_ring: Handle FCP ring completion in polling mode. | 1716 | * lpfc_sli_poll_fcp_ring - Handle FCP ring completion in polling mode |
1686 | * @phba: Pointer to HBA context object. | 1717 | * @phba: Pointer to HBA context object. |
1687 | * | 1718 | * |
1688 | * This function is called from lpfc_queuecommand, lpfc_poll_timeout, | 1719 | * This function is called from lpfc_queuecommand, lpfc_poll_timeout, |
@@ -1845,7 +1876,7 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1845 | } | 1876 | } |
1846 | 1877 | ||
1847 | /** | 1878 | /** |
1848 | * lpfc_sli_handle_fast_ring_event: Handle ring events on FCP ring. | 1879 | * lpfc_sli_handle_fast_ring_event - Handle ring events on FCP ring |
1849 | * @phba: Pointer to HBA context object. | 1880 | * @phba: Pointer to HBA context object. |
1850 | * @pring: Pointer to driver SLI ring object. | 1881 | * @pring: Pointer to driver SLI ring object. |
1851 | * @mask: Host attention register mask for this ring. | 1882 | * @mask: Host attention register mask for this ring. |
@@ -2037,7 +2068,7 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
2037 | } | 2068 | } |
2038 | 2069 | ||
2039 | /** | 2070 | /** |
2040 | * lpfc_sli_handle_slow_ring_event: Handle ring events for non-FCP rings. | 2071 | * lpfc_sli_handle_slow_ring_event - Handle ring events for non-FCP rings |
2041 | * @phba: Pointer to HBA context object. | 2072 | * @phba: Pointer to HBA context object. |
2042 | * @pring: Pointer to driver SLI ring object. | 2073 | * @pring: Pointer to driver SLI ring object. |
2043 | * @mask: Host attention register mask for this ring. | 2074 | * @mask: Host attention register mask for this ring. |
@@ -2311,7 +2342,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
2311 | } | 2342 | } |
2312 | 2343 | ||
2313 | /** | 2344 | /** |
2314 | * lpfc_sli_abort_iocb_ring: Abort all iocbs in the ring. | 2345 | * lpfc_sli_abort_iocb_ring - Abort all iocbs in the ring |
2315 | * @phba: Pointer to HBA context object. | 2346 | * @phba: Pointer to HBA context object. |
2316 | * @pring: Pointer to driver SLI ring object. | 2347 | * @pring: Pointer to driver SLI ring object. |
2317 | * | 2348 | * |
@@ -2325,7 +2356,6 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
2325 | { | 2356 | { |
2326 | LIST_HEAD(completions); | 2357 | LIST_HEAD(completions); |
2327 | struct lpfc_iocbq *iocb, *next_iocb; | 2358 | struct lpfc_iocbq *iocb, *next_iocb; |
2328 | IOCB_t *cmd = NULL; | ||
2329 | 2359 | ||
2330 | if (pring->ringno == LPFC_ELS_RING) { | 2360 | if (pring->ringno == LPFC_ELS_RING) { |
2331 | lpfc_fabric_abort_hba(phba); | 2361 | lpfc_fabric_abort_hba(phba); |
@@ -2344,23 +2374,13 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
2344 | 2374 | ||
2345 | spin_unlock_irq(&phba->hbalock); | 2375 | spin_unlock_irq(&phba->hbalock); |
2346 | 2376 | ||
2347 | while (!list_empty(&completions)) { | 2377 | /* Cancel all the IOCBs from the completions list */ |
2348 | iocb = list_get_first(&completions, struct lpfc_iocbq, list); | 2378 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, |
2349 | cmd = &iocb->iocb; | 2379 | IOERR_SLI_ABORTED); |
2350 | list_del_init(&iocb->list); | ||
2351 | |||
2352 | if (!iocb->iocb_cmpl) | ||
2353 | lpfc_sli_release_iocbq(phba, iocb); | ||
2354 | else { | ||
2355 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2356 | cmd->un.ulpWord[4] = IOERR_SLI_ABORTED; | ||
2357 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
2358 | } | ||
2359 | } | ||
2360 | } | 2380 | } |
2361 | 2381 | ||
2362 | /** | 2382 | /** |
2363 | * lpfc_sli_flush_fcp_rings: flush all iocbs in the fcp ring. | 2383 | * lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring |
2364 | * @phba: Pointer to HBA context object. | 2384 | * @phba: Pointer to HBA context object. |
2365 | * | 2385 | * |
2366 | * This function flushes all iocbs in the fcp ring and frees all the iocb | 2386 | * This function flushes all iocbs in the fcp ring and frees all the iocb |
@@ -2374,8 +2394,6 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba) | |||
2374 | { | 2394 | { |
2375 | LIST_HEAD(txq); | 2395 | LIST_HEAD(txq); |
2376 | LIST_HEAD(txcmplq); | 2396 | LIST_HEAD(txcmplq); |
2377 | struct lpfc_iocbq *iocb; | ||
2378 | IOCB_t *cmd = NULL; | ||
2379 | struct lpfc_sli *psli = &phba->sli; | 2397 | struct lpfc_sli *psli = &phba->sli; |
2380 | struct lpfc_sli_ring *pring; | 2398 | struct lpfc_sli_ring *pring; |
2381 | 2399 | ||
@@ -2393,38 +2411,16 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba) | |||
2393 | spin_unlock_irq(&phba->hbalock); | 2411 | spin_unlock_irq(&phba->hbalock); |
2394 | 2412 | ||
2395 | /* Flush the txq */ | 2413 | /* Flush the txq */ |
2396 | while (!list_empty(&txq)) { | 2414 | lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, |
2397 | iocb = list_get_first(&txq, struct lpfc_iocbq, list); | 2415 | IOERR_SLI_DOWN); |
2398 | cmd = &iocb->iocb; | ||
2399 | list_del_init(&iocb->list); | ||
2400 | |||
2401 | if (!iocb->iocb_cmpl) | ||
2402 | lpfc_sli_release_iocbq(phba, iocb); | ||
2403 | else { | ||
2404 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2405 | cmd->un.ulpWord[4] = IOERR_SLI_DOWN; | ||
2406 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
2407 | } | ||
2408 | } | ||
2409 | 2416 | ||
2410 | /* Flush the txcmpq */ | 2417 | /* Flush the txcmpq */ |
2411 | while (!list_empty(&txcmplq)) { | 2418 | lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, |
2412 | iocb = list_get_first(&txcmplq, struct lpfc_iocbq, list); | 2419 | IOERR_SLI_DOWN); |
2413 | cmd = &iocb->iocb; | ||
2414 | list_del_init(&iocb->list); | ||
2415 | |||
2416 | if (!iocb->iocb_cmpl) | ||
2417 | lpfc_sli_release_iocbq(phba, iocb); | ||
2418 | else { | ||
2419 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
2420 | cmd->un.ulpWord[4] = IOERR_SLI_DOWN; | ||
2421 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
2422 | } | ||
2423 | } | ||
2424 | } | 2420 | } |
2425 | 2421 | ||
2426 | /** | 2422 | /** |
2427 | * lpfc_sli_brdready: Check for host status bits. | 2423 | * lpfc_sli_brdready - Check for host status bits |
2428 | * @phba: Pointer to HBA context object. | 2424 | * @phba: Pointer to HBA context object. |
2429 | * @mask: Bit mask to be checked. | 2425 | * @mask: Bit mask to be checked. |
2430 | * | 2426 | * |
@@ -2484,7 +2480,7 @@ lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask) | |||
2484 | #define BARRIER_TEST_PATTERN (0xdeadbeef) | 2480 | #define BARRIER_TEST_PATTERN (0xdeadbeef) |
2485 | 2481 | ||
2486 | /** | 2482 | /** |
2487 | * lpfc_reset_barrier: Make HBA ready for HBA reset. | 2483 | * lpfc_reset_barrier - Make HBA ready for HBA reset |
2488 | * @phba: Pointer to HBA context object. | 2484 | * @phba: Pointer to HBA context object. |
2489 | * | 2485 | * |
2490 | * This function is called before resetting an HBA. This | 2486 | * This function is called before resetting an HBA. This |
@@ -2564,7 +2560,7 @@ restore_hc: | |||
2564 | } | 2560 | } |
2565 | 2561 | ||
2566 | /** | 2562 | /** |
2567 | * lpfc_sli_brdkill: Issue a kill_board mailbox command. | 2563 | * lpfc_sli_brdkill - Issue a kill_board mailbox command |
2568 | * @phba: Pointer to HBA context object. | 2564 | * @phba: Pointer to HBA context object. |
2569 | * | 2565 | * |
2570 | * This function issues a kill_board mailbox command and waits for | 2566 | * This function issues a kill_board mailbox command and waits for |
@@ -2651,7 +2647,7 @@ lpfc_sli_brdkill(struct lpfc_hba *phba) | |||
2651 | } | 2647 | } |
2652 | 2648 | ||
2653 | /** | 2649 | /** |
2654 | * lpfc_sli_brdreset: Reset the HBA. | 2650 | * lpfc_sli_brdreset - Reset the HBA |
2655 | * @phba: Pointer to HBA context object. | 2651 | * @phba: Pointer to HBA context object. |
2656 | * | 2652 | * |
2657 | * This function resets the HBA by writing HC_INITFF to the control | 2653 | * This function resets the HBA by writing HC_INITFF to the control |
@@ -2714,7 +2710,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba) | |||
2714 | } | 2710 | } |
2715 | 2711 | ||
2716 | /** | 2712 | /** |
2717 | * lpfc_sli_brdrestart: Restart the HBA. | 2713 | * lpfc_sli_brdrestart - Restart the HBA |
2718 | * @phba: Pointer to HBA context object. | 2714 | * @phba: Pointer to HBA context object. |
2719 | * | 2715 | * |
2720 | * This function is called in the SLI initialization code path to | 2716 | * This function is called in the SLI initialization code path to |
@@ -2781,7 +2777,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba) | |||
2781 | } | 2777 | } |
2782 | 2778 | ||
2783 | /** | 2779 | /** |
2784 | * lpfc_sli_chipset_init: Wait for the restart of the HBA after a restart. | 2780 | * lpfc_sli_chipset_init - Wait for the restart of the HBA after a restart |
2785 | * @phba: Pointer to HBA context object. | 2781 | * @phba: Pointer to HBA context object. |
2786 | * | 2782 | * |
2787 | * This function is called after a HBA restart to wait for successful | 2783 | * This function is called after a HBA restart to wait for successful |
@@ -2876,7 +2872,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba) | |||
2876 | } | 2872 | } |
2877 | 2873 | ||
2878 | /** | 2874 | /** |
2879 | * lpfc_sli_hbq_count: Get the number of HBQs to be configured. | 2875 | * lpfc_sli_hbq_count - Get the number of HBQs to be configured |
2880 | * | 2876 | * |
2881 | * This function calculates and returns the number of HBQs required to be | 2877 | * This function calculates and returns the number of HBQs required to be |
2882 | * configured. | 2878 | * configured. |
@@ -2888,7 +2884,7 @@ lpfc_sli_hbq_count(void) | |||
2888 | } | 2884 | } |
2889 | 2885 | ||
2890 | /** | 2886 | /** |
2891 | * lpfc_sli_hbq_entry_count: Calculate total number of hbq entries. | 2887 | * lpfc_sli_hbq_entry_count - Calculate total number of hbq entries |
2892 | * | 2888 | * |
2893 | * This function adds the number of hbq entries in every HBQ to get | 2889 | * This function adds the number of hbq entries in every HBQ to get |
2894 | * the total number of hbq entries required for the HBA and returns | 2890 | * the total number of hbq entries required for the HBA and returns |
@@ -2907,7 +2903,7 @@ lpfc_sli_hbq_entry_count(void) | |||
2907 | } | 2903 | } |
2908 | 2904 | ||
2909 | /** | 2905 | /** |
2910 | * lpfc_sli_hbq_size: Calculate memory required for all hbq entries. | 2906 | * lpfc_sli_hbq_size - Calculate memory required for all hbq entries |
2911 | * | 2907 | * |
2912 | * This function calculates amount of memory required for all hbq entries | 2908 | * This function calculates amount of memory required for all hbq entries |
2913 | * to be configured and returns the total memory required. | 2909 | * to be configured and returns the total memory required. |
@@ -2919,7 +2915,7 @@ lpfc_sli_hbq_size(void) | |||
2919 | } | 2915 | } |
2920 | 2916 | ||
2921 | /** | 2917 | /** |
2922 | * lpfc_sli_hbq_setup: configure and initialize HBQs. | 2918 | * lpfc_sli_hbq_setup - configure and initialize HBQs |
2923 | * @phba: Pointer to HBA context object. | 2919 | * @phba: Pointer to HBA context object. |
2924 | * | 2920 | * |
2925 | * This function is called during the SLI initialization to configure | 2921 | * This function is called during the SLI initialization to configure |
@@ -2988,7 +2984,7 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba) | |||
2988 | } | 2984 | } |
2989 | 2985 | ||
2990 | /** | 2986 | /** |
2991 | * lpfc_sli_config_port: Issue config port mailbox command. | 2987 | * lpfc_sli_config_port - Issue config port mailbox command |
2992 | * @phba: Pointer to HBA context object. | 2988 | * @phba: Pointer to HBA context object. |
2993 | * @sli_mode: sli mode - 2/3 | 2989 | * @sli_mode: sli mode - 2/3 |
2994 | * | 2990 | * |
@@ -3114,7 +3110,7 @@ do_prep_failed: | |||
3114 | 3110 | ||
3115 | 3111 | ||
3116 | /** | 3112 | /** |
3117 | * lpfc_sli_hba_setup: SLI intialization function. | 3113 | * lpfc_sli_hba_setup - SLI intialization function |
3118 | * @phba: Pointer to HBA context object. | 3114 | * @phba: Pointer to HBA context object. |
3119 | * | 3115 | * |
3120 | * This function is the main SLI intialization function. This function | 3116 | * This function is the main SLI intialization function. This function |
@@ -3206,7 +3202,7 @@ lpfc_sli_hba_setup_error: | |||
3206 | 3202 | ||
3207 | 3203 | ||
3208 | /** | 3204 | /** |
3209 | * lpfc_mbox_timeout: Timeout call back function for mbox timer. | 3205 | * lpfc_mbox_timeout - Timeout call back function for mbox timer |
3210 | * @ptr: context object - pointer to hba structure. | 3206 | * @ptr: context object - pointer to hba structure. |
3211 | * | 3207 | * |
3212 | * This is the callback function for mailbox timer. The mailbox | 3208 | * This is the callback function for mailbox timer. The mailbox |
@@ -3237,7 +3233,7 @@ lpfc_mbox_timeout(unsigned long ptr) | |||
3237 | 3233 | ||
3238 | 3234 | ||
3239 | /** | 3235 | /** |
3240 | * lpfc_mbox_timeout_handler: Worker thread function to handle mailbox timeout. | 3236 | * lpfc_mbox_timeout_handler - Worker thread function to handle mailbox timeout |
3241 | * @phba: Pointer to HBA context object. | 3237 | * @phba: Pointer to HBA context object. |
3242 | * | 3238 | * |
3243 | * This function is called from worker thread when a mailbox command times out. | 3239 | * This function is called from worker thread when a mailbox command times out. |
@@ -3252,6 +3248,21 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
3252 | struct lpfc_sli *psli = &phba->sli; | 3248 | struct lpfc_sli *psli = &phba->sli; |
3253 | struct lpfc_sli_ring *pring; | 3249 | struct lpfc_sli_ring *pring; |
3254 | 3250 | ||
3251 | /* Check the pmbox pointer first. There is a race condition | ||
3252 | * between the mbox timeout handler getting executed in the | ||
3253 | * worklist and the mailbox actually completing. When this | ||
3254 | * race condition occurs, the mbox_active will be NULL. | ||
3255 | */ | ||
3256 | spin_lock_irq(&phba->hbalock); | ||
3257 | if (pmbox == NULL) { | ||
3258 | lpfc_printf_log(phba, KERN_WARNING, | ||
3259 | LOG_MBOX | LOG_SLI, | ||
3260 | "0353 Active Mailbox cleared - mailbox timeout " | ||
3261 | "exiting\n"); | ||
3262 | spin_unlock_irq(&phba->hbalock); | ||
3263 | return; | ||
3264 | } | ||
3265 | |||
3255 | /* Mbox cmd <mbxCommand> timeout */ | 3266 | /* Mbox cmd <mbxCommand> timeout */ |
3256 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 3267 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
3257 | "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", | 3268 | "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n", |
@@ -3259,6 +3270,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
3259 | phba->pport->port_state, | 3270 | phba->pport->port_state, |
3260 | phba->sli.sli_flag, | 3271 | phba->sli.sli_flag, |
3261 | phba->sli.mbox_active); | 3272 | phba->sli.mbox_active); |
3273 | spin_unlock_irq(&phba->hbalock); | ||
3262 | 3274 | ||
3263 | /* Setting state unknown so lpfc_sli_abort_iocb_ring | 3275 | /* Setting state unknown so lpfc_sli_abort_iocb_ring |
3264 | * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing | 3276 | * would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing |
@@ -3295,7 +3307,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba) | |||
3295 | } | 3307 | } |
3296 | 3308 | ||
3297 | /** | 3309 | /** |
3298 | * lpfc_sli_issue_mbox: Issue a mailbox command to firmware. | 3310 | * lpfc_sli_issue_mbox - Issue a mailbox command to firmware |
3299 | * @phba: Pointer to HBA context object. | 3311 | * @phba: Pointer to HBA context object. |
3300 | * @pmbox: Pointer to mailbox object. | 3312 | * @pmbox: Pointer to mailbox object. |
3301 | * @flag: Flag indicating how the mailbox need to be processed. | 3313 | * @flag: Flag indicating how the mailbox need to be processed. |
@@ -3365,6 +3377,12 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag) | |||
3365 | goto out_not_finished; | 3377 | goto out_not_finished; |
3366 | } | 3378 | } |
3367 | 3379 | ||
3380 | /* If HBA has a deferred error attention, fail the iocb. */ | ||
3381 | if (unlikely(phba->hba_flag & DEFER_ERATT)) { | ||
3382 | spin_unlock_irqrestore(&phba->hbalock, drvr_flag); | ||
3383 | goto out_not_finished; | ||
3384 | } | ||
3385 | |||
3368 | psli = &phba->sli; | 3386 | psli = &phba->sli; |
3369 | 3387 | ||
3370 | mb = &pmbox->mb; | 3388 | mb = &pmbox->mb; |
@@ -3632,7 +3650,7 @@ out_not_finished: | |||
3632 | } | 3650 | } |
3633 | 3651 | ||
3634 | /** | 3652 | /** |
3635 | * __lpfc_sli_ringtx_put: Add an iocb to the txq. | 3653 | * __lpfc_sli_ringtx_put - Add an iocb to the txq |
3636 | * @phba: Pointer to HBA context object. | 3654 | * @phba: Pointer to HBA context object. |
3637 | * @pring: Pointer to driver SLI ring object. | 3655 | * @pring: Pointer to driver SLI ring object. |
3638 | * @piocb: Pointer to address of newly added command iocb. | 3656 | * @piocb: Pointer to address of newly added command iocb. |
@@ -3651,7 +3669,7 @@ __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3651 | } | 3669 | } |
3652 | 3670 | ||
3653 | /** | 3671 | /** |
3654 | * lpfc_sli_next_iocb: Get the next iocb in the txq. | 3672 | * lpfc_sli_next_iocb - Get the next iocb in the txq |
3655 | * @phba: Pointer to HBA context object. | 3673 | * @phba: Pointer to HBA context object. |
3656 | * @pring: Pointer to driver SLI ring object. | 3674 | * @pring: Pointer to driver SLI ring object. |
3657 | * @piocb: Pointer to address of newly added command iocb. | 3675 | * @piocb: Pointer to address of newly added command iocb. |
@@ -3683,7 +3701,7 @@ lpfc_sli_next_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3683 | } | 3701 | } |
3684 | 3702 | ||
3685 | /** | 3703 | /** |
3686 | * __lpfc_sli_issue_iocb: Lockless version of lpfc_sli_issue_iocb. | 3704 | * __lpfc_sli_issue_iocb - Lockless version of lpfc_sli_issue_iocb |
3687 | * @phba: Pointer to HBA context object. | 3705 | * @phba: Pointer to HBA context object. |
3688 | * @pring: Pointer to driver SLI ring object. | 3706 | * @pring: Pointer to driver SLI ring object. |
3689 | * @piocb: Pointer to command iocb. | 3707 | * @piocb: Pointer to command iocb. |
@@ -3729,6 +3747,10 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3729 | if (unlikely(pci_channel_offline(phba->pcidev))) | 3747 | if (unlikely(pci_channel_offline(phba->pcidev))) |
3730 | return IOCB_ERROR; | 3748 | return IOCB_ERROR; |
3731 | 3749 | ||
3750 | /* If HBA has a deferred error attention, fail the iocb. */ | ||
3751 | if (unlikely(phba->hba_flag & DEFER_ERATT)) | ||
3752 | return IOCB_ERROR; | ||
3753 | |||
3732 | /* | 3754 | /* |
3733 | * We should never get an IOCB if we are in a < LINK_DOWN state | 3755 | * We should never get an IOCB if we are in a < LINK_DOWN state |
3734 | */ | 3756 | */ |
@@ -3813,7 +3835,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3813 | 3835 | ||
3814 | 3836 | ||
3815 | /** | 3837 | /** |
3816 | * lpfc_sli_issue_iocb: Wrapper function for __lpfc_sli_issue_iocb. | 3838 | * lpfc_sli_issue_iocb - Wrapper function for __lpfc_sli_issue_iocb |
3817 | * @phba: Pointer to HBA context object. | 3839 | * @phba: Pointer to HBA context object. |
3818 | * @pring: Pointer to driver SLI ring object. | 3840 | * @pring: Pointer to driver SLI ring object. |
3819 | * @piocb: Pointer to command iocb. | 3841 | * @piocb: Pointer to command iocb. |
@@ -3840,7 +3862,7 @@ lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
3840 | } | 3862 | } |
3841 | 3863 | ||
3842 | /** | 3864 | /** |
3843 | * lpfc_extra_ring_setup: Extra ring setup function. | 3865 | * lpfc_extra_ring_setup - Extra ring setup function |
3844 | * @phba: Pointer to HBA context object. | 3866 | * @phba: Pointer to HBA context object. |
3845 | * | 3867 | * |
3846 | * This function is called while driver attaches with the | 3868 | * This function is called while driver attaches with the |
@@ -3886,7 +3908,7 @@ lpfc_extra_ring_setup( struct lpfc_hba *phba) | |||
3886 | } | 3908 | } |
3887 | 3909 | ||
3888 | /** | 3910 | /** |
3889 | * lpfc_sli_async_event_handler: ASYNC iocb handler function. | 3911 | * lpfc_sli_async_event_handler - ASYNC iocb handler function |
3890 | * @phba: Pointer to HBA context object. | 3912 | * @phba: Pointer to HBA context object. |
3891 | * @pring: Pointer to driver SLI ring object. | 3913 | * @pring: Pointer to driver SLI ring object. |
3892 | * @iocbq: Pointer to iocb object. | 3914 | * @iocbq: Pointer to iocb object. |
@@ -3907,6 +3929,7 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba, | |||
3907 | uint16_t temp; | 3929 | uint16_t temp; |
3908 | struct temp_event temp_event_data; | 3930 | struct temp_event temp_event_data; |
3909 | struct Scsi_Host *shost; | 3931 | struct Scsi_Host *shost; |
3932 | uint32_t *iocb_w; | ||
3910 | 3933 | ||
3911 | icmd = &iocbq->iocb; | 3934 | icmd = &iocbq->iocb; |
3912 | evt_code = icmd->un.asyncstat.evt_code; | 3935 | evt_code = icmd->un.asyncstat.evt_code; |
@@ -3914,13 +3937,23 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba, | |||
3914 | 3937 | ||
3915 | if ((evt_code != ASYNC_TEMP_WARN) && | 3938 | if ((evt_code != ASYNC_TEMP_WARN) && |
3916 | (evt_code != ASYNC_TEMP_SAFE)) { | 3939 | (evt_code != ASYNC_TEMP_SAFE)) { |
3940 | iocb_w = (uint32_t *) icmd; | ||
3917 | lpfc_printf_log(phba, | 3941 | lpfc_printf_log(phba, |
3918 | KERN_ERR, | 3942 | KERN_ERR, |
3919 | LOG_SLI, | 3943 | LOG_SLI, |
3920 | "0346 Ring %d handler: unexpected ASYNC_STATUS" | 3944 | "0346 Ring %d handler: unexpected ASYNC_STATUS" |
3921 | " evt_code 0x%x\n", | 3945 | " evt_code 0x%x \n" |
3946 | "W0 0x%08x W1 0x%08x W2 0x%08x W3 0x%08x\n" | ||
3947 | "W4 0x%08x W5 0x%08x W6 0x%08x W7 0x%08x\n" | ||
3948 | "W8 0x%08x W9 0x%08x W10 0x%08x W11 0x%08x\n" | ||
3949 | "W12 0x%08x W13 0x%08x W14 0x%08x W15 0x%08x\n", | ||
3922 | pring->ringno, | 3950 | pring->ringno, |
3923 | icmd->un.asyncstat.evt_code); | 3951 | icmd->un.asyncstat.evt_code, |
3952 | iocb_w[0], iocb_w[1], iocb_w[2], iocb_w[3], | ||
3953 | iocb_w[4], iocb_w[5], iocb_w[6], iocb_w[7], | ||
3954 | iocb_w[8], iocb_w[9], iocb_w[10], iocb_w[11], | ||
3955 | iocb_w[12], iocb_w[13], iocb_w[14], iocb_w[15]); | ||
3956 | |||
3924 | return; | 3957 | return; |
3925 | } | 3958 | } |
3926 | temp_event_data.data = (uint32_t)temp; | 3959 | temp_event_data.data = (uint32_t)temp; |
@@ -3954,7 +3987,7 @@ lpfc_sli_async_event_handler(struct lpfc_hba * phba, | |||
3954 | 3987 | ||
3955 | 3988 | ||
3956 | /** | 3989 | /** |
3957 | * lpfc_sli_setup: SLI ring setup function. | 3990 | * lpfc_sli_setup - SLI ring setup function |
3958 | * @phba: Pointer to HBA context object. | 3991 | * @phba: Pointer to HBA context object. |
3959 | * | 3992 | * |
3960 | * lpfc_sli_setup sets up rings of the SLI interface with | 3993 | * lpfc_sli_setup sets up rings of the SLI interface with |
@@ -4076,7 +4109,7 @@ lpfc_sli_setup(struct lpfc_hba *phba) | |||
4076 | } | 4109 | } |
4077 | 4110 | ||
4078 | /** | 4111 | /** |
4079 | * lpfc_sli_queue_setup: Queue initialization function. | 4112 | * lpfc_sli_queue_setup - Queue initialization function |
4080 | * @phba: Pointer to HBA context object. | 4113 | * @phba: Pointer to HBA context object. |
4081 | * | 4114 | * |
4082 | * lpfc_sli_queue_setup sets up mailbox queues and iocb queues for each | 4115 | * lpfc_sli_queue_setup sets up mailbox queues and iocb queues for each |
@@ -4115,7 +4148,7 @@ lpfc_sli_queue_setup(struct lpfc_hba *phba) | |||
4115 | } | 4148 | } |
4116 | 4149 | ||
4117 | /** | 4150 | /** |
4118 | * lpfc_sli_host_down: Vport cleanup function. | 4151 | * lpfc_sli_host_down - Vport cleanup function |
4119 | * @vport: Pointer to virtual port object. | 4152 | * @vport: Pointer to virtual port object. |
4120 | * | 4153 | * |
4121 | * lpfc_sli_host_down is called to clean up the resources | 4154 | * lpfc_sli_host_down is called to clean up the resources |
@@ -4179,22 +4212,14 @@ lpfc_sli_host_down(struct lpfc_vport *vport) | |||
4179 | 4212 | ||
4180 | spin_unlock_irqrestore(&phba->hbalock, flags); | 4213 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4181 | 4214 | ||
4182 | while (!list_empty(&completions)) { | 4215 | /* Cancel all the IOCBs from the completions list */ |
4183 | list_remove_head(&completions, iocb, struct lpfc_iocbq, list); | 4216 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, |
4184 | 4217 | IOERR_SLI_DOWN); | |
4185 | if (!iocb->iocb_cmpl) | ||
4186 | lpfc_sli_release_iocbq(phba, iocb); | ||
4187 | else { | ||
4188 | iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT; | ||
4189 | iocb->iocb.un.ulpWord[4] = IOERR_SLI_DOWN; | ||
4190 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
4191 | } | ||
4192 | } | ||
4193 | return 1; | 4218 | return 1; |
4194 | } | 4219 | } |
4195 | 4220 | ||
4196 | /** | 4221 | /** |
4197 | * lpfc_sli_hba_down: Resource cleanup function for the HBA. | 4222 | * lpfc_sli_hba_down - Resource cleanup function for the HBA |
4198 | * @phba: Pointer to HBA context object. | 4223 | * @phba: Pointer to HBA context object. |
4199 | * | 4224 | * |
4200 | * This function cleans up all iocb, buffers, mailbox commands | 4225 | * This function cleans up all iocb, buffers, mailbox commands |
@@ -4216,8 +4241,6 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
4216 | struct lpfc_sli_ring *pring; | 4241 | struct lpfc_sli_ring *pring; |
4217 | struct lpfc_dmabuf *buf_ptr; | 4242 | struct lpfc_dmabuf *buf_ptr; |
4218 | LPFC_MBOXQ_t *pmb; | 4243 | LPFC_MBOXQ_t *pmb; |
4219 | struct lpfc_iocbq *iocb; | ||
4220 | IOCB_t *cmd = NULL; | ||
4221 | int i; | 4244 | int i; |
4222 | unsigned long flags = 0; | 4245 | unsigned long flags = 0; |
4223 | 4246 | ||
@@ -4245,18 +4268,9 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
4245 | } | 4268 | } |
4246 | spin_unlock_irqrestore(&phba->hbalock, flags); | 4269 | spin_unlock_irqrestore(&phba->hbalock, flags); |
4247 | 4270 | ||
4248 | while (!list_empty(&completions)) { | 4271 | /* Cancel all the IOCBs from the completions list */ |
4249 | list_remove_head(&completions, iocb, struct lpfc_iocbq, list); | 4272 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, |
4250 | cmd = &iocb->iocb; | 4273 | IOERR_SLI_DOWN); |
4251 | |||
4252 | if (!iocb->iocb_cmpl) | ||
4253 | lpfc_sli_release_iocbq(phba, iocb); | ||
4254 | else { | ||
4255 | cmd->ulpStatus = IOSTAT_LOCAL_REJECT; | ||
4256 | cmd->un.ulpWord[4] = IOERR_SLI_DOWN; | ||
4257 | (iocb->iocb_cmpl) (phba, iocb, iocb); | ||
4258 | } | ||
4259 | } | ||
4260 | 4274 | ||
4261 | spin_lock_irqsave(&phba->hbalock, flags); | 4275 | spin_lock_irqsave(&phba->hbalock, flags); |
4262 | list_splice_init(&phba->elsbuf, &completions); | 4276 | list_splice_init(&phba->elsbuf, &completions); |
@@ -4299,7 +4313,7 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
4299 | } | 4313 | } |
4300 | 4314 | ||
4301 | /** | 4315 | /** |
4302 | * lpfc_sli_pcimem_bcopy: SLI memory copy function. | 4316 | * lpfc_sli_pcimem_bcopy - SLI memory copy function |
4303 | * @srcp: Source memory pointer. | 4317 | * @srcp: Source memory pointer. |
4304 | * @destp: Destination memory pointer. | 4318 | * @destp: Destination memory pointer. |
4305 | * @cnt: Number of words required to be copied. | 4319 | * @cnt: Number of words required to be copied. |
@@ -4329,7 +4343,7 @@ lpfc_sli_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt) | |||
4329 | 4343 | ||
4330 | 4344 | ||
4331 | /** | 4345 | /** |
4332 | * lpfc_sli_ringpostbuf_put: Function to add a buffer to postbufq. | 4346 | * lpfc_sli_ringpostbuf_put - Function to add a buffer to postbufq |
4333 | * @phba: Pointer to HBA context object. | 4347 | * @phba: Pointer to HBA context object. |
4334 | * @pring: Pointer to driver SLI ring object. | 4348 | * @pring: Pointer to driver SLI ring object. |
4335 | * @mp: Pointer to driver buffer object. | 4349 | * @mp: Pointer to driver buffer object. |
@@ -4352,8 +4366,7 @@ lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
4352 | } | 4366 | } |
4353 | 4367 | ||
4354 | /** | 4368 | /** |
4355 | * lpfc_sli_get_buffer_tag: Tag allocation function for a buffer posted | 4369 | * lpfc_sli_get_buffer_tag - allocates a tag for a CMD_QUE_XRI64_CX buffer |
4356 | * using CMD_QUE_XRI64_CX iocb. | ||
4357 | * @phba: Pointer to HBA context object. | 4370 | * @phba: Pointer to HBA context object. |
4358 | * | 4371 | * |
4359 | * When HBQ is enabled, buffers are searched based on tags. This function | 4372 | * When HBQ is enabled, buffers are searched based on tags. This function |
@@ -4378,8 +4391,7 @@ lpfc_sli_get_buffer_tag(struct lpfc_hba *phba) | |||
4378 | } | 4391 | } |
4379 | 4392 | ||
4380 | /** | 4393 | /** |
4381 | * lpfc_sli_ring_taggedbuf_get: Search HBQ buffer associated with | 4394 | * lpfc_sli_ring_taggedbuf_get - find HBQ buffer associated with given tag |
4382 | * posted using CMD_QUE_XRI64_CX iocb. | ||
4383 | * @phba: Pointer to HBA context object. | 4395 | * @phba: Pointer to HBA context object. |
4384 | * @pring: Pointer to driver SLI ring object. | 4396 | * @pring: Pointer to driver SLI ring object. |
4385 | * @tag: Buffer tag. | 4397 | * @tag: Buffer tag. |
@@ -4422,8 +4434,7 @@ lpfc_sli_ring_taggedbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
4422 | } | 4434 | } |
4423 | 4435 | ||
4424 | /** | 4436 | /** |
4425 | * lpfc_sli_ringpostbuf_get: SLI2 buffer search function for | 4437 | * lpfc_sli_ringpostbuf_get - search buffers for unsolicited CT and ELS events |
4426 | * unsolicited ct and els events. | ||
4427 | * @phba: Pointer to HBA context object. | 4438 | * @phba: Pointer to HBA context object. |
4428 | * @pring: Pointer to driver SLI ring object. | 4439 | * @pring: Pointer to driver SLI ring object. |
4429 | * @phys: DMA address of the buffer. | 4440 | * @phys: DMA address of the buffer. |
@@ -4466,7 +4477,7 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
4466 | } | 4477 | } |
4467 | 4478 | ||
4468 | /** | 4479 | /** |
4469 | * lpfc_sli_abort_els_cmpl: Completion handler for the els abort iocbs. | 4480 | * lpfc_sli_abort_els_cmpl - Completion handler for the els abort iocbs |
4470 | * @phba: Pointer to HBA context object. | 4481 | * @phba: Pointer to HBA context object. |
4471 | * @cmdiocb: Pointer to driver command iocb object. | 4482 | * @cmdiocb: Pointer to driver command iocb object. |
4472 | * @rspiocb: Pointer to driver response iocb object. | 4483 | * @rspiocb: Pointer to driver response iocb object. |
@@ -4542,7 +4553,7 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
4542 | } | 4553 | } |
4543 | 4554 | ||
4544 | /** | 4555 | /** |
4545 | * lpfc_ignore_els_cmpl: Completion handler for aborted ELS command. | 4556 | * lpfc_ignore_els_cmpl - Completion handler for aborted ELS command |
4546 | * @phba: Pointer to HBA context object. | 4557 | * @phba: Pointer to HBA context object. |
4547 | * @cmdiocb: Pointer to driver command iocb object. | 4558 | * @cmdiocb: Pointer to driver command iocb object. |
4548 | * @rspiocb: Pointer to driver response iocb object. | 4559 | * @rspiocb: Pointer to driver response iocb object. |
@@ -4572,7 +4583,7 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
4572 | } | 4583 | } |
4573 | 4584 | ||
4574 | /** | 4585 | /** |
4575 | * lpfc_sli_issue_abort_iotag: Abort function for a command iocb. | 4586 | * lpfc_sli_issue_abort_iotag - Abort function for a command iocb |
4576 | * @phba: Pointer to HBA context object. | 4587 | * @phba: Pointer to HBA context object. |
4577 | * @pring: Pointer to driver SLI ring object. | 4588 | * @pring: Pointer to driver SLI ring object. |
4578 | * @cmdiocb: Pointer to driver command iocb object. | 4589 | * @cmdiocb: Pointer to driver command iocb object. |
@@ -4658,15 +4669,14 @@ abort_iotag_exit: | |||
4658 | } | 4669 | } |
4659 | 4670 | ||
4660 | /** | 4671 | /** |
4661 | * lpfc_sli_validate_fcp_iocb: Filtering function, used to find commands | 4672 | * lpfc_sli_validate_fcp_iocb - find commands associated with a vport or LUN |
4662 | * associated with a vport/SCSI target/lun. | ||
4663 | * @iocbq: Pointer to driver iocb object. | 4673 | * @iocbq: Pointer to driver iocb object. |
4664 | * @vport: Pointer to driver virtual port object. | 4674 | * @vport: Pointer to driver virtual port object. |
4665 | * @tgt_id: SCSI ID of the target. | 4675 | * @tgt_id: SCSI ID of the target. |
4666 | * @lun_id: LUN ID of the scsi device. | 4676 | * @lun_id: LUN ID of the scsi device. |
4667 | * @ctx_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST | 4677 | * @ctx_cmd: LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST |
4668 | * | 4678 | * |
4669 | * This function acts as iocb filter for functions which abort or count | 4679 | * This function acts as an iocb filter for functions which abort or count |
4670 | * all FCP iocbs pending on a lun/SCSI target/SCSI host. It will return | 4680 | * all FCP iocbs pending on a lun/SCSI target/SCSI host. It will return |
4671 | * 0 if the filtering criteria is met for the given iocb and will return | 4681 | * 0 if the filtering criteria is met for the given iocb and will return |
4672 | * 1 if the filtering criteria is not met. | 4682 | * 1 if the filtering criteria is not met. |
@@ -4724,7 +4734,7 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport, | |||
4724 | } | 4734 | } |
4725 | 4735 | ||
4726 | /** | 4736 | /** |
4727 | * lpfc_sli_sum_iocb: Function to count the number of FCP iocbs pending. | 4737 | * lpfc_sli_sum_iocb - Function to count the number of FCP iocbs pending |
4728 | * @vport: Pointer to virtual port. | 4738 | * @vport: Pointer to virtual port. |
4729 | * @tgt_id: SCSI ID of the target. | 4739 | * @tgt_id: SCSI ID of the target. |
4730 | * @lun_id: LUN ID of the scsi device. | 4740 | * @lun_id: LUN ID of the scsi device. |
@@ -4762,8 +4772,7 @@ lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id, | |||
4762 | } | 4772 | } |
4763 | 4773 | ||
4764 | /** | 4774 | /** |
4765 | * lpfc_sli_abort_fcp_cmpl: Completion handler function for an aborted | 4775 | * lpfc_sli_abort_fcp_cmpl - Completion handler function for aborted FCP IOCBs |
4766 | * FCP iocb. | ||
4767 | * @phba: Pointer to HBA context object | 4776 | * @phba: Pointer to HBA context object |
4768 | * @cmdiocb: Pointer to command iocb object. | 4777 | * @cmdiocb: Pointer to command iocb object. |
4769 | * @rspiocb: Pointer to response iocb object. | 4778 | * @rspiocb: Pointer to response iocb object. |
@@ -4781,8 +4790,7 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
4781 | } | 4790 | } |
4782 | 4791 | ||
4783 | /** | 4792 | /** |
4784 | * lpfc_sli_abort_iocb: This function issue abort for all SCSI commands | 4793 | * lpfc_sli_abort_iocb - issue abort for all commands on a host/target/LUN |
4785 | * pending on a SCSI host(vport)/target/lun. | ||
4786 | * @vport: Pointer to virtual port. | 4794 | * @vport: Pointer to virtual port. |
4787 | * @pring: Pointer to driver SLI ring object. | 4795 | * @pring: Pointer to driver SLI ring object. |
4788 | * @tgt_id: SCSI ID of the target. | 4796 | * @tgt_id: SCSI ID of the target. |
@@ -4854,8 +4862,7 @@ lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, | |||
4854 | } | 4862 | } |
4855 | 4863 | ||
4856 | /** | 4864 | /** |
4857 | * lpfc_sli_wake_iocb_wait: iocb completion handler for iocb issued using | 4865 | * lpfc_sli_wake_iocb_wait - lpfc_sli_issue_iocb_wait's completion handler |
4858 | * lpfc_sli_issue_iocb_wait. | ||
4859 | * @phba: Pointer to HBA context object. | 4866 | * @phba: Pointer to HBA context object. |
4860 | * @cmdiocbq: Pointer to command iocb. | 4867 | * @cmdiocbq: Pointer to command iocb. |
4861 | * @rspiocbq: Pointer to response iocb. | 4868 | * @rspiocbq: Pointer to response iocb. |
@@ -4893,7 +4900,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, | |||
4893 | } | 4900 | } |
4894 | 4901 | ||
4895 | /** | 4902 | /** |
4896 | * lpfc_sli_issue_iocb_wait: Synchronous function to issue iocb commands. | 4903 | * lpfc_sli_issue_iocb_wait - Synchronous function to issue iocb commands |
4897 | * @phba: Pointer to HBA context object.. | 4904 | * @phba: Pointer to HBA context object.. |
4898 | * @pring: Pointer to sli ring. | 4905 | * @pring: Pointer to sli ring. |
4899 | * @piocb: Pointer to command iocb. | 4906 | * @piocb: Pointer to command iocb. |
@@ -5000,7 +5007,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
5000 | } | 5007 | } |
5001 | 5008 | ||
5002 | /** | 5009 | /** |
5003 | * lpfc_sli_issue_mbox_wait: Synchronous function to issue mailbox. | 5010 | * lpfc_sli_issue_mbox_wait - Synchronous function to issue mailbox |
5004 | * @phba: Pointer to HBA context object. | 5011 | * @phba: Pointer to HBA context object. |
5005 | * @pmboxq: Pointer to driver mailbox object. | 5012 | * @pmboxq: Pointer to driver mailbox object. |
5006 | * @timeout: Timeout in number of seconds. | 5013 | * @timeout: Timeout in number of seconds. |
@@ -5070,7 +5077,7 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, | |||
5070 | } | 5077 | } |
5071 | 5078 | ||
5072 | /** | 5079 | /** |
5073 | * lpfc_sli_flush_mbox_queue: mailbox queue cleanup function. | 5080 | * lpfc_sli_flush_mbox_queue - mailbox queue cleanup function |
5074 | * @phba: Pointer to HBA context. | 5081 | * @phba: Pointer to HBA context. |
5075 | * | 5082 | * |
5076 | * This function is called to cleanup any pending mailbox | 5083 | * This function is called to cleanup any pending mailbox |
@@ -5113,7 +5120,7 @@ lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba) | |||
5113 | } | 5120 | } |
5114 | 5121 | ||
5115 | /** | 5122 | /** |
5116 | * lpfc_sli_check_eratt: check error attention events | 5123 | * lpfc_sli_check_eratt - check error attention events |
5117 | * @phba: Pointer to HBA context. | 5124 | * @phba: Pointer to HBA context. |
5118 | * | 5125 | * |
5119 | * This function is called form timer soft interrupt context to check HBA's | 5126 | * This function is called form timer soft interrupt context to check HBA's |
@@ -5145,11 +5152,31 @@ lpfc_sli_check_eratt(struct lpfc_hba *phba) | |||
5145 | return 0; | 5152 | return 0; |
5146 | } | 5153 | } |
5147 | 5154 | ||
5155 | /* | ||
5156 | * If there is deferred error attention, do not check for error | ||
5157 | * attention | ||
5158 | */ | ||
5159 | if (unlikely(phba->hba_flag & DEFER_ERATT)) { | ||
5160 | spin_unlock_irq(&phba->hbalock); | ||
5161 | return 0; | ||
5162 | } | ||
5163 | |||
5148 | /* Read chip Host Attention (HA) register */ | 5164 | /* Read chip Host Attention (HA) register */ |
5149 | ha_copy = readl(phba->HAregaddr); | 5165 | ha_copy = readl(phba->HAregaddr); |
5150 | if (ha_copy & HA_ERATT) { | 5166 | if (ha_copy & HA_ERATT) { |
5151 | /* Read host status register to retrieve error event */ | 5167 | /* Read host status register to retrieve error event */ |
5152 | lpfc_sli_read_hs(phba); | 5168 | lpfc_sli_read_hs(phba); |
5169 | |||
5170 | /* Check if there is a deferred error condition is active */ | ||
5171 | if ((HS_FFER1 & phba->work_hs) && | ||
5172 | ((HS_FFER2 | HS_FFER3 | HS_FFER4 | HS_FFER5 | | ||
5173 | HS_FFER6 | HS_FFER7) & phba->work_hs)) { | ||
5174 | phba->hba_flag |= DEFER_ERATT; | ||
5175 | /* Clear all interrupt enable conditions */ | ||
5176 | writel(0, phba->HCregaddr); | ||
5177 | readl(phba->HCregaddr); | ||
5178 | } | ||
5179 | |||
5153 | /* Set the driver HA work bitmap */ | 5180 | /* Set the driver HA work bitmap */ |
5154 | phba->work_ha |= HA_ERATT; | 5181 | phba->work_ha |= HA_ERATT; |
5155 | /* Indicate polling handles this ERATT */ | 5182 | /* Indicate polling handles this ERATT */ |
@@ -5162,7 +5189,7 @@ lpfc_sli_check_eratt(struct lpfc_hba *phba) | |||
5162 | } | 5189 | } |
5163 | 5190 | ||
5164 | /** | 5191 | /** |
5165 | * lpfc_sp_intr_handler: The slow-path interrupt handler of lpfc driver. | 5192 | * lpfc_sp_intr_handler - The slow-path interrupt handler of lpfc driver |
5166 | * @irq: Interrupt number. | 5193 | * @irq: Interrupt number. |
5167 | * @dev_id: The device context pointer. | 5194 | * @dev_id: The device context pointer. |
5168 | * | 5195 | * |
@@ -5238,6 +5265,16 @@ lpfc_sp_intr_handler(int irq, void *dev_id) | |||
5238 | /* Indicate interrupt handler handles ERATT */ | 5265 | /* Indicate interrupt handler handles ERATT */ |
5239 | phba->hba_flag |= HBA_ERATT_HANDLED; | 5266 | phba->hba_flag |= HBA_ERATT_HANDLED; |
5240 | } | 5267 | } |
5268 | |||
5269 | /* | ||
5270 | * If there is deferred error attention, do not check for any | ||
5271 | * interrupt. | ||
5272 | */ | ||
5273 | if (unlikely(phba->hba_flag & DEFER_ERATT)) { | ||
5274 | spin_unlock_irq(&phba->hbalock); | ||
5275 | return IRQ_NONE; | ||
5276 | } | ||
5277 | |||
5241 | /* Clear up only attention source related to slow-path */ | 5278 | /* Clear up only attention source related to slow-path */ |
5242 | writel((ha_copy & (HA_MBATT | HA_R2_CLR_MSK)), | 5279 | writel((ha_copy & (HA_MBATT | HA_R2_CLR_MSK)), |
5243 | phba->HAregaddr); | 5280 | phba->HAregaddr); |
@@ -5309,8 +5346,22 @@ lpfc_sp_intr_handler(int irq, void *dev_id) | |||
5309 | } | 5346 | } |
5310 | } | 5347 | } |
5311 | spin_lock_irqsave(&phba->hbalock, iflag); | 5348 | spin_lock_irqsave(&phba->hbalock, iflag); |
5312 | if (work_ha_copy & HA_ERATT) | 5349 | if (work_ha_copy & HA_ERATT) { |
5313 | lpfc_sli_read_hs(phba); | 5350 | lpfc_sli_read_hs(phba); |
5351 | /* | ||
5352 | * Check if there is a deferred error condition | ||
5353 | * is active | ||
5354 | */ | ||
5355 | if ((HS_FFER1 & phba->work_hs) && | ||
5356 | ((HS_FFER2 | HS_FFER3 | HS_FFER4 | HS_FFER5 | | ||
5357 | HS_FFER6 | HS_FFER7) & phba->work_hs)) { | ||
5358 | phba->hba_flag |= DEFER_ERATT; | ||
5359 | /* Clear all interrupt enable conditions */ | ||
5360 | writel(0, phba->HCregaddr); | ||
5361 | readl(phba->HCregaddr); | ||
5362 | } | ||
5363 | } | ||
5364 | |||
5314 | if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) { | 5365 | if ((work_ha_copy & HA_MBATT) && (phba->sli.mbox_active)) { |
5315 | pmb = phba->sli.mbox_active; | 5366 | pmb = phba->sli.mbox_active; |
5316 | pmbox = &pmb->mb; | 5367 | pmbox = &pmb->mb; |
@@ -5423,7 +5474,7 @@ send_current_mbox: | |||
5423 | } /* lpfc_sp_intr_handler */ | 5474 | } /* lpfc_sp_intr_handler */ |
5424 | 5475 | ||
5425 | /** | 5476 | /** |
5426 | * lpfc_fp_intr_handler: The fast-path interrupt handler of lpfc driver. | 5477 | * lpfc_fp_intr_handler - The fast-path interrupt handler of lpfc driver |
5427 | * @irq: Interrupt number. | 5478 | * @irq: Interrupt number. |
5428 | * @dev_id: The device context pointer. | 5479 | * @dev_id: The device context pointer. |
5429 | * | 5480 | * |
@@ -5474,6 +5525,14 @@ lpfc_fp_intr_handler(int irq, void *dev_id) | |||
5474 | ha_copy = readl(phba->HAregaddr); | 5525 | ha_copy = readl(phba->HAregaddr); |
5475 | /* Clear up only attention source related to fast-path */ | 5526 | /* Clear up only attention source related to fast-path */ |
5476 | spin_lock_irqsave(&phba->hbalock, iflag); | 5527 | spin_lock_irqsave(&phba->hbalock, iflag); |
5528 | /* | ||
5529 | * If there is deferred error attention, do not check for | ||
5530 | * any interrupt. | ||
5531 | */ | ||
5532 | if (unlikely(phba->hba_flag & DEFER_ERATT)) { | ||
5533 | spin_unlock_irq(&phba->hbalock); | ||
5534 | return IRQ_NONE; | ||
5535 | } | ||
5477 | writel((ha_copy & (HA_R0_CLR_MSK | HA_R1_CLR_MSK)), | 5536 | writel((ha_copy & (HA_R0_CLR_MSK | HA_R1_CLR_MSK)), |
5478 | phba->HAregaddr); | 5537 | phba->HAregaddr); |
5479 | readl(phba->HAregaddr); /* flush */ | 5538 | readl(phba->HAregaddr); /* flush */ |
@@ -5510,7 +5569,7 @@ lpfc_fp_intr_handler(int irq, void *dev_id) | |||
5510 | } /* lpfc_fp_intr_handler */ | 5569 | } /* lpfc_fp_intr_handler */ |
5511 | 5570 | ||
5512 | /** | 5571 | /** |
5513 | * lpfc_intr_handler: The device-level interrupt handler of lpfc driver. | 5572 | * lpfc_intr_handler - The device-level interrupt handler of lpfc driver |
5514 | * @irq: Interrupt number. | 5573 | * @irq: Interrupt number. |
5515 | * @dev_id: The device context pointer. | 5574 | * @dev_id: The device context pointer. |
5516 | * | 5575 | * |
@@ -5566,6 +5625,14 @@ lpfc_intr_handler(int irq, void *dev_id) | |||
5566 | phba->hba_flag |= HBA_ERATT_HANDLED; | 5625 | phba->hba_flag |= HBA_ERATT_HANDLED; |
5567 | } | 5626 | } |
5568 | 5627 | ||
5628 | /* | ||
5629 | * If there is deferred error attention, do not check for any interrupt. | ||
5630 | */ | ||
5631 | if (unlikely(phba->hba_flag & DEFER_ERATT)) { | ||
5632 | spin_unlock_irq(&phba->hbalock); | ||
5633 | return IRQ_NONE; | ||
5634 | } | ||
5635 | |||
5569 | /* Clear attention sources except link and error attentions */ | 5636 | /* Clear attention sources except link and error attentions */ |
5570 | writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); | 5637 | writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr); |
5571 | readl(phba->HAregaddr); /* flush */ | 5638 | readl(phba->HAregaddr); /* flush */ |