|
@@ -817,7 +817,6 @@ static int default_rebuild_header(struct sk_buff *skb)
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* dev_open - prepare an interface for use.
|
|
* dev_open - prepare an interface for use.
|
|
* @dev: device to open
|
|
* @dev: device to open
|
|
@@ -2096,9 +2095,9 @@ void dev_seq_stop(struct seq_file *seq, void *v)
|
|
|
|
|
|
static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
|
|
static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
|
|
{
|
|
{
|
|
- if (dev->get_stats) {
|
|
|
|
- struct net_device_stats *stats = dev->get_stats(dev);
|
|
|
|
|
|
+ struct net_device_stats *stats = dev->get_stats(dev);
|
|
|
|
|
|
|
|
+ if (stats) {
|
|
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
|
|
seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
|
|
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
|
|
"%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
|
|
dev->name, stats->rx_bytes, stats->rx_packets,
|
|
dev->name, stats->rx_bytes, stats->rx_packets,
|
|
@@ -3282,6 +3281,13 @@ out:
|
|
mutex_unlock(&net_todo_run_mutex);
|
|
mutex_unlock(&net_todo_run_mutex);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static struct net_device_stats *maybe_internal_stats(struct net_device *dev)
|
|
|
|
+{
|
|
|
|
+ if (dev->features & NETIF_F_INTERNAL_STATS)
|
|
|
|
+ return &dev->stats;
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* alloc_netdev - allocate network device
|
|
* alloc_netdev - allocate network device
|
|
* @sizeof_priv: size of private data to allocate space for
|
|
* @sizeof_priv: size of private data to allocate space for
|
|
@@ -3317,6 +3323,7 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
|
|
if (sizeof_priv)
|
|
if (sizeof_priv)
|
|
dev->priv = netdev_priv(dev);
|
|
dev->priv = netdev_priv(dev);
|
|
|
|
|
|
|
|
+ dev->get_stats = maybe_internal_stats;
|
|
setup(dev);
|
|
setup(dev);
|
|
strcpy(dev->name, name);
|
|
strcpy(dev->name, name);
|
|
return dev;
|
|
return dev;
|