diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /include/linux/if_macvlan.h | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'include/linux/if_macvlan.h')
-rw-r--r-- | include/linux/if_macvlan.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h index 35280b302290..e28b2e4959d4 100644 --- a/include/linux/if_macvlan.h +++ b/include/linux/if_macvlan.h | |||
@@ -25,50 +25,63 @@ struct macvlan_port; | |||
25 | struct macvtap_queue; | 25 | struct macvtap_queue; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * struct macvlan_rx_stats - MACVLAN percpu rx stats | 28 | * struct macvlan_pcpu_stats - MACVLAN percpu stats |
29 | * @rx_packets: number of received packets | 29 | * @rx_packets: number of received packets |
30 | * @rx_bytes: number of received bytes | 30 | * @rx_bytes: number of received bytes |
31 | * @rx_multicast: number of received multicast packets | 31 | * @rx_multicast: number of received multicast packets |
32 | * @tx_packets: number of transmitted packets | ||
33 | * @tx_bytes: number of transmitted bytes | ||
32 | * @syncp: synchronization point for 64bit counters | 34 | * @syncp: synchronization point for 64bit counters |
33 | * @rx_errors: number of errors | 35 | * @rx_errors: number of rx errors |
36 | * @tx_dropped: number of tx dropped packets | ||
34 | */ | 37 | */ |
35 | struct macvlan_rx_stats { | 38 | struct macvlan_pcpu_stats { |
36 | u64 rx_packets; | 39 | u64 rx_packets; |
37 | u64 rx_bytes; | 40 | u64 rx_bytes; |
38 | u64 rx_multicast; | 41 | u64 rx_multicast; |
42 | u64 tx_packets; | ||
43 | u64 tx_bytes; | ||
39 | struct u64_stats_sync syncp; | 44 | struct u64_stats_sync syncp; |
40 | unsigned long rx_errors; | 45 | u32 rx_errors; |
46 | u32 tx_dropped; | ||
41 | }; | 47 | }; |
42 | 48 | ||
49 | /* | ||
50 | * Maximum times a macvtap device can be opened. This can be used to | ||
51 | * configure the number of receive queue, e.g. for multiqueue virtio. | ||
52 | */ | ||
53 | #define MAX_MACVTAP_QUEUES (NR_CPUS < 16 ? NR_CPUS : 16) | ||
54 | |||
43 | struct macvlan_dev { | 55 | struct macvlan_dev { |
44 | struct net_device *dev; | 56 | struct net_device *dev; |
45 | struct list_head list; | 57 | struct list_head list; |
46 | struct hlist_node hlist; | 58 | struct hlist_node hlist; |
47 | struct macvlan_port *port; | 59 | struct macvlan_port *port; |
48 | struct net_device *lowerdev; | 60 | struct net_device *lowerdev; |
49 | struct macvlan_rx_stats __percpu *rx_stats; | 61 | struct macvlan_pcpu_stats __percpu *pcpu_stats; |
50 | enum macvlan_mode mode; | 62 | enum macvlan_mode mode; |
51 | int (*receive)(struct sk_buff *skb); | 63 | int (*receive)(struct sk_buff *skb); |
52 | int (*forward)(struct net_device *dev, struct sk_buff *skb); | 64 | int (*forward)(struct net_device *dev, struct sk_buff *skb); |
53 | struct macvtap_queue *tap; | 65 | struct macvtap_queue *taps[MAX_MACVTAP_QUEUES]; |
66 | int numvtaps; | ||
54 | }; | 67 | }; |
55 | 68 | ||
56 | static inline void macvlan_count_rx(const struct macvlan_dev *vlan, | 69 | static inline void macvlan_count_rx(const struct macvlan_dev *vlan, |
57 | unsigned int len, bool success, | 70 | unsigned int len, bool success, |
58 | bool multicast) | 71 | bool multicast) |
59 | { | 72 | { |
60 | struct macvlan_rx_stats *rx_stats; | ||
61 | |||
62 | rx_stats = this_cpu_ptr(vlan->rx_stats); | ||
63 | if (likely(success)) { | 73 | if (likely(success)) { |
64 | u64_stats_update_begin(&rx_stats->syncp); | 74 | struct macvlan_pcpu_stats *pcpu_stats; |
65 | rx_stats->rx_packets++;; | 75 | |
66 | rx_stats->rx_bytes += len; | 76 | pcpu_stats = this_cpu_ptr(vlan->pcpu_stats); |
77 | u64_stats_update_begin(&pcpu_stats->syncp); | ||
78 | pcpu_stats->rx_packets++; | ||
79 | pcpu_stats->rx_bytes += len; | ||
67 | if (multicast) | 80 | if (multicast) |
68 | rx_stats->rx_multicast++; | 81 | pcpu_stats->rx_multicast++; |
69 | u64_stats_update_end(&rx_stats->syncp); | 82 | u64_stats_update_end(&pcpu_stats->syncp); |
70 | } else { | 83 | } else { |
71 | rx_stats->rx_errors++; | 84 | this_cpu_inc(vlan->pcpu_stats->rx_errors); |
72 | } | 85 | } |
73 | } | 86 | } |
74 | 87 | ||