diff options
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r-- | include/linux/netdevice.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 440a02ee6f92..430c51aed6a4 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -1726,6 +1726,20 @@ struct pcpu_sw_netstats { | |||
1726 | struct u64_stats_sync syncp; | 1726 | struct u64_stats_sync syncp; |
1727 | }; | 1727 | }; |
1728 | 1728 | ||
1729 | #define netdev_alloc_pcpu_stats(type) \ | ||
1730 | ({ \ | ||
1731 | typeof(type) *pcpu_stats = alloc_percpu(type); \ | ||
1732 | if (pcpu_stats) { \ | ||
1733 | int i; \ | ||
1734 | for_each_possible_cpu(i) { \ | ||
1735 | typeof(type) *stat; \ | ||
1736 | stat = per_cpu_ptr(pcpu_stats, i); \ | ||
1737 | u64_stats_init(&stat->syncp); \ | ||
1738 | } \ | ||
1739 | } \ | ||
1740 | pcpu_stats; \ | ||
1741 | }) | ||
1742 | |||
1729 | #include <linux/notifier.h> | 1743 | #include <linux/notifier.h> |
1730 | 1744 | ||
1731 | /* netdevice notifier chain. Please remember to update the rtnetlink | 1745 | /* netdevice notifier chain. Please remember to update the rtnetlink |