summaryrefslogtreecommitdiffstats
path: root/include/linux/if_macvlan.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-06-24 00:54:21 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-28 23:24:30 -0700
commitbc66154efe163a80f269d448572f7906756e9338 (patch)
tree89c9996c9790a84958a756eed77b9780a785ff19 /include/linux/if_macvlan.h
parent33d91f00c73ba0012bce18c1690cb8313ca7adaa (diff)
downloadop-kernel-dev-bc66154efe163a80f269d448572f7906756e9338.zip
op-kernel-dev-bc66154efe163a80f269d448572f7906756e9338.tar.gz
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.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index c26a0e4..e24ce6e 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -6,6 +6,7 @@
#include <linux/netdevice.h>
#include <linux/netlink.h>
#include <net/netlink.h>
+#include <linux/u64_stats_sync.h>
#if defined(CONFIG_MACVTAP) || defined(CONFIG_MACVTAP_MODULE)
struct socket *macvtap_get_socket(struct file *);
@@ -27,14 +28,16 @@ struct macvtap_queue;
* struct macvlan_rx_stats - MACVLAN percpu rx stats
* @rx_packets: number of received packets
* @rx_bytes: number of received bytes
- * @multicast: number of received multicast packets
+ * @rx_multicast: number of received multicast packets
+ * @syncp: synchronization point for 64bit counters
* @rx_errors: number of errors
*/
struct macvlan_rx_stats {
- unsigned long rx_packets;
- unsigned long rx_bytes;
- unsigned long multicast;
- unsigned long rx_errors;
+ u64 rx_packets;
+ u64 rx_bytes;
+ u64 rx_multicast;
+ struct u64_stats_sync syncp;
+ unsigned long rx_errors;
};
struct macvlan_dev {
@@ -56,12 +59,14 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
{
struct macvlan_rx_stats *rx_stats;
- rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
+ rx_stats = this_cpu_ptr(vlan->rx_stats);
if (likely(success)) {
+ u64_stats_update_begin(&rx_stats->syncp);
rx_stats->rx_packets++;;
rx_stats->rx_bytes += len;
if (multicast)
- rx_stats->multicast++;
+ rx_stats->rx_multicast++;
+ u64_stats_update_end(&rx_stats->syncp);
} else {
rx_stats->rx_errors++;
}
OpenPOWER on IntegriCloud