aboutsummaryrefslogtreecommitdiffstats
path: root/net/8021q
diff options
context:
space:
mode:
authorLi RongQing <roy.qing.li@gmail.com>2014-04-21 07:49:08 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-22 21:27:57 -0400
commit5a4ae5f6e7d4b2b5a9b8981d513345053e40b6ac (patch)
tree883deb60087b5d5cbbd48d9dc63fc4716eec675b /net/8021q
parente25578777facd498480d3376752ad21a23375849 (diff)
vlan: unnecessary to check if vlan_pcpu_stats is NULL
if allocating memory for vlan_pcpu_stats failed, the device can not be operated Signed-off-by: Li RongQing <roy.qing.li@gmail.com> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q')
-rw-r--r--net/8021q/vlan_dev.c58
1 files changed, 28 insertions, 30 deletions
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 733ec283ed1b..8f025afa29fd 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -706,38 +706,36 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev,
706 706
707static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) 707static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
708{ 708{
709 struct vlan_pcpu_stats *p;
710 u32 rx_errors = 0, tx_dropped = 0;
711 int i;
709 712
710 if (vlan_dev_priv(dev)->vlan_pcpu_stats) { 713 for_each_possible_cpu(i) {
711 struct vlan_pcpu_stats *p; 714 u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes;
712 u32 rx_errors = 0, tx_dropped = 0; 715 unsigned int start;
713 int i; 716
714 717 p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
715 for_each_possible_cpu(i) { 718 do {
716 u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes; 719 start = u64_stats_fetch_begin_irq(&p->syncp);
717 unsigned int start; 720 rxpackets = p->rx_packets;
718 721 rxbytes = p->rx_bytes;
719 p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i); 722 rxmulticast = p->rx_multicast;
720 do { 723 txpackets = p->tx_packets;
721 start = u64_stats_fetch_begin_irq(&p->syncp); 724 txbytes = p->tx_bytes;
722 rxpackets = p->rx_packets; 725 } while (u64_stats_fetch_retry_irq(&p->syncp, start));
723 rxbytes = p->rx_bytes; 726
724 rxmulticast = p->rx_multicast; 727 stats->rx_packets += rxpackets;
725 txpackets = p->tx_packets; 728 stats->rx_bytes += rxbytes;
726 txbytes = p->tx_bytes; 729 stats->multicast += rxmulticast;
727 } while (u64_stats_fetch_retry_irq(&p->syncp, start)); 730 stats->tx_packets += txpackets;
728 731 stats->tx_bytes += txbytes;
729 stats->rx_packets += rxpackets; 732 /* rx_errors & tx_dropped are u32 */
730 stats->rx_bytes += rxbytes; 733 rx_errors += p->rx_errors;
731 stats->multicast += rxmulticast; 734 tx_dropped += p->tx_dropped;
732 stats->tx_packets += txpackets;
733 stats->tx_bytes += txbytes;
734 /* rx_errors & tx_dropped are u32 */
735 rx_errors += p->rx_errors;
736 tx_dropped += p->tx_dropped;
737 }
738 stats->rx_errors = rx_errors;
739 stats->tx_dropped = tx_dropped;
740 } 735 }
736 stats->rx_errors = rx_errors;
737 stats->tx_dropped = tx_dropped;
738
741 return stats; 739 return stats;
742} 740}
743 741