From: Marcelo Leitner <mleitner@redhat.com>
To: Paul Blakey <paulb@mellanox.com>
Cc: Guy Shattah <sguy@mellanox.com>,
Aaron Conole <aconole@redhat.com>,
John Hurley <john.hurley@netronome.com>,
Simon Horman <simon.horman@netronome.com>,
Justin Pettit <jpettit@ovn.org>,
Gregory Rose <gvrose8192@gmail.com>,
Eelco Chaudron <echaudro@redhat.com>,
Flavio Leitner <fbl@redhat.com>,
Florian Westphal <fwestpha@redhat.com>,
Jiri Pirko <jiri@resnulli.us>, Rashid Khan <rkhan@redhat.com>,
Sushil Kulkarni <sukulkar@redhat.com>,
Andy Gospodarek <andrew.gospodarek@broadcom.com>,
Roi Dayan <roid@mellanox.com>,
Yossi Kuperman <yossiku@mellanox.com>,
Or Gerlitz <ogerlitz@mellanox.com>,
Rony Efraim <ronye@mellanox.com>,
"davem@davemloft.net" <davem@davemloft.net>,
netdev@vger.kernel.org
Subject: Re: [RFC PATCH net-next 3/6 v2] net/sched: cls_flower: Add ematch support
Date: Tue, 29 Jan 2019 16:08:10 -0200 [thread overview]
Message-ID: <20190129180810.GX10660@localhost.localdomain> (raw)
In-Reply-To: <1548748926-23822-4-git-send-email-paulb@mellanox.com>
On Tue, Jan 29, 2019 at 10:02:03AM +0200, Paul Blakey wrote:
> TODO: handle EEXist.
>
> Signed-off-by: Paul Blakey <paulb@mellanox.com>
> ---
> include/uapi/linux/pkt_cls.h | 2 ++
> net/sched/cls_flower.c | 22 ++++++++++++++++++----
> 2 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
> index 121f1ef..d848d6d 100644
> --- a/include/uapi/linux/pkt_cls.h
> +++ b/include/uapi/linux/pkt_cls.h
> @@ -506,6 +506,8 @@ enum {
> TCA_FLOWER_KEY_CT_LABELS,
> TCA_FLOWER_KEY_CT_LABELS_MASK,
>
> + TCA_FLOWER_EMATCHES,
> +
> __TCA_FLOWER_MAX,
> };
>
> diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> index bf74a31..f11fda0 100644
> --- a/net/sched/cls_flower.c
> +++ b/net/sched/cls_flower.c
> @@ -104,6 +104,7 @@ struct cls_fl_filter {
> struct rhash_head ht_node;
> struct fl_flow_key mkey;
> struct tcf_exts exts;
> + struct tcf_ematch_tree ematches;
> struct tcf_result res;
> struct fl_flow_key key;
> struct list_head list;
> @@ -332,10 +333,14 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
> fl_set_masked_key(&skb_mkey, &skb_key, mask);
>
> f = fl_lookup(mask, &skb_mkey, &skb_key);
> - if (f && !tc_skip_sw(f->flags)) {
> - *res = f->res;
> - return tcf_exts_exec(skb, &f->exts, res);
> - }
> + if (!f || tc_skip_sw(f->flags))
> + continue;
> +
> + if (!tcf_em_tree_match(skb, &f->ematches, NULL))
> + continue;
Considering just the recirc_id (and not the other fields supported by
ematch), have you considered integrating recirc_id match on flow
dissector instead? It would avoid the matching in 2 steps here and
benefit from the hashing.
> +
> + *res = f->res;
> + return tcf_exts_exec(skb, &f->exts, res);
> }
> return -1;
> }
> @@ -388,6 +393,7 @@ static bool fl_mask_put(struct cls_fl_head *head, struct fl_flow_mask *mask,
> static void __fl_destroy_filter(struct cls_fl_filter *f)
> {
> tcf_exts_destroy(&f->exts);
> + tcf_em_tree_destroy(&f->ematches);
> tcf_exts_put_net(&f->exts);
> kfree(f);
> }
> @@ -523,6 +529,7 @@ static void *fl_get(struct tcf_proto *tp, u32 handle)
> static const struct nla_policy fl_policy[TCA_FLOWER_MAX + 1] = {
> [TCA_FLOWER_UNSPEC] = { .type = NLA_UNSPEC },
> [TCA_FLOWER_CLASSID] = { .type = NLA_U32 },
> + [TCA_FLOWER_EMATCHES] = { .type = NLA_NESTED },
> [TCA_FLOWER_INDEV] = { .type = NLA_STRING,
> .len = IFNAMSIZ },
> [TCA_FLOWER_KEY_ETH_DST] = { .len = ETH_ALEN },
> @@ -1348,6 +1355,10 @@ static int fl_set_parms(struct net *net, struct tcf_proto *tp,
> if (err < 0)
> return err;
>
> + err = tcf_em_tree_validate(tp, tb[TCA_FLOWER_EMATCHES], &f->ematches);
> + if (err < 0)
> + return err;
> +
> if (tb[TCA_FLOWER_CLASSID]) {
> f->res.classid = nla_get_u32(tb[TCA_FLOWER_CLASSID]);
> tcf_bind_filter(tp, &f->res, base);
> @@ -2143,6 +2154,9 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, void *fh,
> nla_put_u32(skb, TCA_FLOWER_CLASSID, f->res.classid))
> goto nla_put_failure;
>
> + if (tcf_em_tree_dump(skb, &f->ematches, TCA_FLOWER_EMATCHES) < 0)
> + goto nla_put_failure;
> +
> key = &f->key;
> mask = &f->mask->key;
>
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2019-01-29 18:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-29 8:02 [RFC PATCH net-next 1/6 v2] net/sched: Introduce act_ct Paul Blakey
2019-01-29 8:02 ` [RFC PATCH net-next 2/6 v2] net/sched: cls_flower: add match on ct info Paul Blakey
2019-01-29 8:02 ` [RFC PATCH net-next 3/6 v2] net/sched: cls_flower: Add ematch support Paul Blakey
2019-01-29 18:08 ` Marcelo Leitner [this message]
2019-01-30 8:40 ` Paul Blakey
2019-01-29 8:02 ` [RFC PATCH net-next 4/6 v2] net: Add new tc recirc id skb extension Paul Blakey
2019-01-29 8:02 ` [RFC PATCH net-next 5/6 v2] net/sched: em_meta: add match on " Paul Blakey
2019-01-29 8:02 ` [RFC PATCH net-next 6/6 v2] net/sched: act_ct: Add tc recirc id set/del support Paul Blakey
2019-01-29 18:12 ` Marcelo Leitner
2019-01-30 8:20 ` Paul Blakey
2019-02-01 13:23 ` [RFC PATCH net-next 1/6 v2] net/sched: Introduce act_ct Marcelo Leitner
2019-02-03 8:26 ` Paul Blakey
2019-02-04 12:48 ` Simon Horman
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=20190129180810.GX10660@localhost.localdomain \
--to=mleitner@redhat.com \
--cc=aconole@redhat.com \
--cc=andrew.gospodarek@broadcom.com \
--cc=davem@davemloft.net \
--cc=echaudro@redhat.com \
--cc=fbl@redhat.com \
--cc=fwestpha@redhat.com \
--cc=gvrose8192@gmail.com \
--cc=jiri@resnulli.us \
--cc=john.hurley@netronome.com \
--cc=jpettit@ovn.org \
--cc=netdev@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=paulb@mellanox.com \
--cc=rkhan@redhat.com \
--cc=roid@mellanox.com \
--cc=ronye@mellanox.com \
--cc=sguy@mellanox.com \
--cc=simon.horman@netronome.com \
--cc=sukulkar@redhat.com \
--cc=yossiku@mellanox.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).