[dpdk-dev] suggested patch: testpmd txonly mbuf_alloc does not increment refcnt

Han, Dongsu dongsuh at cs.cmu.edu
Thu May 2 16:24:18 CEST 2013


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);
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://dpdk.org/ml/archives/dev/attachments/20130502/523ed003/attachment.html>


More information about the dev mailing list