]> git.proxmox.com Git - mirror_iproute2.git/commitdiff
tc: Reflect HW offload status
authorOr Gerlitz <ogerlitz@mellanox.com>
Thu, 4 May 2017 13:15:15 +0000 (16:15 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 5 May 2017 16:49:25 +0000 (09:49 -0700)
Currently there is no way of querying whether a filter is
offloaded to HW or not when using "both" policy (where none
of skip_sw or skip_hw flags are set by user-space).

Add two new flags, "in hw" and "not in hw" such that user
space can determine if a filter is actually offloaded to
hw or not. The "in hw" UAPI semantics was chosen so it's
similar to the "skip hw" flag logic.

If none of these two flags are set, this signals running
over older kernel.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
tc/f_bpf.c
tc/f_flower.c
tc/f_matchall.c
tc/f_u32.c

index df8a259e18712e9e513c5ec54aeaa7d84678492a..75c44c06cc88f1a00c69cf3b6fb6e03d353e8fa2 100644 (file)
@@ -210,6 +210,11 @@ static int bpf_print_opt(struct filter_util *qu, FILE *f,
                        fprintf(f, "skip_hw ");
                if (flags & TCA_CLS_FLAGS_SKIP_SW)
                        fprintf(f, "skip_sw ");
+
+               if (flags & TCA_CLS_FLAGS_IN_HW)
+                       fprintf(f, "in_hw ");
+               else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
+                       fprintf(f, "not_in_hw ");
        }
 
        if (tb[TCA_BPF_OPS] && tb[TCA_BPF_OPS_LEN])
index 5aac4a0837f406cd9789d424a47558fa5a6f486b..ebc63ca6b2a27f6f4893efe32d3b7513b504d6d5 100644 (file)
@@ -1171,6 +1171,11 @@ static int flower_print_opt(struct filter_util *qu, FILE *f,
                        fprintf(f, "\n  skip_hw");
                if (flags & TCA_CLS_FLAGS_SKIP_SW)
                        fprintf(f, "\n  skip_sw");
+
+               if (flags & TCA_CLS_FLAGS_IN_HW)
+                       fprintf(f, "\n  in_hw");
+               else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
+                       fprintf(f, "\n  not_in_hw");
        }
 
        if (tb[TCA_FLOWER_ACT])
index ac4863083767da7f0840d08efd3e1605d49a9869..5a51e7553e82a1123d20db4ddb9a435dbde09882 100644 (file)
@@ -137,6 +137,11 @@ static int matchall_print_opt(struct filter_util *qu, FILE *f,
                        fprintf(f, "\n  skip_hw");
                if (flags & TCA_CLS_FLAGS_SKIP_SW)
                        fprintf(f, "\n  skip_sw");
+
+               if (flags & TCA_CLS_FLAGS_IN_HW)
+                       fprintf(f, "\n  in_hw");
+               else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
+                       fprintf(f, "\n  not_in_hw");
        }
 
        if (tb[TCA_MATCHALL_ACT])
index 92c1fcd4512c0794bda91d67b1330d9a17621623..ff700e9f4a2d7313450a6ade6d22bb3cd3f487c8 100644 (file)
@@ -1264,6 +1264,11 @@ static int u32_print_opt(struct filter_util *qu, FILE *f, struct rtattr *opt,
                        fprintf(f, "skip_hw ");
                if (flags & TCA_CLS_FLAGS_SKIP_SW)
                        fprintf(f, "skip_sw ");
+
+               if (flags & TCA_CLS_FLAGS_IN_HW)
+                       fprintf(f, "in_hw ");
+               else if (flags & TCA_CLS_FLAGS_NOT_IN_HW)
+                       fprintf(f, "not_in_hw ");
        }
 
        if (tb[TCA_U32_PCNT]) {