From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Eric Dumazet <dada1@cosmosbay.com>, David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [RFC] Get rid of netdev_nit
Date: Tue, 13 Mar 2007 14:26:35 -0700 [thread overview]
Message-ID: <20070313142635.68966970@freekitty> (raw)
In-Reply-To: <45F63891.6040307@cosmosbay.com>
It isn't any faster to test a boolean global variable than do a
simple check for empty list.
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
---
net/core/dev.c | 18 +++++-------------
1 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 3a8590c..f2ae2c9 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -226,12 +226,6 @@ #endif
*******************************************************************************/
/*
- * For efficiency
- */
-
-static int netdev_nit;
-
-/*
* Add a protocol ID to the list. Now that the input handler is
* smarter we can dispense with all the messy stuff that used to be
* here.
@@ -265,10 +259,9 @@ void dev_add_pack(struct packet_type *pt
int hash;
spin_lock_bh(&ptype_lock);
- if (pt->type == htons(ETH_P_ALL)) {
- netdev_nit++;
+ if (pt->type == htons(ETH_P_ALL))
list_add_rcu(&pt->list, &ptype_all);
- } else {
+ else {
hash = ntohs(pt->type) & 15;
list_add_rcu(&pt->list, &ptype_base[hash]);
}
@@ -295,10 +288,9 @@ void __dev_remove_pack(struct packet_typ
spin_lock_bh(&ptype_lock);
- if (pt->type == htons(ETH_P_ALL)) {
- netdev_nit--;
+ if (pt->type == htons(ETH_P_ALL))
head = &ptype_all;
- } else
+ else
head = &ptype_base[ntohs(pt->type) & 15];
list_for_each_entry(pt1, head, list) {
@@ -1333,7 +1325,7 @@ static int dev_gso_segment(struct sk_buf
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
if (likely(!skb->next)) {
- if (netdev_nit)
+ if (!list_empty(&ptype_all))
dev_queue_xmit_nit(skb, dev);
if (netif_needs_gso(dev, skb)) {
--
1.4.1
next prev parent reply other threads:[~2007-03-13 21:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-12 21:08 [patch 0/4] more stuff for 2.6.22 Stephen Hemminger
2007-03-12 21:08 ` [patch 1/4] network dev read_mostly Stephen Hemminger
2007-03-12 21:34 ` David Miller
2007-03-13 5:37 ` Eric Dumazet
2007-03-13 21:26 ` Stephen Hemminger [this message]
2007-04-21 0:02 ` [RFC] Get rid of netdev_nit David Miller
2007-03-15 2:18 ` [patch 1/4] network dev read_mostly Benjamin LaHaise
2007-03-15 4:54 ` David Miller
2007-03-15 6:28 ` Eric Dumazet
2007-03-15 7:25 ` David Miller
2007-03-15 7:42 ` Eric Dumazet
2007-03-15 13:17 ` Benjamin LaHaise
2007-03-16 17:03 ` Stephen Hemminger
2007-03-15 15:10 ` Andi Kleen
2007-03-12 21:08 ` [patch 2/4] net: make seq_operations const Stephen Hemminger
2007-03-12 21:34 ` David Miller
2007-03-12 21:08 ` [patch 3/4] net: show bound packet types Stephen Hemminger
2007-03-12 21:35 ` David Miller
2007-03-12 21:08 ` [patch 4/4] tcp: statistics not read_mostly Stephen Hemminger
2007-03-12 21:15 ` David Miller
2007-03-12 21:26 ` Stephen Hemminger
2007-03-12 21:33 ` David Miller
2007-03-13 20:09 ` Andi Kleen
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=20070313142635.68966970@freekitty \
--to=shemminger@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).