Lines Matching +full:route +full:- +full:up
1 // SPDX-License-Identifier: GPL-2.0
20 res->data = ida; in __ida_init()
26 struct ida *ida = res->data; in __ida_destroy()
36 static struct tb_switch *alloc_switch(struct kunit *test, u64 route, in alloc_switch() argument
47 sw->config.upstream_port_number = upstream_port; in alloc_switch()
48 sw->config.depth = tb_route_length(route); in alloc_switch()
49 sw->config.route_hi = upper_32_bits(route); in alloc_switch()
50 sw->config.route_lo = lower_32_bits(route); in alloc_switch()
51 sw->config.enabled = 0; in alloc_switch()
52 sw->config.max_port_number = max_port_number; in alloc_switch()
54 size = (sw->config.max_port_number + 1) * sizeof(*sw->ports); in alloc_switch()
55 sw->ports = kunit_kzalloc(test, size, GFP_KERNEL); in alloc_switch()
56 if (!sw->ports) in alloc_switch()
59 for (i = 0; i <= sw->config.max_port_number; i++) { in alloc_switch()
60 sw->ports[i].sw = sw; in alloc_switch()
61 sw->ports[i].port = i; in alloc_switch()
62 sw->ports[i].config.port_number = i; 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()
80 sw->config.vendor_id = 0x8086; in alloc_host()
81 sw->config.device_id = 0x9a1b; in alloc_host()
83 sw->ports[0].config.type = TB_TYPE_PORT; in alloc_host()
84 sw->ports[0].config.max_in_hop_id = 7; in alloc_host()
85 sw->ports[0].config.max_out_hop_id = 7; in alloc_host()
87 sw->ports[1].config.type = TB_TYPE_PORT; in alloc_host()
88 sw->ports[1].config.max_in_hop_id = 19; in alloc_host()
89 sw->ports[1].config.max_out_hop_id = 19; in alloc_host()
90 sw->ports[1].dual_link_port = &sw->ports[2]; in alloc_host()
92 sw->ports[2].config.type = TB_TYPE_PORT; in alloc_host()
93 sw->ports[2].config.max_in_hop_id = 19; in alloc_host()
94 sw->ports[2].config.max_out_hop_id = 19; in alloc_host()
95 sw->ports[2].dual_link_port = &sw->ports[1]; in alloc_host()
96 sw->ports[2].link_nr = 1; in alloc_host()
98 sw->ports[3].config.type = TB_TYPE_PORT; in alloc_host()
99 sw->ports[3].config.max_in_hop_id = 19; in alloc_host()
100 sw->ports[3].config.max_out_hop_id = 19; in alloc_host()
101 sw->ports[3].dual_link_port = &sw->ports[4]; in alloc_host()
103 sw->ports[4].config.type = TB_TYPE_PORT; in alloc_host()
104 sw->ports[4].config.max_in_hop_id = 19; in alloc_host()
105 sw->ports[4].config.max_out_hop_id = 19; in alloc_host()
106 sw->ports[4].dual_link_port = &sw->ports[3]; in alloc_host()
107 sw->ports[4].link_nr = 1; in alloc_host()
109 sw->ports[5].config.type = TB_TYPE_DP_HDMI_IN; in alloc_host()
110 sw->ports[5].config.max_in_hop_id = 9; in alloc_host()
111 sw->ports[5].config.max_out_hop_id = 9; in alloc_host()
112 sw->ports[5].cap_adap = -1; in alloc_host()
114 sw->ports[6].config.type = TB_TYPE_DP_HDMI_IN; in alloc_host()
115 sw->ports[6].config.max_in_hop_id = 9; in alloc_host()
116 sw->ports[6].config.max_out_hop_id = 9; in alloc_host()
117 sw->ports[6].cap_adap = -1; in alloc_host()
119 sw->ports[7].config.type = TB_TYPE_NHI; in alloc_host()
120 sw->ports[7].config.max_in_hop_id = 11; in alloc_host()
121 sw->ports[7].config.max_out_hop_id = 11; in alloc_host()
123 sw->ports[8].config.type = TB_TYPE_PCIE_DOWN; in alloc_host()
124 sw->ports[8].config.max_in_hop_id = 8; in alloc_host()
125 sw->ports[8].config.max_out_hop_id = 8; in alloc_host()
127 sw->ports[9].config.type = TB_TYPE_PCIE_DOWN; in alloc_host()
128 sw->ports[9].config.max_in_hop_id = 8; in alloc_host()
129 sw->ports[9].config.max_out_hop_id = 8; in alloc_host()
131 sw->ports[10].disabled = true; in alloc_host()
132 sw->ports[11].disabled = true; in alloc_host()
134 sw->ports[12].config.type = TB_TYPE_USB3_DOWN; in alloc_host()
135 sw->ports[12].config.max_in_hop_id = 8; in alloc_host()
136 sw->ports[12].config.max_out_hop_id = 8; in alloc_host()
138 sw->ports[13].config.type = TB_TYPE_USB3_DOWN; in alloc_host()
139 sw->ports[13].config.max_in_hop_id = 8; in alloc_host()
140 sw->ports[13].config.max_out_hop_id = 8; in alloc_host()
147 u64 route, bool bonded) in alloc_dev_default() argument
152 sw = alloc_switch(test, route, 1, 19); in alloc_dev_default()
156 sw->config.vendor_id = 0x8086; in alloc_dev_default()
157 sw->config.device_id = 0x15ef; in alloc_dev_default()
159 sw->ports[0].config.type = TB_TYPE_PORT; in alloc_dev_default()
160 sw->ports[0].config.max_in_hop_id = 8; in alloc_dev_default()
161 sw->ports[0].config.max_out_hop_id = 8; in alloc_dev_default()
163 sw->ports[1].config.type = TB_TYPE_PORT; in alloc_dev_default()
164 sw->ports[1].config.max_in_hop_id = 19; in alloc_dev_default()
165 sw->ports[1].config.max_out_hop_id = 19; in alloc_dev_default()
166 sw->ports[1].dual_link_port = &sw->ports[2]; in alloc_dev_default()
168 sw->ports[2].config.type = TB_TYPE_PORT; in alloc_dev_default()
169 sw->ports[2].config.max_in_hop_id = 19; in alloc_dev_default()
170 sw->ports[2].config.max_out_hop_id = 19; in alloc_dev_default()
171 sw->ports[2].dual_link_port = &sw->ports[1]; in alloc_dev_default()
172 sw->ports[2].link_nr = 1; in alloc_dev_default()
174 sw->ports[3].config.type = TB_TYPE_PORT; in alloc_dev_default()
175 sw->ports[3].config.max_in_hop_id = 19; in alloc_dev_default()
176 sw->ports[3].config.max_out_hop_id = 19; in alloc_dev_default()
177 sw->ports[3].dual_link_port = &sw->ports[4]; in alloc_dev_default()
179 sw->ports[4].config.type = TB_TYPE_PORT; in alloc_dev_default()
180 sw->ports[4].config.max_in_hop_id = 19; in alloc_dev_default()
181 sw->ports[4].config.max_out_hop_id = 19; in alloc_dev_default()
182 sw->ports[4].dual_link_port = &sw->ports[3]; in alloc_dev_default()
183 sw->ports[4].link_nr = 1; in alloc_dev_default()
185 sw->ports[5].config.type = TB_TYPE_PORT; in alloc_dev_default()
186 sw->ports[5].config.max_in_hop_id = 19; in alloc_dev_default()
187 sw->ports[5].config.max_out_hop_id = 19; in alloc_dev_default()
188 sw->ports[5].dual_link_port = &sw->ports[6]; in alloc_dev_default()
190 sw->ports[6].config.type = TB_TYPE_PORT; in alloc_dev_default()
191 sw->ports[6].config.max_in_hop_id = 19; in alloc_dev_default()
192 sw->ports[6].config.max_out_hop_id = 19; in alloc_dev_default()
193 sw->ports[6].dual_link_port = &sw->ports[5]; in alloc_dev_default()
194 sw->ports[6].link_nr = 1; in alloc_dev_default()
196 sw->ports[7].config.type = TB_TYPE_PORT; in alloc_dev_default()
197 sw->ports[7].config.max_in_hop_id = 19; in alloc_dev_default()
198 sw->ports[7].config.max_out_hop_id = 19; in alloc_dev_default()
199 sw->ports[7].dual_link_port = &sw->ports[8]; in alloc_dev_default()
201 sw->ports[8].config.type = TB_TYPE_PORT; in alloc_dev_default()
202 sw->ports[8].config.max_in_hop_id = 19; in alloc_dev_default()
203 sw->ports[8].config.max_out_hop_id = 19; in alloc_dev_default()
204 sw->ports[8].dual_link_port = &sw->ports[7]; in alloc_dev_default()
205 sw->ports[8].link_nr = 1; in alloc_dev_default()
207 sw->ports[9].config.type = TB_TYPE_PCIE_UP; in alloc_dev_default()
208 sw->ports[9].config.max_in_hop_id = 8; in alloc_dev_default()
209 sw->ports[9].config.max_out_hop_id = 8; in alloc_dev_default()
211 sw->ports[10].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
212 sw->ports[10].config.max_in_hop_id = 8; in alloc_dev_default()
213 sw->ports[10].config.max_out_hop_id = 8; in alloc_dev_default()
215 sw->ports[11].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
216 sw->ports[11].config.max_in_hop_id = 8; in alloc_dev_default()
217 sw->ports[11].config.max_out_hop_id = 8; in alloc_dev_default()
219 sw->ports[12].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
220 sw->ports[12].config.max_in_hop_id = 8; in alloc_dev_default()
221 sw->ports[12].config.max_out_hop_id = 8; in alloc_dev_default()
223 sw->ports[13].config.type = TB_TYPE_DP_HDMI_OUT; in alloc_dev_default()
224 sw->ports[13].config.max_in_hop_id = 9; in alloc_dev_default()
225 sw->ports[13].config.max_out_hop_id = 9; in alloc_dev_default()
226 sw->ports[13].cap_adap = -1; in alloc_dev_default()
228 sw->ports[14].config.type = TB_TYPE_DP_HDMI_OUT; in alloc_dev_default()
229 sw->ports[14].config.max_in_hop_id = 9; in alloc_dev_default()
230 sw->ports[14].config.max_out_hop_id = 9; in alloc_dev_default()
231 sw->ports[14].cap_adap = -1; in alloc_dev_default()
233 sw->ports[15].disabled = true; in alloc_dev_default()
235 sw->ports[16].config.type = TB_TYPE_USB3_UP; in alloc_dev_default()
236 sw->ports[16].config.max_in_hop_id = 8; in alloc_dev_default()
237 sw->ports[16].config.max_out_hop_id = 8; in alloc_dev_default()
239 sw->ports[17].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
240 sw->ports[17].config.max_in_hop_id = 8; in alloc_dev_default()
241 sw->ports[17].config.max_out_hop_id = 8; in alloc_dev_default()
243 sw->ports[18].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
244 sw->ports[18].config.max_in_hop_id = 8; in alloc_dev_default()
245 sw->ports[18].config.max_out_hop_id = 8; in alloc_dev_default()
247 sw->ports[19].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
248 sw->ports[19].config.max_in_hop_id = 8; in alloc_dev_default()
249 sw->ports[19].config.max_out_hop_id = 8; in alloc_dev_default()
256 port = tb_port_at(route, parent); in alloc_dev_default()
257 port->remote = upstream_port; in alloc_dev_default()
258 upstream_port->remote = port; in alloc_dev_default()
259 if (port->dual_link_port && upstream_port->dual_link_port) { in alloc_dev_default()
260 port->dual_link_port->remote = upstream_port->dual_link_port; in alloc_dev_default()
261 upstream_port->dual_link_port->remote = port->dual_link_port; in alloc_dev_default()
266 port->bonded = true; in alloc_dev_default()
267 port->dual_link_port->bonded = true; in alloc_dev_default()
268 upstream_port->bonded = true; in alloc_dev_default()
269 upstream_port->dual_link_port->bonded = true; in alloc_dev_default()
277 u64 route, bool bonded) in alloc_dev_with_dpin() argument
281 sw = alloc_dev_default(test, parent, route, bonded); in alloc_dev_with_dpin()
285 sw->ports[13].config.type = TB_TYPE_DP_HDMI_IN; in alloc_dev_with_dpin()
286 sw->ports[13].config.max_in_hop_id = 9; in alloc_dev_with_dpin()
287 sw->ports[13].config.max_out_hop_id = 9; in alloc_dev_with_dpin()
289 sw->ports[14].config.type = TB_TYPE_DP_HDMI_IN; in alloc_dev_with_dpin()
290 sw->ports[14].config.max_in_hop_id = 9; in alloc_dev_with_dpin()
291 sw->ports[14].config.max_out_hop_id = 9; in alloc_dev_with_dpin()
303 src_port = &host->ports[5]; in tb_test_path_basic()
322 src_port = &host->ports[12]; in tb_test_path_not_connected_walk()
323 dst_port = &dev->ports[16]; in tb_test_path_not_connected_walk()
329 KUNIT_EXPECT_PTR_EQ(test, p, &host->ports[3]); in tb_test_path_not_connected_walk()
340 KUNIT_EXPECT_PTR_EQ(test, p, &dev->ports[1]); in tb_test_path_not_connected_walk()
347 u64 route; member
364 { .route = 0x0, .port = 8, .type = TB_TYPE_PCIE_DOWN }, in tb_test_path_single_hop_walk()
365 { .route = 0x0, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_single_hop_walk()
366 { .route = 0x1, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_single_hop_walk()
367 { .route = 0x1, .port = 9, .type = TB_TYPE_PCIE_UP }, in tb_test_path_single_hop_walk()
376 src_port = &host->ports[8]; in tb_test_path_single_hop_walk()
377 dst_port = &dev->ports[9]; in tb_test_path_single_hop_walk()
384 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
385 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
386 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
393 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_single_hop_walk()
396 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
397 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
398 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
400 i--; in tb_test_path_single_hop_walk()
403 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_single_hop_walk()
420 { .route = 0x0, .port = 5, .type = TB_TYPE_DP_HDMI_IN }, in tb_test_path_daisy_chain_walk()
421 { .route = 0x0, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_daisy_chain_walk()
422 { .route = 0x1, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_daisy_chain_walk()
423 { .route = 0x1, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_daisy_chain_walk()
424 { .route = 0x301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_daisy_chain_walk()
425 { .route = 0x301, .port = 13, .type = TB_TYPE_DP_HDMI_OUT }, in tb_test_path_daisy_chain_walk()
435 src_port = &host->ports[5]; in tb_test_path_daisy_chain_walk()
436 dst_port = &dev2->ports[13]; in tb_test_path_daisy_chain_walk()
443 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
444 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
445 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
452 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_daisy_chain_walk()
455 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
456 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
457 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
459 i--; in tb_test_path_daisy_chain_walk()
462 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_daisy_chain_walk()
481 { .route = 0x0, .port = 5, .type = TB_TYPE_DP_HDMI_IN }, in tb_test_path_simple_tree_walk()
482 { .route = 0x0, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_simple_tree_walk()
483 { .route = 0x1, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_simple_tree_walk()
484 { .route = 0x1, .port = 5, .type = TB_TYPE_PORT }, in tb_test_path_simple_tree_walk()
485 { .route = 0x501, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_simple_tree_walk()
486 { .route = 0x501, .port = 13, .type = TB_TYPE_DP_HDMI_OUT }, in tb_test_path_simple_tree_walk()
498 src_port = &host->ports[5]; in tb_test_path_simple_tree_walk()
499 dst_port = &dev3->ports[13]; in tb_test_path_simple_tree_walk()
506 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
507 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
508 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
515 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_simple_tree_walk()
518 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
519 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
520 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
522 i--; in tb_test_path_simple_tree_walk()
525 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_simple_tree_walk()
552 { .route = 0x50301, .port = 13, .type = TB_TYPE_DP_HDMI_IN }, in tb_test_path_complex_tree_walk()
553 { .route = 0x50301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
554 { .route = 0x301, .port = 5, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
555 { .route = 0x301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
556 { .route = 0x1, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
557 { .route = 0x1, .port = 7, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
558 { .route = 0x701, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
559 { .route = 0x701, .port = 7, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
560 { .route = 0x70701, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
561 { .route = 0x70701, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
562 { .route = 0x3070701, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
563 { .route = 0x3070701, .port = 5, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
564 { .route = 0x503070701, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_complex_tree_walk()
565 { .route = 0x503070701, .port = 14, .type = TB_TYPE_DP_HDMI_OUT }, in tb_test_path_complex_tree_walk()
582 src_port = &dev3->ports[13]; in tb_test_path_complex_tree_walk()
583 dst_port = &dev9->ports[14]; in tb_test_path_complex_tree_walk()
590 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
591 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
592 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
599 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_complex_tree_walk()
602 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
603 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
604 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
606 i--; in tb_test_path_complex_tree_walk()
609 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_complex_tree_walk()
643 { .route = 0x30303030301, .port = 13, .type = TB_TYPE_DP_HDMI_IN }, in tb_test_path_max_length_walk()
644 { .route = 0x30303030301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
645 { .route = 0x303030301, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
646 { .route = 0x303030301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
647 { .route = 0x3030301, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
648 { .route = 0x3030301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
649 { .route = 0x30301, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
650 { .route = 0x30301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
651 { .route = 0x301, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
652 { .route = 0x301, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
653 { .route = 0x1, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
654 { .route = 0x1, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
655 { .route = 0x0, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
656 { .route = 0x0, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
657 { .route = 0x3, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
658 { .route = 0x3, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
659 { .route = 0x303, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
660 { .route = 0x303, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
661 { .route = 0x30303, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
662 { .route = 0x30303, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
663 { .route = 0x3030303, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
664 { .route = 0x3030303, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
665 { .route = 0x303030303, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
666 { .route = 0x303030303, .port = 3, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
667 { .route = 0x30303030303, .port = 1, .type = TB_TYPE_PORT }, in tb_test_path_max_length_walk()
668 { .route = 0x30303030303, .port = 13, .type = TB_TYPE_DP_HDMI_OUT }, in tb_test_path_max_length_walk()
685 src_port = &dev6->ports[13]; in tb_test_path_max_length_walk()
686 dst_port = &dev12->ports[13]; in tb_test_path_max_length_walk()
693 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
694 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
695 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
702 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_max_length_walk()
705 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
706 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
707 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
709 i--; in tb_test_path_max_length_walk()
712 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_max_length_walk()
718 struct tb_port *down, *up; in tb_test_path_not_connected() local
726 down = &dev1->ports[10]; in tb_test_path_not_connected()
727 up = &dev2->ports[9]; in tb_test_path_not_connected()
729 path = tb_path_alloc(NULL, down, 8, up, 8, 0, "PCIe Down"); in tb_test_path_not_connected()
731 path = tb_path_alloc(NULL, down, 8, up, 8, 1, "PCIe Down"); in tb_test_path_not_connected()
736 u64 route; member
755 .route = 0x0, in tb_test_path_not_bonded_lane0()
762 .route = 0x3, in tb_test_path_not_bonded_lane0()
770 struct tb_port *down, *up; in tb_test_path_not_bonded_lane0() local
777 down = &host->ports[9]; in tb_test_path_not_bonded_lane0()
778 up = &dev->ports[9]; in tb_test_path_not_bonded_lane0()
780 path = tb_path_alloc(NULL, down, 8, up, 8, 0, "PCIe Down"); in tb_test_path_not_bonded_lane0()
782 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane0()
786 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane0()
787 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane0()
789 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
790 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane0()
791 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane0()
793 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
794 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane0()
795 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane0()
817 .route = 0x0, in tb_test_path_not_bonded_lane1()
824 .route = 0x1, in tb_test_path_not_bonded_lane1()
839 in = &host->ports[5]; in tb_test_path_not_bonded_lane1()
840 out = &dev->ports[13]; in tb_test_path_not_bonded_lane1()
844 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1()
848 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1()
849 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1()
851 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
852 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1()
853 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1()
855 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
856 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1()
857 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1()
881 .route = 0x0, in tb_test_path_not_bonded_lane1_chain()
888 .route = 0x1, in tb_test_path_not_bonded_lane1_chain()
895 .route = 0x701, in tb_test_path_not_bonded_lane1_chain()
902 .route = 0x50701, in tb_test_path_not_bonded_lane1_chain()
919 in = &host->ports[5]; in tb_test_path_not_bonded_lane1_chain()
920 out = &dev3->ports[13]; in tb_test_path_not_bonded_lane1_chain()
924 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain()
928 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1_chain()
929 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1_chain()
931 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
932 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain()
933 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain()
935 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
936 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain()
937 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain()
961 .route = 0x50701, in tb_test_path_not_bonded_lane1_chain_reverse()
968 .route = 0x701, in tb_test_path_not_bonded_lane1_chain_reverse()
975 .route = 0x1, in tb_test_path_not_bonded_lane1_chain_reverse()
982 .route = 0x0, in tb_test_path_not_bonded_lane1_chain_reverse()
999 in = &dev3->ports[13]; in tb_test_path_not_bonded_lane1_chain_reverse()
1000 out = &host->ports[5]; in tb_test_path_not_bonded_lane1_chain_reverse()
1004 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain_reverse()
1008 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1_chain_reverse()
1009 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1_chain_reverse()
1011 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1012 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1013 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1015 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1016 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1017 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1045 .route = 0x0, in tb_test_path_mixed_chain()
1052 .route = 0x1, in tb_test_path_mixed_chain()
1059 .route = 0x701, in tb_test_path_mixed_chain()
1066 .route = 0x50701, in tb_test_path_mixed_chain()
1073 .route = 0x3050701, in tb_test_path_mixed_chain()
1091 in = &host->ports[5]; in tb_test_path_mixed_chain()
1092 out = &dev4->ports[13]; in tb_test_path_mixed_chain()
1096 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain()
1100 in_port = path->hops[i].in_port; in tb_test_path_mixed_chain()
1101 out_port = path->hops[i].out_port; in tb_test_path_mixed_chain()
1103 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1104 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain()
1105 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain()
1107 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1108 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain()
1109 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain()
1137 .route = 0x3050701, in tb_test_path_mixed_chain_reverse()
1144 .route = 0x50701, in tb_test_path_mixed_chain_reverse()
1151 .route = 0x701, in tb_test_path_mixed_chain_reverse()
1158 .route = 0x1, in tb_test_path_mixed_chain_reverse()
1165 .route = 0x0, in tb_test_path_mixed_chain_reverse()
1183 in = &dev4->ports[13]; in tb_test_path_mixed_chain_reverse()
1184 out = &host->ports[5]; in tb_test_path_mixed_chain_reverse()
1188 KUNIT_ASSERT_EQ(test, path->path_length, (int)ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain_reverse()
1192 in_port = path->hops[i].in_port; in tb_test_path_mixed_chain_reverse()
1193 out_port = path->hops[i].out_port; in tb_test_path_mixed_chain_reverse()
1195 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1196 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain_reverse()
1197 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain_reverse()
1199 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1200 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain_reverse()
1201 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain_reverse()
1211 struct tb_port *down, *up; in tb_test_tunnel_pcie() local
1228 down = &host->ports[8]; in tb_test_tunnel_pcie()
1229 up = &dev1->ports[9]; in tb_test_tunnel_pcie()
1230 tunnel1 = tb_tunnel_alloc_pci(NULL, up, down); in tb_test_tunnel_pcie()
1232 KUNIT_EXPECT_EQ(test, tunnel1->type, (enum tb_tunnel_type)TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1233 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_pcie()
1234 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_pcie()
1235 KUNIT_ASSERT_EQ(test, tunnel1->npaths, (size_t)2); in tb_test_tunnel_pcie()
1236 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1237 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1238 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1239 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1240 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1241 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1243 down = &dev1->ports[10]; in tb_test_tunnel_pcie()
1244 up = &dev2->ports[9]; in tb_test_tunnel_pcie()
1245 tunnel2 = tb_tunnel_alloc_pci(NULL, up, down); in tb_test_tunnel_pcie()
1247 KUNIT_EXPECT_EQ(test, tunnel2->type, (enum tb_tunnel_type)TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1248 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_pcie()
1249 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_pcie()
1250 KUNIT_ASSERT_EQ(test, tunnel2->npaths, (size_t)2); in tb_test_tunnel_pcie()
1251 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1252 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1253 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1254 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1255 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1256 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1279 in = &host->ports[5]; in tb_test_tunnel_dp()
1280 out = &dev->ports[13]; in tb_test_tunnel_dp()
1284 KUNIT_EXPECT_EQ(test, tunnel->type, (enum tb_tunnel_type)TB_TUNNEL_DP); in tb_test_tunnel_dp()
1285 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp()
1286 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp()
1287 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_tunnel_dp()
1288 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 2); in tb_test_tunnel_dp()
1289 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp()
1290 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].out_port, out); in tb_test_tunnel_dp()
1291 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 2); in tb_test_tunnel_dp()
1292 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp()
1293 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].out_port, out); in tb_test_tunnel_dp()
1294 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 2); in tb_test_tunnel_dp()
1295 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp()
1296 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[1].out_port, in); in tb_test_tunnel_dp()
1325 in = &host->ports[5]; in tb_test_tunnel_dp_chain()
1326 out = &dev4->ports[14]; in tb_test_tunnel_dp_chain()
1330 KUNIT_EXPECT_EQ(test, tunnel->type, (enum tb_tunnel_type)TB_TUNNEL_DP); in tb_test_tunnel_dp_chain()
1331 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_chain()
1332 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_chain()
1333 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_tunnel_dp_chain()
1334 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 3); in tb_test_tunnel_dp_chain()
1335 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1336 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1337 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 3); in tb_test_tunnel_dp_chain()
1338 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1339 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1340 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 3); in tb_test_tunnel_dp_chain()
1341 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_chain()
1342 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[2].out_port, in); in tb_test_tunnel_dp_chain()
1375 in = &dev2->ports[13]; in tb_test_tunnel_dp_tree()
1376 out = &dev5->ports[13]; in tb_test_tunnel_dp_tree()
1380 KUNIT_EXPECT_EQ(test, tunnel->type, (enum tb_tunnel_type)TB_TUNNEL_DP); in tb_test_tunnel_dp_tree()
1381 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_tree()
1382 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_tree()
1383 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_tunnel_dp_tree()
1384 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 4); in tb_test_tunnel_dp_tree()
1385 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1386 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1387 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 4); in tb_test_tunnel_dp_tree()
1388 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1389 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1390 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 4); in tb_test_tunnel_dp_tree()
1391 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_tree()
1392 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[3].out_port, in); in tb_test_tunnel_dp_tree()
1440 in = &dev6->ports[13]; in tb_test_tunnel_dp_max_length()
1441 out = &dev12->ports[13]; in tb_test_tunnel_dp_max_length()
1445 KUNIT_EXPECT_EQ(test, tunnel->type, (enum tb_tunnel_type)TB_TUNNEL_DP); in tb_test_tunnel_dp_max_length()
1446 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_max_length()
1447 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_max_length()
1448 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_tunnel_dp_max_length()
1449 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 13); in tb_test_tunnel_dp_max_length()
1451 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1453 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1454 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1455 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1456 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1458 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1459 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 13); in tb_test_tunnel_dp_max_length()
1460 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1461 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1462 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1463 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1464 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1465 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1466 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 13); in tb_test_tunnel_dp_max_length()
1467 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_max_length()
1468 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1469 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1470 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1471 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1472 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[12].out_port, in); in tb_test_tunnel_dp_max_length()
1480 struct tb_port *down, *up; in tb_test_tunnel_usb3() local
1497 down = &host->ports[12]; in tb_test_tunnel_usb3()
1498 up = &dev1->ports[16]; in tb_test_tunnel_usb3()
1499 tunnel1 = tb_tunnel_alloc_usb3(NULL, up, down, 0, 0); in tb_test_tunnel_usb3()
1501 KUNIT_EXPECT_EQ(test, tunnel1->type, (enum tb_tunnel_type)TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1502 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_usb3()
1503 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_usb3()
1504 KUNIT_ASSERT_EQ(test, tunnel1->npaths, (size_t)2); in tb_test_tunnel_usb3()
1505 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1506 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1507 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1508 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1509 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1510 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1512 down = &dev1->ports[17]; in tb_test_tunnel_usb3()
1513 up = &dev2->ports[16]; in tb_test_tunnel_usb3()
1514 tunnel2 = tb_tunnel_alloc_usb3(NULL, up, down, 0, 0); in tb_test_tunnel_usb3()
1516 KUNIT_EXPECT_EQ(test, tunnel2->type, (enum tb_tunnel_type)TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1517 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_usb3()
1518 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_usb3()
1519 KUNIT_ASSERT_EQ(test, tunnel2->npaths, (size_t)2); in tb_test_tunnel_usb3()
1520 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1521 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1522 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1523 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1524 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1525 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1558 in = &dev2->ports[13]; in tb_test_tunnel_port_on_path()
1559 out = &dev5->ports[13]; in tb_test_tunnel_port_on_path()
1567 port = &host->ports[8]; in tb_test_tunnel_port_on_path()
1570 port = &host->ports[3]; in tb_test_tunnel_port_on_path()
1573 port = &dev1->ports[1]; in tb_test_tunnel_port_on_path()
1576 port = &dev1->ports[3]; in tb_test_tunnel_port_on_path()
1579 port = &dev1->ports[5]; in tb_test_tunnel_port_on_path()
1582 port = &dev1->ports[7]; in tb_test_tunnel_port_on_path()
1585 port = &dev3->ports[1]; in tb_test_tunnel_port_on_path()
1588 port = &dev5->ports[1]; in tb_test_tunnel_port_on_path()
1591 port = &dev4->ports[1]; in tb_test_tunnel_port_on_path()