summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2021-09-30 14:17:10 +0100
committerDavid S. Miller <davem@davemloft.net>2021-09-30 14:17:10 +0100
commitb05173028cc52384be42dcf81abdb4133caccfa5 (patch)
treec8834059bb0c4d98bf6446de0c7d2b8b59d377f6 /include
parentdee3b2d0fa4b51a079f7d12159b42240f795bf64 (diff)
parentacbd0c8144138b6e652240bba248910d330d71bf (diff)
downloadlinux-stable-b05173028cc52384be42dcf81abdb4133caccfa5.tar.gz
linux-stable-b05173028cc52384be42dcf81abdb4133caccfa5.tar.bz2
linux-stable-b05173028cc52384be42dcf81abdb4133caccfa5.zip
Merge branch 'snmp-optimizations'
Eric Dumazet says: ==================== net: snmp: minor optimizations Fetching many SNMP counters on hosts with large number of cpus takes a lot of time. mptcp still uses the old non-batched fashion which is not cache friendly. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/ip.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 9192444f2964..cf229a531194 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -291,7 +291,11 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
#define NET_ADD_STATS(net, field, adnd) SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
#define __NET_ADD_STATS(net, field, adnd) __SNMP_ADD_STATS((net)->mib.net_statistics, field, adnd)
-u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offct);
+static inline u64 snmp_get_cpu_field(void __percpu *mib, int cpu, int offt)
+{
+ return *(((unsigned long *)per_cpu_ptr(mib, cpu)) + offt);
+}
+
unsigned long snmp_fold_field(void __percpu *mib, int offt);
#if BITS_PER_LONG==32
u64 snmp_get_cpu_field64(void __percpu *mib, int cpu, int offct,