diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 19:59:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 19:59:51 -0400 |
commit | b1cdc4670b9508fcd47a15fbd12f70d269880b37 (patch) | |
tree | fea9e2650170886d539488f8b1e064f6ca60ad36 /net/core/dev.c | |
parent | ce7d0226198aac42ed311dd2783232adc16b296d (diff) | |
parent | f925b1303e0672effc78547353bd2ddfe11f5b5f (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (63 commits)
drivers/net/usb/asix.c: Fix pointer cast.
be2net: Bug fix to avoid disabling bottom half during firmware upgrade.
proc_dointvec: write a single value
hso: add support for new products
Phonet: fix potential use-after-free in pep_sock_close()
ath9k: remove VEOL support for ad-hoc
ath9k: change beacon allocation to prefer the first beacon slot
sock.h: fix kernel-doc warning
cls_cgroup: Fix build error when built-in
macvlan: do proper cleanup in macvlan_common_newlink() V2
be2net: Bug fix in init code in probe
net/dccp: expansion of error code size
ath9k: Fix rx of mcast/bcast frames in PS mode with auto sleep
wireless: fix sta_info.h kernel-doc warnings
wireless: fix mac80211.h kernel-doc warnings
iwlwifi: testing the wrong variable in iwl_add_bssid_station()
ath9k_htc: rare leak in ath9k_hif_usb_alloc_tx_urbs()
ath9k_htc: dereferencing before check in hif_usb_tx_cb()
rt2x00: Fix rt2800usb TX descriptor writing.
rt2x00: Fix failed SLEEP->AWAKE and AWAKE->SLEEP transitions.
...
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 48 |
1 files changed, 27 insertions, 21 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index d273e4e3ecd..1845b08c624 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -954,18 +954,22 @@ int dev_alloc_name(struct net_device *dev, const char *name) | |||
954 | } | 954 | } |
955 | EXPORT_SYMBOL(dev_alloc_name); | 955 | EXPORT_SYMBOL(dev_alloc_name); |
956 | 956 | ||
957 | static int dev_get_valid_name(struct net *net, const char *name, char *buf, | 957 | static int dev_get_valid_name(struct net_device *dev, const char *name, bool fmt) |
958 | bool fmt) | ||
959 | { | 958 | { |
959 | struct net *net; | ||
960 | |||
961 | BUG_ON(!dev_net(dev)); | ||
962 | net = dev_net(dev); | ||
963 | |||
960 | if (!dev_valid_name(name)) | 964 | if (!dev_valid_name(name)) |
961 | return -EINVAL; | 965 | return -EINVAL; |
962 | 966 | ||
963 | if (fmt && strchr(name, '%')) | 967 | if (fmt && strchr(name, '%')) |
964 | return __dev_alloc_name(net, name, buf); | 968 | return dev_alloc_name(dev, name); |
965 | else if (__dev_get_by_name(net, name)) | 969 | else if (__dev_get_by_name(net, name)) |
966 | return -EEXIST; | 970 | return -EEXIST; |
967 | else if (buf != name) | 971 | else if (dev->name != name) |
968 | strlcpy(buf, name, IFNAMSIZ); | 972 | strlcpy(dev->name, name, IFNAMSIZ); |
969 | 973 | ||
970 | return 0; | 974 | return 0; |
971 | } | 975 | } |
@@ -997,7 +1001,7 @@ int dev_change_name(struct net_device *dev, const char *newname) | |||
997 | 1001 | ||
998 | memcpy(oldname, dev->name, IFNAMSIZ); | 1002 | memcpy(oldname, dev->name, IFNAMSIZ); |
999 | 1003 | ||
1000 | err = dev_get_valid_name(net, newname, dev->name, 1); | 1004 | err = dev_get_valid_name(dev, newname, 1); |
1001 | if (err < 0) | 1005 | if (err < 0) |
1002 | return err; | 1006 | return err; |
1003 | 1007 | ||
@@ -2421,10 +2425,7 @@ static int enqueue_to_backlog(struct sk_buff *skb, int cpu, | |||
2421 | if (skb_queue_len(&sd->input_pkt_queue)) { | 2425 | if (skb_queue_len(&sd->input_pkt_queue)) { |
2422 | enqueue: | 2426 | enqueue: |
2423 | __skb_queue_tail(&sd->input_pkt_queue, skb); | 2427 | __skb_queue_tail(&sd->input_pkt_queue, skb); |
2424 | #ifdef CONFIG_RPS | 2428 | input_queue_tail_incr_save(sd, qtail); |
2425 | *qtail = sd->input_queue_head + | ||
2426 | skb_queue_len(&sd->input_pkt_queue); | ||
2427 | #endif | ||
2428 | rps_unlock(sd); | 2429 | rps_unlock(sd); |
2429 | local_irq_restore(flags); | 2430 | local_irq_restore(flags); |
2430 | return NET_RX_SUCCESS; | 2431 | return NET_RX_SUCCESS; |
@@ -2959,7 +2960,7 @@ static void flush_backlog(void *arg) | |||
2959 | if (skb->dev == dev) { | 2960 | if (skb->dev == dev) { |
2960 | __skb_unlink(skb, &sd->input_pkt_queue); | 2961 | __skb_unlink(skb, &sd->input_pkt_queue); |
2961 | kfree_skb(skb); | 2962 | kfree_skb(skb); |
2962 | input_queue_head_add(sd, 1); | 2963 | input_queue_head_incr(sd); |
2963 | } | 2964 | } |
2964 | } | 2965 | } |
2965 | rps_unlock(sd); | 2966 | rps_unlock(sd); |
@@ -2968,6 +2969,7 @@ static void flush_backlog(void *arg) | |||
2968 | if (skb->dev == dev) { | 2969 | if (skb->dev == dev) { |
2969 | __skb_unlink(skb, &sd->process_queue); | 2970 | __skb_unlink(skb, &sd->process_queue); |
2970 | kfree_skb(skb); | 2971 | kfree_skb(skb); |
2972 | input_queue_head_incr(sd); | ||
2971 | } | 2973 | } |
2972 | } | 2974 | } |
2973 | } | 2975 | } |
@@ -3323,18 +3325,20 @@ static int process_backlog(struct napi_struct *napi, int quota) | |||
3323 | while ((skb = __skb_dequeue(&sd->process_queue))) { | 3325 | while ((skb = __skb_dequeue(&sd->process_queue))) { |
3324 | local_irq_enable(); | 3326 | local_irq_enable(); |
3325 | __netif_receive_skb(skb); | 3327 | __netif_receive_skb(skb); |
3326 | if (++work >= quota) | ||
3327 | return work; | ||
3328 | local_irq_disable(); | 3328 | local_irq_disable(); |
3329 | input_queue_head_incr(sd); | ||
3330 | if (++work >= quota) { | ||
3331 | local_irq_enable(); | ||
3332 | return work; | ||
3333 | } | ||
3329 | } | 3334 | } |
3330 | 3335 | ||
3331 | rps_lock(sd); | 3336 | rps_lock(sd); |
3332 | qlen = skb_queue_len(&sd->input_pkt_queue); | 3337 | qlen = skb_queue_len(&sd->input_pkt_queue); |
3333 | if (qlen) { | 3338 | if (qlen) |
3334 | input_queue_head_add(sd, qlen); | ||
3335 | skb_queue_splice_tail_init(&sd->input_pkt_queue, | 3339 | skb_queue_splice_tail_init(&sd->input_pkt_queue, |
3336 | &sd->process_queue); | 3340 | &sd->process_queue); |
3337 | } | 3341 | |
3338 | if (qlen < quota - work) { | 3342 | if (qlen < quota - work) { |
3339 | /* | 3343 | /* |
3340 | * Inline a custom version of __napi_complete(). | 3344 | * Inline a custom version of __napi_complete(). |
@@ -4960,7 +4964,7 @@ int register_netdevice(struct net_device *dev) | |||
4960 | } | 4964 | } |
4961 | } | 4965 | } |
4962 | 4966 | ||
4963 | ret = dev_get_valid_name(net, dev->name, dev->name, 0); | 4967 | ret = dev_get_valid_name(dev, dev->name, 0); |
4964 | if (ret) | 4968 | if (ret) |
4965 | goto err_uninit; | 4969 | goto err_uninit; |
4966 | 4970 | ||
@@ -5558,7 +5562,7 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char | |||
5558 | /* We get here if we can't use the current device name */ | 5562 | /* We get here if we can't use the current device name */ |
5559 | if (!pat) | 5563 | if (!pat) |
5560 | goto out; | 5564 | goto out; |
5561 | if (dev_get_valid_name(net, pat, dev->name, 1)) | 5565 | if (dev_get_valid_name(dev, pat, 1)) |
5562 | goto out; | 5566 | goto out; |
5563 | } | 5567 | } |
5564 | 5568 | ||
@@ -5661,12 +5665,14 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
5661 | local_irq_enable(); | 5665 | local_irq_enable(); |
5662 | 5666 | ||
5663 | /* Process offline CPU's input_pkt_queue */ | 5667 | /* Process offline CPU's input_pkt_queue */ |
5664 | while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { | 5668 | while ((skb = __skb_dequeue(&oldsd->process_queue))) { |
5665 | netif_rx(skb); | 5669 | netif_rx(skb); |
5666 | input_queue_head_add(oldsd, 1); | 5670 | input_queue_head_incr(oldsd); |
5667 | } | 5671 | } |
5668 | while ((skb = __skb_dequeue(&oldsd->process_queue))) | 5672 | while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { |
5669 | netif_rx(skb); | 5673 | netif_rx(skb); |
5674 | input_queue_head_incr(oldsd); | ||
5675 | } | ||
5670 | 5676 | ||
5671 | return NOTIFY_OK; | 5677 | return NOTIFY_OK; |
5672 | } | 5678 | } |