diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 683d493aa1bf..7fe82929f509 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2352,7 +2352,6 @@ EXPORT_SYMBOL(skb_checksum_help); | |||
2352 | 2352 | ||
2353 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) | 2353 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) |
2354 | { | 2354 | { |
2355 | unsigned int vlan_depth = skb->mac_len; | ||
2356 | __be16 type = skb->protocol; | 2355 | __be16 type = skb->protocol; |
2357 | 2356 | ||
2358 | /* Tunnel gso handlers can set protocol to ethernet. */ | 2357 | /* Tunnel gso handlers can set protocol to ethernet. */ |
@@ -2366,35 +2365,7 @@ __be16 skb_network_protocol(struct sk_buff *skb, int *depth) | |||
2366 | type = eth->h_proto; | 2365 | type = eth->h_proto; |
2367 | } | 2366 | } |
2368 | 2367 | ||
2369 | /* if skb->protocol is 802.1Q/AD then the header should already be | 2368 | return __vlan_get_protocol(skb, type, depth); |
2370 | * present at mac_len - VLAN_HLEN (if mac_len > 0), or at | ||
2371 | * ETH_HLEN otherwise | ||
2372 | */ | ||
2373 | if (type == htons(ETH_P_8021Q) || type == htons(ETH_P_8021AD)) { | ||
2374 | if (vlan_depth) { | ||
2375 | if (WARN_ON(vlan_depth < VLAN_HLEN)) | ||
2376 | return 0; | ||
2377 | vlan_depth -= VLAN_HLEN; | ||
2378 | } else { | ||
2379 | vlan_depth = ETH_HLEN; | ||
2380 | } | ||
2381 | do { | ||
2382 | struct vlan_hdr *vh; | ||
2383 | |||
2384 | if (unlikely(!pskb_may_pull(skb, | ||
2385 | vlan_depth + VLAN_HLEN))) | ||
2386 | return 0; | ||
2387 | |||
2388 | vh = (struct vlan_hdr *)(skb->data + vlan_depth); | ||
2389 | type = vh->h_vlan_encapsulated_proto; | ||
2390 | vlan_depth += VLAN_HLEN; | ||
2391 | } while (type == htons(ETH_P_8021Q) || | ||
2392 | type == htons(ETH_P_8021AD)); | ||
2393 | } | ||
2394 | |||
2395 | *depth = vlan_depth; | ||
2396 | |||
2397 | return type; | ||
2398 | } | 2369 | } |
2399 | 2370 | ||
2400 | /** | 2371 | /** |
@@ -5323,7 +5294,7 @@ void netdev_upper_dev_unlink(struct net_device *dev, | |||
5323 | } | 5294 | } |
5324 | EXPORT_SYMBOL(netdev_upper_dev_unlink); | 5295 | EXPORT_SYMBOL(netdev_upper_dev_unlink); |
5325 | 5296 | ||
5326 | void netdev_adjacent_add_links(struct net_device *dev) | 5297 | static void netdev_adjacent_add_links(struct net_device *dev) |
5327 | { | 5298 | { |
5328 | struct netdev_adjacent *iter; | 5299 | struct netdev_adjacent *iter; |
5329 | 5300 | ||
@@ -5348,7 +5319,7 @@ void netdev_adjacent_add_links(struct net_device *dev) | |||
5348 | } | 5319 | } |
5349 | } | 5320 | } |
5350 | 5321 | ||
5351 | void netdev_adjacent_del_links(struct net_device *dev) | 5322 | static void netdev_adjacent_del_links(struct net_device *dev) |
5352 | { | 5323 | { |
5353 | struct netdev_adjacent *iter; | 5324 | struct netdev_adjacent *iter; |
5354 | 5325 | ||
@@ -6656,7 +6627,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev) | |||
6656 | if (!queue) | 6627 | if (!queue) |
6657 | return NULL; | 6628 | return NULL; |
6658 | netdev_init_one_queue(dev, queue, NULL); | 6629 | netdev_init_one_queue(dev, queue, NULL); |
6659 | queue->qdisc = &noop_qdisc; | 6630 | RCU_INIT_POINTER(queue->qdisc, &noop_qdisc); |
6660 | queue->qdisc_sleeping = &noop_qdisc; | 6631 | queue->qdisc_sleeping = &noop_qdisc; |
6661 | rcu_assign_pointer(dev->ingress_queue, queue); | 6632 | rcu_assign_pointer(dev->ingress_queue, queue); |
6662 | #endif | 6633 | #endif |
@@ -7072,10 +7043,20 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
7072 | oldsd->output_queue = NULL; | 7043 | oldsd->output_queue = NULL; |
7073 | oldsd->output_queue_tailp = &oldsd->output_queue; | 7044 | oldsd->output_queue_tailp = &oldsd->output_queue; |
7074 | } | 7045 | } |
7075 | /* Append NAPI poll list from offline CPU. */ | 7046 | /* Append NAPI poll list from offline CPU, with one exception : |
7076 | if (!list_empty(&oldsd->poll_list)) { | 7047 | * process_backlog() must be called by cpu owning percpu backlog. |
7077 | list_splice_init(&oldsd->poll_list, &sd->poll_list); | 7048 | * We properly handle process_queue & input_pkt_queue later. |
7078 | raise_softirq_irqoff(NET_RX_SOFTIRQ); | 7049 | */ |
7050 | while (!list_empty(&oldsd->poll_list)) { | ||
7051 | struct napi_struct *napi = list_first_entry(&oldsd->poll_list, | ||
7052 | struct napi_struct, | ||
7053 | poll_list); | ||
7054 | |||
7055 | list_del_init(&napi->poll_list); | ||
7056 | if (napi->poll == process_backlog) | ||
7057 | napi->state = 0; | ||
7058 | else | ||
7059 | ____napi_schedule(sd, napi); | ||
7079 | } | 7060 | } |
7080 | 7061 | ||
7081 | raise_softirq_irqoff(NET_TX_SOFTIRQ); | 7062 | raise_softirq_irqoff(NET_TX_SOFTIRQ); |
@@ -7086,7 +7067,7 @@ static int dev_cpu_callback(struct notifier_block *nfb, | |||
7086 | netif_rx_internal(skb); | 7067 | netif_rx_internal(skb); |
7087 | input_queue_head_incr(oldsd); | 7068 | input_queue_head_incr(oldsd); |
7088 | } | 7069 | } |
7089 | while ((skb = __skb_dequeue(&oldsd->input_pkt_queue))) { | 7070 | while ((skb = skb_dequeue(&oldsd->input_pkt_queue))) { |
7090 | netif_rx_internal(skb); | 7071 | netif_rx_internal(skb); |
7091 | input_queue_head_incr(oldsd); | 7072 | input_queue_head_incr(oldsd); |
7092 | } | 7073 | } |