Commit 8212ed77 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

net: sched: cls_flower: use flow_dissector for ingress ifindex

Use previously introduced infra to obtain and store ingress ifindex
instead doing it locally.
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82828b88
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <net/dst_metadata.h> #include <net/dst_metadata.h>
struct fl_flow_key { struct fl_flow_key {
int indev_ifindex; struct flow_dissector_key_meta meta;
struct flow_dissector_key_control control; struct flow_dissector_key_control control;
struct flow_dissector_key_control enc_control; struct flow_dissector_key_control enc_control;
struct flow_dissector_key_basic basic; struct flow_dissector_key_basic basic;
...@@ -284,7 +284,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp, ...@@ -284,7 +284,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
list_for_each_entry_rcu(mask, &head->masks, list) { list_for_each_entry_rcu(mask, &head->masks, list) {
fl_clear_masked_range(&skb_key, mask); fl_clear_masked_range(&skb_key, mask);
skb_key.indev_ifindex = skb->skb_iif; skb_flow_dissect_meta(skb, &mask->dissector, &skb_key);
/* skb_flow_dissect() does not set n_proto in case an unknown /* skb_flow_dissect() does not set n_proto in case an unknown
* protocol, so do it rather here. * protocol, so do it rather here.
*/ */
...@@ -1026,8 +1026,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb, ...@@ -1026,8 +1026,8 @@ static int fl_set_key(struct net *net, struct nlattr **tb,
int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV], extack); int err = tcf_change_indev(net, tb[TCA_FLOWER_INDEV], extack);
if (err < 0) if (err < 0)
return err; return err;
key->indev_ifindex = err; key->meta.ingress_ifindex = err;
mask->indev_ifindex = 0xffffffff; mask->meta.ingress_ifindex = 0xffffffff;
} }
fl_set_key_val(tb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST, fl_set_key_val(tb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST,
...@@ -1281,6 +1281,8 @@ static void fl_init_dissector(struct flow_dissector *dissector, ...@@ -1281,6 +1281,8 @@ static void fl_init_dissector(struct flow_dissector *dissector,
struct flow_dissector_key keys[FLOW_DISSECTOR_KEY_MAX]; struct flow_dissector_key keys[FLOW_DISSECTOR_KEY_MAX];
size_t cnt = 0; size_t cnt = 0;
FL_KEY_SET_IF_MASKED(mask, keys, cnt,
FLOW_DISSECTOR_KEY_META, meta);
FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_CONTROL, control); FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_CONTROL, control);
FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_BASIC, basic); FL_KEY_SET(keys, cnt, FLOW_DISSECTOR_KEY_BASIC, basic);
FL_KEY_SET_IF_MASKED(mask, keys, cnt, FL_KEY_SET_IF_MASKED(mask, keys, cnt,
...@@ -2122,10 +2124,10 @@ static int fl_dump_key_enc_opt(struct sk_buff *skb, ...@@ -2122,10 +2124,10 @@ static int fl_dump_key_enc_opt(struct sk_buff *skb,
static int fl_dump_key(struct sk_buff *skb, struct net *net, static int fl_dump_key(struct sk_buff *skb, struct net *net,
struct fl_flow_key *key, struct fl_flow_key *mask) struct fl_flow_key *key, struct fl_flow_key *mask)
{ {
if (mask->indev_ifindex) { if (mask->meta.ingress_ifindex) {
struct net_device *dev; struct net_device *dev;
dev = __dev_get_by_index(net, key->indev_ifindex); dev = __dev_get_by_index(net, key->meta.ingress_ifindex);
if (dev && nla_put_string(skb, TCA_FLOWER_INDEV, dev->name)) if (dev && nla_put_string(skb, TCA_FLOWER_INDEV, dev->name))
goto nla_put_failure; goto nla_put_failure;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment