From: Marcin Wojtas Subject: [PATCH v2 3/4] net/ena: cleanup if refilling of rx descriptors fails Date: Mon, 10 Apr 2017 16:28:10 +0200 Message-ID: <1491834491-13944-4-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-f48.google.com (mail-lf0-f48.google.com [209.85.215.48]) by dpdk.org (Postfix) with ESMTP id C8E912BBE for ; Mon, 10 Apr 2017 16:20:15 +0200 (CEST) Received: by mail-lf0-f48.google.com with SMTP id z15so71597707lfd.1 for ; Mon, 10 Apr 2017 07:20:15 -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 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 b4c713f..e6e889b 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