app/testpmd: fix compliance with __rte_mbuf_sanity_check()
authorIvan Boule <ivan.boule@6wind.com>
Tue, 26 Apr 2011 14:45:43 +0000 (16:45 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 25 Jul 2013 14:07:51 +0000 (16:07 +0200)
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

Signed-off-by: Ivan Boule <ivan.boule@6wind.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
app/test-pmd/testpmd.c
app/test-pmd/txonly.c

index d4226dd..e1d765e 100644 (file)
@@ -359,6 +359,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) +
index b943ca1..13ab0a4 100644 (file)
@@ -231,6 +231,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;
                        }