Merge tag 'xfs-6.4-rc1-fixes' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-block.git] / include / linux / if_vlan.h
index 0f40f379d75cb1e80aaff132842a8d1b968ad087..6ba71957851e22829ec9f18cd29bea2d92dfa583 100644 (file)
@@ -637,6 +637,23 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
        return __vlan_get_protocol(skb, skb->protocol, NULL);
 }
 
+/* This version of __vlan_get_protocol() also pulls mac header in skb->head */
+static inline __be16 vlan_get_protocol_and_depth(struct sk_buff *skb,
+                                                __be16 type, int *depth)
+{
+       int maclen;
+
+       type = __vlan_get_protocol(skb, type, &maclen);
+
+       if (type) {
+               if (!pskb_may_pull(skb, maclen))
+                       type = 0;
+               else if (depth)
+                       *depth = maclen;
+       }
+       return type;
+}
+
 /* A getter for the SKB protocol field which will handle VLAN tags consistently
  * whether VLAN acceleration is enabled or not.
  */