summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-15 10:47:14 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-15 10:47:14 +0000
commit7f11532c587bdb85924929c4f4d9750761c78562 (patch)
tree67d3a5cb5cdaa93feb25a1089af84bf91da1fad5
parent1133101bc8b302b48240b3acbc6046ef7c74860d (diff)
downloadmtk-20170518-7f11532c587bdb85924929c4f4d9750761c78562.zip
mtk-20170518-7f11532c587bdb85924929c4f4d9750761c78562.tar.gz
mtk-20170518-7f11532c587bdb85924929c4f4d9750761c78562.tar.bz2
kernel: compile out SNMP MIB related counting if debloat-proc is active - improves network stack performance
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 48239
-rw-r--r--target/linux/generic/patches-4.1/902-debloat_proc.patch44
-rw-r--r--target/linux/generic/patches-4.3/902-debloat_proc.patch44
-rw-r--r--target/linux/generic/patches-4.4/902-debloat_proc.patch44
3 files changed, 132 insertions, 0 deletions
diff --git a/target/linux/generic/patches-4.1/902-debloat_proc.patch b/target/linux/generic/patches-4.1/902-debloat_proc.patch
index ae72150..65d6cf8 100644
--- a/target/linux/generic/patches-4.1/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.1/902-debloat_proc.patch
@@ -339,3 +339,47 @@
remove_proc_entry("dev", net->proc_net);
}
+--- a/include/net/snmp.h
++++ b/include/net/snmp.h
+@@ -123,6 +123,30 @@ struct linux_xfrm_mib {
+ #define DECLARE_SNMP_STAT(type, name) \
+ extern __typeof__(type) __percpu *name
+
++#ifdef CONFIG_PROC_STRIPPED
++#define SNMP_INC_STATS_BH(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_USER(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_DEC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_BH(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_USER(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++
++#else
++
+ #define SNMP_INC_STATS_BH(mib, field) \
+ __this_cpu_inc(mib->mibs[field])
+
+@@ -159,8 +183,9 @@ struct linux_xfrm_mib {
+ __this_cpu_add(ptr[basefield##OCTETS], addend); \
+ } while (0)
+
++#endif
+
+-#if BITS_PER_LONG==32
++#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED)
+
+ #define SNMP_ADD_STATS64_BH(mib, field, addend) \
+ do { \
diff --git a/target/linux/generic/patches-4.3/902-debloat_proc.patch b/target/linux/generic/patches-4.3/902-debloat_proc.patch
index 0d409b6..5d74f43 100644
--- a/target/linux/generic/patches-4.3/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.3/902-debloat_proc.patch
@@ -339,3 +339,47 @@
remove_proc_entry("dev", net->proc_net);
}
+--- a/include/net/snmp.h
++++ b/include/net/snmp.h
+@@ -123,6 +123,30 @@ struct linux_xfrm_mib {
+ #define DECLARE_SNMP_STAT(type, name) \
+ extern __typeof__(type) __percpu *name
+
++#ifdef CONFIG_PROC_STRIPPED
++#define SNMP_INC_STATS_BH(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_USER(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_DEC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_BH(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_USER(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++
++#else
++
+ #define SNMP_INC_STATS_BH(mib, field) \
+ __this_cpu_inc(mib->mibs[field])
+
+@@ -159,8 +183,9 @@ struct linux_xfrm_mib {
+ __this_cpu_add(ptr[basefield##OCTETS], addend); \
+ } while (0)
+
++#endif
+
+-#if BITS_PER_LONG==32
++#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED)
+
+ #define SNMP_ADD_STATS64_BH(mib, field, addend) \
+ do { \
diff --git a/target/linux/generic/patches-4.4/902-debloat_proc.patch b/target/linux/generic/patches-4.4/902-debloat_proc.patch
index 6568836..0740e96 100644
--- a/target/linux/generic/patches-4.4/902-debloat_proc.patch
+++ b/target/linux/generic/patches-4.4/902-debloat_proc.patch
@@ -339,3 +339,47 @@
remove_proc_entry("dev", net->proc_net);
}
+--- a/include/net/snmp.h
++++ b/include/net/snmp.h
+@@ -123,6 +123,30 @@ struct linux_xfrm_mib {
+ #define DECLARE_SNMP_STAT(type, name) \
+ extern __typeof__(type) __percpu *name
+
++#ifdef CONFIG_PROC_STRIPPED
++#define SNMP_INC_STATS_BH(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_USER(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_INC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_DEC_STATS(mib, field) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_BH(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS_USER(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_ADD_STATS(mib, field, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
++ do { (void) mib->mibs[0]; } while(0)
++
++#else
++
+ #define SNMP_INC_STATS_BH(mib, field) \
+ __this_cpu_inc(mib->mibs[field])
+
+@@ -159,8 +183,9 @@ struct linux_xfrm_mib {
+ __this_cpu_add(ptr[basefield##OCTETS], addend); \
+ } while (0)
+
++#endif
+
+-#if BITS_PER_LONG==32
++#if (BITS_PER_LONG==32) && !defined(CONFIG_PROC_STRIPPED)
+
+ #define SNMP_ADD_STATS64_BH(mib, field, addend) \
+ do { \