From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4E31A04F7; Fri, 27 Dec 2019 18:05:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DEDEA1C08C; Fri, 27 Dec 2019 18:05:18 +0100 (CET) Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by dpdk.org (Postfix) with ESMTP id AD8B71C07E for ; Fri, 27 Dec 2019 18:05:17 +0100 (CET) Received: by mail-pg1-f196.google.com with SMTP id 6so14710075pgk.0 for ; Fri, 27 Dec 2019 09:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QEvxoNAk45eBVga2wppdhDs/1MLy5/t27ogiiSsuNl8=; b=rGcWAxlifCQ/6EUpTEwibMxYRv020sCENXN9fAYBAiAIqD0/Y1uoUnY7HbEHCzx3GN RAw78m0WghMFKrO8JvtQK0YyEFiVfWD7vXVMVd+aJhFXDt0O2YPZVYwORKofYh2TlTbX J4nbMfIK4sosn0VEnZU9lQgrdrXZAO7azhy7lmc9jGBFJaSwcXJqxV1f/+ewiQK3JufV xtSCDaSX3hZR4qvdUemCqo8WOR8dKpLXlbMu/jMNeR6b7zF30XhXc02PQYUYug1sSh2L rYGS/r8cZqG49ngIOg1/DX2LThaPYIESVR7rtqqK/77N7+kLwBkt1zTA8hHNqcx6Psbg jo4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QEvxoNAk45eBVga2wppdhDs/1MLy5/t27ogiiSsuNl8=; b=GEUF7Zjy+vNBMOK3BmBA/MOiHvswkNCiTxasA0djwViX5lEOOj9xsvlK+CcmT2mwuF yNiOJW5AOum4miQ48D+AzN9POXHBfJPrXYMmYgKLtsWrmFmlpRWYoTwi4XgE1kTw9/qT 4qde2fHo0SvXSskZcUbx/850trRoNoroDsPuDLyCDEXKGxU2IJY2I6kZqDZ4456Xavgv NmK63Zj1DRdKqrRnTi8Lpa5wxfxZbX3OSIh0OpS++8cU/lLwBn23SvKBc7z19QQqBeCG Ic77GL/BID8zxe9slnJC2rCdVg/q5rl8RQx0XgfoBfRMRE6W2c+VXUWqtjUnGibYi+gm hdFw== X-Gm-Message-State: APjAAAUwY/mkPwaImppdtxTAzD3vr0fhI8pfv23sFaaQ19mNyycHXipo 98GDX5KYuDm47sOx6wIwtCR9vBGotLkb8w== X-Google-Smtp-Source: APXvYqz1gmVgA/lxcFO7NdWj/khLIjdQ62h1JQzyUTY+sOtXwgY6zPjITKitlmVpa3G53ivIawciDA== X-Received: by 2002:a63:5512:: with SMTP id j18mr53260409pgb.189.1577466316566; Fri, 27 Dec 2019 09:05:16 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id d14sm44377101pfq.117.2019.12.27.09.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 09:05:16 -0800 (PST) Date: Fri, 27 Dec 2019 09:05:07 -0800 From: Stephen Hemminger To: Olivier Matz Cc: dev@dpdk.org Message-ID: <20191227090507.0fd48cd6@hermes.lan> In-Reply-To: <20191227091018.GN22738@platinum> References: <20191120174125.23704-1-stephen@networkplumber.org> <20191121183055.8096-1-stephen@networkplumber.org> <20191226161539.GI22738@platinum> <20191226085851.7f47ed81@hermes.lan> <20191227091018.GN22738@platinum> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2] mbuf: display more fields in dump X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Fri, 27 Dec 2019 10:10:18 +0100 Olivier Matz wrote: > Hi, > > On Thu, Dec 26, 2019 at 08:58:51AM -0800, Stephen Hemminger wrote: > > On Thu, 26 Dec 2019 17:15:39 +0100 > > Olivier Matz wrote: > > > > > Hi, > > > > > > On Thu, Nov 21, 2019 at 10:30:55AM -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 > > > > --- > > > > v2 - remove casts, change in_port to port > > > > the refcount and offset are property of per-segment > > > > > > > > lib/librte_mbuf/rte_mbuf.c | 17 ++++++++++------- > > > > 1 file changed, 10 insertions(+), 7 deletions(-) > > > > > > > > diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c > > > > index 35df1c4c38a5..4894d46628e3 100644 > > > > --- a/lib/librte_mbuf/rte_mbuf.c > > > > +++ b/lib/librte_mbuf/rte_mbuf.c > > > > @@ -473,18 +473,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; > > > > -- > > > > 2.20.1 > > > > > > > > > > Thanks for this enhancement. > > > > > > One comment however: I don't see why vlan_tci would be important than > > > packet type or rss tag. It is also a bit confusing to display a field > > > which can have a random value (if the vlan flag is not set in ol_flags). > > > > > > I'd prefer to dump vlan_tci only if the flag is present. Later we could > > > add more fields with the same logic. What do you think? > > > > Because this is a debugging hook and easier to always display the value. > > Thats all. > > This is precisely because it is a debug hook that I find dangerous to > display a wrong value. As the mbuf are recycled, a mbuf that does not > have a vlan_tci can display its previous value, which may look valid. > > What about simply doing this? > > 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) > fprintf(f, ", vlan_tci=%#x", m->vlan_tci); > fprintf(f, "\n"); > > If you want I can submit an updated version of your patch The right flags are more complex, you need to deal with TX vlan. And PKT_RX_VLAN means "this is a vlan packet" it doesn't mean vlan tag is stripped into TCI. That is PKT_RX_VLAN_STRIPPED