* [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set
@ 2016-06-13 9:06 Amir Vadai
2016-06-13 12:26 ` Jiri Pirko
2016-06-15 5:30 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Amir Vadai @ 2016-06-13 9:06 UTC (permalink / raw)
To: David S. Miller
Cc: netdev, Jiri Pirko, John Fastabend, Jakub Kicinski, Or Gerlitz,
Hadar Har-Zion, Amir Vadai
From: Amir Vadai <amirva@mellanox.com>
When skip_sw is set and hardware fails to apply filter, return error to
user. This will make error propagation logic similar to the one
currently used in u32 classifier.
Also, changed code to use tc_skip_sw() utility function.
Signed-off-by: Amir Vadai <amirva@mellanox.com>
---
net/sched/cls_flower.c | 42 +++++++++++++++++++++++++-----------------
1 file changed, 25 insertions(+), 17 deletions(-)
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 1ea6f76..5060801 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -140,7 +140,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
f = rhashtable_lookup_fast(&head->ht,
fl_key_get_start(&skb_mkey, &head->mask),
head->ht_params);
- if (f && !(f->flags & TCA_CLS_FLAGS_SKIP_SW)) {
+ if (f && !tc_skip_sw(f->flags)) {
*res = f->res;
return tcf_exts_exec(skb, &f->exts, res);
}
@@ -187,19 +187,20 @@ static void fl_hw_destroy_filter(struct tcf_proto *tp, unsigned long cookie)
dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
}
-static void fl_hw_replace_filter(struct tcf_proto *tp,
- struct flow_dissector *dissector,
- struct fl_flow_key *mask,
- struct fl_flow_key *key,
- struct tcf_exts *actions,
- unsigned long cookie, u32 flags)
+static int fl_hw_replace_filter(struct tcf_proto *tp,
+ struct flow_dissector *dissector,
+ struct fl_flow_key *mask,
+ struct fl_flow_key *key,
+ struct tcf_exts *actions,
+ unsigned long cookie, u32 flags)
{
struct net_device *dev = tp->q->dev_queue->dev;
struct tc_cls_flower_offload offload = {0};
struct tc_to_netdev tc;
+ int err;
if (!tc_should_offload(dev, tp, flags))
- return;
+ return tc_skip_sw(flags) ? -EINVAL : 0;
offload.command = TC_CLSFLOWER_REPLACE;
offload.cookie = cookie;
@@ -211,7 +212,12 @@ static void fl_hw_replace_filter(struct tcf_proto *tp,
tc.type = TC_SETUP_CLSFLOWER;
tc.cls_flower = &offload;
- dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
+ err = dev->netdev_ops->ndo_setup_tc(dev, tp->q->handle, tp->protocol, &tc);
+
+ if (tc_skip_sw(flags))
+ return err;
+
+ return 0;
}
static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
@@ -572,20 +578,22 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,
if (err)
goto errout;
- if (!(fnew->flags & TCA_CLS_FLAGS_SKIP_SW)) {
+ if (!tc_skip_sw(fnew->flags)) {
err = rhashtable_insert_fast(&head->ht, &fnew->ht_node,
head->ht_params);
if (err)
goto errout;
}
- fl_hw_replace_filter(tp,
- &head->dissector,
- &mask.key,
- &fnew->key,
- &fnew->exts,
- (unsigned long)fnew,
- fnew->flags);
+ err = fl_hw_replace_filter(tp,
+ &head->dissector,
+ &mask.key,
+ &fnew->key,
+ &fnew->exts,
+ (unsigned long)fnew,
+ fnew->flags);
+ if (err)
+ goto errout;
if (fold) {
rhashtable_remove_fast(&head->ht, &fold->ht_node,
--
2.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set
2016-06-13 9:06 [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set Amir Vadai
@ 2016-06-13 12:26 ` Jiri Pirko
2016-06-15 5:30 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Pirko @ 2016-06-13 12:26 UTC (permalink / raw)
To: Amir Vadai
Cc: David S. Miller, netdev, Jiri Pirko, John Fastabend,
Jakub Kicinski, Or Gerlitz, Hadar Har-Zion, Amir Vadai
Mon, Jun 13, 2016 at 11:06:39AM CEST, amir@vadai.me wrote:
>From: Amir Vadai <amirva@mellanox.com>
>
>When skip_sw is set and hardware fails to apply filter, return error to
>user. This will make error propagation logic similar to the one
>currently used in u32 classifier.
>Also, changed code to use tc_skip_sw() utility function.
>
>Signed-off-by: Amir Vadai <amirva@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set
2016-06-13 9:06 [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set Amir Vadai
2016-06-13 12:26 ` Jiri Pirko
@ 2016-06-15 5:30 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-06-15 5:30 UTC (permalink / raw)
To: amir
Cc: netdev, jiri, john.r.fastabend, jakub.kicinski, ogerlitz, hadarh,
amirva
From: Amir Vadai <amir@vadai.me>
Date: Mon, 13 Jun 2016 12:06:39 +0300
> From: Amir Vadai <amirva@mellanox.com>
>
> When skip_sw is set and hardware fails to apply filter, return error to
> user. This will make error propagation logic similar to the one
> currently used in u32 classifier.
> Also, changed code to use tc_skip_sw() utility function.
>
> Signed-off-by: Amir Vadai <amirva@mellanox.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-15 5:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-13 9:06 [PATCH net-next] net/sched: flower: Return error when hw can't offload and skip_sw is set Amir Vadai
2016-06-13 12:26 ` Jiri Pirko
2016-06-15 5:30 ` David Miller
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).