DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Han, Dongsu" <dongsuh@cs.cmu.edu>
To: dev@dpdk.org
Subject: [dpdk-dev] suggested patch: testpmd txonly mbuf_alloc does not increment refcnt
Date: Thu, 2 May 2013 10:24:18 -0400	[thread overview]
Message-ID: <CAAYH+dW3RenDv9=dn0Mtdubp0443OWqAqPYfHjGKfQcjQHNgxg@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

Hi dpdk-dev,
  test-pmd txonly leaks mbuf from the pool.
tx_mbuf_alloc does not change the refcnt and the refcnt is 0 when it is
first allocated.

 However, rte_pktmbuf_free_seg called by the driver's xmit code decrements
reference count to -1. So mbuf never goes back to the pool.

 As a result, txonly can't send packets after it exhausts the mempool.
There might be multiple ways to fix this. I decided not to touch
memory management.

Thanks,
-Dongsu Han

---

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index d7c8c31..ee673e5 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -92,14 +92,7 @@ static struct udp_hdr pkt_udp_hdr; /**< UDP header of
transmitted packets. */
 static inline struct rte_mbuf *
 tx_mbuf_alloc(struct rte_mempool *mp)
 {
-       struct rte_mbuf *m;
-       void *mb;
-
-       if (rte_mempool_get(mp, &mb) < 0)
-               return NULL;
-       m = (struct rte_mbuf *)mb;
-       __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);
-       return m;
+       return rte_pktmbuf_alloc(mp);
 }

[-- Attachment #2: Type: text/html, Size: 1550 bytes --]

             reply	other threads:[~2013-05-02 14:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02 14:24 Han, Dongsu [this message]
2013-05-06 12:47 ` [dpdk-dev] [PATCH] app: fix refcnt in mbuf allocation Thomas Monjalon
2013-05-06 13:28   ` Han, Dongsu
2013-05-06 13:56     ` Adrien Mazarguil
2013-05-06 15:47       ` Han, Dongsu
2013-05-06 16:13         ` [dpdk-dev] " Thomas Monjalon
2013-05-06 16:00       ` [dpdk-dev] [PATCH] " Thomas Monjalon
2013-05-06 16:13         ` Adrien Mazarguil
2013-05-06 16:33           ` Thomas Monjalon

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='CAAYH+dW3RenDv9=dn0Mtdubp0443OWqAqPYfHjGKfQcjQHNgxg@mail.gmail.com' \
    --to=dongsuh@cs.cmu.edu \
    --cc=dev@dpdk.org \
    /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).