net: skbuff: Coding: Use eth_type_vlan() instead of open coding it
authorShmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Tue, 20 Sep 2016 09:48:37 +0000 (12:48 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Sep 2016 05:35:57 +0000 (01:35 -0400)
Fix 'skb_vlan_pop' to use eth_type_vlan instead of directly comparing
skb->protocol to ETH_P_8021Q or ETH_P_8021AD.

Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
Reviewed-by: Pravin B Shelar <pshelar@ovn.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/skbuff.c

index b2a51bf1b0f928e7afaf47570f60649f8300b478..d36c7548952ff472857d835eea12412c5b3599cd 100644 (file)
@@ -4567,8 +4567,7 @@ int skb_vlan_pop(struct sk_buff *skb)
        if (likely(skb_vlan_tag_present(skb))) {
                skb->vlan_tci = 0;
        } else {
-               if (unlikely(skb->protocol != htons(ETH_P_8021Q) &&
-                            skb->protocol != htons(ETH_P_8021AD)))
+               if (unlikely(!eth_type_vlan(skb->protocol)))
                        return 0;
 
                err = __skb_vlan_pop(skb, &vlan_tci);
@@ -4576,8 +4575,7 @@ int skb_vlan_pop(struct sk_buff *skb)
                        return err;
        }
        /* move next vlan tag to hw accel tag */
-       if (likely(skb->protocol != htons(ETH_P_8021Q) &&
-                  skb->protocol != htons(ETH_P_8021AD)))
+       if (likely(!eth_type_vlan(skb->protocol)))
                return 0;
 
        vlan_proto = skb->protocol;