Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Rusty Russell <rusty@rustcorp.com.au>,
	Jeff Garzik <jgarzik@pobox.com>
Subject: [NET]: Get rid of NETIF_F_INTERNAL_STATS
Date: Wed, 11 Apr 2007 17:56:02 +1000	[thread overview]
Message-ID: <20070411075602.GA17635@gondor.apana.org.au> (raw)

Hi:

[NET]: Get rid of NETIF_F_INTERNAL_STATS

The recently added NETIF_F_INTERNAL_STATS isn't very useful.  If the
device driver needs to set it then it can always override get_stats
instead.  All existing drivers that have stats (which should be every
one) will override get_stats anyway.  Those that don't have stats
(if there are any) wouldn't hurt from having a get_stats that just
returns zeros everywhere.

So we can simply get rid of this flag.

This also fixes a potential crash in those get_stats callers that
don't check for a NULL return value (e.g., /proc/net/dev).

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 71fc8ff..9c52652 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -323,7 +323,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
diff --git a/net/core/dev.c b/net/core/dev.c
index c484fcf..5791021 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3289,11 +3289,9 @@ out:
 	mutex_unlock(&net_todo_run_mutex);
 }
 
-static struct net_device_stats *maybe_internal_stats(struct net_device *dev)
+static struct net_device_stats *get_internal_stats(struct net_device *dev)
 {
-	if (dev->features & NETIF_F_INTERNAL_STATS)
-		return &dev->stats;
-	return NULL;
+	return &dev->stats;
 }
 
 /**
@@ -3331,7 +3329,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 = get_internal_stats;
 	setup(dev);
 	strcpy(dev->name, name);
 	return dev;

             reply	other threads:[~2007-04-11  7:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-11  7:56 Herbert Xu [this message]
2007-04-11 12:15 ` [NET]: Get rid of NETIF_F_INTERNAL_STATS Rusty Russell
2007-04-11 12:23   ` Herbert Xu
2007-04-13 23:19     ` David Miller
2007-04-28  5:46     ` Rusty Russell
2007-04-28  5:52       ` Herbert Xu
2007-04-29  4:04         ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070411075602.GA17635@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox