All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/sched: cls_flower: Don't err on HW flow add failure unless we're on skip_sw
@ 2017-10-25 14:38 Or Gerlitz
  2017-10-25 15:01 ` Jiri Pirko
  0 siblings, 1 reply; 2+ messages in thread
From: Or Gerlitz @ 2017-10-25 14:38 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, Jiri Pirko, mlxsw, Roi Dayan, Paul Blakey, Or Gerlitz

If we failed to offload a flow to HW, we should be err-ing only if skip_sw
is set, otherwise this should go unnoted.

Fixes: 717503b9cf57 ('net: sched: convert cls_flower->egress_dev users to tc_setup_cb_egdev infra')
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
 net/sched/cls_flower.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 16f58ab..ae2b5c6 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -230,12 +230,10 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
 
 	err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
 			       &cls_flower, skip_sw);
-	if (err < 0) {
+	if (err < 0)
 		fl_hw_destroy_filter(tp, f);
-		return err;
-	} else if (err > 0) {
+	else if (err > 0)
 		f->flags |= TCA_CLS_FLAGS_IN_HW;
-	}
 
 	if (skip_sw && !(f->flags & TCA_CLS_FLAGS_IN_HW))
 		return -EINVAL;
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net/sched: cls_flower: Don't err on HW flow add failure unless we're on skip_sw
  2017-10-25 14:38 [PATCH net] net/sched: cls_flower: Don't err on HW flow add failure unless we're on skip_sw Or Gerlitz
@ 2017-10-25 15:01 ` Jiri Pirko
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2017-10-25 15:01 UTC (permalink / raw)
  To: Or Gerlitz
  Cc: David S. Miller, netdev, Jiri Pirko, mlxsw, Roi Dayan, Paul Blakey

Wed, Oct 25, 2017 at 04:38:33PM CEST, ogerlitz@mellanox.com wrote:
>If we failed to offload a flow to HW, we should be err-ing only if skip_sw
>is set, otherwise this should go unnoted.

First of all, this patch should got to net-next, not net as you
indicate.


>
>Fixes: 717503b9cf57 ('net: sched: convert cls_flower->egress_dev users to tc_setup_cb_egdev infra')
>Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
>---
> net/sched/cls_flower.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
>diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
>index 16f58ab..ae2b5c6 100644
>--- a/net/sched/cls_flower.c
>+++ b/net/sched/cls_flower.c
>@@ -230,12 +230,10 @@ static int fl_hw_replace_filter(struct tcf_proto *tp,
> 
> 	err = tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
> 			       &cls_flower, skip_sw);
>-	if (err < 0) {
>+	if (err < 0)
> 		fl_hw_destroy_filter(tp, f);
>-		return err;

I believe it is better to do just:
		if (skip_sw)
			return err;
The reason is that you would propagate the actual error, not just
"-EINVAL" in all cases.


The same issue is present for matchall, u32 and bpf classifiers. Do you
want to fix it in one go? If not, I can take care of it. Up to you.


Thanks



>-	} else if (err > 0) {
>+	else if (err > 0)
> 		f->flags |= TCA_CLS_FLAGS_IN_HW;
>-	}
> 
> 	if (skip_sw && !(f->flags & TCA_CLS_FLAGS_IN_HW))
> 		return -EINVAL;
>-- 
>2.5.5
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-25 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-25 14:38 [PATCH net] net/sched: cls_flower: Don't err on HW flow add failure unless we're on skip_sw Or Gerlitz
2017-10-25 15:01 ` Jiri Pirko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.