From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 91F8B5B36; Wed, 3 Oct 2018 11:04:26 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us4.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id A6BA6B4005A; Wed, 3 Oct 2018 09:04:25 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 3 Oct 2018 02:04:22 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Wed, 3 Oct 2018 02:04:22 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w9394LNo032020; Wed, 3 Oct 2018 10:04:21 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 1BC0C1626D2; Wed, 3 Oct 2018 10:04:21 +0100 (BST) From: Andrew Rybchenko To: CC: Date: Wed, 3 Oct 2018 10:03:48 +0100 Message-ID: <1538557436-16163-2-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com> References: <1538557436-16163-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24132.005 X-TM-AS-Result: No-1.276000-4.000000-10 X-TMASE-MatchedRID: DC61v9xowC2LYaqu+AuRakf49ONH0RaSaN2KuTwsCwLDTXM3VzSaIigm SXjE3BkeVCHk5OCyKJSUTQ2JYQzY25FGdqVKoSoSt1AhvyEKdj5eu73mFK6GNIfAYSb4KlgZfMr dD3NIUvtyylwV7Bc73YAy6p60ZV62Mhe627A+8aHdB/CxWTRRu5n92B/ceXSVY9dCGryOXYgD6L 3iSS+KQERT+EelkXJ/Q9vfAkNA61I+zCDxsWUomLuzbmNL6sCJhfMqj2TE1oSN1bjUzvR8EUt7t GeeJH5DD1y8R38S3l1URzkirO0Q1F5h9KQWrq4BvuMTr7CQJJ6JNKCbyQlUpEMMprcbiest X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-1.276000-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24132.005 X-MDID: 1538557466-d7ZiqRhk_Dw1 Subject: [dpdk-dev] [PATCH 1/9] net/sfc: receive prepared packets even in Rx exception case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Oct 2018 09:04:26 -0000 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 --- 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