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 D0E4FA04F0; Fri, 27 Dec 2019 10:10:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C0A141BFFB; Fri, 27 Dec 2019 10:10:21 +0100 (CET) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by dpdk.org (Postfix) with ESMTP id E3CA41BFEE for ; Fri, 27 Dec 2019 10:10:19 +0100 (CET) Received: by mail-wr1-f68.google.com with SMTP id d16so25522744wre.10 for ; Fri, 27 Dec 2019 01:10:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uWlKJrwexat6MNkeYZaqyuIuyFAiz/HV6R/L8OZ20c0=; b=UNtvjhw0qdi4KOkFIPicEkQgIWAJX9vYwWrg7dBlwYT5N8NU+VhnWkAro0ucLcHFAH BtQLYxyujEfeXRGjggRtjtcRQBdJXFETEFl2Ar5nNg27g3XmUq4l43OEzypijqayQx1F qSYm5K2fkqxbPP34qq5eKu+I8/86OfsY1I4YSRC50HauAcb7uOCYv6J8FaA6BCQnWLnG sU/jcxAIggS+QxW4wsY6OaZEY0D3M5d5AoSz918i8xuNSJCxHDxr9xYtxi0UiwTda3TB 0DUpD3cSqLvvcfNq8FsnaE9KN2BcmStHYszUJlIf23KOgk3wIhfX2psFD+i4cgJVKfjy 1i2g== 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:references :mime-version:content-disposition:in-reply-to:user-agent; bh=uWlKJrwexat6MNkeYZaqyuIuyFAiz/HV6R/L8OZ20c0=; b=tKjcue1QEdH/tYyxfqww4n2OoL91HBqG25qW31H5DEeUE0hs0uQ6vgsvgocqbAxdpU SGjhyb8LoAVxOHb0Z7zKJNDWlh/Ors6NI6Zc7+NIQSMEBNas3uW0uAiyAZUslHhd9DPv mU4cyyhZsRbSUcqW9iOPKdtr9XhCI7FqLQa4+uGAWhT13Ewq7QYekqyrRXXiTVdL1yeB NbE+yuc5CRrSN/mFSmDoSiYBzAvBCfTuvLBuMHee3Xl/YDQ020pSFDYau2cVrHqk776Y rO+gOxM6nrHSSWpE2SHN8OJeQcSpX47fiQavH647WSDL2vxBN95LGxrBHaob+QZk9mBX FUFw== X-Gm-Message-State: APjAAAXRa28OCO2PCRxWTqmRqjtdIoCVxiK5FJ+rXcZHjHs9IBOdEkVR KtKpY0zzeqEERFEUQhNWAtfQMTCVRNI= X-Google-Smtp-Source: APXvYqyOJJ7zVmx1lVTxWFIjX46tesrYBuGXflE7g0KjhKsZ/J4TqCzXSo/W3iAchKk8fB6uZ3CD5w== X-Received: by 2002:adf:8b4f:: with SMTP id v15mr20164680wra.231.1577437819576; Fri, 27 Dec 2019 01:10:19 -0800 (PST) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id e12sm33676963wrn.56.2019.12.27.01.10.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 01:10:18 -0800 (PST) Date: Fri, 27 Dec 2019 10:10:18 +0100 From: Olivier Matz To: Stephen Hemminger Cc: dev@dpdk.org Message-ID: <20191227091018.GN22738@platinum> References: <20191120174125.23704-1-stephen@networkplumber.org> <20191121183055.8096-1-stephen@networkplumber.org> <20191226161539.GI22738@platinum> <20191226085851.7f47ed81@hermes.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191226085851.7f47ed81@hermes.lan> User-Agent: Mutt/1.10.1 (2018-07-13) 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" 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.