net: sched: fix skb->protocol use in case of accelerated vlan path
[deliverable/linux.git] / include / net / pkt_sched.h
index 27a33833ff4a942a2dde57140a6d67d520ffd7b1..fe6e7aac3c56d3b0d918c10901a0ba3e79ddf2db 100644 (file)
@@ -3,6 +3,7 @@
 
 #include <linux/jiffies.h>
 #include <linux/ktime.h>
+#include <linux/if_vlan.h>
 #include <net/sch_generic.h>
 
 struct qdisc_walker {
@@ -114,6 +115,17 @@ int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
 int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
                struct tcf_result *res);
 
+static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
+{
+       /* We need to take extra care in case the skb came via
+        * vlan accelerated path. In that case, use skb->vlan_proto
+        * as the original vlan header was already stripped.
+        */
+       if (vlan_tx_tag_present(skb))
+               return skb->vlan_proto;
+       return skb->protocol;
+}
+
 /* Calculate maximal size of packet seen by hard_start_xmit
    routine of this device.
  */
This page took 0.078772 seconds and 5 git commands to generate.