cubic_skel = bpf_cubic__open_and_load(); if (!ASSERT_OK_PTR(cubic_skel, "bpf_cubic__open_and_load")) return;
link = bpf_map__attach_struct_ops(cubic_skel->maps.cubic); if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) {
bpf_cubic__destroy(cubic_skel); return;
}
dctcp_skel = bpf_dctcp__open_and_load(); if (!ASSERT_OK_PTR(dctcp_skel, "bpf_dctcp__open_and_load")) return;
link = bpf_map__attach_struct_ops(dctcp_skel->maps.dctcp); if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) {
bpf_dctcp__destroy(dctcp_skel); return;
}
skel = tcp_ca_incompl_cong_ops__open_and_load(); if (!ASSERT_OK_PTR(skel, "open_and_load")) return;
/* That cong_avoid() and cong_control() are missing is only reported at * this point:
*/
link = bpf_map__attach_struct_ops(skel->maps.incompl_cong_ops);
ASSERT_ERR_PTR(link, "attach_struct_ops");
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);
/* A map should be able to be used to create links multiple * times.
*/
link = bpf_map__attach_struct_ops(skel->maps.ca_update_1);
ASSERT_OK_PTR(link, "attach_struct_ops_2nd");
bpf_link__destroy(link);
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); if (!ASSERT_OK_PTR(link, "attach_struct_ops_2nd")) goto out;
/* BPF_F_REPLACE with a wrong old map Fd. It should fail! * * With BPF_F_REPLACE, the link should be updated only if the * old map fd given here matches the map backing the link.
*/
opts.old_map_fd = bpf_map__fd(skel->maps.ca_update_1);
opts.flags = BPF_F_REPLACE;
err = bpf_link_update(bpf_link__fd(link),
bpf_map__fd(skel->maps.ca_update_1),
&opts);
ASSERT_ERR(err, "bpf_link_update_fail");
/* BPF_F_REPLACE with a correct old map Fd. It should success! */
opts.old_map_fd = bpf_map__fd(skel->maps.ca_update_2);
err = bpf_link_update(bpf_link__fd(link),
bpf_map__fd(skel->maps.ca_update_1),
&opts);
ASSERT_OK(err, "bpf_link_update_success");
cc_cubic_skel = bpf_cc_cubic__open_and_load(); if (!ASSERT_OK_PTR(cc_cubic_skel, "bpf_cc_cubic__open_and_load")) return;
link = bpf_map__attach_struct_ops(cc_cubic_skel->maps.cc_cubic); if (!ASSERT_OK_PTR(link, "bpf_map__attach_struct_ops")) {
bpf_cc_cubic__destroy(cc_cubic_skel); return;
}
void test_bpf_tcp_ca(void)
{ if (test__start_subtest("dctcp"))
test_dctcp(); if (test__start_subtest("cubic"))
test_cubic(); if (test__start_subtest("invalid_license"))
test_invalid_license(); if (test__start_subtest("dctcp_fallback"))
test_dctcp_fallback(); if (test__start_subtest("rel_setsockopt"))
test_rel_setsockopt(); if (test__start_subtest("write_sk_pacing"))
test_write_sk_pacing(); if (test__start_subtest("incompl_cong_ops"))
test_incompl_cong_ops(); if (test__start_subtest("unsupp_cong_op"))
test_unsupp_cong_op(); if (test__start_subtest("update_ca"))
test_update_ca(); if (test__start_subtest("update_wrong"))
test_update_wrong(); if (test__start_subtest("mixed_links"))
test_mixed_links(); if (test__start_subtest("multi_links"))
test_multi_links(); if (test__start_subtest("link_replace"))
test_link_replace(); if (test__start_subtest("tcp_ca_kfunc"))
test_tcp_ca_kfunc(); if (test__start_subtest("cc_cubic"))
test_cc_cubic(); if (test__start_subtest("dctcp_autoattach_map"))
test_dctcp_autoattach_map();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.