Skip to content

Commit b3be948

Browse files
edumazetkuba-moo
authored andcommitted
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: Eric Dumazet <edumazet@google.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent e495a96 commit b3be948

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

net/sched/act_mirred.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
295295
at_nh = skb->data == skb_network_header(skb);
296296
if (at_nh != expects_nh) {
297297
mac_len = skb_at_tc_ingress(skb) ? skb->mac_len :
298-
skb_network_header(skb) - skb_mac_header(skb);
298+
skb_network_offset(skb);
299299
if (expects_nh) {
300300
/* target device/action expect data at nh */
301301
skb_pull_rcsum(skb2, mac_len);

net/sched/act_mpls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ TC_INDIRECT_SCOPE int tcf_mpls_act(struct sk_buff *skb,
6969
skb_push_rcsum(skb, skb->mac_len);
7070
mac_len = skb->mac_len;
7171
} else {
72-
mac_len = skb_network_header(skb) - skb_mac_header(skb);
72+
mac_len = skb_network_offset(skb);
7373
}
7474

7575
ret = READ_ONCE(m->tcf_action);

0 commit comments

Comments
 (0)