aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2007-04-29 00:04:03 -0400
committerDavid S. Miller <davem@davemloft.net>2007-04-29 00:04:03 -0400
commit5a1b5898ee9e0bf68a86609ecb9775457b1857a5 (patch)
treec51b0c34ba89472a2b5c59d735a7e1affaa0e244 /net/core/dev.c
parentd16bfd0c77b35a0a0f0e159b94b9921510bf7934 (diff)
[NET]: Remove NETIF_F_INTERNAL_STATS, default to internal stats.
Herbert Xu conviced me that a new flag was overkill; every driver currently overrides get_stats, so we might as well make the internal one the default. If someone did fail to set get_stats, they would now get all 0 stats instead of "No statistics available". Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c45
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
3260static struct net_device_stats *maybe_internal_stats(struct net_device *dev) 3257static 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;