aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/openvswitch/vport.c22
-rw-r--r--net/openvswitch/vport.h11
2 files changed, 13 insertions, 20 deletions
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index c90d856d441c..720623190eaa 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -128,7 +128,7 @@ struct vport *ovs_vport_alloc(int priv_size, const struct vport_ops *ops,
128 vport->ops = ops; 128 vport->ops = ops;
129 INIT_HLIST_NODE(&vport->dp_hash_node); 129 INIT_HLIST_NODE(&vport->dp_hash_node);
130 130
131 vport->percpu_stats = alloc_percpu(struct vport_percpu_stats); 131 vport->percpu_stats = alloc_percpu(struct pcpu_tstats);
132 if (!vport->percpu_stats) { 132 if (!vport->percpu_stats) {
133 kfree(vport); 133 kfree(vport);
134 return ERR_PTR(-ENOMEM); 134 return ERR_PTR(-ENOMEM);
@@ -260,16 +260,16 @@ void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats)
260 spin_unlock_bh(&vport->stats_lock); 260 spin_unlock_bh(&vport->stats_lock);
261 261
262 for_each_possible_cpu(i) { 262 for_each_possible_cpu(i) {
263 const struct vport_percpu_stats *percpu_stats; 263 const struct pcpu_tstats *percpu_stats;
264 struct vport_percpu_stats local_stats; 264 struct pcpu_tstats local_stats;
265 unsigned int start; 265 unsigned int start;
266 266
267 percpu_stats = per_cpu_ptr(vport->percpu_stats, i); 267 percpu_stats = per_cpu_ptr(vport->percpu_stats, i);
268 268
269 do { 269 do {
270 start = u64_stats_fetch_begin_bh(&percpu_stats->sync); 270 start = u64_stats_fetch_begin_bh(&percpu_stats->syncp);
271 local_stats = *percpu_stats; 271 local_stats = *percpu_stats;
272 } while (u64_stats_fetch_retry_bh(&percpu_stats->sync, start)); 272 } while (u64_stats_fetch_retry_bh(&percpu_stats->syncp, start));
273 273
274 stats->rx_bytes += local_stats.rx_bytes; 274 stats->rx_bytes += local_stats.rx_bytes;
275 stats->rx_packets += local_stats.rx_packets; 275 stats->rx_packets += local_stats.rx_packets;
@@ -327,13 +327,13 @@ int ovs_vport_get_options(const struct vport *vport, struct sk_buff *skb)
327 */ 327 */
328void ovs_vport_receive(struct vport *vport, struct sk_buff *skb) 328void ovs_vport_receive(struct vport *vport, struct sk_buff *skb)
329{ 329{
330 struct vport_percpu_stats *stats; 330 struct pcpu_tstats *stats;
331 331
332 stats = this_cpu_ptr(vport->percpu_stats); 332 stats = this_cpu_ptr(vport->percpu_stats);
333 u64_stats_update_begin(&stats->sync); 333 u64_stats_update_begin(&stats->syncp);
334 stats->rx_packets++; 334 stats->rx_packets++;
335 stats->rx_bytes += skb->len; 335 stats->rx_bytes += skb->len;
336 u64_stats_update_end(&stats->sync); 336 u64_stats_update_end(&stats->syncp);
337 337
338 ovs_dp_process_received_packet(vport, skb); 338 ovs_dp_process_received_packet(vport, skb);
339} 339}
@@ -352,14 +352,14 @@ int ovs_vport_send(struct vport *vport, struct sk_buff *skb)
352 int sent = vport->ops->send(vport, skb); 352 int sent = vport->ops->send(vport, skb);
353 353
354 if (likely(sent)) { 354 if (likely(sent)) {
355 struct vport_percpu_stats *stats; 355 struct pcpu_tstats *stats;
356 356
357 stats = this_cpu_ptr(vport->percpu_stats); 357 stats = this_cpu_ptr(vport->percpu_stats);
358 358
359 u64_stats_update_begin(&stats->sync); 359 u64_stats_update_begin(&stats->syncp);
360 stats->tx_packets++; 360 stats->tx_packets++;
361 stats->tx_bytes += sent; 361 stats->tx_bytes += sent;
362 u64_stats_update_end(&stats->sync); 362 u64_stats_update_end(&stats->syncp);
363 } 363 }
364 return sent; 364 return sent;
365} 365}
diff --git a/net/openvswitch/vport.h b/net/openvswitch/vport.h
index 7282b8436ba7..7ba08c30b853 100644
--- a/net/openvswitch/vport.h
+++ b/net/openvswitch/vport.h
@@ -19,6 +19,7 @@
19#ifndef VPORT_H 19#ifndef VPORT_H
20#define VPORT_H 1 20#define VPORT_H 1
21 21
22#include <linux/if_tunnel.h>
22#include <linux/list.h> 23#include <linux/list.h>
23#include <linux/netlink.h> 24#include <linux/netlink.h>
24#include <linux/openvswitch.h> 25#include <linux/openvswitch.h>
@@ -50,14 +51,6 @@ int ovs_vport_send(struct vport *, struct sk_buff *);
50 51
51/* The following definitions are for implementers of vport devices: */ 52/* The following definitions are for implementers of vport devices: */
52 53
53struct vport_percpu_stats {
54 u64 rx_bytes;
55 u64 rx_packets;
56 u64 tx_bytes;
57 u64 tx_packets;
58 struct u64_stats_sync sync;
59};
60
61struct vport_err_stats { 54struct vport_err_stats {
62 u64 rx_dropped; 55 u64 rx_dropped;
63 u64 rx_errors; 56 u64 rx_errors;
@@ -89,7 +82,7 @@ struct vport {
89 struct hlist_node dp_hash_node; 82 struct hlist_node dp_hash_node;
90 const struct vport_ops *ops; 83 const struct vport_ops *ops;
91 84
92 struct vport_percpu_stats __percpu *percpu_stats; 85 struct pcpu_tstats __percpu *percpu_stats;
93 86
94 spinlock_t stats_lock; 87 spinlock_t stats_lock;
95 struct vport_err_stats err_stats; 88 struct vport_err_stats err_stats;