diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/net/ipv6.h | 15 | ||||
-rw-r--r-- | include/net/netns/mib.h | 2 | ||||
-rw-r--r-- | include/net/snmp.h | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index a366a8a1fe23..3f0258d2ef01 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -132,6 +132,15 @@ extern struct ctl_path net_ipv6_ctl_path[]; SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ }) +/* per device and per net counters are atomic_long_t */ +#define _DEVINC_ATOMIC_ATOMIC(net, statname, idev, field) \ +({ \ + struct inet6_dev *_idev = (idev); \ + if (likely(_idev != NULL)) \ + SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \ + SNMP_INC_STATS_ATOMIC_LONG((net)->mib.statname##_statistics, (field));\ +}) + #define _DEVADD(net, statname, modifier, idev, field, val) \ ({ \ struct inet6_dev *_idev = (idev); \ @@ -168,11 +177,11 @@ extern struct ctl_path net_ipv6_ctl_path[]; _DEVINCATOMIC(net, icmpv6, _BH, idev, field) #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ - _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) + _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256) #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ - _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) + _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field +256) #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ - _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) + _DEVINC_ATOMIC_ATOMIC(net, icmpv6msg, idev, field) struct ip6_ra_chain { struct ip6_ra_chain *next; diff --git a/include/net/netns/mib.h b/include/net/netns/mib.h index f360135cb69f..30f6728ee98c 100644 --- a/include/net/netns/mib.h +++ b/include/net/netns/mib.h @@ -18,7 +18,7 @@ struct netns_mib { DEFINE_SNMP_STAT(struct udp_mib, udplite_stats_in6); DEFINE_SNMP_STAT(struct ipstats_mib, ipv6_statistics); DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6_statistics); - DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); + DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib, icmpv6msg_statistics); #endif #ifdef CONFIG_XFRM_STATISTICS DEFINE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); diff --git a/include/net/snmp.h b/include/net/snmp.h index 0feafa68da01..2f65e1686fc8 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h @@ -84,7 +84,7 @@ struct icmpv6_mib_device { #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX /* per network ns counters */ struct icmpv6msg_mib { - unsigned long mibs[ICMP6MSG_MIB_MAX]; + atomic_long_t mibs[ICMP6MSG_MIB_MAX]; }; /* per device counters, (shared on all cpus) */ struct icmpv6msg_mib_device { |