net: add vlan_get_protocol_and_depth() helper
[platform/kernel/linux-starfive.git] / net / packet / af_packet.c
index 640d94e..94c6a1f 100644 (file)
@@ -1934,10 +1934,8 @@ static void packet_parse_headers(struct sk_buff *skb, struct socket *sock)
        /* Move network header to the right position for VLAN tagged packets */
        if (likely(skb->dev->type == ARPHRD_ETHER) &&
            eth_type_vlan(skb->protocol) &&
-           __vlan_get_protocol(skb, skb->protocol, &depth) != 0) {
-               if (pskb_may_pull(skb, depth))
-                       skb_set_network_header(skb, depth);
-       }
+           vlan_get_protocol_and_depth(skb, skb->protocol, &depth) != 0)
+               skb_set_network_header(skb, depth);
 
        skb_probe_transport_header(skb);
 }