aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/pkt_sched.h12
-rw-r--r--net/sched/act_csum.c2
-rw-r--r--net/sched/cls_flow.c8
-rw-r--r--net/sched/em_ipset.c2
-rw-r--r--net/sched/em_meta.c2
-rw-r--r--net/sched/sch_api.c2
-rw-r--r--net/sched/sch_dsmark.c6
-rw-r--r--net/sched/sch_teql.c4
8 files changed, 25 insertions, 13 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 27a33833ff4a..fe6e7aac3c56 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/jiffies.h> 4#include <linux/jiffies.h>
5#include <linux/ktime.h> 5#include <linux/ktime.h>
6#include <linux/if_vlan.h>
6#include <net/sch_generic.h> 7#include <net/sch_generic.h>
7 8
8struct qdisc_walker { 9struct qdisc_walker {
@@ -114,6 +115,17 @@ int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
114int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp, 115int tc_classify(struct sk_buff *skb, const struct tcf_proto *tp,
115 struct tcf_result *res); 116 struct tcf_result *res);
116 117
118static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
119{
120 /* We need to take extra care in case the skb came via
121 * vlan accelerated path. In that case, use skb->vlan_proto
122 * as the original vlan header was already stripped.
123 */
124 if (vlan_tx_tag_present(skb))
125 return skb->vlan_proto;
126 return skb->protocol;
127}
128
117/* Calculate maximal size of packet seen by hard_start_xmit 129/* Calculate maximal size of packet seen by hard_start_xmit
118 routine of this device. 130 routine of this device.
119 */ 131 */
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index edbf40dac709..4cd5cf1aedf8 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -509,7 +509,7 @@ static int tcf_csum(struct sk_buff *skb,
509 if (unlikely(action == TC_ACT_SHOT)) 509 if (unlikely(action == TC_ACT_SHOT))
510 goto drop; 510 goto drop;
511 511
512 switch (skb->protocol) { 512 switch (tc_skb_protocol(skb)) {
513 case cpu_to_be16(ETH_P_IP): 513 case cpu_to_be16(ETH_P_IP):
514 if (!tcf_csum_ipv4(skb, update_flags)) 514 if (!tcf_csum_ipv4(skb, update_flags))
515 goto drop; 515 goto drop;
diff --git a/net/sched/cls_flow.c b/net/sched/cls_flow.c
index 15d68f24a521..461410394d08 100644
--- a/net/sched/cls_flow.c
+++ b/net/sched/cls_flow.c
@@ -77,7 +77,7 @@ static u32 flow_get_dst(const struct sk_buff *skb, const struct flow_keys *flow)
77{ 77{
78 if (flow->dst) 78 if (flow->dst)
79 return ntohl(flow->dst); 79 return ntohl(flow->dst);
80 return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol; 80 return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb);
81} 81}
82 82
83static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow) 83static u32 flow_get_proto(const struct sk_buff *skb, const struct flow_keys *flow)
@@ -98,7 +98,7 @@ static u32 flow_get_proto_dst(const struct sk_buff *skb, const struct flow_keys
98 if (flow->ports) 98 if (flow->ports)
99 return ntohs(flow->port16[1]); 99 return ntohs(flow->port16[1]);
100 100
101 return addr_fold(skb_dst(skb)) ^ (__force u16)skb->protocol; 101 return addr_fold(skb_dst(skb)) ^ (__force u16) tc_skb_protocol(skb);
102} 102}
103 103
104static u32 flow_get_iif(const struct sk_buff *skb) 104static u32 flow_get_iif(const struct sk_buff *skb)
@@ -144,7 +144,7 @@ static u32 flow_get_nfct(const struct sk_buff *skb)
144 144
145static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow) 145static u32 flow_get_nfct_src(const struct sk_buff *skb, const struct flow_keys *flow)
146{ 146{
147 switch (skb->protocol) { 147 switch (tc_skb_protocol(skb)) {
148 case htons(ETH_P_IP): 148 case htons(ETH_P_IP):
149 return ntohl(CTTUPLE(skb, src.u3.ip)); 149 return ntohl(CTTUPLE(skb, src.u3.ip));
150 case htons(ETH_P_IPV6): 150 case htons(ETH_P_IPV6):
@@ -156,7 +156,7 @@ fallback:
156 156
157static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow) 157static u32 flow_get_nfct_dst(const struct sk_buff *skb, const struct flow_keys *flow)
158{ 158{
159 switch (skb->protocol) { 159 switch (tc_skb_protocol(skb)) {
160 case htons(ETH_P_IP): 160 case htons(ETH_P_IP):
161 return ntohl(CTTUPLE(skb, dst.u3.ip)); 161 return ntohl(CTTUPLE(skb, dst.u3.ip));
162 case htons(ETH_P_IPV6): 162 case htons(ETH_P_IPV6):
diff --git a/net/sched/em_ipset.c b/net/sched/em_ipset.c
index 5b4a4efe468c..a3d79c8bf3b8 100644
--- a/net/sched/em_ipset.c
+++ b/net/sched/em_ipset.c
@@ -59,7 +59,7 @@ static int em_ipset_match(struct sk_buff *skb, struct tcf_ematch *em,
59 struct net_device *dev, *indev = NULL; 59 struct net_device *dev, *indev = NULL;
60 int ret, network_offset; 60 int ret, network_offset;
61 61
62 switch (skb->protocol) { 62 switch (tc_skb_protocol(skb)) {
63 case htons(ETH_P_IP): 63 case htons(ETH_P_IP):
64 acpar.family = NFPROTO_IPV4; 64 acpar.family = NFPROTO_IPV4;
65 if (!pskb_network_may_pull(skb, sizeof(struct iphdr))) 65 if (!pskb_network_may_pull(skb, sizeof(struct iphdr)))
diff --git a/net/sched/em_meta.c b/net/sched/em_meta.c
index c8f8c399b99a..2159981b604e 100644
--- a/net/sched/em_meta.c
+++ b/net/sched/em_meta.c
@@ -197,7 +197,7 @@ META_COLLECTOR(int_priority)
197META_COLLECTOR(int_protocol) 197META_COLLECTOR(int_protocol)
198{ 198{
199 /* Let userspace take care of the byte ordering */ 199 /* Let userspace take care of the byte ordering */
200 dst->value = skb->protocol; 200 dst->value = tc_skb_protocol(skb);
201} 201}
202 202
203META_COLLECTOR(int_pkttype) 203META_COLLECTOR(int_pkttype)
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 76f402e05bd6..243b7d169d61 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -1807,7 +1807,7 @@ done:
1807int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp, 1807int tc_classify_compat(struct sk_buff *skb, const struct tcf_proto *tp,
1808 struct tcf_result *res) 1808 struct tcf_result *res)
1809{ 1809{
1810 __be16 protocol = skb->protocol; 1810 __be16 protocol = tc_skb_protocol(skb);
1811 int err; 1811 int err;
1812 1812
1813 for (; tp; tp = rcu_dereference_bh(tp->next)) { 1813 for (; tp; tp = rcu_dereference_bh(tp->next)) {
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 227114f27f94..66700a6116aa 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -203,7 +203,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
203 pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p); 203 pr_debug("%s(skb %p,sch %p,[qdisc %p])\n", __func__, skb, sch, p);
204 204
205 if (p->set_tc_index) { 205 if (p->set_tc_index) {
206 switch (skb->protocol) { 206 switch (tc_skb_protocol(skb)) {
207 case htons(ETH_P_IP): 207 case htons(ETH_P_IP):
208 if (skb_cow_head(skb, sizeof(struct iphdr))) 208 if (skb_cow_head(skb, sizeof(struct iphdr)))
209 goto drop; 209 goto drop;
@@ -289,7 +289,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
289 index = skb->tc_index & (p->indices - 1); 289 index = skb->tc_index & (p->indices - 1);
290 pr_debug("index %d->%d\n", skb->tc_index, index); 290 pr_debug("index %d->%d\n", skb->tc_index, index);
291 291
292 switch (skb->protocol) { 292 switch (tc_skb_protocol(skb)) {
293 case htons(ETH_P_IP): 293 case htons(ETH_P_IP):
294 ipv4_change_dsfield(ip_hdr(skb), p->mask[index], 294 ipv4_change_dsfield(ip_hdr(skb), p->mask[index],
295 p->value[index]); 295 p->value[index]);
@@ -306,7 +306,7 @@ static struct sk_buff *dsmark_dequeue(struct Qdisc *sch)
306 */ 306 */
307 if (p->mask[index] != 0xff || p->value[index]) 307 if (p->mask[index] != 0xff || p->value[index])
308 pr_warn("%s: unsupported protocol %d\n", 308 pr_warn("%s: unsupported protocol %d\n",
309 __func__, ntohs(skb->protocol)); 309 __func__, ntohs(tc_skb_protocol(skb)));
310 break; 310 break;
311 } 311 }
312 312
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 4899d4a18aa5..e02687185a59 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -242,8 +242,8 @@ __teql_resolve(struct sk_buff *skb, struct sk_buff *skb_res,
242 char haddr[MAX_ADDR_LEN]; 242 char haddr[MAX_ADDR_LEN];
243 243
244 neigh_ha_snapshot(haddr, n, dev); 244 neigh_ha_snapshot(haddr, n, dev);
245 err = dev_hard_header(skb, dev, ntohs(skb->protocol), haddr, 245 err = dev_hard_header(skb, dev, ntohs(tc_skb_protocol(skb)),
246 NULL, skb->len); 246 haddr, NULL, skb->len);
247 247
248 if (err < 0) 248 if (err < 0)
249 err = -EINVAL; 249 err = -EINVAL;