diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2007-04-20 20:02:45 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:22 -0400 |
commit | 9be9a6b983314dd57e2c5ba548dee8b53d338ac3 (patch) | |
tree | 93972a232c26fd4175bf3bf0af0299fcc18a64a3 /net/core | |
parent | 42dc9cd54b7290f862874a2544e50395e5719985 (diff) |
[NET]: Get rid of netdev_nit
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | 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 c8f5ea9aea81..431998d9cee9 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -226,12 +226,6 @@ extern void netdev_unregister_sysfs(struct net_device *); | |||
226 | *******************************************************************************/ | 226 | *******************************************************************************/ |
227 | 227 | ||
228 | /* | 228 | /* |
229 | * For efficiency | ||
230 | */ | ||
231 | |||
232 | static int netdev_nit; | ||
233 | |||
234 | /* | ||
235 | * Add a protocol ID to the list. Now that the input handler is | 229 | * Add a protocol ID to the list. Now that the input handler is |
236 | * smarter we can dispense with all the messy stuff that used to be | 230 | * smarter we can dispense with all the messy stuff that used to be |
237 | * here. | 231 | * here. |
@@ -265,10 +259,9 @@ void dev_add_pack(struct packet_type *pt) | |||
265 | int hash; | 259 | int hash; |
266 | 260 | ||
267 | spin_lock_bh(&ptype_lock); | 261 | spin_lock_bh(&ptype_lock); |
268 | if (pt->type == htons(ETH_P_ALL)) { | 262 | if (pt->type == htons(ETH_P_ALL)) |
269 | netdev_nit++; | ||
270 | list_add_rcu(&pt->list, &ptype_all); | 263 | list_add_rcu(&pt->list, &ptype_all); |
271 | } else { | 264 | else { |
272 | hash = ntohs(pt->type) & 15; | 265 | hash = ntohs(pt->type) & 15; |
273 | list_add_rcu(&pt->list, &ptype_base[hash]); | 266 | list_add_rcu(&pt->list, &ptype_base[hash]); |
274 | } | 267 | } |
@@ -295,10 +288,9 @@ void __dev_remove_pack(struct packet_type *pt) | |||
295 | 288 | ||
296 | spin_lock_bh(&ptype_lock); | 289 | spin_lock_bh(&ptype_lock); |
297 | 290 | ||
298 | if (pt->type == htons(ETH_P_ALL)) { | 291 | if (pt->type == htons(ETH_P_ALL)) |
299 | netdev_nit--; | ||
300 | head = &ptype_all; | 292 | head = &ptype_all; |
301 | } else | 293 | else |
302 | head = &ptype_base[ntohs(pt->type) & 15]; | 294 | head = &ptype_base[ntohs(pt->type) & 15]; |
303 | 295 | ||
304 | list_for_each_entry(pt1, head, list) { | 296 | list_for_each_entry(pt1, head, list) { |
@@ -1330,7 +1322,7 @@ static int dev_gso_segment(struct sk_buff *skb) | |||
1330 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | 1322 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) |
1331 | { | 1323 | { |
1332 | if (likely(!skb->next)) { | 1324 | if (likely(!skb->next)) { |
1333 | if (netdev_nit) | 1325 | if (!list_empty(&ptype_all)) |
1334 | dev_queue_xmit_nit(skb, dev); | 1326 | dev_queue_xmit_nit(skb, dev); |
1335 | 1327 | ||
1336 | if (netif_needs_gso(dev, skb)) { | 1328 | if (netif_needs_gso(dev, skb)) { |