From: sashiko-bot@kernel.org
To: "Bobby Eshleman" <bobbyeshleman@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net-next v4 7/8] selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv
Date: Wed, 13 May 2026 05:42:15 +0000 [thread overview]
Message-ID: <20260513054216.0B5D7C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260511-tcp-dm-netkit-v4-7-841b78b99d74@meta.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Hardcoded little-endian byte order for BPF map updates corrupts variables on big-endian architectures.
--
commit 32b478cb3da65a3aa47ba2e69fc7eb3c3f2667d9
Author: Bobby Eshleman <bobbyeshleman@meta.com>
selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv
This commit adds a BPF TC program to redirect non-ICMPv6 IPv6 traffic to a
physical device when sending from a namespace with a netkit leased queue. It
introduces the primary_rx_redirect parameter to NetDrvContEnv to attach
this program and update the physical ifindex via the .bss map.
> diff --git a/tools/testing/selftests/drivers/net/lib/py/env.py b/tools/testing/selftests/drivers/net/lib/py/env.py
> index 409b419222454..af8e1de8ed7b1 100644
> --- a/tools/testing/selftests/drivers/net/lib/py/env.py
> +++ b/tools/testing/selftests/drivers/net/lib/py/env.py
[ ... ]
> @@ -505,3 +529,36 @@ class NetDrvContEnv(NetDrvEpEnv):
> value = ipv6_bytes + ifindex_bytes
> value_hex = ' '.join(f'{b:02x}' for b in value)
> bpftool(f"map update id {bss_map_id} key hex 00 00 00 00 value hex {value_hex}")
> +
> + def _attach_primary_rx_redirect_bpf(self):
[ ... ]
> + if redirect_prog_id is None:
> + raise Exception("Failed to get primary RX redirect BPF prog ID")
> +
> + bss_map_id = self._find_bss_map_id(redirect_prog_id)
> + phys_ifindex_bytes = self.ifindex.to_bytes(4, byteorder='little')
Is it safe to hardcode the byte order to little-endian here?
Since BPF .bss maps are read by the BPF program using the host's native
endianness (as volatile __u32 phys_ifindex), this might result in a
swapped 32-bit integer on big-endian architectures like s390x.
For example, an ifindex of 2 could be read as 33554432, causing
bpf_redirect_neigh() to receive an invalid interface index.
Could this use sys.byteorder instead of 'little' to ensure portability?
> + value_hex = ' '.join(f'{b:02x}' for b in phys_ifindex_bytes)
> + bpftool(f"map update id {bss_map_id} key hex 00 00 00 00 value hex {value_hex}")
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260511-tcp-dm-netkit-v4-0-841b78b99d74@meta.com?part=7
next prev parent reply other threads:[~2026-05-13 5:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 1:17 [PATCH net-next v4 0/8] net: devmem: support devmem with netkit devices Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 1/8] net: convert netmem_tx flag to enum Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 2/8] net: netkit: declare NETMEM_TX_NO_DMA mode Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 3/8] net: devmem: support TX over NETMEM_TX_NO_DMA devices Bobby Eshleman
2026-05-13 4:05 ` sashiko-bot
2026-05-12 1:17 ` [PATCH net-next v4 4/8] selftests: drv-net: ncdevmem: add -n flag to skip NIC configuration Bobby Eshleman
2026-05-12 1:17 ` [PATCH net-next v4 5/8] selftests: drv-net: make attr _nk_guest_ifname public Bobby Eshleman
2026-05-12 1:18 ` [PATCH net-next v4 6/8] selftests: drv-net: refactor devmem command builders into lib module Bobby Eshleman
2026-05-13 5:12 ` sashiko-bot
2026-05-12 1:18 ` [PATCH net-next v4 7/8] selftests: drv-net: add primary_rx_redirect support to NetDrvContEnv Bobby Eshleman
2026-05-13 5:42 ` sashiko-bot [this message]
2026-05-12 1:18 ` [PATCH net-next v4 8/8] selftests: drv-net: add netkit devmem tests Bobby Eshleman
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=20260513054216.0B5D7C2BCB7@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bobbyeshleman@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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