diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d5e42d13bd67..eb999003bbb7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2101,26 +2101,23 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) | |||
2101 | { | 2101 | { |
2102 | struct net_device_stats *stats = dev->get_stats(dev); | 2102 | struct net_device_stats *stats = dev->get_stats(dev); |
2103 | 2103 | ||
2104 | if (stats) { | 2104 | seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " |
2105 | seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " | 2105 | "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", |
2106 | "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", | 2106 | dev->name, stats->rx_bytes, stats->rx_packets, |
2107 | dev->name, stats->rx_bytes, stats->rx_packets, | 2107 | stats->rx_errors, |
2108 | stats->rx_errors, | 2108 | stats->rx_dropped + stats->rx_missed_errors, |
2109 | stats->rx_dropped + stats->rx_missed_errors, | 2109 | stats->rx_fifo_errors, |
2110 | stats->rx_fifo_errors, | 2110 | stats->rx_length_errors + stats->rx_over_errors + |
2111 | stats->rx_length_errors + stats->rx_over_errors + | 2111 | stats->rx_crc_errors + stats->rx_frame_errors, |
2112 | stats->rx_crc_errors + stats->rx_frame_errors, | 2112 | stats->rx_compressed, stats->multicast, |
2113 | stats->rx_compressed, stats->multicast, | 2113 | stats->tx_bytes, stats->tx_packets, |
2114 | stats->tx_bytes, stats->tx_packets, | 2114 | stats->tx_errors, stats->tx_dropped, |
2115 | stats->tx_errors, stats->tx_dropped, | 2115 | stats->tx_fifo_errors, stats->collisions, |
2116 | stats->tx_fifo_errors, stats->collisions, | 2116 | stats->tx_carrier_errors + |
2117 | stats->tx_carrier_errors + | 2117 | stats->tx_aborted_errors + |
2118 | stats->tx_aborted_errors + | 2118 | stats->tx_window_errors + |
2119 | stats->tx_window_errors + | 2119 | stats->tx_heartbeat_errors, |
2120 | stats->tx_heartbeat_errors, | 2120 | stats->tx_compressed); |
2121 | stats->tx_compressed); | ||
2122 | } else | ||
2123 | seq_printf(seq, "%6s: No statistics available.\n", dev->name); | ||
2124 | } | 2121 | } |
2125 | 2122 | ||
2126 | /* | 2123 | /* |
@@ -3257,11 +3254,9 @@ out: | |||
3257 | mutex_unlock(&net_todo_run_mutex); | 3254 | mutex_unlock(&net_todo_run_mutex); |
3258 | } | 3255 | } |
3259 | 3256 | ||
3260 | static struct net_device_stats *maybe_internal_stats(struct net_device *dev) | 3257 | static struct net_device_stats *internal_stats(struct net_device *dev) |
3261 | { | 3258 | { |
3262 | if (dev->features & NETIF_F_INTERNAL_STATS) | 3259 | return &dev->stats; |
3263 | return &dev->stats; | ||
3264 | return NULL; | ||
3265 | } | 3260 | } |
3266 | 3261 | ||
3267 | /** | 3262 | /** |
@@ -3299,7 +3294,7 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name, | |||
3299 | if (sizeof_priv) | 3294 | if (sizeof_priv) |
3300 | dev->priv = netdev_priv(dev); | 3295 | dev->priv = netdev_priv(dev); |
3301 | 3296 | ||
3302 | dev->get_stats = maybe_internal_stats; | 3297 | dev->get_stats = internal_stats; |
3303 | setup(dev); | 3298 | setup(dev); |
3304 | strcpy(dev->name, name); | 3299 | strcpy(dev->name, name); |
3305 | return dev; | 3300 | return dev; |