dev.c (d314774cf2cd5dfeb39a00d37deee65d4c627927) | dev.c (eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0) |
---|---|
1/* 2 * NET3 Protocol independent device support routines. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 2606 unchanged lines hidden (view full) --- 2615void dev_seq_stop(struct seq_file *seq, void *v) 2616 __releases(dev_base_lock) 2617{ 2618 read_unlock(&dev_base_lock); 2619} 2620 2621static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) 2622{ | 1/* 2 * NET3 Protocol independent device support routines. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 7 * 2 of the License, or (at your option) any later version. 8 * --- 2606 unchanged lines hidden (view full) --- 2615void dev_seq_stop(struct seq_file *seq, void *v) 2616 __releases(dev_base_lock) 2617{ 2618 read_unlock(&dev_base_lock); 2619} 2620 2621static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) 2622{ |
2623 struct net_device_stats *stats = dev->get_stats(dev); | 2623 const struct net_device_stats *stats = dev_get_stats(dev); |
2624 2625 seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " 2626 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", 2627 dev->name, stats->rx_bytes, stats->rx_packets, 2628 stats->rx_errors, 2629 stats->rx_dropped + stats->rx_missed_errors, 2630 stats->rx_fifo_errors, 2631 stats->rx_length_errors + stats->rx_over_errors + --- 1651 unchanged lines hidden (view full) --- 4283 if (dev->destructor) 4284 dev->destructor(dev); 4285 4286 /* Free network device */ 4287 kobject_put(&dev->dev.kobj); 4288 } 4289} 4290 | 2624 2625 seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " 2626 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", 2627 dev->name, stats->rx_bytes, stats->rx_packets, 2628 stats->rx_errors, 2629 stats->rx_dropped + stats->rx_missed_errors, 2630 stats->rx_fifo_errors, 2631 stats->rx_length_errors + stats->rx_over_errors + --- 1651 unchanged lines hidden (view full) --- 4283 if (dev->destructor) 4284 dev->destructor(dev); 4285 4286 /* Free network device */ 4287 kobject_put(&dev->dev.kobj); 4288 } 4289} 4290 |
4291static struct net_device_stats *internal_stats(struct net_device *dev) 4292{ 4293 return &dev->stats; | 4291/** 4292 * dev_get_stats - get network device statistics 4293 * @dev: device to get statistics from 4294 * 4295 * Get network statistics from device. The device driver may provide 4296 * its own method by setting dev->netdev_ops->get_stats; otherwise 4297 * the internal statistics structure is used. 4298 */ 4299const struct net_device_stats *dev_get_stats(struct net_device *dev) 4300 { 4301 const struct net_device_ops *ops = dev->netdev_ops; 4302 4303 if (ops->ndo_get_stats) 4304 return ops->ndo_get_stats(dev); 4305 else 4306 return &dev->stats; |
4294} | 4307} |
4308EXPORT_SYMBOL(dev_get_stats); |
|
4295 4296static void netdev_init_one_queue(struct net_device *dev, 4297 struct netdev_queue *queue, 4298 void *_unused) 4299{ 4300 queue->dev = dev; 4301} 4302 --- 62 unchanged lines hidden (view full) --- 4365 ((sizeof(struct net_device) + NETDEV_ALIGN_CONST) 4366 & ~NETDEV_ALIGN_CONST)); 4367 } 4368 4369 dev->gso_max_size = GSO_MAX_SIZE; 4370 4371 netdev_init_queues(dev); 4372 | 4309 4310static void netdev_init_one_queue(struct net_device *dev, 4311 struct netdev_queue *queue, 4312 void *_unused) 4313{ 4314 queue->dev = dev; 4315} 4316 --- 62 unchanged lines hidden (view full) --- 4379 ((sizeof(struct net_device) + NETDEV_ALIGN_CONST) 4380 & ~NETDEV_ALIGN_CONST)); 4381 } 4382 4383 dev->gso_max_size = GSO_MAX_SIZE; 4384 4385 netdev_init_queues(dev); 4386 |
4373 dev->get_stats = internal_stats; | |
4374 netpoll_netdev_init(dev); 4375 setup(dev); 4376 strcpy(dev->name, name); 4377 return dev; 4378} 4379EXPORT_SYMBOL(alloc_netdev_mq); 4380 4381/** --- 639 unchanged lines hidden --- | 4387 netpoll_netdev_init(dev); 4388 setup(dev); 4389 strcpy(dev->name, name); 4390 return dev; 4391} 4392EXPORT_SYMBOL(alloc_netdev_mq); 4393 4394/** --- 639 unchanged lines hidden --- |