Lines Matching full:test
9 #include <kunit/test.h>
31 static void kunit_ida_init(struct kunit *test, struct ida *ida) in kunit_ida_init() argument
33 kunit_alloc_resource(test, __ida_init, __ida_destroy, GFP_KERNEL, ida); in kunit_ida_init()
36 static struct tb_switch *alloc_switch(struct kunit *test, u64 route, in alloc_switch() argument
43 sw = kunit_kzalloc(test, sizeof(*sw), GFP_KERNEL); in alloc_switch()
55 sw->ports = kunit_kzalloc(test, size, GFP_KERNEL); in alloc_switch()
64 kunit_ida_init(test, &sw->ports[i].in_hopids); in alloc_switch()
65 kunit_ida_init(test, &sw->ports[i].out_hopids); in alloc_switch()
72 static struct tb_switch *alloc_host(struct kunit *test) in alloc_host() argument
76 sw = alloc_switch(test, 0, 7, 13); in alloc_host()
154 static struct tb_switch *alloc_host_usb4(struct kunit *test) in alloc_host_usb4() argument
158 sw = alloc_host(test); in alloc_host_usb4()
173 static struct tb_switch *alloc_host_br(struct kunit *test) in alloc_host_br() argument
177 sw = alloc_host_usb4(test); in alloc_host_br()
190 static struct tb_switch *alloc_dev_default(struct kunit *test, in alloc_dev_default() argument
197 sw = alloc_switch(test, route, 1, 19); in alloc_dev_default()
340 static struct tb_switch *alloc_dev_with_dpin(struct kunit *test, in alloc_dev_with_dpin() argument
346 sw = alloc_dev_default(test, parent, route, bonded); in alloc_dev_with_dpin()
361 static struct tb_switch *alloc_dev_without_dp(struct kunit *test, in alloc_dev_without_dp() argument
368 sw = alloc_dev_default(test, parent, route, bonded); in alloc_dev_without_dp()
402 static struct tb_switch *alloc_dev_usb4(struct kunit *test, in alloc_dev_usb4() argument
408 sw = alloc_dev_default(test, parent, route, bonded); in alloc_dev_usb4()
423 static void tb_test_path_basic(struct kunit *test) in tb_test_path_basic() argument
428 host = alloc_host(test); in tb_test_path_basic()
434 KUNIT_EXPECT_PTR_EQ(test, p, dst_port); in tb_test_path_basic()
437 KUNIT_EXPECT_TRUE(test, !p); in tb_test_path_basic()
440 static void tb_test_path_not_connected_walk(struct kunit *test) in tb_test_path_not_connected_walk() argument
445 host = alloc_host(test); in tb_test_path_not_connected_walk()
447 dev = alloc_dev_default(test, NULL, 3, true); in tb_test_path_not_connected_walk()
453 KUNIT_EXPECT_PTR_EQ(test, p, src_port); in tb_test_path_not_connected_walk()
456 KUNIT_EXPECT_PTR_EQ(test, p, &host->ports[3]); in tb_test_path_not_connected_walk()
459 KUNIT_EXPECT_TRUE(test, !p); in tb_test_path_not_connected_walk()
464 KUNIT_EXPECT_PTR_EQ(test, p, dst_port); in tb_test_path_not_connected_walk()
467 KUNIT_EXPECT_PTR_EQ(test, p, &dev->ports[1]); in tb_test_path_not_connected_walk()
470 KUNIT_EXPECT_TRUE(test, !p); in tb_test_path_not_connected_walk()
479 static void tb_test_path_single_hop_walk(struct kunit *test) in tb_test_path_single_hop_walk() argument
500 host = alloc_host(test); in tb_test_path_single_hop_walk()
501 dev = alloc_dev_default(test, host, 1, true); in tb_test_path_single_hop_walk()
510 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_single_hop_walk()
511 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
512 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
513 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
518 KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(test_data)); in tb_test_path_single_hop_walk()
522 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_single_hop_walk()
523 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
524 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
525 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
530 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_single_hop_walk()
533 static void tb_test_path_daisy_chain_walk(struct kunit *test) in tb_test_path_daisy_chain_walk() argument
558 host = alloc_host(test); in tb_test_path_daisy_chain_walk()
559 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_daisy_chain_walk()
560 dev2 = alloc_dev_default(test, dev1, 0x301, true); in tb_test_path_daisy_chain_walk()
569 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_daisy_chain_walk()
570 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
571 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
572 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
577 KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(test_data)); in tb_test_path_daisy_chain_walk()
581 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_daisy_chain_walk()
582 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
583 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
584 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
589 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_daisy_chain_walk()
592 static void tb_test_path_simple_tree_walk(struct kunit *test) in tb_test_path_simple_tree_walk() argument
619 host = alloc_host(test); in tb_test_path_simple_tree_walk()
620 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_simple_tree_walk()
621 alloc_dev_default(test, dev1, 0x301, true); in tb_test_path_simple_tree_walk()
622 dev3 = alloc_dev_default(test, dev1, 0x501, true); in tb_test_path_simple_tree_walk()
623 alloc_dev_default(test, dev1, 0x701, true); in tb_test_path_simple_tree_walk()
632 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_simple_tree_walk()
633 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
634 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
635 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
640 KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(test_data)); in tb_test_path_simple_tree_walk()
644 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_simple_tree_walk()
645 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
646 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
647 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
652 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_simple_tree_walk()
655 static void tb_test_path_complex_tree_walk(struct kunit *test) in tb_test_path_complex_tree_walk() argument
698 host = alloc_host(test); in tb_test_path_complex_tree_walk()
699 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_complex_tree_walk()
700 dev2 = alloc_dev_default(test, dev1, 0x301, true); in tb_test_path_complex_tree_walk()
701 dev3 = alloc_dev_with_dpin(test, dev2, 0x50301, true); in tb_test_path_complex_tree_walk()
702 alloc_dev_default(test, dev1, 0x501, true); in tb_test_path_complex_tree_walk()
703 dev5 = alloc_dev_default(test, dev1, 0x701, true); in tb_test_path_complex_tree_walk()
704 dev6 = alloc_dev_default(test, dev5, 0x70701, true); in tb_test_path_complex_tree_walk()
705 dev7 = alloc_dev_default(test, dev6, 0x3070701, true); in tb_test_path_complex_tree_walk()
706 alloc_dev_default(test, dev7, 0x303070701, true); in tb_test_path_complex_tree_walk()
707 dev9 = alloc_dev_default(test, dev7, 0x503070701, true); in tb_test_path_complex_tree_walk()
716 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_complex_tree_walk()
717 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
718 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
719 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
724 KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(test_data)); in tb_test_path_complex_tree_walk()
728 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_complex_tree_walk()
729 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
730 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
731 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
736 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_complex_tree_walk()
739 static void tb_test_path_max_length_walk(struct kunit *test) in tb_test_path_max_length_walk() argument
798 host = alloc_host(test); in tb_test_path_max_length_walk()
799 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_max_length_walk()
800 dev2 = alloc_dev_default(test, dev1, 0x301, true); in tb_test_path_max_length_walk()
801 dev3 = alloc_dev_default(test, dev2, 0x30301, true); in tb_test_path_max_length_walk()
802 dev4 = alloc_dev_default(test, dev3, 0x3030301, true); in tb_test_path_max_length_walk()
803 dev5 = alloc_dev_default(test, dev4, 0x303030301, true); in tb_test_path_max_length_walk()
804 dev6 = alloc_dev_with_dpin(test, dev5, 0x30303030301, true); in tb_test_path_max_length_walk()
805 dev7 = alloc_dev_default(test, host, 0x3, true); in tb_test_path_max_length_walk()
806 dev8 = alloc_dev_default(test, dev7, 0x303, true); in tb_test_path_max_length_walk()
807 dev9 = alloc_dev_default(test, dev8, 0x30303, true); in tb_test_path_max_length_walk()
808 dev10 = alloc_dev_default(test, dev9, 0x3030303, true); in tb_test_path_max_length_walk()
809 dev11 = alloc_dev_default(test, dev10, 0x303030303, true); in tb_test_path_max_length_walk()
810 dev12 = alloc_dev_default(test, dev11, 0x30303030303, true); in tb_test_path_max_length_walk()
819 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_max_length_walk()
820 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
821 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
822 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
827 KUNIT_EXPECT_EQ(test, i, ARRAY_SIZE(test_data)); in tb_test_path_max_length_walk()
831 KUNIT_EXPECT_TRUE(test, i < ARRAY_SIZE(test_data)); in tb_test_path_max_length_walk()
832 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
833 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
834 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
839 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_max_length_walk()
842 static void tb_test_path_not_connected(struct kunit *test) in tb_test_path_not_connected() argument
848 host = alloc_host(test); in tb_test_path_not_connected()
849 dev1 = alloc_dev_default(test, host, 0x3, false); in tb_test_path_not_connected()
851 dev2 = alloc_dev_default(test, NULL, 0x303, false); in tb_test_path_not_connected()
857 KUNIT_ASSERT_NULL(test, path); in tb_test_path_not_connected()
859 KUNIT_ASSERT_NULL(test, path); in tb_test_path_not_connected()
870 static void tb_test_path_not_bonded_lane0(struct kunit *test) in tb_test_path_not_bonded_lane0() argument
901 host = alloc_host(test); in tb_test_path_not_bonded_lane0()
902 dev = alloc_dev_default(test, host, 0x3, false); in tb_test_path_not_bonded_lane0()
908 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_not_bonded_lane0()
909 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane0()
916 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
917 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane0()
918 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane0()
920 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
921 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane0()
922 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane0()
928 static void tb_test_path_not_bonded_lane1(struct kunit *test) in tb_test_path_not_bonded_lane1() argument
963 host = alloc_host(test); in tb_test_path_not_bonded_lane1()
964 dev = alloc_dev_default(test, host, 0x1, false); in tb_test_path_not_bonded_lane1()
970 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_not_bonded_lane1()
971 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1()
978 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
979 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1()
980 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1()
982 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
983 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1()
984 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1()
990 static void tb_test_path_not_bonded_lane1_chain(struct kunit *test) in tb_test_path_not_bonded_lane1_chain() argument
1041 host = alloc_host(test); in tb_test_path_not_bonded_lane1_chain()
1042 dev1 = alloc_dev_default(test, host, 0x1, false); in tb_test_path_not_bonded_lane1_chain()
1043 dev2 = alloc_dev_default(test, dev1, 0x701, false); in tb_test_path_not_bonded_lane1_chain()
1044 dev3 = alloc_dev_default(test, dev2, 0x50701, false); in tb_test_path_not_bonded_lane1_chain()
1050 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_not_bonded_lane1_chain()
1051 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain()
1058 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
1059 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain()
1060 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain()
1062 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
1063 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain()
1064 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain()
1070 static void tb_test_path_not_bonded_lane1_chain_reverse(struct kunit *test) in tb_test_path_not_bonded_lane1_chain_reverse() argument
1121 host = alloc_host(test); in tb_test_path_not_bonded_lane1_chain_reverse()
1122 dev1 = alloc_dev_default(test, host, 0x1, false); in tb_test_path_not_bonded_lane1_chain_reverse()
1123 dev2 = alloc_dev_default(test, dev1, 0x701, false); in tb_test_path_not_bonded_lane1_chain_reverse()
1124 dev3 = alloc_dev_with_dpin(test, dev2, 0x50701, false); in tb_test_path_not_bonded_lane1_chain_reverse()
1130 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_not_bonded_lane1_chain_reverse()
1131 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain_reverse()
1138 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1139 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1140 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1142 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1143 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1144 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1150 static void tb_test_path_mixed_chain(struct kunit *test) in tb_test_path_mixed_chain() argument
1212 host = alloc_host(test); in tb_test_path_mixed_chain()
1213 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_mixed_chain()
1214 dev2 = alloc_dev_default(test, dev1, 0x701, false); in tb_test_path_mixed_chain()
1215 dev3 = alloc_dev_default(test, dev2, 0x50701, false); in tb_test_path_mixed_chain()
1216 dev4 = alloc_dev_default(test, dev3, 0x3050701, true); in tb_test_path_mixed_chain()
1222 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_mixed_chain()
1223 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain()
1230 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1231 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain()
1232 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain()
1234 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1235 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain()
1236 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain()
1242 static void tb_test_path_mixed_chain_reverse(struct kunit *test) in tb_test_path_mixed_chain_reverse() argument
1304 host = alloc_host(test); in tb_test_path_mixed_chain_reverse()
1305 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_path_mixed_chain_reverse()
1306 dev2 = alloc_dev_default(test, dev1, 0x701, false); in tb_test_path_mixed_chain_reverse()
1307 dev3 = alloc_dev_default(test, dev2, 0x50701, false); in tb_test_path_mixed_chain_reverse()
1308 dev4 = alloc_dev_default(test, dev3, 0x3050701, true); in tb_test_path_mixed_chain_reverse()
1314 KUNIT_ASSERT_NOT_NULL(test, path); in tb_test_path_mixed_chain_reverse()
1315 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain_reverse()
1322 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1323 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain_reverse()
1324 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain_reverse()
1326 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1327 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain_reverse()
1328 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain_reverse()
1334 static void tb_test_tunnel_pcie(struct kunit *test) in tb_test_tunnel_pcie() argument
1351 host = alloc_host(test); in tb_test_tunnel_pcie()
1352 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_tunnel_pcie()
1353 dev2 = alloc_dev_default(test, dev1, 0x501, true); in tb_test_tunnel_pcie()
1358 KUNIT_ASSERT_NOT_NULL(test, tunnel1); in tb_test_tunnel_pcie()
1359 KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1360 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_pcie()
1361 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_pcie()
1362 KUNIT_ASSERT_EQ(test, tunnel1->npaths, 2); in tb_test_tunnel_pcie()
1363 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1364 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1365 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1366 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1367 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1368 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1373 KUNIT_ASSERT_NOT_NULL(test, tunnel2); in tb_test_tunnel_pcie()
1374 KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1375 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_pcie()
1376 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_pcie()
1377 KUNIT_ASSERT_EQ(test, tunnel2->npaths, 2); in tb_test_tunnel_pcie()
1378 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1379 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1380 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1381 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1382 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1383 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1389 static void tb_test_tunnel_dp(struct kunit *test) in tb_test_tunnel_dp() argument
1403 host = alloc_host(test); in tb_test_tunnel_dp()
1404 dev = alloc_dev_default(test, host, 0x3, true); in tb_test_tunnel_dp()
1410 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dp()
1411 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp()
1412 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp()
1413 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp()
1414 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp()
1415 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 2); in tb_test_tunnel_dp()
1416 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp()
1417 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].out_port, out); in tb_test_tunnel_dp()
1418 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 2); in tb_test_tunnel_dp()
1419 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp()
1420 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].out_port, out); in tb_test_tunnel_dp()
1421 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 2); in tb_test_tunnel_dp()
1422 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp()
1423 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[1].out_port, in); in tb_test_tunnel_dp()
1427 static void tb_test_tunnel_dp_chain(struct kunit *test) in tb_test_tunnel_dp_chain() argument
1446 host = alloc_host(test); in tb_test_tunnel_dp_chain()
1447 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_tunnel_dp_chain()
1448 alloc_dev_default(test, dev1, 0x301, true); in tb_test_tunnel_dp_chain()
1449 alloc_dev_default(test, dev1, 0x501, true); in tb_test_tunnel_dp_chain()
1450 dev4 = alloc_dev_default(test, dev1, 0x701, true); in tb_test_tunnel_dp_chain()
1456 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dp_chain()
1457 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_chain()
1458 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_chain()
1459 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_chain()
1460 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_chain()
1461 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 3); in tb_test_tunnel_dp_chain()
1462 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1463 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1464 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 3); in tb_test_tunnel_dp_chain()
1465 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1466 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1467 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 3); in tb_test_tunnel_dp_chain()
1468 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_chain()
1469 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[2].out_port, in); in tb_test_tunnel_dp_chain()
1473 static void tb_test_tunnel_dp_tree(struct kunit *test) in tb_test_tunnel_dp_tree() argument
1495 host = alloc_host(test); in tb_test_tunnel_dp_tree()
1496 dev1 = alloc_dev_default(test, host, 0x3, true); in tb_test_tunnel_dp_tree()
1497 dev2 = alloc_dev_with_dpin(test, dev1, 0x303, true); in tb_test_tunnel_dp_tree()
1498 dev3 = alloc_dev_default(test, dev1, 0x503, true); in tb_test_tunnel_dp_tree()
1499 alloc_dev_default(test, dev1, 0x703, true); in tb_test_tunnel_dp_tree()
1500 dev5 = alloc_dev_default(test, dev3, 0x50503, true); in tb_test_tunnel_dp_tree()
1506 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dp_tree()
1507 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_tree()
1508 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_tree()
1509 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_tree()
1510 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_tree()
1511 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 4); in tb_test_tunnel_dp_tree()
1512 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1513 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1514 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 4); in tb_test_tunnel_dp_tree()
1515 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1516 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1517 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 4); in tb_test_tunnel_dp_tree()
1518 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_tree()
1519 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[3].out_port, in); in tb_test_tunnel_dp_tree()
1523 static void tb_test_tunnel_dp_max_length(struct kunit *test) in tb_test_tunnel_dp_max_length() argument
1553 host = alloc_host(test); in tb_test_tunnel_dp_max_length()
1554 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_tunnel_dp_max_length()
1555 dev2 = alloc_dev_default(test, dev1, 0x301, true); in tb_test_tunnel_dp_max_length()
1556 dev3 = alloc_dev_default(test, dev2, 0x30301, true); in tb_test_tunnel_dp_max_length()
1557 dev4 = alloc_dev_default(test, dev3, 0x3030301, true); in tb_test_tunnel_dp_max_length()
1558 dev5 = alloc_dev_default(test, dev4, 0x303030301, true); in tb_test_tunnel_dp_max_length()
1559 dev6 = alloc_dev_with_dpin(test, dev5, 0x30303030301, true); in tb_test_tunnel_dp_max_length()
1560 dev7 = alloc_dev_default(test, host, 0x3, true); in tb_test_tunnel_dp_max_length()
1561 dev8 = alloc_dev_default(test, dev7, 0x303, true); in tb_test_tunnel_dp_max_length()
1562 dev9 = alloc_dev_default(test, dev8, 0x30303, true); in tb_test_tunnel_dp_max_length()
1563 dev10 = alloc_dev_default(test, dev9, 0x3030303, true); in tb_test_tunnel_dp_max_length()
1564 dev11 = alloc_dev_default(test, dev10, 0x303030303, true); in tb_test_tunnel_dp_max_length()
1565 dev12 = alloc_dev_default(test, dev11, 0x30303030303, true); in tb_test_tunnel_dp_max_length()
1571 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dp_max_length()
1572 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_max_length()
1573 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_max_length()
1574 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_max_length()
1575 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_max_length()
1576 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 13); in tb_test_tunnel_dp_max_length()
1578 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1580 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1582 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1585 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1586 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 13); in tb_test_tunnel_dp_max_length()
1587 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1588 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1590 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1592 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1593 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 13); in tb_test_tunnel_dp_max_length()
1594 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_max_length()
1595 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1597 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1599 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[12].out_port, in); in tb_test_tunnel_dp_max_length()
1603 static void tb_test_tunnel_3dp(struct kunit *test) in tb_test_tunnel_3dp() argument
1625 host = alloc_host_br(test); in tb_test_tunnel_3dp()
1626 dev1 = alloc_dev_default(test, host, 0x3, true); in tb_test_tunnel_3dp()
1627 dev2 = alloc_dev_default(test, dev1, 0x303, true); in tb_test_tunnel_3dp()
1628 dev3 = alloc_dev_default(test, dev1, 0x503, true); in tb_test_tunnel_3dp()
1629 dev4 = alloc_dev_default(test, dev1, 0x703, true); in tb_test_tunnel_3dp()
1630 dev5 = alloc_dev_default(test, dev3, 0x50503, true); in tb_test_tunnel_3dp()
1641 KUNIT_ASSERT_TRUE(test, tunnel1 != NULL); in tb_test_tunnel_3dp()
1642 KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_DP); in tb_test_tunnel_3dp()
1643 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, in1); in tb_test_tunnel_3dp()
1644 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, out1); in tb_test_tunnel_3dp()
1645 KUNIT_ASSERT_EQ(test, tunnel1->npaths, 3); in tb_test_tunnel_3dp()
1646 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 3); in tb_test_tunnel_3dp()
1649 KUNIT_ASSERT_TRUE(test, tunnel2 != NULL); in tb_test_tunnel_3dp()
1650 KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_DP); in tb_test_tunnel_3dp()
1651 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, in2); in tb_test_tunnel_3dp()
1652 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, out2); in tb_test_tunnel_3dp()
1653 KUNIT_ASSERT_EQ(test, tunnel2->npaths, 3); in tb_test_tunnel_3dp()
1654 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 4); in tb_test_tunnel_3dp()
1657 KUNIT_ASSERT_TRUE(test, tunnel3 != NULL); in tb_test_tunnel_3dp()
1658 KUNIT_EXPECT_EQ(test, tunnel3->type, TB_TUNNEL_DP); in tb_test_tunnel_3dp()
1659 KUNIT_EXPECT_PTR_EQ(test, tunnel3->src_port, in3); in tb_test_tunnel_3dp()
1660 KUNIT_EXPECT_PTR_EQ(test, tunnel3->dst_port, out3); in tb_test_tunnel_3dp()
1661 KUNIT_ASSERT_EQ(test, tunnel3->npaths, 3); in tb_test_tunnel_3dp()
1662 KUNIT_ASSERT_EQ(test, tunnel3->paths[0]->path_length, 3); in tb_test_tunnel_3dp()
1668 static void tb_test_tunnel_usb3(struct kunit *test) in tb_test_tunnel_usb3() argument
1685 host = alloc_host(test); in tb_test_tunnel_usb3()
1686 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_tunnel_usb3()
1687 dev2 = alloc_dev_default(test, dev1, 0x701, true); in tb_test_tunnel_usb3()
1692 KUNIT_ASSERT_NOT_NULL(test, tunnel1); in tb_test_tunnel_usb3()
1693 KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1694 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_usb3()
1695 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_usb3()
1696 KUNIT_ASSERT_EQ(test, tunnel1->npaths, 2); in tb_test_tunnel_usb3()
1697 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1698 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1699 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1700 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1701 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1702 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1707 KUNIT_ASSERT_NOT_NULL(test, tunnel2); in tb_test_tunnel_usb3()
1708 KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1709 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_usb3()
1710 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_usb3()
1711 KUNIT_ASSERT_EQ(test, tunnel2->npaths, 2); in tb_test_tunnel_usb3()
1712 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1713 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1714 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1715 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1716 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1717 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1723 static void tb_test_tunnel_port_on_path(struct kunit *test) in tb_test_tunnel_port_on_path() argument
1743 host = alloc_host(test); in tb_test_tunnel_port_on_path()
1744 dev1 = alloc_dev_default(test, host, 0x3, true); in tb_test_tunnel_port_on_path()
1745 dev2 = alloc_dev_with_dpin(test, dev1, 0x303, true); in tb_test_tunnel_port_on_path()
1746 dev3 = alloc_dev_default(test, dev1, 0x503, true); in tb_test_tunnel_port_on_path()
1747 dev4 = alloc_dev_default(test, dev1, 0x703, true); in tb_test_tunnel_port_on_path()
1748 dev5 = alloc_dev_default(test, dev3, 0x50503, true); in tb_test_tunnel_port_on_path()
1754 KUNIT_ASSERT_NOT_NULL(test, dp_tunnel); in tb_test_tunnel_port_on_path()
1756 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, in)); in tb_test_tunnel_port_on_path()
1757 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, out)); in tb_test_tunnel_port_on_path()
1760 KUNIT_EXPECT_FALSE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1763 KUNIT_EXPECT_FALSE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1766 KUNIT_EXPECT_FALSE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1769 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1772 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1775 KUNIT_EXPECT_FALSE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1778 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1781 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1784 KUNIT_EXPECT_FALSE(test, tb_tunnel_port_on_path(dp_tunnel, port)); in tb_test_tunnel_port_on_path()
1789 static void tb_test_tunnel_dma(struct kunit *test) in tb_test_tunnel_dma() argument
1806 host = alloc_host(test); in tb_test_tunnel_dma()
1811 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma()
1812 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma()
1813 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma()
1814 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma()
1815 KUNIT_ASSERT_EQ(test, tunnel->npaths, 2); in tb_test_tunnel_dma()
1817 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma()
1818 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma()
1819 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 8); in tb_test_tunnel_dma()
1820 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, nhi); in tb_test_tunnel_dma()
1821 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 1); in tb_test_tunnel_dma()
1823 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 1); in tb_test_tunnel_dma()
1824 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, nhi); in tb_test_tunnel_dma()
1825 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].in_hop_index, 1); in tb_test_tunnel_dma()
1826 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].out_port, port); in tb_test_tunnel_dma()
1827 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].next_hop_index, 8); in tb_test_tunnel_dma()
1832 static void tb_test_tunnel_dma_rx(struct kunit *test) in tb_test_tunnel_dma_rx() argument
1849 host = alloc_host(test); in tb_test_tunnel_dma_rx()
1854 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_rx()
1855 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_rx()
1856 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_rx()
1857 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_rx()
1858 KUNIT_ASSERT_EQ(test, tunnel->npaths, 1); in tb_test_tunnel_dma_rx()
1860 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma_rx()
1861 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma_rx()
1862 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 15); in tb_test_tunnel_dma_rx()
1863 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, nhi); in tb_test_tunnel_dma_rx()
1864 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 2); in tb_test_tunnel_dma_rx()
1869 static void tb_test_tunnel_dma_tx(struct kunit *test) in tb_test_tunnel_dma_tx() argument
1886 host = alloc_host(test); in tb_test_tunnel_dma_tx()
1891 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_tx()
1892 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_tx()
1893 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_tx()
1894 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_tx()
1895 KUNIT_ASSERT_EQ(test, tunnel->npaths, 1); in tb_test_tunnel_dma_tx()
1897 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma_tx()
1898 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, nhi); in tb_test_tunnel_dma_tx()
1899 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 2); in tb_test_tunnel_dma_tx()
1900 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, port); in tb_test_tunnel_dma_tx()
1901 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 15); in tb_test_tunnel_dma_tx()
1906 static void tb_test_tunnel_dma_chain(struct kunit *test) in tb_test_tunnel_dma_chain() argument
1930 host = alloc_host(test); in tb_test_tunnel_dma_chain()
1931 dev1 = alloc_dev_default(test, host, 0x1, true); in tb_test_tunnel_dma_chain()
1932 dev2 = alloc_dev_default(test, dev1, 0x701, true); in tb_test_tunnel_dma_chain()
1937 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_chain()
1938 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_chain()
1939 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_chain()
1940 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_chain()
1941 KUNIT_ASSERT_EQ(test, tunnel->npaths, 2); in tb_test_tunnel_dma_chain()
1943 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 3); in tb_test_tunnel_dma_chain()
1944 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma_chain()
1945 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 8); in tb_test_tunnel_dma_chain()
1946 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, in tb_test_tunnel_dma_chain()
1948 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].in_port, in tb_test_tunnel_dma_chain()
1950 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].out_port, in tb_test_tunnel_dma_chain()
1952 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].in_port, in tb_test_tunnel_dma_chain()
1954 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].out_port, nhi); in tb_test_tunnel_dma_chain()
1955 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[2].next_hop_index, 1); in tb_test_tunnel_dma_chain()
1957 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 3); in tb_test_tunnel_dma_chain()
1958 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, nhi); in tb_test_tunnel_dma_chain()
1959 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].in_hop_index, 1); in tb_test_tunnel_dma_chain()
1960 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].in_port, in tb_test_tunnel_dma_chain()
1962 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].out_port, in tb_test_tunnel_dma_chain()
1964 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].in_port, in tb_test_tunnel_dma_chain()
1966 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].out_port, port); in tb_test_tunnel_dma_chain()
1967 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[2].next_hop_index, 8); in tb_test_tunnel_dma_chain()
1972 static void tb_test_tunnel_dma_match(struct kunit *test) in tb_test_tunnel_dma_match() argument
1978 host = alloc_host(test); in tb_test_tunnel_dma_match()
1983 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_match()
1985 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, 1, 15, 1)); in tb_test_tunnel_dma_match()
1986 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 8, 1, 15, 1)); in tb_test_tunnel_dma_match()
1987 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
1988 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); in tb_test_tunnel_dma_match()
1989 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); in tb_test_tunnel_dma_match()
1990 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); in tb_test_tunnel_dma_match()
1991 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); in tb_test_tunnel_dma_match()
1992 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 1)); in tb_test_tunnel_dma_match()
1993 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
1994 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 8, -1, 8, -1)); in tb_test_tunnel_dma_match()
1999 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_match()
2000 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); in tb_test_tunnel_dma_match()
2001 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); in tb_test_tunnel_dma_match()
2002 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); in tb_test_tunnel_dma_match()
2003 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
2004 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 15, 1, 15, 1)); in tb_test_tunnel_dma_match()
2005 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
2006 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); in tb_test_tunnel_dma_match()
2011 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_tunnel_dma_match()
2012 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 11)); in tb_test_tunnel_dma_match()
2013 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); in tb_test_tunnel_dma_match()
2014 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 11)); in tb_test_tunnel_dma_match()
2015 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
2016 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
2017 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 10, 11)); in tb_test_tunnel_dma_match()
2018 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); in tb_test_tunnel_dma_match()
2023 static void tb_test_credit_alloc_legacy_not_bonded(struct kunit *test) in tb_test_credit_alloc_legacy_not_bonded() argument
2030 host = alloc_host(test); in tb_test_credit_alloc_legacy_not_bonded()
2031 dev = alloc_dev_default(test, host, 0x1, false); in tb_test_credit_alloc_legacy_not_bonded()
2036 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_legacy_not_bonded()
2037 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_legacy_not_bonded()
2040 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_not_bonded()
2041 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
2042 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_not_bonded()
2043 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
2044 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 16U); in tb_test_credit_alloc_legacy_not_bonded()
2047 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_not_bonded()
2048 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
2049 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_not_bonded()
2050 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
2051 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 16U); in tb_test_credit_alloc_legacy_not_bonded()
2056 static void tb_test_credit_alloc_legacy_bonded(struct kunit *test) in tb_test_credit_alloc_legacy_bonded() argument
2063 host = alloc_host(test); in tb_test_credit_alloc_legacy_bonded()
2064 dev = alloc_dev_default(test, host, 0x1, true); in tb_test_credit_alloc_legacy_bonded()
2069 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_legacy_bonded()
2070 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_legacy_bonded()
2073 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_bonded()
2074 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
2075 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_bonded()
2076 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
2077 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_legacy_bonded()
2080 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_bonded()
2081 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
2082 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_bonded()
2083 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
2084 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_legacy_bonded()
2089 static void tb_test_credit_alloc_pcie(struct kunit *test) in tb_test_credit_alloc_pcie() argument
2096 host = alloc_host_usb4(test); in tb_test_credit_alloc_pcie()
2097 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_pcie()
2102 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_pcie()
2103 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_pcie()
2106 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_pcie()
2107 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
2108 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_pcie()
2109 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
2110 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_pcie()
2113 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_pcie()
2114 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
2115 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_pcie()
2116 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
2117 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 64U); in tb_test_credit_alloc_pcie()
2122 static void tb_test_credit_alloc_without_dp(struct kunit *test) in tb_test_credit_alloc_without_dp() argument
2129 host = alloc_host_usb4(test); in tb_test_credit_alloc_without_dp()
2130 dev = alloc_dev_without_dp(test, host, 0x1, true); in tb_test_credit_alloc_without_dp()
2150 KUNIT_ASSERT_TRUE(test, tunnel != NULL); in tb_test_credit_alloc_without_dp()
2151 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_without_dp()
2155 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_without_dp()
2156 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_without_dp()
2157 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_without_dp()
2158 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_without_dp()
2159 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 9U); in tb_test_credit_alloc_without_dp()
2163 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_without_dp()
2164 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_without_dp()
2165 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_without_dp()
2166 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_without_dp()
2167 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 64U); in tb_test_credit_alloc_without_dp()
2172 static void tb_test_credit_alloc_dp(struct kunit *test) in tb_test_credit_alloc_dp() argument
2179 host = alloc_host_usb4(test); in tb_test_credit_alloc_dp()
2180 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_dp()
2186 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_dp()
2187 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_credit_alloc_dp()
2191 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2192 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in tb_test_credit_alloc_dp()
2193 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dp()
2194 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in tb_test_credit_alloc_dp()
2195 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in tb_test_credit_alloc_dp()
2199 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2200 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2201 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in tb_test_credit_alloc_dp()
2202 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2203 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dp()
2207 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2208 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2209 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in tb_test_credit_alloc_dp()
2210 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2211 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dp()
2216 static void tb_test_credit_alloc_usb3(struct kunit *test) in tb_test_credit_alloc_usb3() argument
2223 host = alloc_host_usb4(test); in tb_test_credit_alloc_usb3()
2224 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_usb3()
2229 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_usb3()
2230 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_usb3()
2233 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_usb3()
2234 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2235 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_usb3()
2236 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2237 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_usb3()
2240 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_usb3()
2241 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2242 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_usb3()
2243 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2244 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_usb3()
2249 static void tb_test_credit_alloc_dma(struct kunit *test) in tb_test_credit_alloc_dma() argument
2256 host = alloc_host_usb4(test); in tb_test_credit_alloc_dma()
2257 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_dma()
2263 KUNIT_ASSERT_NOT_NULL(test, tunnel); in tb_test_credit_alloc_dma()
2264 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_dma()
2268 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma()
2269 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2270 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma()
2271 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2272 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma()
2276 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma()
2277 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2278 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma()
2279 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2280 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma()
2285 static void tb_test_credit_alloc_dma_multiple(struct kunit *test) in tb_test_credit_alloc_dma_multiple() argument
2292 host = alloc_host_usb4(test); in tb_test_credit_alloc_dma_multiple()
2293 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_dma_multiple()
2317 KUNIT_ASSERT_NOT_NULL(test, tunnel1); in tb_test_credit_alloc_dma_multiple()
2318 KUNIT_ASSERT_EQ(test, tunnel1->npaths, (size_t)2); in tb_test_credit_alloc_dma_multiple()
2321 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2322 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2323 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2324 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2325 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2328 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2329 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2330 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2331 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2332 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2335 KUNIT_ASSERT_NOT_NULL(test, tunnel2); in tb_test_credit_alloc_dma_multiple()
2336 KUNIT_ASSERT_EQ(test, tunnel2->npaths, (size_t)2); in tb_test_credit_alloc_dma_multiple()
2339 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2340 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2341 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2342 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2343 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dma_multiple()
2346 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2347 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2348 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2349 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2350 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dma_multiple()
2353 KUNIT_ASSERT_NULL(test, tunnel3); in tb_test_credit_alloc_dma_multiple()
2362 KUNIT_ASSERT_NOT_NULL(test, tunnel3); in tb_test_credit_alloc_dma_multiple()
2365 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2366 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2367 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2368 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2369 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2372 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2373 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2374 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2375 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2376 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2382 static struct tb_tunnel *TB_TEST_PCIE_TUNNEL(struct kunit *test, in TB_TEST_PCIE_TUNNEL() argument
2392 KUNIT_ASSERT_NOT_NULL(test, pcie_tunnel); in TB_TEST_PCIE_TUNNEL()
2393 KUNIT_ASSERT_EQ(test, pcie_tunnel->npaths, (size_t)2); in TB_TEST_PCIE_TUNNEL()
2396 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_PCIE_TUNNEL()
2397 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2398 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_PCIE_TUNNEL()
2399 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2400 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in TB_TEST_PCIE_TUNNEL()
2403 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_PCIE_TUNNEL()
2404 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2405 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_PCIE_TUNNEL()
2406 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2407 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 64U); in TB_TEST_PCIE_TUNNEL()
2412 static struct tb_tunnel *TB_TEST_DP_TUNNEL1(struct kunit *test, in TB_TEST_DP_TUNNEL1() argument
2422 KUNIT_ASSERT_NOT_NULL(test, dp_tunnel1); in TB_TEST_DP_TUNNEL1()
2423 KUNIT_ASSERT_EQ(test, dp_tunnel1->npaths, (size_t)3); in TB_TEST_DP_TUNNEL1()
2426 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2427 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in TB_TEST_DP_TUNNEL1()
2428 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DP_TUNNEL1()
2429 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in TB_TEST_DP_TUNNEL1()
2430 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in TB_TEST_DP_TUNNEL1()
2433 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2434 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2435 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2436 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2437 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2440 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2441 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2442 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2443 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2444 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2449 static struct tb_tunnel *TB_TEST_DP_TUNNEL2(struct kunit *test, in TB_TEST_DP_TUNNEL2() argument
2459 KUNIT_ASSERT_NOT_NULL(test, dp_tunnel2); in TB_TEST_DP_TUNNEL2()
2460 KUNIT_ASSERT_EQ(test, dp_tunnel2->npaths, (size_t)3); in TB_TEST_DP_TUNNEL2()
2463 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2464 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in TB_TEST_DP_TUNNEL2()
2465 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DP_TUNNEL2()
2466 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in TB_TEST_DP_TUNNEL2()
2467 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in TB_TEST_DP_TUNNEL2()
2470 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2471 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2472 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2473 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2474 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2477 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2478 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2479 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2480 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2481 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2486 static struct tb_tunnel *TB_TEST_USB3_TUNNEL(struct kunit *test, in TB_TEST_USB3_TUNNEL() argument
2496 KUNIT_ASSERT_NOT_NULL(test, usb3_tunnel); in TB_TEST_USB3_TUNNEL()
2497 KUNIT_ASSERT_EQ(test, usb3_tunnel->npaths, (size_t)2); in TB_TEST_USB3_TUNNEL()
2500 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_USB3_TUNNEL()
2501 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2502 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_USB3_TUNNEL()
2503 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2504 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_USB3_TUNNEL()
2507 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_USB3_TUNNEL()
2508 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2509 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_USB3_TUNNEL()
2510 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2511 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in TB_TEST_USB3_TUNNEL()
2516 static struct tb_tunnel *TB_TEST_DMA_TUNNEL1(struct kunit *test, in TB_TEST_DMA_TUNNEL1() argument
2526 KUNIT_ASSERT_NOT_NULL(test, dma_tunnel1); in TB_TEST_DMA_TUNNEL1()
2527 KUNIT_ASSERT_EQ(test, dma_tunnel1->npaths, (size_t)2); in TB_TEST_DMA_TUNNEL1()
2530 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL1()
2531 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2532 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2533 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2534 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2537 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL1()
2538 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2539 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2540 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2541 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2546 static struct tb_tunnel *TB_TEST_DMA_TUNNEL2(struct kunit *test, in TB_TEST_DMA_TUNNEL2() argument
2556 KUNIT_ASSERT_NOT_NULL(test, dma_tunnel2); in TB_TEST_DMA_TUNNEL2()
2557 KUNIT_ASSERT_EQ(test, dma_tunnel2->npaths, (size_t)2); in TB_TEST_DMA_TUNNEL2()
2560 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL2()
2561 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2562 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in TB_TEST_DMA_TUNNEL2()
2563 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2564 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DMA_TUNNEL2()
2567 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL2()
2568 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2569 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2570 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2571 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DMA_TUNNEL2()
2576 static void tb_test_credit_alloc_all(struct kunit *test) in tb_test_credit_alloc_all() argument
2588 host = alloc_host_usb4(test); in tb_test_credit_alloc_all()
2589 dev = alloc_dev_usb4(test, host, 0x1, true); in tb_test_credit_alloc_all()
2591 pcie_tunnel = TB_TEST_PCIE_TUNNEL(test, host, dev); in tb_test_credit_alloc_all()
2592 dp_tunnel1 = TB_TEST_DP_TUNNEL1(test, host, dev); in tb_test_credit_alloc_all()
2593 dp_tunnel2 = TB_TEST_DP_TUNNEL2(test, host, dev); in tb_test_credit_alloc_all()
2594 usb3_tunnel = TB_TEST_USB3_TUNNEL(test, host, dev); in tb_test_credit_alloc_all()
2595 dma_tunnel1 = TB_TEST_DMA_TUNNEL1(test, host, dev); in tb_test_credit_alloc_all()
2596 dma_tunnel2 = TB_TEST_DMA_TUNNEL2(test, host, dev); in tb_test_credit_alloc_all()
2666 static void tb_test_property_parse(struct kunit *test) in tb_test_property_parse() argument
2672 KUNIT_ASSERT_NOT_NULL(test, dir); in tb_test_property_parse()
2675 KUNIT_ASSERT_NULL(test, p); in tb_test_property_parse()
2678 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2679 KUNIT_EXPECT_STREQ(test, p->value.text, "Apple Inc."); in tb_test_property_parse()
2682 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2683 KUNIT_EXPECT_EQ(test, p->value.immediate, 0xa27); in tb_test_property_parse()
2686 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2687 KUNIT_EXPECT_STREQ(test, p->value.text, "Macintosh"); in tb_test_property_parse()
2690 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2691 KUNIT_EXPECT_EQ(test, p->value.immediate, 0xa); in tb_test_property_parse()
2694 KUNIT_ASSERT_NULL(test, p); in tb_test_property_parse()
2697 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2700 KUNIT_EXPECT_TRUE(test, uuid_equal(network_dir->uuid, &network_dir_uuid)); in tb_test_property_parse()
2703 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2704 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2707 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2708 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2711 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2712 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2715 KUNIT_ASSERT_NOT_NULL(test, p); in tb_test_property_parse()
2716 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x0); in tb_test_property_parse()
2719 KUNIT_EXPECT_TRUE(test, !p); in tb_test_property_parse()
2721 KUNIT_EXPECT_TRUE(test, !p); in tb_test_property_parse()
2726 static void tb_test_property_format(struct kunit *test) in tb_test_property_format() argument
2734 KUNIT_ASSERT_NOT_NULL(test, dir); in tb_test_property_format()
2737 KUNIT_ASSERT_EQ(test, ret, ARRAY_SIZE(root_directory)); in tb_test_property_format()
2741 block = kunit_kzalloc(test, block_len * sizeof(u32), GFP_KERNEL); in tb_test_property_format()
2742 KUNIT_ASSERT_NOT_NULL(test, block); in tb_test_property_format()
2745 KUNIT_EXPECT_EQ(test, ret, 0); in tb_test_property_format()
2748 KUNIT_EXPECT_EQ(test, root_directory[i], block[i]); in tb_test_property_format()
2753 static void compare_dirs(struct kunit *test, struct tb_property_dir *d1, in compare_dirs() argument
2760 KUNIT_ASSERT_NOT_NULL(test, d2->uuid); in compare_dirs()
2761 KUNIT_ASSERT_TRUE(test, uuid_equal(d1->uuid, d2->uuid)); in compare_dirs()
2763 KUNIT_ASSERT_NULL(test, d2->uuid); in compare_dirs()
2769 KUNIT_ASSERT_NE(test, n1, 0); in compare_dirs()
2774 KUNIT_ASSERT_NE(test, n2, 0); in compare_dirs()
2776 KUNIT_ASSERT_EQ(test, n1, n2); in compare_dirs()
2782 KUNIT_ASSERT_NOT_NULL(test, p1); in compare_dirs()
2784 KUNIT_ASSERT_NOT_NULL(test, p2); in compare_dirs()
2786 KUNIT_ASSERT_STREQ(test, &p1->key[0], &p2->key[0]); in compare_dirs()
2787 KUNIT_ASSERT_EQ(test, p1->type, p2->type); in compare_dirs()
2788 KUNIT_ASSERT_EQ(test, p1->length, p2->length); in compare_dirs()
2792 KUNIT_ASSERT_NOT_NULL(test, p1->value.dir); in compare_dirs()
2793 KUNIT_ASSERT_NOT_NULL(test, p2->value.dir); in compare_dirs()
2794 compare_dirs(test, p1->value.dir, p2->value.dir); in compare_dirs()
2798 KUNIT_ASSERT_NOT_NULL(test, p1->value.data); in compare_dirs()
2799 KUNIT_ASSERT_NOT_NULL(test, p2->value.data); in compare_dirs()
2800 KUNIT_ASSERT_TRUE(test, in compare_dirs()
2807 KUNIT_ASSERT_NOT_NULL(test, p1->value.text); in compare_dirs()
2808 KUNIT_ASSERT_NOT_NULL(test, p2->value.text); in compare_dirs()
2809 KUNIT_ASSERT_STREQ(test, p1->value.text, p2->value.text); in compare_dirs()
2813 KUNIT_ASSERT_EQ(test, p1->value.immediate, in compare_dirs()
2817 KUNIT_FAIL(test, "unexpected property type"); in compare_dirs()
2823 static void tb_test_property_copy(struct kunit *test) in tb_test_property_copy() argument
2830 KUNIT_ASSERT_NOT_NULL(test, src); in tb_test_property_copy()
2833 KUNIT_ASSERT_NOT_NULL(test, dst); in tb_test_property_copy()
2836 compare_dirs(test, src, dst); in tb_test_property_copy()
2840 KUNIT_ASSERT_EQ(test, ret, ARRAY_SIZE(root_directory)); in tb_test_property_copy()
2842 block = kunit_kzalloc(test, sizeof(root_directory), GFP_KERNEL); in tb_test_property_copy()
2843 KUNIT_ASSERT_NOT_NULL(test, block); in tb_test_property_copy()
2846 KUNIT_EXPECT_TRUE(test, !ret); in tb_test_property_copy()
2849 KUNIT_EXPECT_EQ(test, root_directory[i], block[i]); in tb_test_property_copy()