Commit 5a4ae5f6 authored by Li RongQing's avatar Li RongQing Committed by David S. Miller

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: default avatarLi RongQing <roy.qing.li@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2557877
...@@ -706,38 +706,36 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev, ...@@ -706,38 +706,36 @@ static void vlan_ethtool_get_drvinfo(struct net_device *dev,
static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats) static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
{ {
struct vlan_pcpu_stats *p;
u32 rx_errors = 0, tx_dropped = 0;
int i;
if (vlan_dev_priv(dev)->vlan_pcpu_stats) { for_each_possible_cpu(i) {
struct vlan_pcpu_stats *p; u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes;
u32 rx_errors = 0, tx_dropped = 0; unsigned int start;
int i;
p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i);
for_each_possible_cpu(i) { do {
u64 rxpackets, rxbytes, rxmulticast, txpackets, txbytes; start = u64_stats_fetch_begin_irq(&p->syncp);
unsigned int start; rxpackets = p->rx_packets;
rxbytes = p->rx_bytes;
p = per_cpu_ptr(vlan_dev_priv(dev)->vlan_pcpu_stats, i); rxmulticast = p->rx_multicast;
do { txpackets = p->tx_packets;
start = u64_stats_fetch_begin_irq(&p->syncp); txbytes = p->tx_bytes;
rxpackets = p->rx_packets; } while (u64_stats_fetch_retry_irq(&p->syncp, start));
rxbytes = p->rx_bytes;
rxmulticast = p->rx_multicast; stats->rx_packets += rxpackets;
txpackets = p->tx_packets; stats->rx_bytes += rxbytes;
txbytes = p->tx_bytes; stats->multicast += rxmulticast;
} while (u64_stats_fetch_retry_irq(&p->syncp, start)); stats->tx_packets += txpackets;
stats->tx_bytes += txbytes;
stats->rx_packets += rxpackets; /* rx_errors & tx_dropped are u32 */
stats->rx_bytes += rxbytes; rx_errors += p->rx_errors;
stats->multicast += rxmulticast; tx_dropped += p->tx_dropped;
stats->tx_packets += txpackets;
stats->tx_bytes += txbytes;
/* rx_errors & tx_dropped are u32 */
rx_errors += p->rx_errors;
tx_dropped += p->tx_dropped;
}
stats->rx_errors = rx_errors;
stats->tx_dropped = tx_dropped;
} }
stats->rx_errors = rx_errors;
stats->tx_dropped = tx_dropped;
return stats; return stats;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment