<div dir="ltr"><div style>Hi dpdk-dev,</div><div style>  test-pmd txonly leaks mbuf from the pool.</div><div style>tx_mbuf_alloc does not change the refcnt and the refcnt is 0 when it is first allocated. </div><div style><br>
</div><div style> 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. </div><div style><br></div><div style> As a result, txonly can't send packets after it exhausts the mempool. </div>
<div style>There might be multiple ways to fix this. I decided not to touch memory management.</div><div style><br></div><div style>Thanks,</div><div style>-Dongsu Han </div><div style><br></div><div style>---</div><div><br>
</div><div>diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c</div><div>index d7c8c31..ee673e5 100644</div><div>--- a/app/test-pmd/txonly.c</div><div>+++ b/app/test-pmd/txonly.c</div><div>@@ -92,14 +92,7 @@ static struct udp_hdr pkt_udp_hdr; /**< UDP header of transmitted packets. */</div>
<div> static inline struct rte_mbuf *</div><div> tx_mbuf_alloc(struct rte_mempool *mp)</div><div> {</div><div>-       struct rte_mbuf *m;</div><div>-       void *mb;</div><div>-</div><div>-       if (rte_mempool_get(mp, &mb) < 0)</div>
<div>-               return NULL;</div><div>-       m = (struct rte_mbuf *)mb;</div><div>-       __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 1);</div><div>-       return m;</div><div>+       return rte_pktmbuf_alloc(mp);</div>
<div> }</div><div> </div><div><br></div></div>