diff mbox

[net-next,1/4] net/sched: cls_flower: Use skip flags to reflect HW offload status

Message ID 1486649888-2786-2-git-send-email-ogerlitz@mellanox.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Or Gerlitz Feb. 9, 2017, 2:18 p.m. UTC
From: Paul Blakey <paulb@mellanox.com>

Currently there is no way of querying whether a filter is
offloaded to HW or not when using both policy (no flag).

Reuse the skip flags to show the insertion status by setting
the skip_hw flag in case the filter wasn't offloaded.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
---
 net/sched/cls_flower.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
index 0826c8e..90e4490 100644
--- a/net/sched/cls_flower.c
+++ b/net/sched/cls_flower.c
@@ -252,7 +252,10 @@  static int fl_hw_replace_filter(struct tcf_proto *tp,
 		if (tcf_exts_get_dev(dev, &f->exts, &f->hw_dev) ||
 		    (f->hw_dev && !tc_can_offload(f->hw_dev, tp))) {
 			f->hw_dev = dev;
-			return tc_skip_sw(f->flags) ? -EINVAL : 0;
+			if (tc_skip_sw(f->flags))
+				return -EINVAL;
+			f->flags |= TCA_CLS_FLAGS_SKIP_HW;
+			return 0;
 		}
 		dev = f->hw_dev;
 		tc->egress_dev = true;
@@ -276,6 +279,8 @@  static int fl_hw_replace_filter(struct tcf_proto *tp,
 
 	if (tc_skip_sw(f->flags))
 		return err;
+	if (err)
+		f->flags |= TCA_CLS_FLAGS_SKIP_HW;
 	return 0;
 }