]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
net/sched: Reflect HW offload status
authorOr Gerlitz <ogerlitz@mellanox.com>
Thu, 16 Feb 2017 08:31:12 +0000 (10:31 +0200)
committerTim Gardner <tim.gardner@canonical.com>
Wed, 1 Mar 2017 13:55:49 +0000 (06:55 -0700)
BugLink: http://bugs.launchpad.net/bugs/1668019
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: Amir Vadai <amir@vadai.me>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e696028acc458aa3d43ad899371a963eb28336d8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
include/net/pkt_cls.h
include/uapi/linux/pkt_cls.h

index f0a051480c6c27e1a360a9c041acd582114c4aae..e424e453467bcb21310f191b78fd17acbdc7d867 100644 (file)
@@ -473,6 +473,11 @@ static inline bool tc_flags_valid(u32 flags)
        return true;
 }
 
+static inline bool tc_in_hw(u32 flags)
+{
+       return (flags & TCA_CLS_FLAGS_IN_HW) ? true : false;
+}
+
 enum tc_fl_command {
        TC_CLSFLOWER_REPLACE,
        TC_CLSFLOWER_DESTROY,
index a4dcd88ec2718621c2cf8e801566e5264c75c071..425538714e89e76e01c6f5209de09b5bcbec028e 100644 (file)
@@ -155,8 +155,10 @@ enum {
 #define TCA_POLICE_MAX (__TCA_POLICE_MAX - 1)
 
 /* tca flags definitions */
-#define TCA_CLS_FLAGS_SKIP_HW  (1 << 0)
-#define TCA_CLS_FLAGS_SKIP_SW  (1 << 1)
+#define TCA_CLS_FLAGS_SKIP_HW  (1 << 0) /* don't offload filter to HW */
+#define TCA_CLS_FLAGS_SKIP_SW  (1 << 1) /* don't use filter in SW */
+#define TCA_CLS_FLAGS_IN_HW    (1 << 2) /* filter is offloaded to HW */
+#define TCA_CLS_FLAGS_NOT_IN_HW (1 << 3) /* filter isn't offloaded to HW */
 
 /* U32 filters */