DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH 1/9] net/sfc: receive prepared packets even in Rx exception case
Date: Wed, 3 Oct 2018 10:03:48 +0100	[thread overview]
Message-ID: <1538557436-16163-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com>

Make sure that number of prepared packets, completed and added
Rx ring pointers are reset to zeros on queue purge at stop.

Fixes: 638bddc99faa ("net/sfc: implement EF10 native Rx datapath")
Cc: stable@dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
 drivers/net/sfc/sfc_ef10_rx.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/sfc/sfc_ef10_rx.c b/drivers/net/sfc/sfc_ef10_rx.c
index 6a5052b93..5c0152d01 100644
--- a/drivers/net/sfc/sfc_ef10_rx.c
+++ b/drivers/net/sfc/sfc_ef10_rx.c
@@ -359,11 +359,11 @@ sfc_ef10_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	uint16_t n_rx_pkts;
 	efx_qword_t rx_ev;
 
+	n_rx_pkts = sfc_ef10_rx_prepared(rxq, rx_pkts, nb_pkts);
+
 	if (unlikely(rxq->flags &
 		     (SFC_EF10_RXQ_NOT_RUNNING | SFC_EF10_RXQ_EXCEPTION)))
-		return 0;
-
-	n_rx_pkts = sfc_ef10_rx_prepared(rxq, rx_pkts, nb_pkts);
+		goto done;
 
 	evq_old_read_ptr = rxq->evq_read_ptr;
 	while (n_rx_pkts != nb_pkts && sfc_ef10_rx_get_event(rxq, &rx_ev)) {
@@ -383,6 +383,7 @@ sfc_ef10_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
 	/* It is not a problem if we refill in the case of exception */
 	sfc_ef10_rx_qrefill(rxq);
 
+done:
 	return n_rx_pkts;
 }
 
@@ -594,8 +595,9 @@ sfc_ef10_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr)
 {
 	struct sfc_ef10_rxq *rxq = sfc_ef10_rxq_by_dp_rxq(dp_rxq);
 
-	rxq->prepared = 0;
-	rxq->completed = rxq->added = 0;
+	SFC_ASSERT(rxq->prepared == 0);
+	SFC_ASSERT(rxq->completed == 0);
+	SFC_ASSERT(rxq->added == 0);
 
 	sfc_ef10_rx_qrefill(rxq);
 
@@ -642,12 +644,16 @@ sfc_ef10_rx_qpurge(struct sfc_dp_rxq *dp_rxq)
 	unsigned int i;
 	struct sfc_ef10_rx_sw_desc *rxd;
 
+	rxq->prepared = 0;
+
 	for (i = rxq->completed; i != rxq->added; ++i) {
 		rxd = &rxq->sw_ring[i & rxq->ptr_mask];
 		rte_mempool_put(rxq->refill_mb_pool, rxd->mbuf);
 		rxd->mbuf = NULL;
 	}
 
+	rxq->completed = rxq->added = 0;
+
 	rxq->flags &= ~SFC_EF10_RXQ_STARTED;
 }
 
-- 
2.17.1

  reply	other threads:[~2018-10-03  9:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03  9:03 [dpdk-dev] [PATCH 0/9] net/sfc: support more features in EF10 Rx Andrew Rybchenko
2018-10-03  9:03 ` Andrew Rybchenko [this message]
2018-10-03  9:03 ` [dpdk-dev] [PATCH 2/9] net/sfc: use mbuf raw free instead of mempool put directly Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 3/9] net/sfc: check mbufs allocated using mempool API for Rx Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 4/9] net/sfc: avoid dummy writes to Rx queue state structure Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 5/9] net/sfc: decrease number of variables maintained on EF10 Rx Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 6/9] net/sfc: avoid usage of prepared packets number in " Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 7/9] net/sfc: rename variable to prepare for scatter support Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 8/9] net/sfc: support Rx scatter in EF10 Rx datapath Andrew Rybchenko
2018-10-03  9:03 ` [dpdk-dev] [PATCH 9/9] net/sfc: support Rx descriptor status on EF10 datapath Andrew Rybchenko
2018-10-04  7:55 ` [dpdk-dev] [PATCH 0/9] net/sfc: support more features in EF10 Rx Ferruh Yigit
2018-10-04 10:04 [dpdk-dev] [PATCH 1/9] net/sfc: receive prepared packets even in Rx exception case Ivan Malov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1538557436-16163-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).