summaryrefslogtreecommitdiffstats
path: root/include/net/snmp.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-08-04 22:26:13 +0200
committerDavid S. Miller <davem@davemloft.net>2012-08-06 22:40:47 +0200
commitd25398df59b561a26cb4000ceb4dea8a3ff94d22 (patch)
treee5dfb19ca7a9d1dc7cfed76709ebc2c16c3200f1 /include/net/snmp.h
parentipv4: Introduce IN_DEV_NET_ROUTE_LOCALNET (diff)
downloadlinux-d25398df59b561a26cb4000ceb4dea8a3ff94d22.tar.xz
linux-d25398df59b561a26cb4000ceb4dea8a3ff94d22.zip
net: avoid reloads in SNMP_UPD_PO_STATS
Avoid two instructions to reload dev->nd_net->mib.ip_statistics pointer, unsing a temp variable, in ip_rcv(), ip_output() paths for example. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/snmp.h')
-rw-r--r--include/net/snmp.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/net/snmp.h b/include/net/snmp.h
index 0147b901e79c..71596261fa99 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -154,13 +154,15 @@ struct linux_xfrm_mib {
*/
#define SNMP_UPD_PO_STATS(mib, basefield, addend) \
do { \
- this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \
- this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \
+ __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
+ this_cpu_inc(ptr[basefield##PKTS]); \
+ this_cpu_add(ptr[basefield##OCTETS], addend); \
} while (0)
#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
do { \
- __this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \
- __this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \
+ __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
+ __this_cpu_inc(ptr[basefield##PKTS]); \
+ __this_cpu_add(ptr[basefield##OCTETS], addend); \
} while (0)