From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <simon.horman@corigine.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 3/3] net/sched: remove two skb_mac_header() uses
Date: Tue, 21 Mar 2023 16:45:19 +0000 [thread overview]
Message-ID: <20230321164519.1286357-4-edumazet@google.com> (raw)
In-Reply-To: <20230321164519.1286357-1-edumazet@google.com>
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>
---
net/sched/act_mirred.c | 2 +-
net/sched/act_mpls.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 8037ec9b1d311486d803159b3f2f77eedf6b31d3..ec43764e92e7ba66586310628d78a6b184957fd2 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -295,7 +295,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb,
at_nh = skb->data == skb_network_header(skb);
if (at_nh != expects_nh) {
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) {
/* target device/action expect data at nh */
skb_pull_rcsum(skb2, mac_len);
diff --git a/net/sched/act_mpls.c b/net/sched/act_mpls.c
index 809f7928a1be622671e47b8bdf384a8a10349926..1010dc632874ec5f4f0517f0512ab3ed30f14e24 100644
--- a/net/sched/act_mpls.c
+++ b/net/sched/act_mpls.c
@@ -69,7 +69,7 @@ TC_INDIRECT_SCOPE int tcf_mpls_act(struct sk_buff *skb,
skb_push_rcsum(skb, skb->mac_len);
mac_len = skb->mac_len;
} else {
- mac_len = skb_network_header(skb) - skb_mac_header(skb);
+ mac_len = skb_network_offset(skb);
}
ret = READ_ONCE(m->tcf_action);
--
2.40.0.rc2.332.ga46443480c-goog
next prev parent reply other threads:[~2023-03-21 16:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-21 16:45 [PATCH net-next 0/3] net: remove some skb_mac_header assumptions Eric Dumazet
2023-03-21 16:45 ` [PATCH net-next 1/3] net: do not use skb_mac_header() in qdisc_pkt_len_init() Eric Dumazet
2023-03-22 11:25 ` Simon Horman
2023-03-21 16:45 ` [PATCH net-next 2/3] sch_cake: do not use skb_mac_header() in cake_overhead() Eric Dumazet
2023-03-22 11:26 ` Simon Horman
2023-03-21 16:45 ` Eric Dumazet [this message]
2023-03-22 11:26 ` [PATCH net-next 3/3] net/sched: remove two skb_mac_header() uses Simon Horman
2023-03-21 17:13 ` [PATCH net-next 0/3] net: remove some skb_mac_header assumptions Vladimir Oltean
2023-03-21 18:41 ` Eric Dumazet
2023-03-23 5:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230321164519.1286357-4-edumazet@google.com \
--to=edumazet@google.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simon.horman@corigine.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.