On 3/22/23 8:24 PM, Kui-Feng Lee wrote:
+static void test_link_replace(void) +{ + DECLARE_LIBBPF_OPTS(bpf_link_update_opts, opts); + struct tcp_ca_update *skel; + struct bpf_link *link; + int err; + + skel = tcp_ca_update__open_and_load(); + if (!ASSERT_OK_PTR(skel, "open")) + return; + + link = bpf_map__attach_struct_ops(skel->maps.ca_update_1); + ASSERT_OK_PTR(link, "attach_struct_ops_1st"); + bpf_link__destroy(link); + + link = bpf_map__attach_struct_ops(skel->maps.ca_update_2); + ASSERT_OK_PTR(link, "attach_struct_ops_1st");
I fixed this up s/1st/2nd/. Also, added a 'if (!ret)' check before synchronize_rcu() in patch 2. massaged the comment in bpf_struct_ops_map_free in patch1. The set is applied. Thanks.