From: Ido Schimmel <idosch@nvidia.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, dsahern@gmail.com, petrm@nvidia.com,
horms@kernel.org, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, martin.lau@linux.dev,
john.fastabend@gmail.com, sdf@fomichev.me,
Ido Schimmel <idosch@nvidia.com>
Subject: [RFC PATCH bpf-next 3/9] selftests/bpf: fib_lookup: Allow parametrizing ifindex
Date: Thu, 26 Feb 2026 09:59:57 +0200 [thread overview]
Message-ID: <20260226080003.524935-4-idosch@nvidia.com> (raw)
In-Reply-To: <20260226080003.524935-1-idosch@nvidia.com>
Currently, the ifindex passed to the bpf_fib_lookup() helper is always
that of veth1. In preparation for output route tests, allow test cases
to specify an alternative ifindex. Default to that of veth1 when ifindex
is not specified.
Reviewed-by: Petr Machata <petrm@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
tools/testing/selftests/bpf/prog_tests/fib_lookup.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/fib_lookup.c b/tools/testing/selftests/bpf/prog_tests/fib_lookup.c
index 14a6515a453d..cd306bd4819a 100644
--- a/tools/testing/selftests/bpf/prog_tests/fib_lookup.c
+++ b/tools/testing/selftests/bpf/prog_tests/fib_lookup.c
@@ -54,6 +54,7 @@ struct fib_lookup_test {
__u32 tbid;
__u8 dmac[6];
__u32 mark;
+ int ifindex;
};
static const struct fib_lookup_test tests[] = {
@@ -221,15 +222,14 @@ static int setup_netns(void)
}
static int set_lookup_params(struct bpf_fib_lookup *params,
- const struct fib_lookup_test *test,
- int ifindex)
+ const struct fib_lookup_test *test)
{
int ret;
memset(params, 0, sizeof(*params));
params->l4_protocol = IPPROTO_TCP;
- params->ifindex = ifindex;
+ params->ifindex = test->ifindex ? : IFINDEX_VETH1;
params->tbid = test->tbid;
params->mark = test->mark;
@@ -335,13 +335,12 @@ void test_fib_lookup(void)
if (setup_netns())
goto fail;
- skb.ifindex = IFINDEX_VETH1;
fib_params = &skel->bss->fib_params;
for (i = 0; i < ARRAY_SIZE(tests); i++) {
printf("Testing %s ", tests[i].desc);
- if (set_lookup_params(fib_params, &tests[i], skb.ifindex))
+ if (set_lookup_params(fib_params, &tests[i]))
continue;
skel->bss->fib_lookup_ret = -1;
--
2.53.0
next prev parent reply other threads:[~2026-02-26 8:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-26 7:59 [RFC PATCH bpf-next 0/9] bpf: fib_lookup: IPv6 output routes enhancements Ido Schimmel
2026-02-26 7:59 ` [RFC PATCH bpf-next 1/9] selftests/bpf: fib_lookup: Force specific interface indexes Ido Schimmel
2026-02-26 7:59 ` [RFC PATCH bpf-next 2/9] selftests/bpf: fib_lookup: Enable forwarding on second net device Ido Schimmel
2026-02-26 7:59 ` Ido Schimmel [this message]
2026-02-26 7:59 ` [RFC PATCH bpf-next 4/9] selftests/bpf: fib_lookup: Allow testing for expected ifindex Ido Schimmel
2026-02-26 7:59 ` [RFC PATCH bpf-next 5/9] selftests/bpf: fib_lookup: Add IPv4 output route tests Ido Schimmel
2026-02-26 8:00 ` [RFC PATCH bpf-next 6/9] bpf: fib_lookup: Honor oif in IPv6 output route lookups Ido Schimmel
2026-02-26 8:41 ` bot+bpf-ci
2026-02-26 15:31 ` David Ahern
2026-02-26 8:00 ` [RFC PATCH bpf-next 7/9] selftests/bpf: fib_lookup: Add IPv6 output route tests Ido Schimmel
2026-02-26 8:00 ` [RFC PATCH bpf-next 8/9] bpf: fib_lookup: Allow output lookups for IPv6 link-local addresses Ido Schimmel
2026-02-26 15:36 ` David Ahern
2026-02-26 8:00 ` [RFC PATCH bpf-next 9/9] selftests/bpf: fib_lookup: Add IPv6 link-local tests Ido Schimmel
2026-02-26 17:14 ` [RFC PATCH bpf-next 0/9] bpf: fib_lookup: IPv6 output routes enhancements Alexei Starovoitov
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=20260226080003.524935-4-idosch@nvidia.com \
--to=idosch@nvidia.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@nvidia.com \
--cc=sdf@fomichev.me \
/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