DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ori Kam <orika@nvidia.com>
To: NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Cc: Slava Ovsiienko <viacheslavo@nvidia.com>,
	"ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"ajit.khaparde@broadcom.com" <ajit.khaparde@broadcom.com>,
	"jerinj@marvell.com" <jerinj@marvell.com>,
	Ori Kam <orika@nvidia.com>
Subject: Re: [dpdk-dev] [RFC] ethdev: add sanity packet checks
Date: Sun, 7 Mar 2021 18:46:49 +0000	[thread overview]
Message-ID: <DM6PR12MB49872DA13B26A4EDDB2A8876D6949@DM6PR12MB4987.namprd12.prod.outlook.com> (raw)
In-Reply-To: <7146547.nIQmEXas8S@thomas>

Hi

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Thursday, March 4, 2021 12:46 PM
> Subject: Re: [dpdk-dev] [RFC] ethdev: add sanity packet checks
> 
> 04/03/2021 11:00, Ori Kam:
> > From: Thomas Monjalon
> > > 28/02/2021 20:48, Ori Kam:
> > > > Currently, DPDK application can offload the checksum check,
> > > > and report it in the mbuf.
> > > >
> > > > However, this approach doesn't work if the traffic
> > > > is offloaded and should not arrive to the application.
> > > >
> > > > This commit introduces rte flow item that enables
> > >
> > > s/rte flow/rte_flow/
> > >
> >
> > Sure
> >
> > > > matching on the checksum of the L3 and L4 layers,
> > > > in addition to other checks that can determine if
> > > > the packet is valid.
> > > > some of those tests can be packet len, data len,
> > > > unsupported flags, and so on.
> > > >
> > > > The full check is HW dependent.
> > >
> > > What is the "full check"?
> > > How much it is HW dependent?
> > >
> >
> > This also relates to your other comments,
> > Each HW may run different set of checks on the packet,
> > for example one PMD can just check the tcp flags while
> > a different PMD will also check the option.
> 
> I'm not sure how an application can rely on
> such a vague definition.
> 
Even now we are marking a packet in the mbuf with unknown 
in case of some error.
Would a better wording be " The HW detected errors in the packet"
in any case if the app will need to know what is the error it is his
responsibility, this item is just verification for fast path.
If you have better suggestion, I will be very happy to hear.

> 
> > > > + * RTE_FLOW_ITEM_TYPE_SANITY_CHECKS
> > > > + *
> > > > + * Enable matching on packet validity based on HW checks for the L3 and
> L4
> > > > + * layers.
> > > > + */
> > > > +struct rte_flow_item_sanity_checks {
> > > > +	uint32_t level;
> > > > +	/**< Packet encapsulation level the item should apply to.
> > > > +	 * @see rte_flow_action_rss
> > > > +	 */
> > > > +RTE_STD_C11
> > > > +	union {
> > > > +		struct {
> > >
> > > Why there is no L2 check?
> > >
> > Our HW doesn't support it.
> > If other HW support it, it should be added.
> 
> It would be an ABI breakage. Can we add it day one?
> 
Will add reserve, since this is bit field there shouldn't be any
ABI break.

> > > > +			uint32_t l3_ok:1;
> > > > +			/**< L3 layer is valid after passing all HW checking. */
> > > > +			uint32_t l4_ok:1;
> > > > +			/**< L4 layer is valid after passing all HW checking. */
> > >
> > > l3_ok and l4_ok looks vague.
> > > What does it cover exactly?
> > >
> > It depends on the HW in question.
> > In our case it checks in case of L3
> > the header len, and the version.
> > For L4 checking the len.
> 
> If we don't know exactly what is checked,
> how an application can rely on it?
> Is it a best effort check? What is the use case?
> 
From application point of view that packet is invalid.
it is the app responsibility to understand why.
You can think about it that in any case there might be
different counters for different errors or different actions.
For example, the app can decide that incorrect ipv4 version
should result in packet drop, while incorrect len
may pass.

Maybe we can list all possible error result, but I'm worried
that we may not cover all of them. On some HW there is just one 
bit that marks if the packet is valid or not.

> 
> > > > +			uint32_t l3_ok_csum:1;
> > > > +			/**< L3 layer checksum is valid. */
> > > > +			uint32_t l4_ok_csum:1;
> > > > +			/**< L4 layer checksum is valid. */
> 
> What worries me is that the checksum is separate but other checks
> are in a common bucket.
> I think we should have one field per precise check
> with a way to report what is checked.
> 
Pleas see above comment, Current HW doesn't support
such fine grain detection, so adding bit will force the user
to select all of them, in addition since the HW has some internal 
checks it is possible that the reject reason will be un related to the
L3, for example some HW may not support more then two vlans
so in case of 3 vlans may report bad L3.

Best,
Ori,


  reply	other threads:[~2021-03-07 18:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-28 19:48 Ori Kam
2021-02-28 20:14 ` Thomas Monjalon
2021-03-04 10:00   ` Ori Kam
2021-03-04 10:46     ` Thomas Monjalon
2021-03-07 18:46       ` Ori Kam [this message]
2021-03-08 23:05         ` Ajit Khaparde
2021-03-09 19:21           ` Ori Kam
2021-03-09  9:01 ` Andrew Rybchenko
2021-03-09  9:11   ` Thomas Monjalon
2021-03-09 15:08     ` Ori Kam
2021-03-09 15:27       ` Andrew Rybchenko
2021-03-09 19:46         ` Ori Kam

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=DM6PR12MB49872DA13B26A4EDDB2A8876D6949@DM6PR12MB4987.namprd12.prod.outlook.com \
    --to=orika@nvidia.com \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jerinj@marvell.com \
    --cc=thomas@monjalon.net \
    --cc=viacheslavo@nvidia.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).