Commit d25398df authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9eb43e76
...@@ -154,13 +154,15 @@ struct linux_xfrm_mib { ...@@ -154,13 +154,15 @@ struct linux_xfrm_mib {
*/ */
#define SNMP_UPD_PO_STATS(mib, basefield, addend) \ #define SNMP_UPD_PO_STATS(mib, basefield, addend) \
do { \ do { \
this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ this_cpu_inc(ptr[basefield##PKTS]); \
this_cpu_add(ptr[basefield##OCTETS], addend); \
} while (0) } while (0)
#define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \ #define SNMP_UPD_PO_STATS_BH(mib, basefield, addend) \
do { \ do { \
__this_cpu_inc(mib[0]->mibs[basefield##PKTS]); \ __typeof__(*mib[0]->mibs) *ptr = mib[0]->mibs; \
__this_cpu_add(mib[0]->mibs[basefield##OCTETS], addend); \ __this_cpu_inc(ptr[basefield##PKTS]); \
__this_cpu_add(ptr[basefield##OCTETS], addend); \
} while (0) } while (0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment