From: Paul Blakey <pa...@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 <pa...@mellanox.com>
Signed-off-by: Roi Dayan <r...@mellanox.com>
Reviewed-by: Or Gerlitz <ogerl...@mellanox.com>
Acked-by: Jiri Pirko <j...@mellanox.com>
---
 net/sched/cls_flower.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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;
 }
 
-- 
2.3.7

Reply via email to