From: Martin KaFai Lau <martin.lau@linux•dev>
To: "D. Wythe" <alibuda@linux•alibaba.com>
Cc: ast@kernel•org, daniel@iogearbox•net, andrii@kernel•org,
pabeni@redhat•com, song@kernel•org, sdf@google•com,
haoluo@google•com, yhs@fb•com, edumazet@google•com,
john.fastabend@gmail•com, kpsingh@kernel•org, jolsa@kernel•org,
mjambigi@linux•ibm.com, wenjia@linux•ibm.com,
wintera@linux•ibm.com, dust.li@linux•alibaba.com,
tonylu@linux•alibaba.com, guwen@linux•alibaba.com,
bpf@vger•kernel.org, davem@davemloft•net, kuba@kernel•org,
netdev@vger•kernel.org, sidraya@linux•ibm.com,
jaka@linux•ibm.com
Subject: Re: [PATCH bpf-next v4 3/3] bpf/selftests: add selftest for bpf_smc_hs_ctrl
Date: Tue, 4 Nov 2025 16:13:39 -0800 [thread overview]
Message-ID: <14bc0878-796e-415a-a319-baa609474a20@linux.dev> (raw)
In-Reply-To: <20251103073124.43077-4-alibuda@linux.alibaba.com>
On 11/2/25 11:31 PM, D. Wythe wrote:
> +static bool setup_netns(void)
> +{
> + test_netns = netns_new(TEST_NS, true);
> + if (!ASSERT_OK_PTR(test_netns, "open net namespace"))
> + goto fail_netns;
> +
> + if (!ASSERT_OK(system("ip addr add 127.0.1.0/8 dev lo"),
SYS(fail_ip, "ip addr add ...")
> + "add server node"))
> + goto fail_ip;
> +
> + if (!ASSERT_OK(system("ip addr add 127.0.2.0/8 dev lo"),
same here.
> + "server via risk path"))
> + goto fail_ip;
> +
> + return true;
> +fail_ip:
> + netns_free(test_netns);
> +fail_netns:
> + return false;
> +}
> +
> +static void cleanup_netns(void)
> +{
> + netns_free(test_netns);
> + remove_netns(TEST_NS);
remove_netns should not be needed. netns_free() should have removed it.
[ ... ]
> +static void test_topo(void)
> +{
> + struct bpf_smc *skel;
> + int rc, map_fd;
> +
> + skel = bpf_smc__open_and_load();
> + if (!ASSERT_OK_PTR(skel, "bpf_smc__open_and_load"))
> + return;
> +
> + rc = bpf_smc__attach(skel);
> + if (!ASSERT_OK(rc, "bpf_smc__attach"))
> + goto fail;
> +
> + map_fd = bpf_map__fd(skel->maps.smc_policy_ip);
> + if (!ASSERT_OK_FD(map_fd, "bpf_map__fd"))
> + goto fail;
> +
> + /* Mock the process of transparent replacement, since we will modify
> + * protocol to ipproto_smc accropding to it via
> + * fmod_ret/update_socket_protocol.
> + */
> + system("sysctl -w net.smc.hs_ctrl=linkcheck");
The "sysctl -w" will echo useless output to test_progs. just use
write_sysctl().
next prev parent reply other threads:[~2025-11-05 0:13 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 7:31 [PATCH bpf-next v4 0/3] net/smc: Introduce smc_hs_ctrl D. Wythe
2025-11-03 7:31 ` [PATCH bpf-next v4 1/3] bpf: export necessary symbols for modules with struct_ops D. Wythe
2025-11-03 7:31 ` [PATCH bpf-next v4 2/3] net/smc: bpf: Introduce generic hook for handshake flow D. Wythe
2025-11-03 7:55 ` bot+bpf-ci
2025-11-03 9:18 ` D. Wythe
2025-11-05 0:03 ` Martin KaFai Lau
2025-11-05 7:01 ` D. Wythe
2025-11-05 22:58 ` Martin KaFai Lau
2025-11-06 2:33 ` D. Wythe
2025-11-06 4:16 ` Martin KaFai Lau
2025-11-06 8:34 ` D. Wythe
2025-11-06 17:15 ` Martin KaFai Lau
2025-11-07 3:11 ` D. Wythe
2025-11-03 7:31 ` [PATCH bpf-next v4 3/3] bpf/selftests: add selftest for bpf_smc_hs_ctrl D. Wythe
2025-11-05 0:13 ` Martin KaFai Lau [this message]
2025-11-05 7:04 ` D. Wythe
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=14bc0878-796e-415a-a319-baa609474a20@linux.dev \
--to=martin.lau@linux$(echo .)dev \
--cc=alibuda@linux$(echo .)alibaba.com \
--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=dust.li@linux$(echo .)alibaba.com \
--cc=edumazet@google$(echo .)com \
--cc=guwen@linux$(echo .)alibaba.com \
--cc=haoluo@google$(echo .)com \
--cc=jaka@linux$(echo .)ibm.com \
--cc=john.fastabend@gmail$(echo .)com \
--cc=jolsa@kernel$(echo .)org \
--cc=kpsingh@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=mjambigi@linux$(echo .)ibm.com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=sdf@google$(echo .)com \
--cc=sidraya@linux$(echo .)ibm.com \
--cc=song@kernel$(echo .)org \
--cc=tonylu@linux$(echo .)alibaba.com \
--cc=wenjia@linux$(echo .)ibm.com \
--cc=wintera@linux$(echo .)ibm.com \
--cc=yhs@fb$(echo .)com \
/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