[dpdk-dev] [PATCH 09/22] app: fix testpmd compliance with __rte_mbuf_sanity_check()

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Mar 20 17:04:57 CET 2013


From: Ivan Boule <ivan.boule at 6wind.com>

Build mbuf and lists of mbufs in a way compliant with the checks performed
by the function __rte_mbuf_sanity_check() when CONFIG_RTE_LIBRTE_MBUF_DEBUG=y

Acked-by: Olivier Matz <olivier.matz at 6wind.com>
Signed-off-by: Ivan Boule <ivan.boule at 6wind.com>
---
 app/test-pmd/testpmd.c |    1 +
 app/test-pmd/txonly.c  |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 6813b66..d67b662 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -323,6 +323,7 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
 	mb_ctor_arg = (struct mbuf_ctor_arg *) opaque_arg;
 	mb = (struct rte_mbuf *) raw_mbuf;
 
+	mb->type         = RTE_MBUF_PKT;
 	mb->pool         = mp;
 	mb->buf_addr     = (void *) ((char *)mb + mb_ctor_arg->seg_buf_offset);
 	mb->buf_physaddr = (uint64_t) (rte_mempool_virt2phy(mp, mb) +
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index bf0a3e2..d7c8c31 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -235,6 +235,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
 		for (i = 1; i < tx_pkt_nb_segs; i++) {
 			pkt_seg->pkt.next = tx_mbuf_alloc(mbp);
 			if (pkt_seg->pkt.next == NULL) {
+				pkt->pkt.nb_segs = i;
 				rte_pktmbuf_free(pkt);
 				goto nomore_mbuf;
 			}
-- 
1.7.2.5




More information about the dev mailing list