提交 ecf4ee41 编写于 作者: S Shmulik Ladkani 提交者: David S. Miller

net: skbuff: Coding: Use eth_type_vlan() instead of open coding it

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: NShmulik Ladkani <shmulik.ladkani@gmail.com>
Reviewed-by: NPravin B Shelar <pshelar@ovn.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 636c2628
...@@ -4567,8 +4567,7 @@ int skb_vlan_pop(struct sk_buff *skb) ...@@ -4567,8 +4567,7 @@ int skb_vlan_pop(struct sk_buff *skb)
if (likely(skb_vlan_tag_present(skb))) { if (likely(skb_vlan_tag_present(skb))) {
skb->vlan_tci = 0; skb->vlan_tci = 0;
} else { } else {
if (unlikely(skb->protocol != htons(ETH_P_8021Q) && if (unlikely(!eth_type_vlan(skb->protocol)))
skb->protocol != htons(ETH_P_8021AD)))
return 0; return 0;
err = __skb_vlan_pop(skb, &vlan_tci); err = __skb_vlan_pop(skb, &vlan_tci);
...@@ -4576,8 +4575,7 @@ int skb_vlan_pop(struct sk_buff *skb) ...@@ -4576,8 +4575,7 @@ int skb_vlan_pop(struct sk_buff *skb)
return err; return err;
} }
/* move next vlan tag to hw accel tag */ /* move next vlan tag to hw accel tag */
if (likely(skb->protocol != htons(ETH_P_8021Q) && if (likely(!eth_type_vlan(skb->protocol)))
skb->protocol != htons(ETH_P_8021AD)))
return 0; return 0;
vlan_proto = skb->protocol; vlan_proto = skb->protocol;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册