[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <14bc0878-796e-415a-a319-baa609474a20@linux.dev>
Date: Tue, 4 Nov 2025 16:13:39 -0800
From: Martin KaFai Lau <martin.lau@...ux.dev>
To: "D. Wythe" <alibuda@...ux.alibaba.com>
Cc: ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
pabeni@...hat.com, song@...nel.org, sdf@...gle.com, haoluo@...gle.com,
yhs@...com, edumazet@...gle.com, john.fastabend@...il.com,
kpsingh@...nel.org, jolsa@...nel.org, mjambigi@...ux.ibm.com,
wenjia@...ux.ibm.com, wintera@...ux.ibm.com, dust.li@...ux.alibaba.com,
tonylu@...ux.alibaba.com, guwen@...ux.alibaba.com, bpf@...r.kernel.org,
davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org,
sidraya@...ux.ibm.com, jaka@...ux.ibm.com
Subject: Re: [PATCH bpf-next v4 3/3] bpf/selftests: add selftest for
bpf_smc_hs_ctrl
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().
Powered by blists - more mailing lists