|
7 | 7 | #include <test_progs.h> |
8 | 8 |
|
9 | 9 | #include "test_xdp_devmap_helpers.skel.h" |
| 10 | +#include "test_xdp_devmap_tailcall.skel.h" |
10 | 11 | #include "test_xdp_with_devmap_frags_helpers.skel.h" |
11 | 12 | #include "test_xdp_with_devmap_helpers.skel.h" |
12 | 13 |
|
@@ -107,6 +108,29 @@ static void test_neg_xdp_devmap_helpers(void) |
107 | 108 | } |
108 | 109 | } |
109 | 110 |
|
| 111 | +static void test_xdp_devmap_tailcall(enum bpf_attach_type prog_dev, |
| 112 | + enum bpf_attach_type prog_tail, |
| 113 | + bool expect_reject) |
| 114 | +{ |
| 115 | + struct test_xdp_devmap_tailcall *skel; |
| 116 | + int err; |
| 117 | + |
| 118 | + skel = test_xdp_devmap_tailcall__open(); |
| 119 | + if (!ASSERT_OK_PTR(skel, "test_xdp_devmap_tailcall__open")) |
| 120 | + return; |
| 121 | + |
| 122 | + bpf_program__set_expected_attach_type(skel->progs.xdp_devmap, prog_dev); |
| 123 | + bpf_program__set_expected_attach_type(skel->progs.xdp_entry, prog_tail); |
| 124 | + |
| 125 | + err = test_xdp_devmap_tailcall__load(skel); |
| 126 | + if (expect_reject) |
| 127 | + ASSERT_ERR(err, "test_xdp_devmap_tailcall__load"); |
| 128 | + else |
| 129 | + ASSERT_OK(err, "test_xdp_devmap_tailcall__load"); |
| 130 | + |
| 131 | + test_xdp_devmap_tailcall__destroy(skel); |
| 132 | +} |
| 133 | + |
110 | 134 | static void test_xdp_with_devmap_frags_helpers(void) |
111 | 135 | { |
112 | 136 | struct test_xdp_with_devmap_frags_helpers *skel; |
@@ -238,8 +262,13 @@ void serial_test_xdp_devmap_attach(void) |
238 | 262 | if (test__start_subtest("DEVMAP with frags programs in entries")) |
239 | 263 | test_xdp_with_devmap_frags_helpers(); |
240 | 264 |
|
241 | | - if (test__start_subtest("Verifier check of DEVMAP programs")) |
| 265 | + if (test__start_subtest("Verifier check of DEVMAP programs")) { |
242 | 266 | test_neg_xdp_devmap_helpers(); |
| 267 | + test_xdp_devmap_tailcall(BPF_XDP_DEVMAP, BPF_XDP_DEVMAP, false); |
| 268 | + test_xdp_devmap_tailcall(0, 0, true); |
| 269 | + test_xdp_devmap_tailcall(BPF_XDP_DEVMAP, 0, true); |
| 270 | + test_xdp_devmap_tailcall(0, BPF_XDP_DEVMAP, true); |
| 271 | + } |
243 | 272 |
|
244 | 273 | if (test__start_subtest("DEVMAP with programs in entries on veth")) |
245 | 274 | test_xdp_with_devmap_helpers_veth(); |
|
0 commit comments