diff options
Diffstat (limited to 'net/core/dev.c')
-rw-r--r-- | net/core/dev.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 3721db716350..45fa2f11f84d 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -2286,7 +2286,7 @@ out: | |||
2286 | } | 2286 | } |
2287 | EXPORT_SYMBOL(skb_checksum_help); | 2287 | EXPORT_SYMBOL(skb_checksum_help); |
2288 | 2288 | ||
2289 | __be16 skb_network_protocol(struct sk_buff *skb) | 2289 | __be16 skb_network_protocol(struct sk_buff *skb, int *depth) |
2290 | { | 2290 | { |
2291 | __be16 type = skb->protocol; | 2291 | __be16 type = skb->protocol; |
2292 | int vlan_depth = ETH_HLEN; | 2292 | int vlan_depth = ETH_HLEN; |
@@ -2313,6 +2313,8 @@ __be16 skb_network_protocol(struct sk_buff *skb) | |||
2313 | vlan_depth += VLAN_HLEN; | 2313 | vlan_depth += VLAN_HLEN; |
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | *depth = vlan_depth; | ||
2317 | |||
2316 | return type; | 2318 | return type; |
2317 | } | 2319 | } |
2318 | 2320 | ||
@@ -2326,12 +2328,13 @@ struct sk_buff *skb_mac_gso_segment(struct sk_buff *skb, | |||
2326 | { | 2328 | { |
2327 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); | 2329 | struct sk_buff *segs = ERR_PTR(-EPROTONOSUPPORT); |
2328 | struct packet_offload *ptype; | 2330 | struct packet_offload *ptype; |
2329 | __be16 type = skb_network_protocol(skb); | 2331 | int vlan_depth = skb->mac_len; |
2332 | __be16 type = skb_network_protocol(skb, &vlan_depth); | ||
2330 | 2333 | ||
2331 | if (unlikely(!type)) | 2334 | if (unlikely(!type)) |
2332 | return ERR_PTR(-EINVAL); | 2335 | return ERR_PTR(-EINVAL); |
2333 | 2336 | ||
2334 | __skb_pull(skb, skb->mac_len); | 2337 | __skb_pull(skb, vlan_depth); |
2335 | 2338 | ||
2336 | rcu_read_lock(); | 2339 | rcu_read_lock(); |
2337 | list_for_each_entry_rcu(ptype, &offload_base, list) { | 2340 | list_for_each_entry_rcu(ptype, &offload_base, list) { |
@@ -2420,7 +2423,7 @@ EXPORT_SYMBOL(netdev_rx_csum_fault); | |||
2420 | * 2. No high memory really exists on this machine. | 2423 | * 2. No high memory really exists on this machine. |
2421 | */ | 2424 | */ |
2422 | 2425 | ||
2423 | static int illegal_highdma(struct net_device *dev, struct sk_buff *skb) | 2426 | static int illegal_highdma(const struct net_device *dev, struct sk_buff *skb) |
2424 | { | 2427 | { |
2425 | #ifdef CONFIG_HIGHMEM | 2428 | #ifdef CONFIG_HIGHMEM |
2426 | int i; | 2429 | int i; |
@@ -2495,34 +2498,38 @@ static int dev_gso_segment(struct sk_buff *skb, netdev_features_t features) | |||
2495 | } | 2498 | } |
2496 | 2499 | ||
2497 | static netdev_features_t harmonize_features(struct sk_buff *skb, | 2500 | static netdev_features_t harmonize_features(struct sk_buff *skb, |
2498 | netdev_features_t features) | 2501 | const struct net_device *dev, |
2502 | netdev_features_t features) | ||
2499 | { | 2503 | { |
2504 | int tmp; | ||
2505 | |||
2500 | if (skb->ip_summed != CHECKSUM_NONE && | 2506 | if (skb->ip_summed != CHECKSUM_NONE && |
2501 | !can_checksum_protocol(features, skb_network_protocol(skb))) { | 2507 | !can_checksum_protocol(features, skb_network_protocol(skb, &tmp))) { |
2502 | features &= ~NETIF_F_ALL_CSUM; | 2508 | features &= ~NETIF_F_ALL_CSUM; |
2503 | } else if (illegal_highdma(skb->dev, skb)) { | 2509 | } else if (illegal_highdma(dev, skb)) { |
2504 | features &= ~NETIF_F_SG; | 2510 | features &= ~NETIF_F_SG; |
2505 | } | 2511 | } |
2506 | 2512 | ||
2507 | return features; | 2513 | return features; |
2508 | } | 2514 | } |
2509 | 2515 | ||
2510 | netdev_features_t netif_skb_features(struct sk_buff *skb) | 2516 | netdev_features_t netif_skb_dev_features(struct sk_buff *skb, |
2517 | const struct net_device *dev) | ||
2511 | { | 2518 | { |
2512 | __be16 protocol = skb->protocol; | 2519 | __be16 protocol = skb->protocol; |
2513 | netdev_features_t features = skb->dev->features; | 2520 | netdev_features_t features = dev->features; |
2514 | 2521 | ||
2515 | if (skb_shinfo(skb)->gso_segs > skb->dev->gso_max_segs) | 2522 | if (skb_shinfo(skb)->gso_segs > dev->gso_max_segs) |
2516 | features &= ~NETIF_F_GSO_MASK; | 2523 | features &= ~NETIF_F_GSO_MASK; |
2517 | 2524 | ||
2518 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { | 2525 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) { |
2519 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; | 2526 | struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; |
2520 | protocol = veh->h_vlan_encapsulated_proto; | 2527 | protocol = veh->h_vlan_encapsulated_proto; |
2521 | } else if (!vlan_tx_tag_present(skb)) { | 2528 | } else if (!vlan_tx_tag_present(skb)) { |
2522 | return harmonize_features(skb, features); | 2529 | return harmonize_features(skb, dev, features); |
2523 | } | 2530 | } |
2524 | 2531 | ||
2525 | features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | | 2532 | features &= (dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX | |
2526 | NETIF_F_HW_VLAN_STAG_TX); | 2533 | NETIF_F_HW_VLAN_STAG_TX); |
2527 | 2534 | ||
2528 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) | 2535 | if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) |
@@ -2530,9 +2537,9 @@ netdev_features_t netif_skb_features(struct sk_buff *skb) | |||
2530 | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | | 2537 | NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX | |
2531 | NETIF_F_HW_VLAN_STAG_TX; | 2538 | NETIF_F_HW_VLAN_STAG_TX; |
2532 | 2539 | ||
2533 | return harmonize_features(skb, features); | 2540 | return harmonize_features(skb, dev, features); |
2534 | } | 2541 | } |
2535 | EXPORT_SYMBOL(netif_skb_features); | 2542 | EXPORT_SYMBOL(netif_skb_dev_features); |
2536 | 2543 | ||
2537 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, | 2544 | int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, |
2538 | struct netdev_queue *txq) | 2545 | struct netdev_queue *txq) |
@@ -2803,7 +2810,7 @@ EXPORT_SYMBOL(dev_loopback_xmit); | |||
2803 | * the BH enable code must have IRQs enabled so that it will not deadlock. | 2810 | * the BH enable code must have IRQs enabled so that it will not deadlock. |
2804 | * --BLG | 2811 | * --BLG |
2805 | */ | 2812 | */ |
2806 | int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv) | 2813 | static int __dev_queue_xmit(struct sk_buff *skb, void *accel_priv) |
2807 | { | 2814 | { |
2808 | struct net_device *dev = skb->dev; | 2815 | struct net_device *dev = skb->dev; |
2809 | struct netdev_queue *txq; | 2816 | struct netdev_queue *txq; |
@@ -4637,7 +4644,7 @@ struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev) | |||
4637 | } | 4644 | } |
4638 | EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu); | 4645 | EXPORT_SYMBOL(netdev_master_upper_dev_get_rcu); |
4639 | 4646 | ||
4640 | int netdev_adjacent_sysfs_add(struct net_device *dev, | 4647 | static int netdev_adjacent_sysfs_add(struct net_device *dev, |
4641 | struct net_device *adj_dev, | 4648 | struct net_device *adj_dev, |
4642 | struct list_head *dev_list) | 4649 | struct list_head *dev_list) |
4643 | { | 4650 | { |
@@ -4647,7 +4654,7 @@ int netdev_adjacent_sysfs_add(struct net_device *dev, | |||
4647 | return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj), | 4654 | return sysfs_create_link(&(dev->dev.kobj), &(adj_dev->dev.kobj), |
4648 | linkname); | 4655 | linkname); |
4649 | } | 4656 | } |
4650 | void netdev_adjacent_sysfs_del(struct net_device *dev, | 4657 | static void netdev_adjacent_sysfs_del(struct net_device *dev, |
4651 | char *name, | 4658 | char *name, |
4652 | struct list_head *dev_list) | 4659 | struct list_head *dev_list) |
4653 | { | 4660 | { |