MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sfc_rx_qflush

Function sfc_rx_qflush

dpdk/drivers/net/sfc/sfc_rx.c:674–735  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

672};
673
674static void
675sfc_rx_qflush(struct sfc_adapter *sa, sfc_sw_index_t sw_index)
676{
677 struct sfc_adapter_shared *sas = sfc_sa2shared(sa);
678 sfc_ethdev_qid_t ethdev_qid;
679 struct sfc_rxq_info *rxq_info;
680 struct sfc_rxq *rxq;
681 unsigned int retry_count;
682 unsigned int wait_count;
683 int rc;
684
685 ethdev_qid = sfc_ethdev_rx_qid_by_rxq_sw_index(sas, sw_index);
686 rxq_info = &sfc_sa2shared(sa)->rxq_info[sw_index];
687 SFC_ASSERT(rxq_info->state & SFC_RXQ_STARTED);
688
689 rxq = &sa->rxq_ctrl[sw_index];
690
691 /*
692 * Retry Rx queue flushing in the case of flush failed or
693 * timeout. In the worst case it can delay for 6 seconds.
694 */
695 for (retry_count = 0;
696 ((rxq_info->state & SFC_RXQ_FLUSHED) == 0) &&
697 (retry_count < SFC_RX_QFLUSH_ATTEMPTS);
698 ++retry_count) {
699 rc = efx_rx_qflush(rxq->common);
700 if (rc != 0) {
701 rxq_info->state |= (rc == EALREADY) ?
702 SFC_RXQ_FLUSHED : SFC_RXQ_FLUSH_FAILED;
703 break;
704 }
705 rxq_info->state &= ~SFC_RXQ_FLUSH_FAILED;
706 rxq_info->state |= SFC_RXQ_FLUSHING;
707
708 /*
709 * Wait for Rx queue flush done or failed event at least
710 * SFC_RX_QFLUSH_POLL_WAIT_MS milliseconds and not more
711 * than 2 seconds (SFC_RX_QFLUSH_POLL_WAIT_MS multiplied
712 * by SFC_RX_QFLUSH_POLL_ATTEMPTS).
713 */
714 wait_count = 0;
715 do {
716 rte_delay_ms(SFC_RX_QFLUSH_POLL_WAIT_MS);
717 sfc_ev_qpoll(rxq->evq);
718 } while ((rxq_info->state & SFC_RXQ_FLUSHING) &&
719 (wait_count++ < SFC_RX_QFLUSH_POLL_ATTEMPTS));
720
721 if (rxq_info->state & SFC_RXQ_FLUSHING)
722 sfc_err(sa, "RxQ %d (internal %u) flush timed out",
723 ethdev_qid, sw_index);
724
725 if (rxq_info->state & SFC_RXQ_FLUSH_FAILED)
726 sfc_err(sa, "RxQ %d (internal %u) flush failed",
727 ethdev_qid, sw_index);
728
729 if (rxq_info->state & SFC_RXQ_FLUSHED)
730 sfc_notice(sa, "RxQ %d (internal %u) flushed",
731 ethdev_qid, sw_index);

Callers 2

sfc_rx_qstartFunction · 0.85
sfc_rx_qstopFunction · 0.85

Calls 5

sfc_sa2sharedFunction · 0.85
efx_rx_qflushFunction · 0.85
rte_delay_msFunction · 0.85
sfc_ev_qpollFunction · 0.85

Tested by

no test coverage detected