Netdev List
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@mellanox.com>,
	mlxsw@mellanox.com, Roi Dayan <roid@mellanox.com>,
	Paul Blakey <paulb@mellanox.com>,
	Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net] net/sched: cls_flower: Avoid attempt to delete from hw a flow which was not offloaded
Date: Wed, 25 Oct 2017 16:44:40 +0300	[thread overview]
Message-ID: <1508939080-22317-1-git-send-email-ogerlitz@mellanox.com> (raw)

If we failed to offload a flow to HW, we should not be attempting to delete
it from the HW. Also, on this case, we should be err-ing only if the flow is
not is SW, fix both issues.

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 | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 16f58ab..b98e0cb 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -230,15 +230,12 @@ 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) {
-		fl_hw_destroy_filter(tp, f);
-		return err;
-	} else if (err > 0) {
+
+	if (err > 0)
 		f->flags |= TCA_CLS_FLAGS_IN_HW;
-	}
 
-	if (skip_sw && !(f->flags & TCA_CLS_FLAGS_IN_HW))
-		return -EINVAL;
+	if (skip_sw)
+		return err;
 
 	return 0;
 }
-- 
2.5.5

             reply	other threads:[~2017-10-25 13:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-25 13:44 Or Gerlitz [this message]
2017-10-25 13:58 ` [PATCH net] net/sched: cls_flower: Avoid attempt to delete from hw a flow which was not offloaded Jiri Pirko
2017-10-25 14:07   ` Or Gerlitz
2017-10-25 14:16     ` Jiri Pirko
2017-10-25 14:30       ` Or Gerlitz

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=1508939080-22317-1-git-send-email-ogerlitz@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=jiri@mellanox.com \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=paulb@mellanox.com \
    --cc=roid@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