From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Eric Dumazet <edumazet@kernel.org>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, <netdev@vger.kernel.org>,
<edumazet@google.com>
Subject: Re: [PATCH net-next] net: inline eth_type_trans() fast path
Date: Thu, 1 Oct 2026 17:57:47 +0200 [thread overview]
Message-ID: <d6170c1d-d8cf-4fd5-b0f2-361b89902fe7@intel.com> (raw)
In-Reply-To: <20260930172957.897342-1-edumazet@kernel.org>
From: Edumazet@kernel.org <edumazet@kernel.org>
Date: Wed, 30 Sep 2026 19:29:57 +0200
> eth_type_trans() is called once per received packet by most
> Ethernet drivers, and by core helpers (napi_gro_frags(),
> xdp_build_skb_from_*(), veth, tun, tunnels, loopback...).
>
> With CONFIG_MITIGATION_RETHUNK / SRSO, the call and return
> are not free anymore.
>
> Add eth_type_trans_inline(), handling the common case inline:
> unicast frame sent to dev->dev_addr, with a real ethertype,
> on a device which is not a DSA conduit. All other frames
> (multicast, broadcast, otherhost, 802.2, runts, DSA)
> are handled by the out-of-line eth_type_trans().
>
> eth_type_trans() is now a macro calling eth_type_trans_inline(),
> so that all existing callers get the fast path. The out-of-line
> version remains exported, and can be called with
> (eth_type_trans)(skb, dev). bpf_prog_test_run_skb() uses this
Shouldn't it get renamed to e.g. eth_type_trans_slow() to avoid this
confusion?
> to keep tools/testing/selftests/bpf fentry/fexit tests working.
>
> The inline part is about 25 instructions on x86_64, and the whole
Nice!
> function would be almost twice as big when fully inlined.
>
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
> ---
> include/linux/etherdevice.h | 43 +++++++++++++++++++++++++++++++++++++
> net/bpf/test_run.c | 3 ++-
> net/ethernet/eth.c | 8 +++++++
> 3 files changed, 53 insertions(+), 1 deletion(-)
Thanks,
Olek
next prev parent reply other threads:[~2026-10-01 15:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 17:29 [PATCH net-next] net: inline eth_type_trans() fast path Eric Dumazet
2026-10-01 15:57 ` Alexander Lobakin [this message]
2026-10-01 17:10 ` Eric Dumazet
2026-10-02 15:26 ` Stanislav Fomichev
2026-10-02 16:54 ` Alexander Lobakin
2026-10-02 18:52 ` Eric Dumazet
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=d6170c1d-d8cf-4fd5-b0f2-361b89902fe7@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox