From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5 2/6] net/mlx5: support basic flow items and actions
Date: Mon, 9 Jan 2017 16:29:58 +0100 [thread overview]
Message-ID: <20170109152958.GB12822@6wind.com> (raw)
In-Reply-To: <37389e42-030a-a36f-57bc-a7ef15a0ee66@intel.com>
Hi Ferruh,
On Fri, Jan 06, 2017 at 01:52:53PM +0000, Ferruh Yigit wrote:
> On 1/4/2017 6:42 PM, Adrien Mazarguil wrote:
> > Hi Ferruh,
> >
> > On Wed, Jan 04, 2017 at 05:49:46PM +0000, Ferruh Yigit wrote:
> >> Hi Nelio,
> >>
> >> A quick question.
> >
> > I'll reply since it's related to the API.
> >
> >> On 12/29/2016 3:15 PM, Nelio Laranjeiro wrote:
> >>> Introduce initial software for rte_flow rules.
> >>>
> >>> VLAN, VXLAN are still not supported.
> >>>
> >>> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
> >>> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> >>
> >> <...>
> >>
> >>> +static int
> >>> +priv_flow_validate(struct priv *priv,
> >>> + const struct rte_flow_attr *attr,
> >>> + const struct rte_flow_item items[],
> >>> + const struct rte_flow_action actions[],
> >>> + struct rte_flow_error *error,
> >>> + struct mlx5_flow *flow)
> >>> +{
> >>> + const struct mlx5_flow_items *cur_item = mlx5_flow_items;
> >>
> >> <...>
> >>
> >>> + for (; items->type != RTE_FLOW_ITEM_TYPE_END; ++items) {
> >> <...>
> >>> + }
> >>> + for (; actions->type != RTE_FLOW_ACTION_TYPE_END; ++actions) {
> >> <...>
> >>> + }
> >>
> >> Is it guarantied in somewhere that items or actions terminated with
> >> TYPE_END?
> >
> > Yes, since it's now the only way to terminate items/actions lists [1][2].
> > There used to be a "max" value in the original draft but it seemed redundant
> > and proved annoying to use, and was therefore dropped.
> >
> > END items/actions behave like a NUL terminator for C strings. They are
> > likewise defined with value 0 for convenience.
>
> At least it is good idea to set END values to 0, but still if user not
> set it, most probably this will crash the app.
>
> Although most probably this kind of error will be detected easily in
> development phase, still it would be nice to return an error instead of
> crashing when user provide wrong input.
Unfortunately I cannot think of an easy way to do that, even for debugging
purposes, this would be like checking for unterminated strings or linked
lists without a NULL ending pointer. That's the trade-off of any unbounded
data structure.
Note PMDs will likely return errors as they iterate on garbage item/action
types, crashes will also almost always occur when attempting to dereference
the related spec/last/mask/conf pointers.
> >> And these fields are direct inputs from user.
> >> Is there a way to verify user provided values are with TYPE_END terminated?
> >
> > No, applications must check for its presence (they normally add it
> > themselves) before feeding these lists to PMDs. I think that's safe enough.
> >
> > Note the testpmd flow command does not allow entering a flow rule without
> > "end" tokens in both lists, there is no way around this restriction.
> >
> > [1] http://dpdk.org/doc/guides/prog_guide/rte_flow.html#matching-pattern
> > [2] http://dpdk.org/doc/guides/prog_guide/rte_flow.html#actions
--
Adrien Mazarguil
6WIND
next prev parent reply other threads:[~2017-01-09 15:30 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-25 18:14 [dpdk-dev] [PATCH 0/3] net/mlx5: support flow_rte Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 1/3] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 2/3] net/mlx5: add software " Nelio Laranjeiro
2016-11-25 18:14 ` [dpdk-dev] [PATCH 3/3] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 0/4] net/mlx5: support flow_rte Nelio Laranjeiro
2016-12-21 15:19 ` [dpdk-dev] [PATCH v3 " Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 0/6] net/mlx5: support flow API Nelio Laranjeiro
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 " Nelio Laranjeiro
2017-01-03 16:19 ` Ferruh Yigit
2017-01-04 14:48 ` Ferruh Yigit
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 1/6] net/mlx5: add preliminary flow API support Nelio Laranjeiro
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 2/6] net/mlx5: support basic flow items and actions Nelio Laranjeiro
2017-01-04 17:49 ` Ferruh Yigit
2017-01-04 18:42 ` Adrien Mazarguil
2017-01-06 13:52 ` Ferruh Yigit
2017-01-09 15:29 ` Adrien Mazarguil [this message]
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 3/6] net/mlx5: support VLAN flow item Nelio Laranjeiro
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 4/6] net/mlx5: support VXLAN " Nelio Laranjeiro
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 5/6] net/mlx5: support mark flow action Nelio Laranjeiro
2016-12-29 15:15 ` [dpdk-dev] [PATCH v5 6/6] net/mlx5: extend IPv4 flow item Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 1/6] net/mlx5: add preliminary flow API support Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 2/6] net/mlx5: support basic flow items and actions Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 3/6] net/mlx5: support VLAN flow item Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 4/6] net/mlx5: support VXLAN " Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 5/6] net/mlx5: support mark flow action Nelio Laranjeiro
2016-12-28 10:37 ` [dpdk-dev] [PATCH v4 6/6] net/mlx5: extend IPv4 flow item Nelio Laranjeiro
2016-12-21 15:19 ` [dpdk-dev] [PATCH v3 1/4] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-12-21 15:19 ` [dpdk-dev] [PATCH v3 2/4] net/mlx5: add software " Nelio Laranjeiro
2016-12-23 12:19 ` Ferruh Yigit
2016-12-23 13:24 ` Adrien Mazarguil
2016-12-21 15:19 ` [dpdk-dev] [PATCH v3 3/4] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-23 12:21 ` Ferruh Yigit
2016-12-26 12:20 ` Nélio Laranjeiro
2016-12-21 15:19 ` [dpdk-dev] [PATCH v3 4/4] net/mlx5: add VLAN filter support in rte_flow Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 1/4] net/mlx5: add preliminary support for rte_flow Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 2/4] net/mlx5: add software " Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 3/4] net/mlx5: add rte_flow rule creation Nelio Laranjeiro
2016-12-21 10:01 ` [dpdk-dev] [PATCH v2 4/4] net/mlx5: add VLAN filter support in rte_flow Nelio Laranjeiro
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=20170109152958.GB12822@6wind.com \
--to=adrien.mazarguil@6wind.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=nelio.laranjeiro@6wind.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).