diff options
Diffstat (limited to 'net/openvswitch')
-rw-r--r-- | net/openvswitch/vport.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c index dc81dc619aa2..fc5c0b9ccfe9 100644 --- a/net/openvswitch/vport.c +++ b/net/openvswitch/vport.c | |||
@@ -280,35 +280,19 @@ void ovs_vport_del(struct vport *vport) | |||
280 | */ | 280 | */ |
281 | void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) | 281 | void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *stats) |
282 | { | 282 | { |
283 | struct net_device *dev = vport->dev; | 283 | const struct rtnl_link_stats64 *dev_stats; |
284 | int i; | 284 | struct rtnl_link_stats64 temp; |
285 | 285 | ||
286 | memset(stats, 0, sizeof(*stats)); | 286 | dev_stats = dev_get_stats(vport->dev, &temp); |
287 | stats->rx_errors = dev->stats.rx_errors; | 287 | stats->rx_errors = dev_stats->rx_errors; |
288 | stats->tx_errors = dev->stats.tx_errors; | 288 | stats->tx_errors = dev_stats->tx_errors; |
289 | stats->tx_dropped = dev->stats.tx_dropped; | 289 | stats->tx_dropped = dev_stats->tx_dropped; |
290 | stats->rx_dropped = dev->stats.rx_dropped; | 290 | stats->rx_dropped = dev_stats->rx_dropped; |
291 | 291 | ||
292 | stats->rx_dropped += atomic_long_read(&dev->rx_dropped); | 292 | stats->rx_bytes = dev_stats->rx_bytes; |
293 | stats->tx_dropped += atomic_long_read(&dev->tx_dropped); | 293 | stats->rx_packets = dev_stats->rx_packets; |
294 | 294 | stats->tx_bytes = dev_stats->tx_bytes; | |
295 | for_each_possible_cpu(i) { | 295 | stats->tx_packets = dev_stats->tx_packets; |
296 | const struct pcpu_sw_netstats *percpu_stats; | ||
297 | struct pcpu_sw_netstats local_stats; | ||
298 | unsigned int start; | ||
299 | |||
300 | percpu_stats = per_cpu_ptr(dev->tstats, i); | ||
301 | |||
302 | do { | ||
303 | start = u64_stats_fetch_begin_irq(&percpu_stats->syncp); | ||
304 | local_stats = *percpu_stats; | ||
305 | } while (u64_stats_fetch_retry_irq(&percpu_stats->syncp, start)); | ||
306 | |||
307 | stats->rx_bytes += local_stats.rx_bytes; | ||
308 | stats->rx_packets += local_stats.rx_packets; | ||
309 | stats->tx_bytes += local_stats.tx_bytes; | ||
310 | stats->tx_packets += local_stats.tx_packets; | ||
311 | } | ||
312 | } | 296 | } |
313 | 297 | ||
314 | /** | 298 | /** |