Commit 79685219 authored by Hadar Hen Zion's avatar Hadar Hen Zion Committed by David S. Miller

net/sched: cls_flower: Try to offload only if skip_hw flag isn't set

Check skip_hw flag isn't set before calling
fl_hw_{replace/destroy}_filter and fl_hw_update_stats functions.

Replace the call to tc_should_offload with tc_can_offload.
tc_can_offload only checks if the device supports offloading, the check for
skip_hw flag is done earlier in the flow.
Signed-off-by: default avatarHadar Hen Zion <hadarh@mellanox.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 55330f05
...@@ -207,7 +207,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, unsigned long cookie) ...@@ -207,7 +207,7 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, unsigned long cookie)
struct tc_cls_flower_offload offload = {0}; struct tc_cls_flower_offload offload = {0};
struct tc_to_netdev tc; struct tc_to_netdev tc;
if (!tc_should_offload(dev, tp, 0)) if (!tc_can_offload(dev, tp))
return; return;
offload.command = TC_CLSFLOWER_DESTROY; offload.command = TC_CLSFLOWER_DESTROY;
...@@ -231,7 +231,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp, ...@@ -231,7 +231,7 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
struct tc_to_netdev tc; struct tc_to_netdev tc;
int err; int err;
if (!tc_should_offload(dev, tp, flags)) if (!tc_can_offload(dev, tp))
return tc_skip_sw(flags) ? -EINVAL : 0; return tc_skip_sw(flags) ? -EINVAL : 0;
offload.command = TC_CLSFLOWER_REPLACE; offload.command = TC_CLSFLOWER_REPLACE;
...@@ -259,7 +259,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) ...@@ -259,7 +259,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
struct tc_cls_flower_offload offload = {0}; struct tc_cls_flower_offload offload = {0};
struct tc_to_netdev tc; struct tc_to_netdev tc;
if (!tc_should_offload(dev, tp, 0)) if (!tc_can_offload(dev, tp))
return; return;
offload.command = TC_CLSFLOWER_STATS; offload.command = TC_CLSFLOWER_STATS;
...@@ -275,6 +275,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f) ...@@ -275,6 +275,7 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f) static void __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f)
{ {
list_del_rcu(&f->list); list_del_rcu(&f->list);
if (!tc_skip_hw(f->flags))
fl_hw_destroy_filter(tp, (unsigned long)f); fl_hw_destroy_filter(tp, (unsigned long)f);
tcf_unbind_filter(tp, &f->res); tcf_unbind_filter(tp, &f->res);
call_rcu(&f->rcu, fl_destroy_filter); call_rcu(&f->rcu, fl_destroy_filter);
...@@ -743,6 +744,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -743,6 +744,7 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
goto errout; goto errout;
} }
if (!tc_skip_hw(fnew->flags)) {
err = fl_hw_replace_filter(tp, err = fl_hw_replace_filter(tp,
&head->dissector, &head->dissector,
&mask.key, &mask.key,
...@@ -752,10 +754,12 @@ static int fl_change(struct net *net, struct sk_buff *in_skb, ...@@ -752,10 +754,12 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
fnew->flags); fnew->flags);
if (err) if (err)
goto errout; goto errout;
}
if (fold) { if (fold) {
rhashtable_remove_fast(&head->ht, &fold->ht_node, rhashtable_remove_fast(&head->ht, &fold->ht_node,
head->ht_params); head->ht_params);
if (!tc_skip_hw(fold->flags))
fl_hw_destroy_filter(tp, (unsigned long)fold); fl_hw_destroy_filter(tp, (unsigned long)fold);
} }
...@@ -879,6 +883,7 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh, ...@@ -879,6 +883,7 @@ static int fl_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
goto nla_put_failure; goto nla_put_failure;
} }
if (!tc_skip_hw(f->flags))
fl_hw_update_stats(tp, f); fl_hw_update_stats(tp, f);
if (fl_dump_key_val(skb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST, if (fl_dump_key_val(skb, key->eth.dst, TCA_FLOWER_KEY_ETH_DST,
......
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