| 603 | } |
| 604 | |
| 605 | void |
| 606 | sfc_tx_qstop(struct sfc_adapter *sa, sfc_sw_index_t sw_index) |
| 607 | { |
| 608 | struct sfc_adapter_shared * const sas = sfc_sa2shared(sa); |
| 609 | sfc_ethdev_qid_t ethdev_qid; |
| 610 | struct sfc_txq_info *txq_info; |
| 611 | struct sfc_txq *txq; |
| 612 | unsigned int retry_count; |
| 613 | unsigned int wait_count; |
| 614 | int rc; |
| 615 | |
| 616 | ethdev_qid = sfc_ethdev_tx_qid_by_txq_sw_index(sas, sw_index); |
| 617 | |
| 618 | sfc_log_init(sa, "TxQ = %d (internal %u)", ethdev_qid, sw_index); |
| 619 | |
| 620 | SFC_ASSERT(sw_index < sas->txq_count); |
| 621 | txq_info = &sas->txq_info[sw_index]; |
| 622 | |
| 623 | if (txq_info->state == SFC_TXQ_INITIALIZED) |
| 624 | return; |
| 625 | |
| 626 | SFC_ASSERT(txq_info->state & SFC_TXQ_STARTED); |
| 627 | |
| 628 | txq = &sa->txq_ctrl[sw_index]; |
| 629 | sa->priv.dp_tx->qstop(txq_info->dp, &txq->evq->read_ptr); |
| 630 | |
| 631 | /* |
| 632 | * Retry TX queue flushing in case of flush failed or |
| 633 | * timeout; in the worst case it can delay for 6 seconds |
| 634 | */ |
| 635 | for (retry_count = 0; |
| 636 | ((txq_info->state & SFC_TXQ_FLUSHED) == 0) && |
| 637 | (retry_count < SFC_TX_QFLUSH_ATTEMPTS); |
| 638 | ++retry_count) { |
| 639 | rc = efx_tx_qflush(txq->common); |
| 640 | if (rc != 0) { |
| 641 | txq_info->state |= (rc == EALREADY) ? |
| 642 | SFC_TXQ_FLUSHED : SFC_TXQ_FLUSH_FAILED; |
| 643 | break; |
| 644 | } |
| 645 | |
| 646 | /* |
| 647 | * Wait for TX queue flush done or flush failed event at least |
| 648 | * SFC_TX_QFLUSH_POLL_WAIT_MS milliseconds and not more |
| 649 | * than 2 seconds (SFC_TX_QFLUSH_POLL_WAIT_MS multiplied |
| 650 | * by SFC_TX_QFLUSH_POLL_ATTEMPTS) |
| 651 | */ |
| 652 | wait_count = 0; |
| 653 | do { |
| 654 | rte_delay_ms(SFC_TX_QFLUSH_POLL_WAIT_MS); |
| 655 | sfc_ev_qpoll(txq->evq); |
| 656 | } while ((txq_info->state & SFC_TXQ_FLUSHING) && |
| 657 | wait_count++ < SFC_TX_QFLUSH_POLL_ATTEMPTS); |
| 658 | |
| 659 | if (txq_info->state & SFC_TXQ_FLUSHING) |
| 660 | sfc_err(sa, "TxQ %d (internal %u) flush timed out", |
| 661 | ethdev_qid, sw_index); |
| 662 |
no test coverage detected