diff options
Diffstat (limited to 'include/linux/if_macvlan.h')
| -rw-r--r-- | include/linux/if_macvlan.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index b78a712247da..35280b302290 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,17 +59,21 @@ 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 | } |
| 68 | } | 73 | } |
| 69 | 74 | ||
| 75 | extern void macvlan_common_setup(struct net_device *dev); | ||
| 76 | |||
| 70 | extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, | 77 | extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, |
| 71 | struct nlattr *tb[], struct nlattr *data[], | 78 | struct nlattr *tb[], struct nlattr *data[], |
| 72 | int (*receive)(struct sk_buff *skb), | 79 | int (*receive)(struct sk_buff *skb), |
| @@ -84,7 +91,4 @@ extern int macvlan_link_register(struct rtnl_link_ops *ops); | |||
| 84 | extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, | 91 | extern netdev_tx_t macvlan_start_xmit(struct sk_buff *skb, |
| 85 | struct net_device *dev); | 92 | struct net_device *dev); |
| 86 | 93 | ||
| 87 | |||
| 88 | extern struct sk_buff *(*macvlan_handle_frame_hook)(struct sk_buff *); | ||
| 89 | |||
| 90 | #endif /* _LINUX_IF_MACVLAN_H */ | 94 | #endif /* _LINUX_IF_MACVLAN_H */ |
