Commit b3be9488 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

net/sched: remove two skb_mac_header() uses

tcf_mirred_act() and tcf_mpls_act() can use skb_network_offset()
instead of relying on skb_mac_header().
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e495a967
...@@ -295,7 +295,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb, ...@@ -295,7 +295,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
at_nh = skb->data == skb_network_header(skb); at_nh = skb->data == skb_network_header(skb);
if (at_nh != expects_nh) { if (at_nh != expects_nh) {
mac_len = skb_at_tc_ingress(skb) ? skb->mac_len : mac_len = skb_at_tc_ingress(skb) ? skb->mac_len :
skb_network_header(skb) - skb_mac_header(skb); skb_network_offset(skb);
if (expects_nh) { if (expects_nh) {
/* target device/action expect data at nh */ /* target device/action expect data at nh */
skb_pull_rcsum(skb2, mac_len); skb_pull_rcsum(skb2, mac_len);
......
...@@ -69,7 +69,7 @@ TC_INDIRECT_SCOPE int tcf_mpls_act(struct sk_buff *skb, ...@@ -69,7 +69,7 @@ TC_INDIRECT_SCOPE int tcf_mpls_act(struct sk_buff *skb,
skb_push_rcsum(skb, skb->mac_len); skb_push_rcsum(skb, skb->mac_len);
mac_len = skb->mac_len; mac_len = skb->mac_len;
} else { } else {
mac_len = skb_network_header(skb) - skb_mac_header(skb); mac_len = skb_network_offset(skb);
} }
ret = READ_ONCE(m->tcf_action); ret = READ_ONCE(m->tcf_action);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment