Skip to content

Commit

Permalink
net: skbuff: Coding: Use eth_type_vlan() instead of open coding it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shmulik Ladkani authored and David S. Miller committed Sep 22, 2016
1 parent 636c262 commit ecf4ee4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -4567,17 +4567,15 @@ 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);
if (err)
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;
Expand Down

0 comments on commit ecf4ee4

Please sign in to comment.