> From: David Marchand [mailto:[email protected]] > Sent: Friday, 31 October 2025 15.08 > > On Fri, 31 Oct 2025 at 14:28, Morten Brørup <[email protected]> > wrote: > > Printing of outer_l2_len and outer_l3_len could be omitted if not > present, like the VLAN IDs, e.g.: > > > > fprintf(f, " "); > > if (m->outer_l2_len != 0) > > fprintf(f, "outer_l2_len=%u, ", m->outer_l2_len); > > if (m->outer_l3_len != 0) > > fprintf(f, "outer_l3_len=%u, ", m->outer_l3_len); > > fprintf(f, "l2_len=%u, l3_len=%u, l4_len=%u, tso_segsz=%u\n", > > m->l2_len, m->l3_len, m->l4_len, m->tso_segsz); > > Mm, why specifically those two only? > If the intention is to make this debug output shorter, I would apply > the same to all those fields, and omit the whole (new) line if no > field is set.
The intention is not do make the output shorter, but to reduce the amount of "noise" (useless data) in the output. My suggestion omits noise for non-tunneled packets. Maybe tso_segsz could be conditional on non-zero too. It depends on what the user/developer is debugging, whether l2/l3/l4_len are considered noise. I don't object to making them conditional too, if you prefer. Anyway, I just realized that the tx_offload field is not cleared on RX, so the discussed zero-check is useless (checking uninitialized data) when dumping an mbuf at an early stage in the application's packet processing pipeline. I have an idea to get around this... The TX flags in ol_flags are cleared at RX, so we can consider tx_offload uninitialized until one of the TX flags in ol_flags has been set.

