From 292d5bd9bb344527e0da19433cf3e51f8a24058c Mon Sep 17 00:00:00 2001 From: Vlad Buslov Date: Mon, 4 Nov 2019 18:34:49 +0200 Subject: tc: Set 'no_percpu' flag for compatible actions Recent changes in Linux kernel TC action subsystem introduced new TCA_ACT_FLAGS_NO_PERCPU_STATS flag. The purpose of the flag is to request action implementation to skip allocating action stats with expensive percpu allocator and use regular built-in action stats instead. Such approach significantly improves rule insertion rate and reduce memory usage for hardware-offloaded rules that don't need benefits provided by percpu allocated stats (improved software TC fast-path performance). Set the flag for all compatible actions. Modify acinclude.m4 to use OVS-internal pkt_cls.h implementation when TCA_ACT_FLAGS is not defined by kernel headers and to manually define struct nla_bitfield32 in netlink.h (new file) when it is not defined by kernel headers. Signed-off-by: Vlad Buslov Reviewed-by: Roi Dayan Signed-off-by: Simon Horman --- include/linux/automake.mk | 1 + include/linux/netlink.h | 30 ++++++++++++++++++++++++++++++ include/linux/pkt_cls.h | 7 ++++++- 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 include/linux/netlink.h (limited to 'include/linux') diff --git a/include/linux/automake.mk b/include/linux/automake.mk index 4873a6ae6..c75918626 100644 --- a/include/linux/automake.mk +++ b/include/linux/automake.mk @@ -1,4 +1,5 @@ noinst_HEADERS += \ + include/linux/netlink.h \ include/linux/netfilter/nf_conntrack_sctp.h \ include/linux/pkt_cls.h \ include/linux/tc_act/tc_mpls.h \ diff --git a/include/linux/netlink.h b/include/linux/netlink.h new file mode 100644 index 000000000..cd558fb4c --- /dev/null +++ b/include/linux/netlink.h @@ -0,0 +1,30 @@ +#ifndef __UAPI_LINUX_NETLINK_WRAPPER_H +#define __UAPI_LINUX_NETLINK_WRAPPER_H 1 + +#if !defined(__KERNEL__) && !defined(HAVE_NLA_BITFIELD32) + +#include + +/* Generic 32 bitflags attribute content sent to the kernel. + * + * The value is a bitmap that defines the values being set + * The selector is a bitmask that defines which value is legit + * + * Examples: + * value = 0x0, and selector = 0x1 + * implies we are selecting bit 1 and we want to set its value to 0. + * + * value = 0x2, and selector = 0x2 + * implies we are selecting bit 2 and we want to set its value to 1. + * + */ +struct nla_bitfield32 { + __u32 value; + __u32 selector; +}; + +#endif /* !__KERNEL__ && !HAVE_NLA_BITFIELD32 */ + +#include_next + +#endif /* __UAPI_LINUX_NETLINK_WRAPPER_H */ diff --git a/include/linux/pkt_cls.h b/include/linux/pkt_cls.h index 2f7e328c4..55f3ef17c 100644 --- a/include/linux/pkt_cls.h +++ b/include/linux/pkt_cls.h @@ -1,7 +1,7 @@ #ifndef __LINUX_PKT_CLS_WRAPPER_H #define __LINUX_PKT_CLS_WRAPPER_H 1 -#if defined(__KERNEL__) || defined(HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK) +#if defined(__KERNEL__) || defined(HAVE_TCA_ACT_FLAGS) #include_next #else @@ -17,9 +17,14 @@ enum { TCA_ACT_STATS, TCA_ACT_PAD, TCA_ACT_COOKIE, + TCA_ACT_FLAGS, __TCA_ACT_MAX }; +#define TCA_ACT_FLAGS_NO_PERCPU_STATS 1 /* Don't use percpu allocator for + * actions stats. + */ + #define TCA_ACT_MAX __TCA_ACT_MAX #define TCA_OLD_COMPAT (TCA_ACT_MAX+1) #define TCA_ACT_MAX_PRIO 32 -- cgit v1.2.1