public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux•dev>
To: bpf@vger•kernel.org
Cc: "David S . Miller" <davem@davemloft•net>,
	Eric Dumazet <edumazet@google•com>,
	Jakub Kicinski <kuba@kernel•org>, Paolo Abeni <pabeni@redhat•com>,
	Simon Horman <horms@kernel•org>,
	Andrii Nakryiko <andrii@kernel•org>,
	Eduard Zingerman <eddyz87@gmail•com>,
	Alexei Starovoitov <ast@kernel•org>,
	Daniel Borkmann <daniel@iogearbox•net>,
	Martin KaFai Lau <martin.lau@linux•dev>,
	Kumar Kartikeya Dwivedi <memxor@gmail•com>,
	Song Liu <song@kernel•org>,
	Yonghong Song <yonghong.song@linux•dev>,
	Jiri Olsa <jolsa@kernel•org>, Shuah Khan <shuah@kernel•org>,
	Guillaume Nault <gnault@redhat•com>,
	Leon Hwang <leon.hwang@linux•dev>,
	Ido Schimmel <idosch@nvidia•com>,
	Fernando Fernandez Mancera <fmancera@suse•de>,
	Peter Oskolkov <posk@google•com>,
	linux-kernel@vger•kernel.org, netdev@vger•kernel.org,
	linux-kselftest@vger•kernel.org, kernel-patches-bot@fb•com
Subject: [PATCH bpf v4 0/2] bpf: Update transport_header when encapsulating UDP tunnel in lwt
Date: Tue,  2 Jun 2026 23:09:29 +0800	[thread overview]
Message-ID: <20260602150931.49629-1-leon.hwang@linux.dev> (raw)

Currently, bpf_lwt_push_ip_encap() does not update skb->transport_header.
When a driver, e.g. ice, reuses the stale skb->transport_header to
offload checksum computation to NIC hardware, VxLAN packets encapsulated
by bpf_lwt_push_encap() helper may be dropped due to incorrect checksum.

Update skb->transport_header in bpf_lwt_push_ip_encap() whenever the
encapsulated packet uses UDP, so checksum offload works correctly.

Changes:
v3 -> v4:
* Address comments from Emil:
  * Make the logic of skb_set_transport_header() clearer in patch #1.
  * Fold the code of fexit_lwt_push_ip_encap() into test_lwt_ip_encap.c in
    patch #2.
  * Resolve assorted issues of test in patch #2.
* v3: https://lore.kernel.org/bpf/20260601150203.20352-1-leon.hwang@linux.dev/

v2 -> v3:
* Drop patch #1 and #2 of v2 that aim to resolve potential issues
  reported by sashiko (per Alexei).
* Check target IP version and UDP tunnel in test (per sashiko).
* v2: https://lore.kernel.org/bpf/20260529151351.69911-1-leon.hwang@linux.dev/

v1 -> v2:
* Address sashiko's reviews:
  * Fix TOCTOU issue in lwt to avoid changing hdr after checks.
  * Add check iph->ihl < 5 in lwt to avoid infinite-loop in MIPS driver.
  * Update comment style in selftests with BPF comment style.
* v1: https://lore.kernel.org/bpf/20260525142650.2569-1-leon.hwang@linux.dev/

Leon Hwang (2):
  bpf: Update transport_header when encapsulating UDP tunnel in lwt
  selftests/bpf: Add tests to verify the fix of encapsulating VxLAN in
    lwt

 net/core/lwt_bpf.c                            |  12 ++
 .../selftests/bpf/prog_tests/lwt_ip_encap.c   | 145 ++++++++++++++++
 .../selftests/bpf/progs/test_lwt_ip_encap.c   | 155 ++++++++++++++++--
 3 files changed, 302 insertions(+), 10 deletions(-)

-- 
2.54.0


             reply	other threads:[~2026-06-02 15:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 15:09 Leon Hwang [this message]
2026-06-02 15:09 ` [PATCH bpf v4 1/2] bpf: Update transport_header when encapsulating UDP tunnel in lwt Leon Hwang
2026-06-02 15:51   ` bot+bpf-ci
2026-06-02 15:09 ` [PATCH bpf v4 2/2] selftests/bpf: Add tests to verify the fix of encapsulating VxLAN " Leon Hwang
2026-06-05 22:30 ` [PATCH bpf v4 0/2] bpf: Update transport_header when encapsulating UDP tunnel " 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=20260602150931.49629-1-leon.hwang@linux.dev \
    --to=leon.hwang@linux$(echo .)dev \
    --cc=andrii@kernel$(echo .)org \
    --cc=ast@kernel$(echo .)org \
    --cc=bpf@vger$(echo .)kernel.org \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=eddyz87@gmail$(echo .)com \
    --cc=edumazet@google$(echo .)com \
    --cc=fmancera@suse$(echo .)de \
    --cc=gnault@redhat$(echo .)com \
    --cc=horms@kernel$(echo .)org \
    --cc=idosch@nvidia$(echo .)com \
    --cc=jolsa@kernel$(echo .)org \
    --cc=kernel-patches-bot@fb$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-kselftest@vger$(echo .)kernel.org \
    --cc=martin.lau@linux$(echo .)dev \
    --cc=memxor@gmail$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=posk@google$(echo .)com \
    --cc=shuah@kernel$(echo .)org \
    --cc=song@kernel$(echo .)org \
    --cc=yonghong.song@linux$(echo .)dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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