DPDK patches and discussions
 help / color / mirror / Atom feed
From: Marcin Wojtas <mw@semihalf.com>
To: dev@dpdk.org
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
Subject: [dpdk-dev] [PATCH 3/4] net/ena: cleanup if refilling of Rx descriptors fails
Date: Fri,  7 Apr 2017 12:48:57 +0200	[thread overview]
Message-ID: <1491562138-2178-4-git-send-email-mw@semihalf.com> (raw)
In-Reply-To: <1491562138-2178-1-git-send-email-mw@semihalf.com>

From: Michal Krawczyk <mk@semihalf.com>

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 <mk@semihalf.com>
---
 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

  parent reply	other threads:[~2017-04-07 10:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-07 10:48 [dpdk-dev] [PATCH 0/4] Ena PMD fixes Marcin Wojtas
2017-04-07 10:48 ` [dpdk-dev] [PATCH 1/4] net/ena: fix incorrect Rx descriptors allocation Marcin Wojtas
2017-04-10 10:10   ` Jakub Palider
2017-04-07 10:48 ` [dpdk-dev] [PATCH 2/4] net/ena: fix delayed cleanup of Rx descriptors Marcin Wojtas
2017-04-10 10:05   ` Jakub Palider
2017-04-07 10:48 ` Marcin Wojtas [this message]
2017-04-07 10:48 ` [dpdk-dev] [PATCH 4/4] net/ena: calculate partial checksum if DF bit is disabled Marcin Wojtas
2017-04-10 11:05   ` Jan Mędala

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=1491562138-2178-4-git-send-email-mw@semihalf.com \
    --to=mw@semihalf.com \
    --cc=dev@dpdk.org \
    --cc=evgenys@amazon.com \
    --cc=gtzalik@amazon.com \
    --cc=jan.medala@outlook.com \
    --cc=jpalider@gmail.com \
    --cc=matua@amazon.com \
    --cc=mk@semihalf.com \
    --cc=netanel@amazon.com \
    /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).