diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-06-23 20:54:21 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-29 02:24:30 -0400 |
commit | bc66154efe163a80f269d448572f7906756e9338 (patch) | |
tree | 89c9996c9790a84958a756eed77b9780a785ff19 /include/linux/if_macvlan.h | |
parent | 33d91f00c73ba0012bce18c1690cb8313ca7adaa (diff) |
macvlan: 64 bit rx counters
Use u64_stats_sync infrastructure to implement 64bit stats.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_macvlan.h')
-rw-r--r-- | include/linux/if_macvlan.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index c26a0e4f0ce8..e24ce6ea1fa3 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/netdevice.h> | 6 | #include <linux/netdevice.h> |
7 | #include <linux/netlink.h> | 7 | #include <linux/netlink.h> |
8 | #include <net/netlink.h> | 8 | #include <net/netlink.h> |
9 | #include <linux/u64_stats_sync.h> | ||
9 | 10 | ||
10 | #if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) | 11 | #if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE) |
11 | struct socket *macvtap_get_socket(struct file *); | 12 | struct socket *macvtap_get_socket(struct file *); |
@@ -27,14 +28,16 @@ struct macvtap_queue; | |||
27 | * struct macvlan_rx_stats - MACVLAN percpu rx stats | 28 | * struct macvlan_rx_stats - MACVLAN percpu rx stats |
28 | * @rx_packets: number of received packets | 29 | * @rx_packets: number of received packets |
29 | * @rx_bytes: number of received bytes | 30 | * @rx_bytes: number of received bytes |
30 | * @multicast: number of received multicast packets | 31 | * @rx_multicast: number of received multicast packets |
32 | * @syncp: synchronization point for 64bit counters | ||
31 | * @rx_errors: number of errors | 33 | * @rx_errors: number of errors |
32 | */ | 34 | */ |
33 | struct macvlan_rx_stats { | 35 | struct macvlan_rx_stats { |
34 | unsigned long rx_packets; | 36 | u64 rx_packets; |
35 | unsigned long rx_bytes; | 37 | u64 rx_bytes; |
36 | unsigned long multicast; | 38 | u64 rx_multicast; |
37 | unsigned long rx_errors; | 39 | struct u64_stats_sync syncp; |
40 | unsigned long rx_errors; | ||
38 | }; | 41 | }; |
39 | 42 | ||
40 | struct macvlan_dev { | 43 | struct macvlan_dev { |
@@ -56,12 +59,14 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan, | |||
56 | { | 59 | { |
57 | struct macvlan_rx_stats *rx_stats; | 60 | struct macvlan_rx_stats *rx_stats; |
58 | 61 | ||
59 | rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id()); | 62 | rx_stats = this_cpu_ptr(vlan->rx_stats); |
60 | if (likely(success)) { | 63 | if (likely(success)) { |
64 | u64_stats_update_begin(&rx_stats->syncp); | ||
61 | rx_stats->rx_packets++;; | 65 | rx_stats->rx_packets++;; |
62 | rx_stats->rx_bytes += len; | 66 | rx_stats->rx_bytes += len; |
63 | if (multicast) | 67 | if (multicast) |
64 | rx_stats->multicast++; | 68 | rx_stats->rx_multicast++; |
69 | u64_stats_update_end(&rx_stats->syncp); | ||
65 | } else { | 70 | } else { |
66 | rx_stats->rx_errors++; | 71 | rx_stats->rx_errors++; |
67 | } | 72 | } |