[ovs-dev] [PATCH 3/3] debug: print mbuf extra info.

Aaron Conole aconole at redhat.com
Thu Sep 26 15:59:14 UTC 2019


Flavio Leitner <fbl at sysclose.org> writes:

> Signed-off-by: Flavio Leitner <fbl at sysclose.org>
> ---
>  lib/netdev-dpdk.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index cfbd9a9e5..7965bf57a 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2294,6 +2294,24 @@ netdev_dpdk_vhost_update_rx_counters(struct netdev_stats *stats,
>          }
>  
>          stats->rx_bytes += packet_size;
> +#if 0

I've never liked bare '#if 0' in the code.

Can you make this something like:

  #ifndef NDEBUG

This means for all debug builds we would get this tracing
infrastructure.  Maybe even make a special configuration option?

> +        /* Debug/Tracing */
> +        struct rte_mbuf *mbuf = (struct rte_mbuf *)packet;
> +        int nb_segs = mbuf->nb_segs;
> +        if (nb_segs == 1)
> +                VLOG_INFO("single (root) size = %d, nb_segs = %d, max = %d",
> +                          mbuf->pkt_len, nb_segs,
> +                          rte_pktmbuf_data_room_size(mbuf->pool));
> +        else
> +                VLOG_INFO("chained (root) size = %d, nb_segs = %d, max = %d",
> +                          mbuf->pkt_len, nb_segs,
> +                          rte_pktmbuf_data_room_size(mbuf->pool));
> +
> +        for (int j = 1; j < nb_segs; j++) {
> +                mbuf = mbuf->next;
> +                VLOG_INFO("chained packet (%d) size = %d", j, mbuf->data_len);
> +        }
> +#endif
>      }
>  }


More information about the dev mailing list