aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>2015-03-27 01:31:11 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-29 16:33:22 -0400
commitf5a7fb88e1f82542ca14ba93a1d4fa35471c60ca (patch)
treee901a68ad66666d1566e9f0de7a358c43d117bec /net
parent8d463504c191c2126d097ac94fb258aabe6d3e62 (diff)
vlan: Introduce helper functions to check if skb is tagged
Separate the two checks for single vlan and multiple vlans in netif_skb_features(). This allows us to move the check for multiple vlans to another function later. Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index a0408d497dae..04bffcd4a48d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2567,7 +2567,6 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2567 struct net_device *dev = skb->dev; 2567 struct net_device *dev = skb->dev;
2568 netdev_features_t features = dev->features; 2568 netdev_features_t features = dev->features;
2569 u16 gso_segs = skb_shinfo(skb)->gso_segs; 2569 u16 gso_segs = skb_shinfo(skb)->gso_segs;
2570 __be16 protocol = skb->protocol;
2571 2570
2572 if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs) 2571 if (gso_segs > dev->gso_max_segs || gso_segs < dev->gso_min_segs)
2573 features &= ~NETIF_F_GSO_MASK; 2572 features &= ~NETIF_F_GSO_MASK;
@@ -2579,22 +2578,15 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2579 if (skb->encapsulation) 2578 if (skb->encapsulation)
2580 features &= dev->hw_enc_features; 2579 features &= dev->hw_enc_features;
2581 2580
2582 if (!skb_vlan_tag_present(skb)) { 2581 if (skb_vlan_tagged(skb))
2583 if (unlikely(protocol == htons(ETH_P_8021Q) || 2582 features = netdev_intersect_features(features,
2584 protocol == htons(ETH_P_8021AD))) { 2583 dev->vlan_features |
2585 struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data; 2584 NETIF_F_HW_VLAN_CTAG_TX |
2586 protocol = veh->h_vlan_encapsulated_proto; 2585 NETIF_F_HW_VLAN_STAG_TX);
2587 } else { 2586 else
2588 goto finalize; 2587 goto finalize;
2589 }
2590 }
2591
2592 features = netdev_intersect_features(features,
2593 dev->vlan_features |
2594 NETIF_F_HW_VLAN_CTAG_TX |
2595 NETIF_F_HW_VLAN_STAG_TX);
2596 2588
2597 if (protocol == htons(ETH_P_8021Q) || protocol == htons(ETH_P_8021AD)) 2589 if (skb_vlan_tagged_multi(skb))
2598 features = netdev_intersect_features(features, 2590 features = netdev_intersect_features(features,
2599 NETIF_F_SG | 2591 NETIF_F_SG |
2600 NETIF_F_HIGHDMA | 2592 NETIF_F_HIGHDMA |