* Re: [dpdk-dev] [PATCH] mbuf: display more fields in dump
@ 2019-11-21 17:04 Morten Brørup
0 siblings, 0 replies; 4+ messages in thread
From: Morten Brørup @ 2019-11-21 17:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
I think the name also changed from in_port.Sent from a smartphone. Please pardon brevity and spelling.
-------- Oprindelig besked --------Fra: Stephen Hemminger <stephen@networkplumber.org> Dato: 21/11/2019 17.43 (GMT+01:00) Til: Morten Brørup <mb@smartsharesystems.com> Cc: dev@dpdk.org Emne: Re: [dpdk-dev] [PATCH] mbuf: display more fields in dump On Thu, 21 Nov 2019 17:16:42 +0100Morten Brørup <mb@smartsharesystems.com> wrote:> Are all these explicit type casts really needed? buf_iova is already uint64_t, buflen is uint16_t, data_off is uint16_t, rte_mbuf_refcnt_read() returns uint16_t, pkt_len is uint32_t, nb_segs is uint16_t, port is uint16_t, vlan_tci is uint16_t.Normally, they are not needed.If you turn up some of the warning levels in Gcc, then yes.> > m->port is not only the input port anymore (ref. the mbuf documentation), so please change in_port=%u to port=%u.Makes sense, but since this in internal would rather keep existing to print the name of the field.> > For consistency with ol_flags and vlan_tci format, consider changing iova=% to iova=%#.good idea, personal preference is to always use %#x over %x
^ permalink raw reply [flat|nested] 4+ messages in thread
* [dpdk-dev] [PATCH] mbuf: display more fields in dump
@ 2019-11-20 17:41 Stephen Hemminger
2019-11-21 16:16 ` Morten Brørup
0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2019-11-20 17:41 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger
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>
---
lib/librte_mbuf/rte_mbuf.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
index 35df1c4c38a5..a964464bd598 100644
--- a/lib/librte_mbuf/rte_mbuf.c
+++ b/lib/librte_mbuf/rte_mbuf.c
@@ -473,11 +473,14 @@ 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,"
+ " offs=%u, refcnt=%u\n",
+ m, (uint64_t)m->buf_iova, (unsigned)m->buf_len,
+ (unsigned)m->data_off, (unsigned)rte_mbuf_refcnt_read(m));
+ fprintf(f, " pkt_len=%u, ol_flags=%#"PRIx64","
+ " nb_segs=%u, in_port=%u, vlan_tci=%#x\n",
+ (unsigned)m->pkt_len, m->ol_flags,
+ (unsigned)m->nb_segs, (unsigned)m->port, (unsigned)m->vlan_tci);
nb_segs = m->nb_segs;
while (m && nb_segs != 0) {
--
2.20.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] mbuf: display more fields in dump
2019-11-20 17:41 Stephen Hemminger
@ 2019-11-21 16:16 ` Morten Brørup
2019-11-21 16:43 ` Stephen Hemminger
0 siblings, 1 reply; 4+ messages in thread
From: Morten Brørup @ 2019-11-21 16:16 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger
> Sent: Wednesday, November 20, 2019 6:41 PM
>
> 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>
> ---
> lib/librte_mbuf/rte_mbuf.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c
> index 35df1c4c38a5..a964464bd598 100644
> --- a/lib/librte_mbuf/rte_mbuf.c
> +++ b/lib/librte_mbuf/rte_mbuf.c
> @@ -473,11 +473,14 @@ 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,"
> + " offs=%u, refcnt=%u\n",
> + m, (uint64_t)m->buf_iova, (unsigned)m->buf_len,
> + (unsigned)m->data_off, (unsigned)rte_mbuf_refcnt_read(m));
> + fprintf(f, " pkt_len=%u, ol_flags=%#"PRIx64","
> + " nb_segs=%u, in_port=%u, vlan_tci=%#x\n",
> + (unsigned)m->pkt_len, m->ol_flags,
> + (unsigned)m->nb_segs, (unsigned)m->port, (unsigned)m-
> >vlan_tci);
Are all these explicit type casts really needed? buf_iova is already uint64_t, buflen is uint16_t, data_off is uint16_t, rte_mbuf_refcnt_read() returns uint16_t, pkt_len is uint32_t, nb_segs is uint16_t, port is uint16_t, vlan_tci is uint16_t.
m->port is not only the input port anymore (ref. the mbuf documentation), so please change in_port=%u to port=%u.
For consistency with ol_flags and vlan_tci format, consider changing iova=% to iova=%#.
> nb_segs = m->nb_segs;
>
> while (m && nb_segs != 0) {
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] mbuf: display more fields in dump
2019-11-21 16:16 ` Morten Brørup
@ 2019-11-21 16:43 ` Stephen Hemminger
0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2019-11-21 16:43 UTC (permalink / raw)
To: Morten Brørup; +Cc: dev
On Thu, 21 Nov 2019 17:16:42 +0100
Morten Brørup <mb@smartsharesystems.com> wrote:
> Are all these explicit type casts really needed? buf_iova is already uint64_t, buflen is uint16_t, data_off is uint16_t, rte_mbuf_refcnt_read() returns uint16_t, pkt_len is uint32_t, nb_segs is uint16_t, port is uint16_t, vlan_tci is uint16_t.
Normally, they are not needed.
If you turn up some of the warning levels in Gcc, then yes.
>
> m->port is not only the input port anymore (ref. the mbuf documentation), so please change in_port=%u to port=%u.
Makes sense, but since this in internal would rather keep existing
to print the name of the field.
>
> For consistency with ol_flags and vlan_tci format, consider changing iova=% to iova=%#.
good idea, personal preference is to always use %#x over %x
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-21 17:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 17:04 [dpdk-dev] [PATCH] mbuf: display more fields in dump Morten Brørup
-- strict thread matches above, loose matches on Subject: below --
2019-11-20 17:41 Stephen Hemminger
2019-11-21 16:16 ` Morten Brørup
2019-11-21 16:43 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).