Lines Matching refs:skeletons

89 struct skeletons {  struct
98 static int xdp_attach(struct skeletons *skeletons, struct bpf_program *prog, char *iface) in xdp_attach() argument
107 if (!ASSERT_LE(skeletons->nlinks+1, MAX_BPF_LINKS, "too many XDP programs attached")) in xdp_attach()
114 skeletons->links[skeletons->nlinks++] = link; in xdp_attach()
141 static int bonding_setup(struct skeletons *skeletons, int mode, int xmit_policy, in bonding_setup() argument
169 if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "veth1_2")) in bonding_setup()
183 if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "bond1")) in bonding_setup()
190 if (xdp_attach(skeletons, skeletons->xdp_tx->progs.xdp_tx, "bond2")) in bonding_setup()
201 static void bonding_cleanup(struct skeletons *skeletons) in bonding_cleanup() argument
204 while (skeletons->nlinks) { in bonding_cleanup()
205 skeletons->nlinks--; in bonding_cleanup()
206 bpf_link__destroy(skeletons->links[skeletons->nlinks]); in bonding_cleanup()
274 static void test_xdp_bonding_with_mode(struct skeletons *skeletons, int mode, int xmit_policy) in test_xdp_bonding_with_mode() argument
278 if (bonding_setup(skeletons, mode, xmit_policy, BOND_BOTH_AND_ATTACH)) in test_xdp_bonding_with_mode()
327 bonding_cleanup(skeletons); in test_xdp_bonding_with_mode()
334 static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons) in test_xdp_bonding_redirect_multi() argument
340 if (bonding_setup(skeletons, BOND_MODE_ROUNDROBIN, BOND_XMIT_POLICY_LAYER23, in test_xdp_bonding_redirect_multi()
351 int map_fd = bpf_map__fd(skeletons->xdp_redirect_multi_kern->maps.map_all); in test_xdp_bonding_redirect_multi()
361 if (xdp_attach(skeletons, in test_xdp_bonding_redirect_multi()
362 skeletons->xdp_redirect_multi_kern->progs.xdp_redirect_map_multi_prog, in test_xdp_bonding_redirect_multi()
379 bonding_cleanup(skeletons); in test_xdp_bonding_redirect_multi()
383 static void test_xdp_bonding_attach(struct skeletons *skeletons) in test_xdp_bonding_attach() argument
402 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
414 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
419 link2 = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
427 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
432 link2 = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
449 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
463 static void test_xdp_bonding_nested(struct skeletons *skeletons) in test_xdp_bonding_nested() argument
489 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_nested()
525 struct skeletons skeletons = {}; in test_xdp_bonding() local
534 skeletons.xdp_dummy = xdp_dummy__open_and_load(); in test_xdp_bonding()
535 if (!ASSERT_OK_PTR(skeletons.xdp_dummy, "xdp_dummy__open_and_load")) in test_xdp_bonding()
538 skeletons.xdp_tx = xdp_tx__open_and_load(); in test_xdp_bonding()
539 if (!ASSERT_OK_PTR(skeletons.xdp_tx, "xdp_tx__open_and_load")) in test_xdp_bonding()
542 skeletons.xdp_redirect_multi_kern = xdp_redirect_multi_kern__open_and_load(); in test_xdp_bonding()
543 if (!ASSERT_OK_PTR(skeletons.xdp_redirect_multi_kern, in test_xdp_bonding()
548 test_xdp_bonding_attach(&skeletons); in test_xdp_bonding()
551 test_xdp_bonding_nested(&skeletons); in test_xdp_bonding()
558 &skeletons, in test_xdp_bonding()
564 test_xdp_bonding_redirect_multi(&skeletons); in test_xdp_bonding()
567 xdp_dummy__destroy(skeletons.xdp_dummy); in test_xdp_bonding()
568 xdp_tx__destroy(skeletons.xdp_tx); in test_xdp_bonding()
569 xdp_redirect_multi_kern__destroy(skeletons.xdp_redirect_multi_kern); in test_xdp_bonding()