Lines Matching refs:skeletons
90 struct skeletons { struct
99 static int xdp_attach(struct skeletons *skeletons, struct bpf_program *prog, char *iface) in xdp_attach() argument
108 if (!ASSERT_LE(skeletons->nlinks+1, MAX_BPF_LINKS, "too many XDP programs attached")) in xdp_attach()
115 skeletons->links[skeletons->nlinks++] = link; in xdp_attach()
142 static int bonding_setup(struct skeletons *skeletons, int mode, int xmit_policy, in bonding_setup() argument
162 if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "veth1_2")) in bonding_setup()
176 if (xdp_attach(skeletons, skeletons->xdp_dummy->progs.xdp_dummy_prog, "bond1")) in bonding_setup()
183 if (xdp_attach(skeletons, skeletons->xdp_tx->progs.xdp_tx, "bond2")) in bonding_setup()
194 static void bonding_cleanup(struct skeletons *skeletons) in bonding_cleanup() argument
197 while (skeletons->nlinks) { in bonding_cleanup()
198 skeletons->nlinks--; in bonding_cleanup()
199 bpf_link__destroy(skeletons->links[skeletons->nlinks]); in bonding_cleanup()
271 static void test_xdp_bonding_with_mode(struct skeletons *skeletons, int mode, int xmit_policy) in test_xdp_bonding_with_mode() argument
275 if (bonding_setup(skeletons, mode, xmit_policy, BOND_BOTH_AND_ATTACH)) in test_xdp_bonding_with_mode()
324 bonding_cleanup(skeletons); in test_xdp_bonding_with_mode()
331 static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons) in test_xdp_bonding_redirect_multi() argument
337 if (bonding_setup(skeletons, BOND_MODE_ROUNDROBIN, BOND_XMIT_POLICY_LAYER23, in test_xdp_bonding_redirect_multi()
348 int map_fd = bpf_map__fd(skeletons->xdp_redirect_multi_kern->maps.map_all); in test_xdp_bonding_redirect_multi()
358 if (xdp_attach(skeletons, in test_xdp_bonding_redirect_multi()
359 skeletons->xdp_redirect_multi_kern->progs.xdp_redirect_map_multi_prog, in test_xdp_bonding_redirect_multi()
376 bonding_cleanup(skeletons); in test_xdp_bonding_redirect_multi()
380 static void test_xdp_bonding_attach(struct skeletons *skeletons) in test_xdp_bonding_attach() argument
399 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
411 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
416 link2 = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
424 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
429 link2 = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, veth); in test_xdp_bonding_attach()
446 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_attach()
460 static void test_xdp_bonding_nested(struct skeletons *skeletons) in test_xdp_bonding_nested() argument
486 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, bond); in test_xdp_bonding_nested()
496 static void test_xdp_bonding_features(struct skeletons *skeletons) in test_xdp_bonding_features() argument
547 link = bpf_program__attach_xdp(skeletons->xdp_dummy->progs.xdp_dummy_prog, in test_xdp_bonding_features()
639 struct skeletons skeletons = {}; in serial_test_xdp_bonding() local
648 skeletons.xdp_dummy = xdp_dummy__open_and_load(); in serial_test_xdp_bonding()
649 if (!ASSERT_OK_PTR(skeletons.xdp_dummy, "xdp_dummy__open_and_load")) in serial_test_xdp_bonding()
652 skeletons.xdp_tx = xdp_tx__open_and_load(); in serial_test_xdp_bonding()
653 if (!ASSERT_OK_PTR(skeletons.xdp_tx, "xdp_tx__open_and_load")) in serial_test_xdp_bonding()
656 skeletons.xdp_redirect_multi_kern = xdp_redirect_multi_kern__open_and_load(); in serial_test_xdp_bonding()
657 if (!ASSERT_OK_PTR(skeletons.xdp_redirect_multi_kern, in serial_test_xdp_bonding()
662 test_xdp_bonding_attach(&skeletons); in serial_test_xdp_bonding()
665 test_xdp_bonding_nested(&skeletons); in serial_test_xdp_bonding()
668 test_xdp_bonding_features(&skeletons); in serial_test_xdp_bonding()
675 &skeletons, in serial_test_xdp_bonding()
681 test_xdp_bonding_redirect_multi(&skeletons); in serial_test_xdp_bonding()
684 xdp_dummy__destroy(skeletons.xdp_dummy); in serial_test_xdp_bonding()
685 xdp_tx__destroy(skeletons.xdp_tx); in serial_test_xdp_bonding()
686 xdp_redirect_multi_kern__destroy(skeletons.xdp_redirect_multi_kern); in serial_test_xdp_bonding()