diff options
-rw-r--r-- | arch/s390/appldata/appldata_net_sum.c | 3 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 59 | ||||
-rw-r--r-- | drivers/parisc/led.c | 2 | ||||
-rw-r--r-- | include/linux/netdevice.h | 1 | ||||
-rw-r--r-- | net/core/dev.c | 45 |
5 files changed, 45 insertions, 65 deletions
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c index 516b3ac9a9b5..a43f3488fecf 100644 --- a/arch/s390/appldata/appldata_net_sum.c +++ b/arch/s390/appldata/appldata_net_sum.c | |||
@@ -109,9 +109,6 @@ static void appldata_get_net_sum_data(void *data) | |||
109 | read_lock(&dev_base_lock); | 109 | read_lock(&dev_base_lock); |
110 | for (dev = dev_base; dev != NULL; dev = dev->next) { | 110 | for (dev = dev_base; dev != NULL; dev = dev->next) { |
111 | stats = dev->get_stats(dev); | 111 | stats = dev->get_stats(dev); |
112 | if (stats == NULL) { | ||
113 | continue; | ||
114 | } | ||
115 | rx_packets += stats->rx_packets; | 112 | rx_packets += stats->rx_packets; |
116 | tx_packets += stats->tx_packets; | 113 | tx_packets += stats->tx_packets; |
117 | rx_bytes += stats->rx_bytes; | 114 | rx_bytes += stats->rx_bytes; |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index cea3783c92c5..724bce51f936 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1360,13 +1360,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1360 | goto err_undo_flags; | 1360 | goto err_undo_flags; |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | if (slave_dev->get_stats == NULL) { | ||
1364 | printk(KERN_NOTICE DRV_NAME | ||
1365 | ": %s: the driver for slave device %s does not provide " | ||
1366 | "get_stats function, network statistics will be " | ||
1367 | "inaccurate.\n", bond_dev->name, slave_dev->name); | ||
1368 | } | ||
1369 | |||
1370 | new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL); | 1363 | new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL); |
1371 | if (!new_slave) { | 1364 | if (!new_slave) { |
1372 | res = -ENOMEM; | 1365 | res = -ENOMEM; |
@@ -3641,33 +3634,31 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | |||
3641 | 3634 | ||
3642 | bond_for_each_slave(bond, slave, i) { | 3635 | bond_for_each_slave(bond, slave, i) { |
3643 | sstats = slave->dev->get_stats(slave->dev); | 3636 | sstats = slave->dev->get_stats(slave->dev); |
3644 | if (sstats) { | 3637 | stats->rx_packets += sstats->rx_packets; |
3645 | stats->rx_packets += sstats->rx_packets; | 3638 | stats->rx_bytes += sstats->rx_bytes; |
3646 | stats->rx_bytes += sstats->rx_bytes; | 3639 | stats->rx_errors += sstats->rx_errors; |
3647 | stats->rx_errors += sstats->rx_errors; | 3640 | stats->rx_dropped += sstats->rx_dropped; |
3648 | stats->rx_dropped += sstats->rx_dropped; | 3641 | |
3649 | 3642 | stats->tx_packets += sstats->tx_packets; | |
3650 | stats->tx_packets += sstats->tx_packets; | 3643 | stats->tx_bytes += sstats->tx_bytes; |
3651 | stats->tx_bytes += sstats->tx_bytes; | 3644 | stats->tx_errors += sstats->tx_errors; |
3652 | stats->tx_errors += sstats->tx_errors; | 3645 | stats->tx_dropped += sstats->tx_dropped; |
3653 | stats->tx_dropped += sstats->tx_dropped; | 3646 | |
3654 | 3647 | stats->multicast += sstats->multicast; | |
3655 | stats->multicast += sstats->multicast; | 3648 | stats->collisions += sstats->collisions; |
3656 | stats->collisions += sstats->collisions; | 3649 | |
3657 | 3650 | stats->rx_length_errors += sstats->rx_length_errors; | |
3658 | stats->rx_length_errors += sstats->rx_length_errors; | 3651 | stats->rx_over_errors += sstats->rx_over_errors; |
3659 | stats->rx_over_errors += sstats->rx_over_errors; | 3652 | stats->rx_crc_errors += sstats->rx_crc_errors; |
3660 | stats->rx_crc_errors += sstats->rx_crc_errors; | 3653 | stats->rx_frame_errors += sstats->rx_frame_errors; |
3661 | stats->rx_frame_errors += sstats->rx_frame_errors; | 3654 | stats->rx_fifo_errors += sstats->rx_fifo_errors; |
3662 | stats->rx_fifo_errors += sstats->rx_fifo_errors; | 3655 | stats->rx_missed_errors += sstats->rx_missed_errors; |
3663 | stats->rx_missed_errors += sstats->rx_missed_errors; | 3656 | |
3664 | 3657 | stats->tx_aborted_errors += sstats->tx_aborted_errors; | |
3665 | stats->tx_aborted_errors += sstats->tx_aborted_errors; | 3658 | stats->tx_carrier_errors += sstats->tx_carrier_errors; |
3666 | stats->tx_carrier_errors += sstats->tx_carrier_errors; | 3659 | stats->tx_fifo_errors += sstats->tx_fifo_errors; |
3667 | stats->tx_fifo_errors += sstats->tx_fifo_errors; | 3660 | stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors; |
3668 | stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors; | 3661 | stats->tx_window_errors += sstats->tx_window_errors; |
3669 | stats->tx_window_errors += sstats->tx_window_errors; | ||
3670 | } | ||
3671 | } | 3662 | } |
3672 | 3663 | ||
3673 | read_unlock_bh(&bond->lock); | 3664 | read_unlock_bh(&bond->lock); |
diff --git a/drivers/parisc/led.c b/drivers/parisc/led.c index 453e6829756c..3df82fe9ce8c 100644 --- a/drivers/parisc/led.c +++ b/drivers/parisc/led.c | |||
@@ -373,8 +373,6 @@ static __inline__ int led_get_net_activity(void) | |||
373 | if (LOOPBACK(in_dev->ifa_list->ifa_local)) | 373 | if (LOOPBACK(in_dev->ifa_list->ifa_local)) |
374 | continue; | 374 | continue; |
375 | stats = dev->get_stats(dev); | 375 | stats = dev->get_stats(dev); |
376 | if (!stats) | ||
377 | continue; | ||
378 | rx_total += stats->rx_packets; | 376 | rx_total += stats->rx_packets; |
379 | tx_total += stats->tx_packets; | 377 | tx_total += stats->tx_packets; |
380 | } | 378 | } |
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 24cef42f1e0f..ac0c92b1e002 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -325,7 +325,6 @@ struct net_device | |||
325 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ | 325 | #define NETIF_F_VLAN_CHALLENGED 1024 /* Device cannot handle VLAN packets */ |
326 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ | 326 | #define NETIF_F_GSO 2048 /* Enable software GSO. */ |
327 | #define NETIF_F_LLTX 4096 /* LockLess TX */ | 327 | #define NETIF_F_LLTX 4096 /* LockLess TX */ |
328 | #define NETIF_F_INTERNAL_STATS 8192 /* Use stats structure in net_device */ | ||
329 | 328 | ||
330 | /* Segmentation offload features */ | 329 | /* Segmentation offload features */ |
331 | #define NETIF_F_GSO_SHIFT 16 | 330 | #define NETIF_F_GSO_SHIFT 16 |
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; |