diff options
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_bsg.c | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 6 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_nportdisc.c | 1 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_scsi.c | 4 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 92 |
8 files changed, 70 insertions, 43 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index a364cae9e984..97921dcd8626 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -692,7 +692,7 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type) | |||
692 | */ | 692 | */ |
693 | for (i = 0; i < psli->num_rings; i++) { | 693 | for (i = 0; i < psli->num_rings; i++) { |
694 | pring = &psli->ring[i]; | 694 | pring = &psli->ring[i]; |
695 | while (pring->txcmplq_cnt) { | 695 | while (!list_empty(&pring->txcmplq)) { |
696 | msleep(10); | 696 | msleep(10); |
697 | if (cnt++ > 500) { /* 5 secs */ | 697 | if (cnt++ > 500) { /* 5 secs */ |
698 | lpfc_printf_log(phba, | 698 | lpfc_printf_log(phba, |
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index 32d5683e6181..18d3b69963ab 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c | |||
@@ -1559,7 +1559,7 @@ lpfc_bsg_diag_mode_enter(struct lpfc_hba *phba) | |||
1559 | scsi_block_requests(shost); | 1559 | scsi_block_requests(shost); |
1560 | } | 1560 | } |
1561 | 1561 | ||
1562 | while (pring->txcmplq_cnt) { | 1562 | while (!list_empty(&pring->txcmplq)) { |
1563 | if (i++ > 500) /* wait up to 5 seconds */ | 1563 | if (i++ > 500) /* wait up to 5 seconds */ |
1564 | break; | 1564 | break; |
1565 | msleep(10); | 1565 | msleep(10); |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 08d156a9094f..b7a61ff43ca8 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -6225,7 +6225,7 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport) | |||
6225 | spin_unlock_irq(&phba->hbalock); | 6225 | spin_unlock_irq(&phba->hbalock); |
6226 | } | 6226 | } |
6227 | 6227 | ||
6228 | if (phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt) | 6228 | if (!list_empty(&phba->sli.ring[LPFC_ELS_RING].txcmplq)) |
6229 | mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout); | 6229 | mod_timer(&vport->els_tmofunc, jiffies + HZ * timeout); |
6230 | } | 6230 | } |
6231 | 6231 | ||
@@ -6279,7 +6279,6 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) | |||
6279 | continue; | 6279 | continue; |
6280 | 6280 | ||
6281 | list_move_tail(&piocb->list, &completions); | 6281 | list_move_tail(&piocb->list, &completions); |
6282 | pring->txq_cnt--; | ||
6283 | } | 6282 | } |
6284 | 6283 | ||
6285 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 6284 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
@@ -6339,7 +6338,6 @@ lpfc_els_flush_all_cmd(struct lpfc_hba *phba) | |||
6339 | cmd->ulpCommand == CMD_ABORT_XRI_CN) | 6338 | cmd->ulpCommand == CMD_ABORT_XRI_CN) |
6340 | continue; | 6339 | continue; |
6341 | list_move_tail(&piocb->list, &completions); | 6340 | list_move_tail(&piocb->list, &completions); |
6342 | pring->txq_cnt--; | ||
6343 | } | 6341 | } |
6344 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { | 6342 | list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { |
6345 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) | 6343 | if (piocb->iocb_flag & LPFC_IO_LIBDFC) |
@@ -8065,7 +8063,7 @@ lpfc_sli4_els_xri_aborted(struct lpfc_hba *phba, | |||
8065 | rxid, 1); | 8063 | rxid, 1); |
8066 | 8064 | ||
8067 | /* Check if TXQ queue needs to be serviced */ | 8065 | /* Check if TXQ queue needs to be serviced */ |
8068 | if (pring->txq_cnt) | 8066 | if (!(list_empty(&pring->txq))) |
8069 | lpfc_worker_wake_up(phba); | 8067 | lpfc_worker_wake_up(phba); |
8070 | return; | 8068 | return; |
8071 | } | 8069 | } |
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index d7096ad94d3f..915e1aa6c681 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -696,7 +696,8 @@ lpfc_work_done(struct lpfc_hba *phba) | |||
696 | (status & | 696 | (status & |
697 | HA_RXMASK)); | 697 | HA_RXMASK)); |
698 | } | 698 | } |
699 | if ((phba->sli_rev == LPFC_SLI_REV4) && pring->txq_cnt) | 699 | if ((phba->sli_rev == LPFC_SLI_REV4) & |
700 | (!list_empty(&pring->txq))) | ||
700 | lpfc_drain_txq(phba); | 701 | lpfc_drain_txq(phba); |
701 | /* | 702 | /* |
702 | * Turn on Ring interrupts | 703 | * Turn on Ring interrupts |
@@ -4354,7 +4355,6 @@ lpfc_no_rpi(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
4354 | with an error */ | 4355 | with an error */ |
4355 | list_move_tail(&iocb->list, | 4356 | list_move_tail(&iocb->list, |
4356 | &completions); | 4357 | &completions); |
4357 | pring->txq_cnt--; | ||
4358 | } | 4358 | } |
4359 | } | 4359 | } |
4360 | spin_unlock_irq(&phba->hbalock); | 4360 | spin_unlock_irq(&phba->hbalock); |
@@ -5055,7 +5055,6 @@ lpfc_free_tx(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
5055 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { | 5055 | (icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) { |
5056 | 5056 | ||
5057 | list_move_tail(&iocb->list, &completions); | 5057 | list_move_tail(&iocb->list, &completions); |
5058 | pring->txq_cnt--; | ||
5059 | } | 5058 | } |
5060 | } | 5059 | } |
5061 | 5060 | ||
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 314b4f61b9e3..b28f4e7c3bc6 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -839,7 +839,6 @@ lpfc_hba_down_post_s3(struct lpfc_hba *phba) | |||
839 | * way, nothing should be on txcmplq as it will NEVER complete. | 839 | * way, nothing should be on txcmplq as it will NEVER complete. |
840 | */ | 840 | */ |
841 | list_splice_init(&pring->txcmplq, &completions); | 841 | list_splice_init(&pring->txcmplq, &completions); |
842 | pring->txcmplq_cnt = 0; | ||
843 | spin_unlock_irq(&phba->hbalock); | 842 | spin_unlock_irq(&phba->hbalock); |
844 | 843 | ||
845 | /* Cancel all the IOCBs from the completions list */ | 844 | /* Cancel all the IOCBs from the completions list */ |
diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c index 46128c679202..82f4d3542289 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c | |||
@@ -226,7 +226,6 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp) | |||
226 | if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp)) { | 226 | if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp)) { |
227 | /* It matches, so deque and call compl with anp error */ | 227 | /* It matches, so deque and call compl with anp error */ |
228 | list_move_tail(&iocb->list, &completions); | 228 | list_move_tail(&iocb->list, &completions); |
229 | pring->txq_cnt--; | ||
230 | } | 229 | } |
231 | } | 230 | } |
232 | 231 | ||
diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 98af07c6e300..e75210d67970 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c | |||
@@ -732,7 +732,7 @@ lpfc_sli4_fcp_xri_aborted(struct lpfc_hba *phba, | |||
732 | psb = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); | 732 | psb = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq); |
733 | psb->exch_busy = 0; | 733 | psb->exch_busy = 0; |
734 | spin_unlock_irqrestore(&phba->hbalock, iflag); | 734 | spin_unlock_irqrestore(&phba->hbalock, iflag); |
735 | if (pring->txq_cnt) | 735 | if (!list_empty(&pring->txq)) |
736 | lpfc_worker_wake_up(phba); | 736 | lpfc_worker_wake_up(phba); |
737 | return; | 737 | return; |
738 | 738 | ||
@@ -4246,7 +4246,7 @@ static __inline__ void lpfc_poll_rearm_timer(struct lpfc_hba * phba) | |||
4246 | unsigned long poll_tmo_expires = | 4246 | unsigned long poll_tmo_expires = |
4247 | (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); | 4247 | (jiffies + msecs_to_jiffies(phba->cfg_poll_tmo)); |
4248 | 4248 | ||
4249 | if (phba->sli.ring[LPFC_FCP_RING].txcmplq_cnt) | 4249 | if (!list_empty(&phba->sli.ring[LPFC_FCP_RING].txcmplq)) |
4250 | mod_timer(&phba->fcp_poll_timer, | 4250 | mod_timer(&phba->fcp_poll_timer, |
4251 | poll_tmo_expires); | 4251 | poll_tmo_expires); |
4252 | } | 4252 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 74b67d98e952..a0ef439058f0 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1008,6 +1008,18 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
1008 | else | 1008 | else |
1009 | sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); | 1009 | sglq = __lpfc_clear_active_sglq(phba, iocbq->sli4_lxritag); |
1010 | 1010 | ||
1011 | /* | ||
1012 | ** This should have been removed from the txcmplq before calling | ||
1013 | ** iocbq_release. The normal completion | ||
1014 | ** path should have already done the list_del_init. | ||
1015 | */ | ||
1016 | if (unlikely(!list_empty(&iocbq->list))) { | ||
1017 | if (iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) | ||
1018 | iocbq->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | ||
1019 | list_del_init(&iocbq->list); | ||
1020 | } | ||
1021 | |||
1022 | |||
1011 | if (sglq) { | 1023 | if (sglq) { |
1012 | if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && | 1024 | if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && |
1013 | (sglq->state != SGL_XRI_ABORTED)) { | 1025 | (sglq->state != SGL_XRI_ABORTED)) { |
@@ -1024,7 +1036,7 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
1024 | &phba->sli4_hba.lpfc_sgl_list); | 1036 | &phba->sli4_hba.lpfc_sgl_list); |
1025 | 1037 | ||
1026 | /* Check if TXQ queue needs to be serviced */ | 1038 | /* Check if TXQ queue needs to be serviced */ |
1027 | if (pring->txq_cnt) | 1039 | if (!list_empty(&pring->txq)) |
1028 | lpfc_worker_wake_up(phba); | 1040 | lpfc_worker_wake_up(phba); |
1029 | } | 1041 | } |
1030 | } | 1042 | } |
@@ -1056,6 +1068,14 @@ __lpfc_sli_release_iocbq_s3(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) | |||
1056 | size_t start_clean = offsetof(struct lpfc_iocbq, iocb); | 1068 | size_t start_clean = offsetof(struct lpfc_iocbq, iocb); |
1057 | 1069 | ||
1058 | /* | 1070 | /* |
1071 | ** This should have been removed from the txcmplq before calling | ||
1072 | ** iocbq_release. The normal completion | ||
1073 | ** path should have already done the list_del_init. | ||
1074 | */ | ||
1075 | if (unlikely(!list_empty(&iocbq->list))) | ||
1076 | list_del_init(&iocbq->list); | ||
1077 | |||
1078 | /* | ||
1059 | * Clean all volatile data fields, preserve iotag and node struct. | 1079 | * Clean all volatile data fields, preserve iotag and node struct. |
1060 | */ | 1080 | */ |
1061 | memset((char*)iocbq + start_clean, 0, sizeof(*iocbq) - start_clean); | 1081 | memset((char*)iocbq + start_clean, 0, sizeof(*iocbq) - start_clean); |
@@ -1121,7 +1141,6 @@ lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct list_head *iocblist, | |||
1121 | 1141 | ||
1122 | while (!list_empty(iocblist)) { | 1142 | while (!list_empty(iocblist)) { |
1123 | list_remove_head(iocblist, piocb, struct lpfc_iocbq, list); | 1143 | list_remove_head(iocblist, piocb, struct lpfc_iocbq, list); |
1124 | |||
1125 | if (!piocb->iocb_cmpl) | 1144 | if (!piocb->iocb_cmpl) |
1126 | lpfc_sli_release_iocbq(phba, piocb); | 1145 | lpfc_sli_release_iocbq(phba, piocb); |
1127 | else { | 1146 | else { |
@@ -1309,9 +1328,6 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
1309 | { | 1328 | { |
1310 | list_add_tail(&piocb->list, &pring->txcmplq); | 1329 | list_add_tail(&piocb->list, &pring->txcmplq); |
1311 | piocb->iocb_flag |= LPFC_IO_ON_TXCMPLQ; | 1330 | piocb->iocb_flag |= LPFC_IO_ON_TXCMPLQ; |
1312 | pring->txcmplq_cnt++; | ||
1313 | if (pring->txcmplq_cnt > pring->txcmplq_max) | ||
1314 | pring->txcmplq_max = pring->txcmplq_cnt; | ||
1315 | 1331 | ||
1316 | if ((unlikely(pring->ringno == LPFC_ELS_RING)) && | 1332 | if ((unlikely(pring->ringno == LPFC_ELS_RING)) && |
1317 | (piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) && | 1333 | (piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) && |
@@ -1343,8 +1359,6 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1343 | struct lpfc_iocbq *cmd_iocb; | 1359 | struct lpfc_iocbq *cmd_iocb; |
1344 | 1360 | ||
1345 | list_remove_head((&pring->txq), cmd_iocb, struct lpfc_iocbq, list); | 1361 | list_remove_head((&pring->txq), cmd_iocb, struct lpfc_iocbq, list); |
1346 | if (cmd_iocb != NULL) | ||
1347 | pring->txq_cnt--; | ||
1348 | return cmd_iocb; | 1362 | return cmd_iocb; |
1349 | } | 1363 | } |
1350 | 1364 | ||
@@ -1613,8 +1627,9 @@ lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
1613 | * (c) link attention events can be processed (fcp ring only) | 1627 | * (c) link attention events can be processed (fcp ring only) |
1614 | * (d) IOCB processing is not blocked by the outstanding mbox command. | 1628 | * (d) IOCB processing is not blocked by the outstanding mbox command. |
1615 | */ | 1629 | */ |
1616 | if (pring->txq_cnt && | 1630 | |
1617 | lpfc_is_link_up(phba) && | 1631 | if (lpfc_is_link_up(phba) && |
1632 | (!list_empty(&pring->txq)) && | ||
1618 | (pring->ringno != phba->sli.fcp_ring || | 1633 | (pring->ringno != phba->sli.fcp_ring || |
1619 | phba->sli.sli_flag & LPFC_PROCESS_LA)) { | 1634 | phba->sli.sli_flag & LPFC_PROCESS_LA)) { |
1620 | 1635 | ||
@@ -2611,7 +2626,6 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, | |||
2611 | cmd_iocb = phba->sli.iocbq_lookup[iotag]; | 2626 | cmd_iocb = phba->sli.iocbq_lookup[iotag]; |
2612 | list_del_init(&cmd_iocb->list); | 2627 | list_del_init(&cmd_iocb->list); |
2613 | if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { | 2628 | if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { |
2614 | pring->txcmplq_cnt--; | ||
2615 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | 2629 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; |
2616 | } | 2630 | } |
2617 | return cmd_iocb; | 2631 | return cmd_iocb; |
@@ -2649,7 +2663,6 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, | |||
2649 | /* remove from txcmpl queue list */ | 2663 | /* remove from txcmpl queue list */ |
2650 | list_del_init(&cmd_iocb->list); | 2664 | list_del_init(&cmd_iocb->list); |
2651 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; | 2665 | cmd_iocb->iocb_flag &= ~LPFC_IO_ON_TXCMPLQ; |
2652 | pring->txcmplq_cnt--; | ||
2653 | return cmd_iocb; | 2666 | return cmd_iocb; |
2654 | } | 2667 | } |
2655 | } | 2668 | } |
@@ -3498,7 +3511,6 @@ lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring) | |||
3498 | */ | 3511 | */ |
3499 | spin_lock_irq(&phba->hbalock); | 3512 | spin_lock_irq(&phba->hbalock); |
3500 | list_splice_init(&pring->txq, &completions); | 3513 | list_splice_init(&pring->txq, &completions); |
3501 | pring->txq_cnt = 0; | ||
3502 | 3514 | ||
3503 | /* Next issue ABTS for everything on the txcmplq */ | 3515 | /* Next issue ABTS for everything on the txcmplq */ |
3504 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) | 3516 | list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) |
@@ -3535,11 +3547,9 @@ lpfc_sli_flush_fcp_rings(struct lpfc_hba *phba) | |||
3535 | spin_lock_irq(&phba->hbalock); | 3547 | spin_lock_irq(&phba->hbalock); |
3536 | /* Retrieve everything on txq */ | 3548 | /* Retrieve everything on txq */ |
3537 | list_splice_init(&pring->txq, &txq); | 3549 | list_splice_init(&pring->txq, &txq); |
3538 | pring->txq_cnt = 0; | ||
3539 | 3550 | ||
3540 | /* Retrieve everything on the txcmplq */ | 3551 | /* Retrieve everything on the txcmplq */ |
3541 | list_splice_init(&pring->txcmplq, &txcmplq); | 3552 | list_splice_init(&pring->txcmplq, &txcmplq); |
3542 | pring->txcmplq_cnt = 0; | ||
3543 | 3553 | ||
3544 | /* Indicate the I/O queues are flushed */ | 3554 | /* Indicate the I/O queues are flushed */ |
3545 | phba->hba_flag |= HBA_FCP_IOQ_FLUSH; | 3555 | phba->hba_flag |= HBA_FCP_IOQ_FLUSH; |
@@ -7614,7 +7624,6 @@ __lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, | |||
7614 | { | 7624 | { |
7615 | /* Insert the caller's iocb in the txq tail for later processing. */ | 7625 | /* Insert the caller's iocb in the txq tail for later processing. */ |
7616 | list_add_tail(&piocb->list, &pring->txq); | 7626 | list_add_tail(&piocb->list, &pring->txq); |
7617 | pring->txq_cnt++; | ||
7618 | } | 7627 | } |
7619 | 7628 | ||
7620 | /** | 7629 | /** |
@@ -8386,7 +8395,7 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uint32_t ring_number, | |||
8386 | piocb->iocb.ulpCommand == CMD_CLOSE_XRI_CN) | 8395 | piocb->iocb.ulpCommand == CMD_CLOSE_XRI_CN) |
8387 | sglq = NULL; | 8396 | sglq = NULL; |
8388 | else { | 8397 | else { |
8389 | if (pring->txq_cnt) { | 8398 | if (!list_empty(&pring->txq)) { |
8390 | if (!(flag & SLI_IOCB_RET_IOCB)) { | 8399 | if (!(flag & SLI_IOCB_RET_IOCB)) { |
8391 | __lpfc_sli_ringtx_put(phba, | 8400 | __lpfc_sli_ringtx_put(phba, |
8392 | pring, piocb); | 8401 | pring, piocb); |
@@ -9054,7 +9063,6 @@ lpfc_sli_host_down(struct lpfc_vport *vport) | |||
9054 | if (iocb->vport != vport) | 9063 | if (iocb->vport != vport) |
9055 | continue; | 9064 | continue; |
9056 | list_move_tail(&iocb->list, &completions); | 9065 | list_move_tail(&iocb->list, &completions); |
9057 | pring->txq_cnt--; | ||
9058 | } | 9066 | } |
9059 | 9067 | ||
9060 | /* Next issue ABTS for everything on the txcmplq */ | 9068 | /* Next issue ABTS for everything on the txcmplq */ |
@@ -9123,8 +9131,6 @@ lpfc_sli_hba_down(struct lpfc_hba *phba) | |||
9123 | * given to the FW yet. | 9131 | * given to the FW yet. |
9124 | */ | 9132 | */ |
9125 | list_splice_init(&pring->txq, &completions); | 9133 | list_splice_init(&pring->txq, &completions); |
9126 | pring->txq_cnt = 0; | ||
9127 | |||
9128 | } | 9134 | } |
9129 | spin_unlock_irqrestore(&phba->hbalock, flags); | 9135 | spin_unlock_irqrestore(&phba->hbalock, flags); |
9130 | 9136 | ||
@@ -9965,6 +9971,9 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
9965 | long timeleft, timeout_req = 0; | 9971 | long timeleft, timeout_req = 0; |
9966 | int retval = IOCB_SUCCESS; | 9972 | int retval = IOCB_SUCCESS; |
9967 | uint32_t creg_val; | 9973 | uint32_t creg_val; |
9974 | struct lpfc_iocbq *iocb; | ||
9975 | int txq_cnt = 0; | ||
9976 | int txcmplq_cnt = 0; | ||
9968 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; | 9977 | struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING]; |
9969 | /* | 9978 | /* |
9970 | * If the caller has provided a response iocbq buffer, then context2 | 9979 | * If the caller has provided a response iocbq buffer, then context2 |
@@ -10012,9 +10021,17 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, | |||
10012 | retval = IOCB_TIMEDOUT; | 10021 | retval = IOCB_TIMEDOUT; |
10013 | } | 10022 | } |
10014 | } else if (retval == IOCB_BUSY) { | 10023 | } else if (retval == IOCB_BUSY) { |
10015 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 10024 | if (phba->cfg_log_verbose & LOG_SLI) { |
10016 | "2818 Max IOCBs %d txq cnt %d txcmplq cnt %d\n", | 10025 | list_for_each_entry(iocb, &pring->txq, list) { |
10017 | phba->iocb_cnt, pring->txq_cnt, pring->txcmplq_cnt); | 10026 | txq_cnt++; |
10027 | } | ||
10028 | list_for_each_entry(iocb, &pring->txcmplq, list) { | ||
10029 | txcmplq_cnt++; | ||
10030 | } | ||
10031 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | ||
10032 | "2818 Max IOCBs %d txq cnt %d txcmplq cnt %d\n", | ||
10033 | phba->iocb_cnt, txq_cnt, txcmplq_cnt); | ||
10034 | } | ||
10018 | return retval; | 10035 | return retval; |
10019 | } else { | 10036 | } else { |
10020 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, | 10037 | lpfc_printf_log(phba, KERN_INFO, LOG_SLI, |
@@ -11297,16 +11314,25 @@ lpfc_sli4_sp_handle_els_wcqe(struct lpfc_hba *phba, struct lpfc_queue *cq, | |||
11297 | struct lpfc_iocbq *irspiocbq; | 11314 | struct lpfc_iocbq *irspiocbq; |
11298 | unsigned long iflags; | 11315 | unsigned long iflags; |
11299 | struct lpfc_sli_ring *pring = cq->pring; | 11316 | struct lpfc_sli_ring *pring = cq->pring; |
11317 | int txq_cnt = 0; | ||
11318 | int txcmplq_cnt = 0; | ||
11319 | int fcp_txcmplq_cnt = 0; | ||
11300 | 11320 | ||
11301 | /* Get an irspiocbq for later ELS response processing use */ | 11321 | /* Get an irspiocbq for later ELS response processing use */ |
11302 | irspiocbq = lpfc_sli_get_iocbq(phba); | 11322 | irspiocbq = lpfc_sli_get_iocbq(phba); |
11303 | if (!irspiocbq) { | 11323 | if (!irspiocbq) { |
11324 | if (!list_empty(&pring->txq)) | ||
11325 | txq_cnt++; | ||
11326 | if (!list_empty(&pring->txcmplq)) | ||
11327 | txcmplq_cnt++; | ||
11328 | if (!list_empty(&phba->sli.ring[LPFC_FCP_RING].txcmplq)) | ||
11329 | fcp_txcmplq_cnt++; | ||
11304 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 11330 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
11305 | "0387 NO IOCBQ data: txq_cnt=%d iocb_cnt=%d " | 11331 | "0387 NO IOCBQ data: txq_cnt=%d iocb_cnt=%d " |
11306 | "fcp_txcmplq_cnt=%d, els_txcmplq_cnt=%d\n", | 11332 | "fcp_txcmplq_cnt=%d, els_txcmplq_cnt=%d\n", |
11307 | pring->txq_cnt, phba->iocb_cnt, | 11333 | txq_cnt, phba->iocb_cnt, |
11308 | phba->sli.ring[LPFC_FCP_RING].txcmplq_cnt, | 11334 | fcp_txcmplq_cnt, |
11309 | phba->sli.ring[LPFC_ELS_RING].txcmplq_cnt); | 11335 | txcmplq_cnt); |
11310 | return false; | 11336 | return false; |
11311 | } | 11337 | } |
11312 | 11338 | ||
@@ -16244,14 +16270,19 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16244 | char *fail_msg = NULL; | 16270 | char *fail_msg = NULL; |
16245 | struct lpfc_sglq *sglq; | 16271 | struct lpfc_sglq *sglq; |
16246 | union lpfc_wqe wqe; | 16272 | union lpfc_wqe wqe; |
16273 | int txq_cnt = 0; | ||
16247 | 16274 | ||
16248 | spin_lock_irqsave(&phba->hbalock, iflags); | 16275 | spin_lock_irqsave(&phba->hbalock, iflags); |
16249 | if (pring->txq_cnt > pring->txq_max) | 16276 | list_for_each_entry(piocbq, &pring->txq, list) { |
16250 | pring->txq_max = pring->txq_cnt; | 16277 | txq_cnt++; |
16278 | } | ||
16279 | |||
16280 | if (txq_cnt > pring->txq_max) | ||
16281 | pring->txq_max = txq_cnt; | ||
16251 | 16282 | ||
16252 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16283 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
16253 | 16284 | ||
16254 | while (pring->txq_cnt) { | 16285 | while (!list_empty(&pring->txq)) { |
16255 | spin_lock_irqsave(&phba->hbalock, iflags); | 16286 | spin_lock_irqsave(&phba->hbalock, iflags); |
16256 | 16287 | ||
16257 | piocbq = lpfc_sli_ringtx_get(phba, pring); | 16288 | piocbq = lpfc_sli_ringtx_get(phba, pring); |
@@ -16259,7 +16290,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16259 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16290 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
16260 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 16291 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, |
16261 | "2823 txq empty and txq_cnt is %d\n ", | 16292 | "2823 txq empty and txq_cnt is %d\n ", |
16262 | pring->txq_cnt); | 16293 | txq_cnt); |
16263 | break; | 16294 | break; |
16264 | } | 16295 | } |
16265 | sglq = __lpfc_sli_get_sglq(phba, piocbq); | 16296 | sglq = __lpfc_sli_get_sglq(phba, piocbq); |
@@ -16268,6 +16299,7 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16268 | spin_unlock_irqrestore(&phba->hbalock, iflags); | 16299 | spin_unlock_irqrestore(&phba->hbalock, iflags); |
16269 | break; | 16300 | break; |
16270 | } | 16301 | } |
16302 | txq_cnt--; | ||
16271 | 16303 | ||
16272 | /* The xri and iocb resources secured, | 16304 | /* The xri and iocb resources secured, |
16273 | * attempt to issue request | 16305 | * attempt to issue request |
@@ -16299,5 +16331,5 @@ lpfc_drain_txq(struct lpfc_hba *phba) | |||
16299 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, | 16331 | lpfc_sli_cancel_iocbs(phba, &completions, IOSTAT_LOCAL_REJECT, |
16300 | IOERR_SLI_ABORTED); | 16332 | IOERR_SLI_ABORTED); |
16301 | 16333 | ||
16302 | return pring->txq_cnt; | 16334 | return txq_cnt; |
16303 | } | 16335 | } |