From: Marcin Wojtas Subject: [PATCH v2 2/4] net/ena: fix delayed cleanup of Rx descriptors Date: Mon, 10 Apr 2017 16:28:09 +0200 Message-ID: <1491834491-13944-3-git-send-email-mw@semihalf.com> References: <1491834491-13944-1-git-send-email-mw@semihalf.com> Cc: jan.medala@outlook.com, jpalider@gmail.com, netanel@amazon.com, evgenys@amazon.com, matua@amazon.com, gtzalik@amazon.com, igorch@amazon.com, mw@semihalf.com, mk@semihalf.com To: dev@dpdk.org Return-path: Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by dpdk.org (Postfix) with ESMTP id 93E4A2C0B for ; Mon, 10 Apr 2017 16:20:14 +0200 (CEST) Received: by mail-lf0-f53.google.com with SMTP id s141so35970481lfe.3 for ; Mon, 10 Apr 2017 07:20:14 -0700 (PDT) In-Reply-To: <1491834491-13944-1-git-send-email-mw@semihalf.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Michal Krawczyk On RX path, after receiving bunch of packets, variable tracking available descriptors in HW queue was not updated. To fix this issue, variable tracking used descriptors must be updated after receiving packets - it must be reduced by the amount of received descriptors in current batch. Additionally, variable next_to_clean in rx_ring must be updated before entering ena_populate_rx_queue() to keep it up to date with the current ring state. Fixes: 1daff5260ff8 ("net/ena: use unmasked head and tail") Signed-off-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index 90cf2ad..b4c713f 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1575,13 +1575,13 @@ static uint16_t eth_ena_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, recv_idx++; } - desc_in_use += 1; + rx_ring->next_to_clean = next_to_clean; + + desc_in_use = desc_in_use - completed + 1; /* Burst refill to save doorbells, memory barriers, const interval */ if (ring_size - desc_in_use > ENA_RING_DESCS_RATIO(ring_size)) ena_populate_rx_queue(rx_ring, ring_size - desc_in_use); - rx_ring->next_to_clean = next_to_clean; - return recv_idx; } -- 1.8.3.1