Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5a1b5898 authored by Rusty Russell's avatar Rusty Russell Committed by David S. Miller
Browse files

[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: default avatarRusty Russell <rusty@rustcorp.com.au>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d16bfd0c
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -109,9 +109,6 @@ static void appldata_get_net_sum_data(void *data)
	read_lock(&dev_base_lock);
	for (dev = dev_base; dev != NULL; dev = dev->next) {
		stats = dev->get_stats(dev);
		if (stats == NULL) {
			continue;
		}
		rx_packets += stats->rx_packets;
		tx_packets += stats->tx_packets;
		rx_bytes   += stats->rx_bytes;
+25 −34
Original line number Diff line number Diff line
@@ -1360,13 +1360,6 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
		goto err_undo_flags;
	}

	if (slave_dev->get_stats == NULL) {
		printk(KERN_NOTICE DRV_NAME
			": %s: the driver for slave device %s does not provide "
			"get_stats function, network statistics will be "
			"inaccurate.\n", bond_dev->name, slave_dev->name);
	}

	new_slave = kzalloc(sizeof(struct slave), GFP_KERNEL);
	if (!new_slave) {
		res = -ENOMEM;
@@ -3641,7 +3634,6 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)

	bond_for_each_slave(bond, slave, i) {
		sstats = slave->dev->get_stats(slave->dev);
		if (sstats) {
		stats->rx_packets += sstats->rx_packets;
		stats->rx_bytes += sstats->rx_bytes;
		stats->rx_errors += sstats->rx_errors;
@@ -3668,7 +3660,6 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
		stats->tx_heartbeat_errors += sstats->tx_heartbeat_errors;
		stats->tx_window_errors += sstats->tx_window_errors;
	}
	}

	read_unlock_bh(&bond->lock);

+0 −2
Original line number Diff line number Diff line
@@ -373,8 +373,6 @@ static __inline__ int led_get_net_activity(void)
	    if (LOOPBACK(in_dev->ifa_list->ifa_local))
		continue;
	    stats = dev->get_stats(dev);
	    if (!stats)
		continue;
	    rx_total += stats->rx_packets;
	    tx_total += stats->tx_packets;
	}
+0 −1
Original line number Diff line number Diff line
@@ -325,7 +325,6 @@ struct net_device
#define NETIF_F_VLAN_CHALLENGED	1024	/* Device cannot handle VLAN packets */
#define NETIF_F_GSO		2048	/* Enable software GSO. */
#define NETIF_F_LLTX		4096	/* LockLess TX */
#define NETIF_F_INTERNAL_STATS	8192	/* Use stats structure in net_device */

	/* Segmentation offload features */
#define NETIF_F_GSO_SHIFT	16
+20 −25
Original line number Diff line number Diff line
@@ -2101,7 +2101,6 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
{
	struct net_device_stats *stats = dev->get_stats(dev);

	if (stats) {
	seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
		   "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
		   dev->name, stats->rx_bytes, stats->rx_packets,
@@ -2119,8 +2118,6 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
		    stats->tx_window_errors +
		    stats->tx_heartbeat_errors,
		   stats->tx_compressed);
	} else
		seq_printf(seq, "%6s: No statistics available.\n", dev->name);
}

/*
@@ -3257,11 +3254,9 @@ void netdev_run_todo(void)
	mutex_unlock(&net_todo_run_mutex);
}

static struct net_device_stats *maybe_internal_stats(struct net_device *dev)
static struct net_device_stats *internal_stats(struct net_device *dev)
{
	if (dev->features & NETIF_F_INTERNAL_STATS)
	return &dev->stats;
	return NULL;
}

/**
@@ -3299,7 +3294,7 @@ struct net_device *alloc_netdev(int sizeof_priv, const char *name,
	if (sizeof_priv)
		dev->priv = netdev_priv(dev);

	dev->get_stats = maybe_internal_stats;
	dev->get_stats = internal_stats;
	setup(dev);
	strcpy(dev->name, name);
	return dev;