mbuf: display more fields in dump
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 21 Nov 2019 18:30:55 +0000 (10:30 -0800)
committerOlivier Matz <olivier.matz@6wind.com>
Fri, 27 Dec 2019 09:03:26 +0000 (10:03 +0100)
The rte_pktmbuf_dump should display offset, refcount, and vlan
info since these are often useful during debugging.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
lib/librte_mbuf/rte_mbuf.c

index 8fa7f49..cb5793c 100644 (file)
@@ -475,18 +475,21 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)
 
        __rte_mbuf_sanity_check(m, 1);
 
-       fprintf(f, "dump mbuf at %p, iova=%"PRIx64", buf_len=%u\n",
-              m, (uint64_t)m->buf_iova, (unsigned)m->buf_len);
-       fprintf(f, "  pkt_len=%"PRIu32", ol_flags=%"PRIx64", nb_segs=%u, "
-              "in_port=%u\n", m->pkt_len, m->ol_flags,
-              (unsigned)m->nb_segs, (unsigned)m->port);
+       fprintf(f, "dump mbuf at %p, iova=%#"PRIx64", buf_len=%u\n",
+               m, m->buf_iova, m->buf_len);
+       fprintf(f,
+               "  pkt_len=%u, ol_flags=%#"PRIx64", nb_segs=%u, port=%u, vlan_tci=%#x\n",
+               m->pkt_len, m->ol_flags, m->nb_segs, m->port, m->vlan_tci);
+
        nb_segs = m->nb_segs;
 
        while (m && nb_segs != 0) {
                __rte_mbuf_sanity_check(m, 0);
 
-               fprintf(f, "  segment at %p, data=%p, data_len=%u\n",
-                       m, rte_pktmbuf_mtod(m, void *), (unsigned)m->data_len);
+               fprintf(f, "  segment at %p, data=%p, len=%u, off=%u, refcnt=%u\n",
+                       m, rte_pktmbuf_mtod(m, void *),
+                       m->data_len, m->data_off, rte_mbuf_refcnt_read(m));
+
                len = dump_len;
                if (len > m->data_len)
                        len = m->data_len;