From: Olivier Matz <olivier.matz@6wind.com>
To: Andrew Rybchenko <arybchenko@solarflare.com>
Cc: David Marchand <david.marchand@6wind.com>,
dev@dpdk.org, "Lu, Wenzhuo" <wenzhuo.lu@intel.com>,
"Wu, Jingjing" <jingjing.wu@intel.com>,
"Iremonger, Bernard" <bernard.iremonger@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/3] mbuf: add a non fatal sanity check helper
Date: Tue, 9 Oct 2018 11:10:46 +0200 [thread overview]
Message-ID: <20181009091046.hxlwveehcg5y562u@platinum> (raw)
In-Reply-To: <8d525334-f770-7627-4023-c61aa92f4655@solarflare.com>
On Mon, Sep 10, 2018 at 11:33:44AM +0300, Andrew Rybchenko wrote:
> On 09/10/2018 11:24 AM, David Marchand wrote:
> > On Mon, Sep 10, 2018 at 10:12 AM, Andrew Rybchenko
> > <arybchenko@solarflare.com> wrote:
> > > +/**
> > > + * Sanity checks on a mbuf.
> > > + *
> > > + * Almost like rte_mbuf_sanity_check(), but this function gives the reason
> > > + * if corruption is detected rather than panic.
> > > + *
> > > + * @param m
> > > + * The mbuf to be checked.
> > > + * @param is_header
> > > + * True if the mbuf is a packet header, false if it is a sub-segment
> > > + * of a packet (in this case, some fields like nb_segs are not checked)
> > > + * @param reason
> > > + * A reference to a string pointer where to store the reason why a mbuf
> > > is
> > > + * considered invalid.
> > > + * @return
> > > + * - 0 if no issue has been found, reason is left untouched.
> > > + * - -1 if a problem is detected, reason then points to a string
> > > describing
> > > + * the reason why the mbuf is deemed invalid.
> > > + */
> > > +__rte_experimental
> > > +int rte_mbuf_check(const struct rte_mbuf *m, int is_header,
> > > + const char **reason);
> > > +
> > >
> > >
> > > May be it would be better to return reason as return value and if it is NULL
> > > everything is OK?
> > This was what I had done with my first attempt.
> > But given the name "rte_mbuf_check", having a int (used as a bool)
> > returned makes sense to me.
>
> Yes, good point.
>
> > So no strong opinion here.
>
> Me too.
I think an int is fine.
Acked-by: Olivier Matz <olivier.matz@6wind.com>
next prev parent reply other threads:[~2018-10-09 9:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 5:45 [dpdk-dev] [PATCH 0/3] segment sanity checks David Marchand
2018-09-10 5:45 ` [dpdk-dev] [PATCH 1/3] mbuf: add sanity checks on segment metadata David Marchand
2018-09-11 18:16 ` Yongseok Koh
2018-09-13 6:55 ` David Marchand
2018-10-09 9:11 ` Olivier Matz
2018-09-10 5:45 ` [dpdk-dev] [PATCH 2/3] mbuf: add a non fatal sanity check helper David Marchand
2018-09-10 5:56 ` David Marchand
2018-09-10 8:12 ` Andrew Rybchenko
2018-09-10 8:24 ` David Marchand
2018-09-10 8:33 ` Andrew Rybchenko
2018-10-09 9:10 ` Olivier Matz [this message]
2018-09-10 5:45 ` [dpdk-dev] [PATCH 3/3] app/testpmd: add sanity checks on received/sent packets David Marchand
2018-09-25 13:17 ` Iremonger, Bernard
2018-09-25 15:11 ` David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181009091046.hxlwveehcg5y562u@platinum \
--to=olivier.matz@6wind.com \
--cc=arybchenko@solarflare.com \
--cc=bernard.iremonger@intel.com \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).