aboutsummaryrefslogtreecommitdiff
path: root/include/linux/if_vlan.h
diff options
context:
space:
mode:
authorMark Brown <[email protected]>2023-05-19 12:32:04 +0900
committerMark Brown <[email protected]>2023-05-19 12:32:04 +0900
commitaf53b00fa3aca3410c89900a34e5d727a27c36e2 (patch)
tree1b51641988e0ae56f8de4a693ab3d1aecc5491d4 /include/linux/if_vlan.h
parent98be58f2b517b212b57b8493dab92312a52614ac (diff)
parentf1fcbaa18b28dec10281551dfe6ed3a3ed80e3d6 (diff)
Merge tag 'v6.4-rc2' into asoc-6.5 to get fixes for CI
Linux 6.4-rc2
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r--include/linux/if_vlan.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 0f40f379d75c..6ba71957851e 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -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.
*/