From: Marcin Wojtas Subject: [PATCH 3/4] net/ena: cleanup if refilling of Rx descriptors fails Date: Fri, 7 Apr 2017 12:48:57 +0200 Message-ID: <1491562138-2178-4-git-send-email-mw@semihalf.com> References: <1491562138-2178-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, mw@semihalf.com, mk@semihalf.com To: dev@dpdk.org Return-path: Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id CAD4E388F for ; Fri, 7 Apr 2017 12:41:17 +0200 (CEST) Received: by mail-lf0-f43.google.com with SMTP id q141so10095514lfe.2 for ; Fri, 07 Apr 2017 03:41:17 -0700 (PDT) In-Reply-To: <1491562138-2178-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 If wrong number of descriptors for refilling was passed to the Rx repopulate function, there was memory leak which caused memory pool to run out of resources in longer go. In case of fail when refilling Rx descriptors, all additional mbufs have to be released. Fixes: 1173fca25af9 ("ena: add polling-mode driver") Signed-off-by: Michal Krawczyk --- drivers/net/ena/ena_ethdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c index d875a2b..54ba5c1 100644 --- a/drivers/net/ena/ena_ethdev.c +++ b/drivers/net/ena/ena_ethdev.c @@ -1172,6 +1172,8 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) rc = ena_com_add_single_rx_desc(rxq->ena_com_io_sq, &ebuf, next_to_use_masked); if (unlikely(rc)) { + rte_mempool_put_bulk(rxq->mb_pool, (void **)(&mbuf), + count - i); RTE_LOG(WARNING, PMD, "failed adding rx desc\n"); break; } -- 1.8.3.1