[v3] mbuf: display more fields in dump

Message ID 20200122173956.25527-1-stephen@networkplumber.org (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v3] mbuf: display more fields in dump |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance fail Performance Testing issues
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Stephen Hemminger Jan. 22, 2020, 5:39 p.m. UTC
  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>
---
v3 - only display vlan tci if offload flags say it is there
     display packet type
v2 - remove casts, change in_port to port
     the refcount and offset are property of per-segment

 lib/librte_mbuf/rte_mbuf.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
  

Comments

Olivier Matz Feb. 6, 2020, 9:48 a.m. UTC | #1
On Wed, Jan 22, 2020 at 09:39:56AM -0800, Stephen Hemminger wrote:
> 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>

Acked-by: Olivier Matz <olivier.matz@6wind.com>
  
Thomas Monjalon Feb. 6, 2020, 2:32 p.m. UTC | #2
06/02/2020 10:48, Olivier Matz:
> On Wed, Jan 22, 2020 at 09:39:56AM -0800, Stephen Hemminger wrote:
> > 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>
> 
> Acked-by: Olivier Matz <olivier.matz@6wind.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 25eea1db259d..56a1a98a6c0c 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -675,18 +675,25 @@  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",
+		m->pkt_len, m->ol_flags, m->nb_segs, m->port);
+
+	if (m->ol_flags & (PKT_RX_VLAN | PKT_TX_VLAN))
+		fprintf(f, ", vlan_tci=%u", m->vlan_tci);
+
+	fprintf(f, ", ptype=%#"PRIx32"\n", m->packet_type);
+
 	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;