Lines Matching +full:out +full:- +full:ports

1 // SPDX-License-Identifier: GPL-2.0
20 res->data = ida; in __ida_init()
26 struct ida *ida = res->data; in __ida_destroy()
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].total_credits = 60; in alloc_host()
91 sw->ports[1].ctl_credits = 2; in alloc_host()
92 sw->ports[1].dual_link_port = &sw->ports[2]; in alloc_host()
94 sw->ports[2].config.type = TB_TYPE_PORT; in alloc_host()
95 sw->ports[2].config.max_in_hop_id = 19; in alloc_host()
96 sw->ports[2].config.max_out_hop_id = 19; in alloc_host()
97 sw->ports[2].total_credits = 60; in alloc_host()
98 sw->ports[2].ctl_credits = 2; in alloc_host()
99 sw->ports[2].dual_link_port = &sw->ports[1]; in alloc_host()
100 sw->ports[2].link_nr = 1; in alloc_host()
102 sw->ports[3].config.type = TB_TYPE_PORT; in alloc_host()
103 sw->ports[3].config.max_in_hop_id = 19; in alloc_host()
104 sw->ports[3].config.max_out_hop_id = 19; in alloc_host()
105 sw->ports[3].total_credits = 60; in alloc_host()
106 sw->ports[3].ctl_credits = 2; in alloc_host()
107 sw->ports[3].dual_link_port = &sw->ports[4]; in alloc_host()
109 sw->ports[4].config.type = TB_TYPE_PORT; in alloc_host()
110 sw->ports[4].config.max_in_hop_id = 19; in alloc_host()
111 sw->ports[4].config.max_out_hop_id = 19; in alloc_host()
112 sw->ports[4].total_credits = 60; in alloc_host()
113 sw->ports[4].ctl_credits = 2; in alloc_host()
114 sw->ports[4].dual_link_port = &sw->ports[3]; in alloc_host()
115 sw->ports[4].link_nr = 1; in alloc_host()
117 sw->ports[5].config.type = TB_TYPE_DP_HDMI_IN; in alloc_host()
118 sw->ports[5].config.max_in_hop_id = 9; in alloc_host()
119 sw->ports[5].config.max_out_hop_id = 9; in alloc_host()
120 sw->ports[5].cap_adap = -1; in alloc_host()
122 sw->ports[6].config.type = TB_TYPE_DP_HDMI_IN; in alloc_host()
123 sw->ports[6].config.max_in_hop_id = 9; in alloc_host()
124 sw->ports[6].config.max_out_hop_id = 9; in alloc_host()
125 sw->ports[6].cap_adap = -1; in alloc_host()
127 sw->ports[7].config.type = TB_TYPE_NHI; in alloc_host()
128 sw->ports[7].config.max_in_hop_id = 11; in alloc_host()
129 sw->ports[7].config.max_out_hop_id = 11; in alloc_host()
130 sw->ports[7].config.nfc_credits = 0x41800000; in alloc_host()
132 sw->ports[8].config.type = TB_TYPE_PCIE_DOWN; in alloc_host()
133 sw->ports[8].config.max_in_hop_id = 8; in alloc_host()
134 sw->ports[8].config.max_out_hop_id = 8; in alloc_host()
136 sw->ports[9].config.type = TB_TYPE_PCIE_DOWN; in alloc_host()
137 sw->ports[9].config.max_in_hop_id = 8; in alloc_host()
138 sw->ports[9].config.max_out_hop_id = 8; in alloc_host()
140 sw->ports[10].disabled = true; in alloc_host()
141 sw->ports[11].disabled = true; in alloc_host()
143 sw->ports[12].config.type = TB_TYPE_USB3_DOWN; in alloc_host()
144 sw->ports[12].config.max_in_hop_id = 8; in alloc_host()
145 sw->ports[12].config.max_out_hop_id = 8; in alloc_host()
147 sw->ports[13].config.type = TB_TYPE_USB3_DOWN; in alloc_host()
148 sw->ports[13].config.max_in_hop_id = 8; in alloc_host()
149 sw->ports[13].config.max_out_hop_id = 8; in alloc_host()
162 sw->generation = 4; in alloc_host_usb4()
163 sw->credit_allocation = true; in alloc_host_usb4()
164 sw->max_usb3_credits = 32; in alloc_host_usb4()
165 sw->min_dp_aux_credits = 1; in alloc_host_usb4()
166 sw->min_dp_main_credits = 0; in alloc_host_usb4()
167 sw->max_pcie_credits = 64; in alloc_host_usb4()
168 sw->max_dma_credits = 14; in alloc_host_usb4()
184 sw->config.vendor_id = 0x8086; in alloc_dev_default()
185 sw->config.device_id = 0x15ef; in alloc_dev_default()
187 sw->ports[0].config.type = TB_TYPE_PORT; in alloc_dev_default()
188 sw->ports[0].config.max_in_hop_id = 8; in alloc_dev_default()
189 sw->ports[0].config.max_out_hop_id = 8; in alloc_dev_default()
191 sw->ports[1].config.type = TB_TYPE_PORT; in alloc_dev_default()
192 sw->ports[1].config.max_in_hop_id = 19; in alloc_dev_default()
193 sw->ports[1].config.max_out_hop_id = 19; in alloc_dev_default()
194 sw->ports[1].total_credits = 60; in alloc_dev_default()
195 sw->ports[1].ctl_credits = 2; in alloc_dev_default()
196 sw->ports[1].dual_link_port = &sw->ports[2]; in alloc_dev_default()
198 sw->ports[2].config.type = TB_TYPE_PORT; in alloc_dev_default()
199 sw->ports[2].config.max_in_hop_id = 19; in alloc_dev_default()
200 sw->ports[2].config.max_out_hop_id = 19; in alloc_dev_default()
201 sw->ports[2].total_credits = 60; in alloc_dev_default()
202 sw->ports[2].ctl_credits = 2; in alloc_dev_default()
203 sw->ports[2].dual_link_port = &sw->ports[1]; in alloc_dev_default()
204 sw->ports[2].link_nr = 1; in alloc_dev_default()
206 sw->ports[3].config.type = TB_TYPE_PORT; in alloc_dev_default()
207 sw->ports[3].config.max_in_hop_id = 19; in alloc_dev_default()
208 sw->ports[3].config.max_out_hop_id = 19; in alloc_dev_default()
209 sw->ports[3].total_credits = 60; in alloc_dev_default()
210 sw->ports[3].ctl_credits = 2; in alloc_dev_default()
211 sw->ports[3].dual_link_port = &sw->ports[4]; in alloc_dev_default()
213 sw->ports[4].config.type = TB_TYPE_PORT; in alloc_dev_default()
214 sw->ports[4].config.max_in_hop_id = 19; in alloc_dev_default()
215 sw->ports[4].config.max_out_hop_id = 19; in alloc_dev_default()
216 sw->ports[4].total_credits = 60; in alloc_dev_default()
217 sw->ports[4].ctl_credits = 2; in alloc_dev_default()
218 sw->ports[4].dual_link_port = &sw->ports[3]; in alloc_dev_default()
219 sw->ports[4].link_nr = 1; in alloc_dev_default()
221 sw->ports[5].config.type = TB_TYPE_PORT; in alloc_dev_default()
222 sw->ports[5].config.max_in_hop_id = 19; in alloc_dev_default()
223 sw->ports[5].config.max_out_hop_id = 19; in alloc_dev_default()
224 sw->ports[5].total_credits = 60; in alloc_dev_default()
225 sw->ports[5].ctl_credits = 2; in alloc_dev_default()
226 sw->ports[5].dual_link_port = &sw->ports[6]; in alloc_dev_default()
228 sw->ports[6].config.type = TB_TYPE_PORT; in alloc_dev_default()
229 sw->ports[6].config.max_in_hop_id = 19; in alloc_dev_default()
230 sw->ports[6].config.max_out_hop_id = 19; in alloc_dev_default()
231 sw->ports[6].total_credits = 60; in alloc_dev_default()
232 sw->ports[6].ctl_credits = 2; in alloc_dev_default()
233 sw->ports[6].dual_link_port = &sw->ports[5]; in alloc_dev_default()
234 sw->ports[6].link_nr = 1; in alloc_dev_default()
236 sw->ports[7].config.type = TB_TYPE_PORT; in alloc_dev_default()
237 sw->ports[7].config.max_in_hop_id = 19; in alloc_dev_default()
238 sw->ports[7].config.max_out_hop_id = 19; in alloc_dev_default()
239 sw->ports[7].total_credits = 60; in alloc_dev_default()
240 sw->ports[7].ctl_credits = 2; in alloc_dev_default()
241 sw->ports[7].dual_link_port = &sw->ports[8]; in alloc_dev_default()
243 sw->ports[8].config.type = TB_TYPE_PORT; in alloc_dev_default()
244 sw->ports[8].config.max_in_hop_id = 19; in alloc_dev_default()
245 sw->ports[8].config.max_out_hop_id = 19; in alloc_dev_default()
246 sw->ports[8].total_credits = 60; in alloc_dev_default()
247 sw->ports[8].ctl_credits = 2; in alloc_dev_default()
248 sw->ports[8].dual_link_port = &sw->ports[7]; in alloc_dev_default()
249 sw->ports[8].link_nr = 1; in alloc_dev_default()
251 sw->ports[9].config.type = TB_TYPE_PCIE_UP; in alloc_dev_default()
252 sw->ports[9].config.max_in_hop_id = 8; in alloc_dev_default()
253 sw->ports[9].config.max_out_hop_id = 8; in alloc_dev_default()
255 sw->ports[10].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
256 sw->ports[10].config.max_in_hop_id = 8; in alloc_dev_default()
257 sw->ports[10].config.max_out_hop_id = 8; in alloc_dev_default()
259 sw->ports[11].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
260 sw->ports[11].config.max_in_hop_id = 8; in alloc_dev_default()
261 sw->ports[11].config.max_out_hop_id = 8; in alloc_dev_default()
263 sw->ports[12].config.type = TB_TYPE_PCIE_DOWN; in alloc_dev_default()
264 sw->ports[12].config.max_in_hop_id = 8; in alloc_dev_default()
265 sw->ports[12].config.max_out_hop_id = 8; in alloc_dev_default()
267 sw->ports[13].config.type = TB_TYPE_DP_HDMI_OUT; in alloc_dev_default()
268 sw->ports[13].config.max_in_hop_id = 9; in alloc_dev_default()
269 sw->ports[13].config.max_out_hop_id = 9; in alloc_dev_default()
270 sw->ports[13].cap_adap = -1; in alloc_dev_default()
272 sw->ports[14].config.type = TB_TYPE_DP_HDMI_OUT; in alloc_dev_default()
273 sw->ports[14].config.max_in_hop_id = 9; in alloc_dev_default()
274 sw->ports[14].config.max_out_hop_id = 9; in alloc_dev_default()
275 sw->ports[14].cap_adap = -1; in alloc_dev_default()
277 sw->ports[15].disabled = true; in alloc_dev_default()
279 sw->ports[16].config.type = TB_TYPE_USB3_UP; in alloc_dev_default()
280 sw->ports[16].config.max_in_hop_id = 8; in alloc_dev_default()
281 sw->ports[16].config.max_out_hop_id = 8; in alloc_dev_default()
283 sw->ports[17].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
284 sw->ports[17].config.max_in_hop_id = 8; in alloc_dev_default()
285 sw->ports[17].config.max_out_hop_id = 8; in alloc_dev_default()
287 sw->ports[18].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
288 sw->ports[18].config.max_in_hop_id = 8; in alloc_dev_default()
289 sw->ports[18].config.max_out_hop_id = 8; in alloc_dev_default()
291 sw->ports[19].config.type = TB_TYPE_USB3_DOWN; in alloc_dev_default()
292 sw->ports[19].config.max_in_hop_id = 8; in alloc_dev_default()
293 sw->ports[19].config.max_out_hop_id = 8; in alloc_dev_default()
301 port->remote = upstream_port; in alloc_dev_default()
302 upstream_port->remote = port; in alloc_dev_default()
303 if (port->dual_link_port && upstream_port->dual_link_port) { in alloc_dev_default()
304 port->dual_link_port->remote = upstream_port->dual_link_port; in alloc_dev_default()
305 upstream_port->dual_link_port->remote = port->dual_link_port; in alloc_dev_default()
309 port->bonded = true; in alloc_dev_default()
310 port->total_credits *= 2; in alloc_dev_default()
311 port->dual_link_port->bonded = true; in alloc_dev_default()
312 port->dual_link_port->total_credits = 0; in alloc_dev_default()
313 upstream_port->bonded = true; in alloc_dev_default()
314 upstream_port->total_credits *= 2; in alloc_dev_default()
315 upstream_port->dual_link_port->bonded = true; in alloc_dev_default()
316 upstream_port->dual_link_port->total_credits = 0; in alloc_dev_default()
333 sw->ports[13].config.type = TB_TYPE_DP_HDMI_IN; in alloc_dev_with_dpin()
334 sw->ports[13].config.max_in_hop_id = 9; in alloc_dev_with_dpin()
335 sw->ports[13].config.max_out_hop_id = 9; in alloc_dev_with_dpin()
337 sw->ports[14].config.type = TB_TYPE_DP_HDMI_IN; in alloc_dev_with_dpin()
338 sw->ports[14].config.max_in_hop_id = 9; in alloc_dev_with_dpin()
339 sw->ports[14].config.max_out_hop_id = 9; in alloc_dev_with_dpin()
354 sw->generation = 4; in alloc_dev_usb4()
355 sw->credit_allocation = true; in alloc_dev_usb4()
356 sw->max_usb3_credits = 14; in alloc_dev_usb4()
357 sw->min_dp_aux_credits = 1; in alloc_dev_usb4()
358 sw->min_dp_main_credits = 18; in alloc_dev_usb4()
359 sw->max_pcie_credits = 32; in alloc_dev_usb4()
360 sw->max_dma_credits = 14; in alloc_dev_usb4()
372 src_port = &host->ports[5]; in tb_test_path_basic()
391 src_port = &host->ports[12]; in tb_test_path_not_connected_walk()
392 dst_port = &dev->ports[16]; in tb_test_path_not_connected_walk()
398 KUNIT_EXPECT_PTR_EQ(test, p, &host->ports[3]); in tb_test_path_not_connected_walk()
409 KUNIT_EXPECT_PTR_EQ(test, p, &dev->ports[1]); in tb_test_path_not_connected_walk()
445 src_port = &host->ports[8]; in tb_test_path_single_hop_walk()
446 dst_port = &dev->ports[9]; in tb_test_path_single_hop_walk()
453 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
454 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
455 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
462 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_single_hop_walk()
465 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_single_hop_walk()
466 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_single_hop_walk()
467 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_single_hop_walk()
469 i--; in tb_test_path_single_hop_walk()
472 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_single_hop_walk()
478 * Walks from Host DP IN to Device #2 DP OUT. in tb_test_path_daisy_chain_walk()
504 src_port = &host->ports[5]; in tb_test_path_daisy_chain_walk()
505 dst_port = &dev2->ports[13]; in tb_test_path_daisy_chain_walk()
512 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
513 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
514 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
521 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_daisy_chain_walk()
524 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_daisy_chain_walk()
525 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_daisy_chain_walk()
526 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_daisy_chain_walk()
528 i--; in tb_test_path_daisy_chain_walk()
531 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_daisy_chain_walk()
537 * Walks from Host DP IN to Device #3 DP OUT. in tb_test_path_simple_tree_walk()
567 src_port = &host->ports[5]; in tb_test_path_simple_tree_walk()
568 dst_port = &dev3->ports[13]; in tb_test_path_simple_tree_walk()
575 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
576 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
577 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
584 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_simple_tree_walk()
587 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_simple_tree_walk()
588 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_simple_tree_walk()
589 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_simple_tree_walk()
591 i--; in tb_test_path_simple_tree_walk()
594 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_simple_tree_walk()
600 * Walks from Device #3 DP IN to Device #9 DP OUT. in tb_test_path_complex_tree_walk()
651 src_port = &dev3->ports[13]; in tb_test_path_complex_tree_walk()
652 dst_port = &dev9->ports[14]; in tb_test_path_complex_tree_walk()
659 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
660 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
661 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
668 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_complex_tree_walk()
671 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_complex_tree_walk()
672 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_complex_tree_walk()
673 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_complex_tree_walk()
675 i--; in tb_test_path_complex_tree_walk()
678 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_complex_tree_walk()
689 * Walks from Device #6 DP IN to Device #12 DP OUT. in tb_test_path_max_length_walk()
754 src_port = &dev6->ports[13]; in tb_test_path_max_length_walk()
755 dst_port = &dev12->ports[13]; in tb_test_path_max_length_walk()
762 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
763 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
764 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
771 i = ARRAY_SIZE(test_data) - 1; in tb_test_path_max_length_walk()
774 KUNIT_EXPECT_EQ(test, tb_route(p->sw), test_data[i].route); in tb_test_path_max_length_walk()
775 KUNIT_EXPECT_EQ(test, p->port, test_data[i].port); in tb_test_path_max_length_walk()
776 KUNIT_EXPECT_EQ(test, (enum tb_port_type)p->config.type, in tb_test_path_max_length_walk()
778 i--; in tb_test_path_max_length_walk()
781 KUNIT_EXPECT_EQ(test, i, -1); in tb_test_path_max_length_walk()
795 down = &dev1->ports[10]; in tb_test_path_not_connected()
796 up = &dev2->ports[9]; in tb_test_path_not_connected()
846 down = &host->ports[9]; in tb_test_path_not_bonded_lane0()
847 up = &dev->ports[9]; in tb_test_path_not_bonded_lane0()
851 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane0()
855 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane0()
856 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane0()
858 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
859 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane0()
860 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane0()
862 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane0()
863 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane0()
864 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane0()
901 struct tb_port *in, *out; in tb_test_path_not_bonded_lane1() local
908 in = &host->ports[5]; in tb_test_path_not_bonded_lane1()
909 out = &dev->ports[13]; in tb_test_path_not_bonded_lane1()
911 path = tb_path_alloc(NULL, in, 9, out, 9, 1, "Video"); in tb_test_path_not_bonded_lane1()
913 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1()
917 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1()
918 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1()
920 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
921 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1()
922 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1()
924 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1()
925 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1()
926 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1()
979 struct tb_port *in, *out; in tb_test_path_not_bonded_lane1_chain() local
988 in = &host->ports[5]; in tb_test_path_not_bonded_lane1_chain()
989 out = &dev3->ports[13]; in tb_test_path_not_bonded_lane1_chain()
991 path = tb_path_alloc(NULL, in, 9, out, 9, 1, "Video"); in tb_test_path_not_bonded_lane1_chain()
993 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain()
997 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1_chain()
998 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1_chain()
1000 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
1001 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain()
1002 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain()
1004 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain()
1005 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain()
1006 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain()
1059 struct tb_port *in, *out; in tb_test_path_not_bonded_lane1_chain_reverse() local
1068 in = &dev3->ports[13]; in tb_test_path_not_bonded_lane1_chain_reverse()
1069 out = &host->ports[5]; in tb_test_path_not_bonded_lane1_chain_reverse()
1071 path = tb_path_alloc(NULL, in, 9, out, 9, 1, "Video"); in tb_test_path_not_bonded_lane1_chain_reverse()
1073 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_not_bonded_lane1_chain_reverse()
1077 in_port = path->hops[i].in_port; in tb_test_path_not_bonded_lane1_chain_reverse()
1078 out_port = path->hops[i].out_port; in tb_test_path_not_bonded_lane1_chain_reverse()
1080 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1081 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1082 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1084 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_not_bonded_lane1_chain_reverse()
1085 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_not_bonded_lane1_chain_reverse()
1086 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_not_bonded_lane1_chain_reverse()
1150 struct tb_port *in, *out; in tb_test_path_mixed_chain() local
1160 in = &host->ports[5]; in tb_test_path_mixed_chain()
1161 out = &dev4->ports[13]; in tb_test_path_mixed_chain()
1163 path = tb_path_alloc(NULL, in, 9, out, 9, 1, "Video"); in tb_test_path_mixed_chain()
1165 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain()
1169 in_port = path->hops[i].in_port; in tb_test_path_mixed_chain()
1170 out_port = path->hops[i].out_port; in tb_test_path_mixed_chain()
1172 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1173 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain()
1174 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain()
1176 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain()
1177 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain()
1178 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain()
1242 struct tb_port *in, *out; in tb_test_path_mixed_chain_reverse() local
1252 in = &dev4->ports[13]; in tb_test_path_mixed_chain_reverse()
1253 out = &host->ports[5]; in tb_test_path_mixed_chain_reverse()
1255 path = tb_path_alloc(NULL, in, 9, out, 9, 1, "Video"); in tb_test_path_mixed_chain_reverse()
1257 KUNIT_ASSERT_EQ(test, path->path_length, ARRAY_SIZE(test_data)); in tb_test_path_mixed_chain_reverse()
1261 in_port = path->hops[i].in_port; in tb_test_path_mixed_chain_reverse()
1262 out_port = path->hops[i].out_port; in tb_test_path_mixed_chain_reverse()
1264 KUNIT_EXPECT_EQ(test, tb_route(in_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1265 KUNIT_EXPECT_EQ(test, in_port->port, test_data[i].in_port); in tb_test_path_mixed_chain_reverse()
1266 KUNIT_EXPECT_EQ(test, (enum tb_port_type)in_port->config.type, in tb_test_path_mixed_chain_reverse()
1268 KUNIT_EXPECT_EQ(test, tb_route(out_port->sw), test_data[i].route); in tb_test_path_mixed_chain_reverse()
1269 KUNIT_EXPECT_EQ(test, out_port->port, test_data[i].out_port); in tb_test_path_mixed_chain_reverse()
1270 KUNIT_EXPECT_EQ(test, (enum tb_port_type)out_port->config.type, in tb_test_path_mixed_chain_reverse()
1297 down = &host->ports[8]; in tb_test_tunnel_pcie()
1298 up = &dev1->ports[9]; in tb_test_tunnel_pcie()
1301 KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1302 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_pcie()
1303 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_pcie()
1304 KUNIT_ASSERT_EQ(test, tunnel1->npaths, 2); in tb_test_tunnel_pcie()
1305 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1306 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1307 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1308 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1309 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1310 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1312 down = &dev1->ports[10]; in tb_test_tunnel_pcie()
1313 up = &dev2->ports[9]; in tb_test_tunnel_pcie()
1316 KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_PCI); in tb_test_tunnel_pcie()
1317 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_pcie()
1318 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_pcie()
1319 KUNIT_ASSERT_EQ(test, tunnel2->npaths, 2); in tb_test_tunnel_pcie()
1320 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_pcie()
1321 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_pcie()
1322 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_pcie()
1323 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_pcie()
1324 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_pcie()
1325 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_pcie()
1334 struct tb_port *in, *out; in tb_test_tunnel_dp() local
1348 in = &host->ports[5]; in tb_test_tunnel_dp()
1349 out = &dev->ports[13]; in tb_test_tunnel_dp()
1351 tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_tunnel_dp()
1353 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp()
1354 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp()
1355 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp()
1356 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp()
1357 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 2); in tb_test_tunnel_dp()
1358 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp()
1359 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].out_port, out); in tb_test_tunnel_dp()
1360 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 2); in tb_test_tunnel_dp()
1361 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp()
1362 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].out_port, out); in tb_test_tunnel_dp()
1363 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 2); in tb_test_tunnel_dp()
1364 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp()
1365 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[1].out_port, in); in tb_test_tunnel_dp()
1372 struct tb_port *in, *out; in tb_test_tunnel_dp_chain() local
1376 * Create DP tunnel from Host DP IN to Device #4 DP OUT. in tb_test_tunnel_dp_chain()
1394 in = &host->ports[5]; in tb_test_tunnel_dp_chain()
1395 out = &dev4->ports[14]; in tb_test_tunnel_dp_chain()
1397 tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_tunnel_dp_chain()
1399 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_chain()
1400 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_chain()
1401 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_chain()
1402 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_chain()
1403 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 3); in tb_test_tunnel_dp_chain()
1404 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1405 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1406 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 3); in tb_test_tunnel_dp_chain()
1407 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_chain()
1408 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].out_port, out); in tb_test_tunnel_dp_chain()
1409 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 3); in tb_test_tunnel_dp_chain()
1410 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_chain()
1411 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[2].out_port, in); in tb_test_tunnel_dp_chain()
1418 struct tb_port *in, *out; in tb_test_tunnel_dp_tree() local
1422 * Create DP tunnel from Device #2 DP IN to Device #5 DP OUT. in tb_test_tunnel_dp_tree()
1444 in = &dev2->ports[13]; in tb_test_tunnel_dp_tree()
1445 out = &dev5->ports[13]; in tb_test_tunnel_dp_tree()
1447 tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_tunnel_dp_tree()
1449 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_tree()
1450 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_tree()
1451 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_tree()
1452 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_tree()
1453 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 4); in tb_test_tunnel_dp_tree()
1454 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1455 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1456 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 4); in tb_test_tunnel_dp_tree()
1457 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_tree()
1458 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[3].out_port, out); in tb_test_tunnel_dp_tree()
1459 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 4); in tb_test_tunnel_dp_tree()
1460 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_tree()
1461 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[3].out_port, in); in tb_test_tunnel_dp_tree()
1469 struct tb_port *in, *out; in tb_test_tunnel_dp_max_length() local
1509 in = &dev6->ports[13]; in tb_test_tunnel_dp_max_length()
1510 out = &dev12->ports[13]; in tb_test_tunnel_dp_max_length()
1512 tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_tunnel_dp_max_length()
1514 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); in tb_test_tunnel_dp_max_length()
1515 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); in tb_test_tunnel_dp_max_length()
1516 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, out); in tb_test_tunnel_dp_max_length()
1517 KUNIT_ASSERT_EQ(test, tunnel->npaths, 3); in tb_test_tunnel_dp_max_length()
1518 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 13); in tb_test_tunnel_dp_max_length()
1520 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1522 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1523 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1524 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1525 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1527 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1528 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 13); in tb_test_tunnel_dp_max_length()
1529 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, in); in tb_test_tunnel_dp_max_length()
1530 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1531 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1532 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1533 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1534 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[12].out_port, out); in tb_test_tunnel_dp_max_length()
1535 KUNIT_ASSERT_EQ(test, tunnel->paths[2]->path_length, 13); in tb_test_tunnel_dp_max_length()
1536 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[0].in_port, out); in tb_test_tunnel_dp_max_length()
1537 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].in_port, in tb_test_tunnel_dp_max_length()
1538 &host->ports[3]); in tb_test_tunnel_dp_max_length()
1539 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[6].out_port, in tb_test_tunnel_dp_max_length()
1540 &host->ports[1]); in tb_test_tunnel_dp_max_length()
1541 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[2]->hops[12].out_port, in); in tb_test_tunnel_dp_max_length()
1566 down = &host->ports[12]; in tb_test_tunnel_usb3()
1567 up = &dev1->ports[16]; in tb_test_tunnel_usb3()
1570 KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1571 KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, down); in tb_test_tunnel_usb3()
1572 KUNIT_EXPECT_PTR_EQ(test, tunnel1->dst_port, up); in tb_test_tunnel_usb3()
1573 KUNIT_ASSERT_EQ(test, tunnel1->npaths, 2); in tb_test_tunnel_usb3()
1574 KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1575 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1576 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1577 KUNIT_ASSERT_EQ(test, tunnel1->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1578 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1579 KUNIT_EXPECT_PTR_EQ(test, tunnel1->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1581 down = &dev1->ports[17]; in tb_test_tunnel_usb3()
1582 up = &dev2->ports[16]; in tb_test_tunnel_usb3()
1585 KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_USB3); in tb_test_tunnel_usb3()
1586 KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, down); in tb_test_tunnel_usb3()
1587 KUNIT_EXPECT_PTR_EQ(test, tunnel2->dst_port, up); in tb_test_tunnel_usb3()
1588 KUNIT_ASSERT_EQ(test, tunnel2->npaths, 2); in tb_test_tunnel_usb3()
1589 KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 2); in tb_test_tunnel_usb3()
1590 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[0].in_port, down); in tb_test_tunnel_usb3()
1591 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[0]->hops[1].out_port, up); in tb_test_tunnel_usb3()
1592 KUNIT_ASSERT_EQ(test, tunnel2->paths[1]->path_length, 2); in tb_test_tunnel_usb3()
1593 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[0].in_port, up); in tb_test_tunnel_usb3()
1594 KUNIT_EXPECT_PTR_EQ(test, tunnel2->paths[1]->hops[1].out_port, down); in tb_test_tunnel_usb3()
1603 struct tb_port *in, *out, *port; in tb_test_tunnel_port_on_path() local
1627 in = &dev2->ports[13]; in tb_test_tunnel_port_on_path()
1628 out = &dev5->ports[13]; in tb_test_tunnel_port_on_path()
1630 dp_tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_tunnel_port_on_path()
1634 KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, out)); in tb_test_tunnel_port_on_path()
1636 port = &host->ports[8]; in tb_test_tunnel_port_on_path()
1639 port = &host->ports[3]; in tb_test_tunnel_port_on_path()
1642 port = &dev1->ports[1]; in tb_test_tunnel_port_on_path()
1645 port = &dev1->ports[3]; in tb_test_tunnel_port_on_path()
1648 port = &dev1->ports[5]; in tb_test_tunnel_port_on_path()
1651 port = &dev1->ports[7]; in tb_test_tunnel_port_on_path()
1654 port = &dev3->ports[1]; in tb_test_tunnel_port_on_path()
1657 port = &dev5->ports[1]; in tb_test_tunnel_port_on_path()
1660 port = &dev4->ports[1]; in tb_test_tunnel_port_on_path()
1676 * 1 ^ In HopID 1 -> Out HopID 8 in tb_test_tunnel_dma()
1678 * v In HopID 8 -> Out HopID 1 in tb_test_tunnel_dma()
1684 nhi = &host->ports[7]; in tb_test_tunnel_dma()
1685 port = &host->ports[1]; in tb_test_tunnel_dma()
1689 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma()
1690 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma()
1691 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma()
1692 KUNIT_ASSERT_EQ(test, tunnel->npaths, 2); in tb_test_tunnel_dma()
1694 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma()
1695 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma()
1696 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 8); in tb_test_tunnel_dma()
1697 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, nhi); in tb_test_tunnel_dma()
1698 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 1); in tb_test_tunnel_dma()
1700 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 1); in tb_test_tunnel_dma()
1701 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, nhi); in tb_test_tunnel_dma()
1702 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].in_hop_index, 1); in tb_test_tunnel_dma()
1703 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].out_port, port); in tb_test_tunnel_dma()
1704 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].next_hop_index, 8); in tb_test_tunnel_dma()
1721 * | In HopID 15 -> Out HopID 2 in tb_test_tunnel_dma_rx()
1727 nhi = &host->ports[7]; in tb_test_tunnel_dma_rx()
1728 port = &host->ports[1]; in tb_test_tunnel_dma_rx()
1730 tunnel = tb_tunnel_alloc_dma(NULL, nhi, port, -1, -1, 15, 2); in tb_test_tunnel_dma_rx()
1732 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_rx()
1733 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_rx()
1734 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_rx()
1735 KUNIT_ASSERT_EQ(test, tunnel->npaths, 1); in tb_test_tunnel_dma_rx()
1737 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma_rx()
1738 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma_rx()
1739 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 15); in tb_test_tunnel_dma_rx()
1740 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, nhi); in tb_test_tunnel_dma_rx()
1741 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 2); in tb_test_tunnel_dma_rx()
1756 * 1 | In HopID 2 -> Out HopID 15 in tb_test_tunnel_dma_tx()
1764 nhi = &host->ports[7]; in tb_test_tunnel_dma_tx()
1765 port = &host->ports[1]; in tb_test_tunnel_dma_tx()
1767 tunnel = tb_tunnel_alloc_dma(NULL, nhi, port, 15, 2, -1, -1); in tb_test_tunnel_dma_tx()
1769 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_tx()
1770 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_tx()
1771 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_tx()
1772 KUNIT_ASSERT_EQ(test, tunnel->npaths, 1); in tb_test_tunnel_dma_tx()
1774 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 1); in tb_test_tunnel_dma_tx()
1775 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, nhi); in tb_test_tunnel_dma_tx()
1776 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 2); in tb_test_tunnel_dma_tx()
1777 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, port); in tb_test_tunnel_dma_tx()
1778 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].next_hop_index, 15); in tb_test_tunnel_dma_tx()
1793 * 1 ^ In HopID 1 -> Out HopID x in tb_test_tunnel_dma_chain()
1795 * 1 | In HopID x -> Out HopID 1 in tb_test_tunnel_dma_chain()
1800 * 3 | In HopID x -> Out HopID 8 in tb_test_tunnel_dma_chain()
1802 * v In HopID 8 -> Out HopID x in tb_test_tunnel_dma_chain()
1811 nhi = &host->ports[7]; in tb_test_tunnel_dma_chain()
1812 port = &dev2->ports[3]; in tb_test_tunnel_dma_chain()
1815 KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DMA); in tb_test_tunnel_dma_chain()
1816 KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, nhi); in tb_test_tunnel_dma_chain()
1817 KUNIT_EXPECT_PTR_EQ(test, tunnel->dst_port, port); in tb_test_tunnel_dma_chain()
1818 KUNIT_ASSERT_EQ(test, tunnel->npaths, 2); in tb_test_tunnel_dma_chain()
1820 KUNIT_ASSERT_EQ(test, tunnel->paths[0]->path_length, 3); in tb_test_tunnel_dma_chain()
1821 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].in_port, port); in tb_test_tunnel_dma_chain()
1822 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[0].in_hop_index, 8); in tb_test_tunnel_dma_chain()
1823 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[0].out_port, in tb_test_tunnel_dma_chain()
1824 &dev2->ports[1]); in tb_test_tunnel_dma_chain()
1825 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].in_port, in tb_test_tunnel_dma_chain()
1826 &dev1->ports[7]); in tb_test_tunnel_dma_chain()
1827 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[1].out_port, in tb_test_tunnel_dma_chain()
1828 &dev1->ports[1]); in tb_test_tunnel_dma_chain()
1829 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].in_port, in tb_test_tunnel_dma_chain()
1830 &host->ports[1]); in tb_test_tunnel_dma_chain()
1831 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[0]->hops[2].out_port, nhi); in tb_test_tunnel_dma_chain()
1832 KUNIT_EXPECT_EQ(test, tunnel->paths[0]->hops[2].next_hop_index, 1); in tb_test_tunnel_dma_chain()
1834 KUNIT_ASSERT_EQ(test, tunnel->paths[1]->path_length, 3); in tb_test_tunnel_dma_chain()
1835 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[0].in_port, nhi); in tb_test_tunnel_dma_chain()
1836 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[0].in_hop_index, 1); in tb_test_tunnel_dma_chain()
1837 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].in_port, in tb_test_tunnel_dma_chain()
1838 &dev1->ports[1]); in tb_test_tunnel_dma_chain()
1839 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[1].out_port, in tb_test_tunnel_dma_chain()
1840 &dev1->ports[7]); in tb_test_tunnel_dma_chain()
1841 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].in_port, in tb_test_tunnel_dma_chain()
1842 &dev2->ports[1]); in tb_test_tunnel_dma_chain()
1843 KUNIT_EXPECT_PTR_EQ(test, tunnel->paths[1]->hops[2].out_port, port); in tb_test_tunnel_dma_chain()
1844 KUNIT_EXPECT_EQ(test, tunnel->paths[1]->hops[2].next_hop_index, 8); in tb_test_tunnel_dma_chain()
1856 nhi = &host->ports[7]; in tb_test_tunnel_dma_match()
1857 port = &host->ports[1]; in tb_test_tunnel_dma_match()
1864 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
1865 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); in tb_test_tunnel_dma_match()
1866 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); in tb_test_tunnel_dma_match()
1867 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); in tb_test_tunnel_dma_match()
1868 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); in tb_test_tunnel_dma_match()
1869 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 1)); in tb_test_tunnel_dma_match()
1870 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
1871 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 8, -1, 8, -1)); in tb_test_tunnel_dma_match()
1875 tunnel = tb_tunnel_alloc_dma(NULL, nhi, port, 15, 1, -1, -1); in tb_test_tunnel_dma_match()
1877 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, 1, -1, -1)); in tb_test_tunnel_dma_match()
1878 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, 15, -1, -1, -1)); in tb_test_tunnel_dma_match()
1879 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, 1, -1, -1)); in tb_test_tunnel_dma_match()
1880 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
1882 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
1883 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); in tb_test_tunnel_dma_match()
1887 tunnel = tb_tunnel_alloc_dma(NULL, nhi, port, -1, -1, 15, 11); in tb_test_tunnel_dma_match()
1889 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 11)); in tb_test_tunnel_dma_match()
1890 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, -1)); in tb_test_tunnel_dma_match()
1891 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, 11)); in tb_test_tunnel_dma_match()
1892 KUNIT_ASSERT_TRUE(test, tb_tunnel_match_dma(tunnel, -1, -1, -1, -1)); in tb_test_tunnel_dma_match()
1893 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 15, 1)); in tb_test_tunnel_dma_match()
1894 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, -1, -1, 10, 11)); in tb_test_tunnel_dma_match()
1895 KUNIT_ASSERT_FALSE(test, tb_tunnel_match_dma(tunnel, 15, 11, -1, -1)); in tb_test_tunnel_dma_match()
1910 down = &host->ports[8]; in tb_test_credit_alloc_legacy_not_bonded()
1911 up = &dev->ports[9]; in tb_test_credit_alloc_legacy_not_bonded()
1914 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_legacy_not_bonded()
1916 path = tunnel->paths[0]; in tb_test_credit_alloc_legacy_not_bonded()
1917 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_not_bonded()
1918 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
1919 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_not_bonded()
1920 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
1921 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 16U); in tb_test_credit_alloc_legacy_not_bonded()
1923 path = tunnel->paths[1]; in tb_test_credit_alloc_legacy_not_bonded()
1924 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_not_bonded()
1925 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
1926 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_not_bonded()
1927 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_not_bonded()
1928 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 16U); in tb_test_credit_alloc_legacy_not_bonded()
1943 down = &host->ports[8]; in tb_test_credit_alloc_legacy_bonded()
1944 up = &dev->ports[9]; in tb_test_credit_alloc_legacy_bonded()
1947 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_legacy_bonded()
1949 path = tunnel->paths[0]; in tb_test_credit_alloc_legacy_bonded()
1950 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_bonded()
1951 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
1952 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_bonded()
1953 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
1954 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_legacy_bonded()
1956 path = tunnel->paths[1]; in tb_test_credit_alloc_legacy_bonded()
1957 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_legacy_bonded()
1958 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
1959 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_legacy_bonded()
1960 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_legacy_bonded()
1961 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_legacy_bonded()
1976 down = &host->ports[8]; in tb_test_credit_alloc_pcie()
1977 up = &dev->ports[9]; in tb_test_credit_alloc_pcie()
1980 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_pcie()
1982 path = tunnel->paths[0]; in tb_test_credit_alloc_pcie()
1983 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_pcie()
1984 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
1985 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_pcie()
1986 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
1987 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_pcie()
1989 path = tunnel->paths[1]; in tb_test_credit_alloc_pcie()
1990 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_pcie()
1991 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
1992 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_pcie()
1993 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_pcie()
1994 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 64U); in tb_test_credit_alloc_pcie()
2002 struct tb_port *in, *out; in tb_test_credit_alloc_dp() local
2009 in = &host->ports[5]; in tb_test_credit_alloc_dp()
2010 out = &dev->ports[14]; in tb_test_credit_alloc_dp()
2012 tunnel = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in tb_test_credit_alloc_dp()
2014 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); in tb_test_credit_alloc_dp()
2017 path = tunnel->paths[0]; in tb_test_credit_alloc_dp()
2018 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2019 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in tb_test_credit_alloc_dp()
2020 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dp()
2021 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in tb_test_credit_alloc_dp()
2022 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in tb_test_credit_alloc_dp()
2025 path = tunnel->paths[1]; in tb_test_credit_alloc_dp()
2026 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2027 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2028 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in tb_test_credit_alloc_dp()
2029 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2030 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dp()
2033 path = tunnel->paths[2]; in tb_test_credit_alloc_dp()
2034 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dp()
2035 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2036 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in tb_test_credit_alloc_dp()
2037 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dp()
2038 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dp()
2053 down = &host->ports[12]; in tb_test_credit_alloc_usb3()
2054 up = &dev->ports[16]; in tb_test_credit_alloc_usb3()
2057 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_usb3()
2059 path = tunnel->paths[0]; in tb_test_credit_alloc_usb3()
2060 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_usb3()
2061 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2062 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_usb3()
2063 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2064 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_usb3()
2066 path = tunnel->paths[1]; in tb_test_credit_alloc_usb3()
2067 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_usb3()
2068 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2069 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in tb_test_credit_alloc_usb3()
2070 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_usb3()
2071 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in tb_test_credit_alloc_usb3()
2086 nhi = &host->ports[7]; in tb_test_credit_alloc_dma()
2087 port = &dev->ports[3]; in tb_test_credit_alloc_dma()
2091 KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)2); in tb_test_credit_alloc_dma()
2094 path = tunnel->paths[0]; in tb_test_credit_alloc_dma()
2095 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma()
2096 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2097 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma()
2098 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2099 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma()
2102 path = tunnel->paths[1]; in tb_test_credit_alloc_dma()
2103 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma()
2104 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2105 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma()
2106 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma()
2107 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma()
2122 nhi = &host->ports[7]; in tb_test_credit_alloc_dma_multiple()
2123 port = &dev->ports[3]; in tb_test_credit_alloc_dma_multiple()
2126 * Create three DMA tunnels through the same ports. With the in tb_test_credit_alloc_dma_multiple()
2132 * 120 - (2 + 2 * (1 + 0) + 32 + 64 + spare) = 20 in tb_test_credit_alloc_dma_multiple()
2136 * 120 - (2 + 2 * (1 + 18) + 14 + 32 + spare) = 34 in tb_test_credit_alloc_dma_multiple()
2141 * remaining 1 and then we run out of buffers. in tb_test_credit_alloc_dma_multiple()
2145 KUNIT_ASSERT_EQ(test, tunnel1->npaths, (size_t)2); in tb_test_credit_alloc_dma_multiple()
2147 path = tunnel1->paths[0]; in tb_test_credit_alloc_dma_multiple()
2148 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2149 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2150 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2151 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2152 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2154 path = tunnel1->paths[1]; in tb_test_credit_alloc_dma_multiple()
2155 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2156 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2157 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2158 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2159 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2163 KUNIT_ASSERT_EQ(test, tunnel2->npaths, (size_t)2); in tb_test_credit_alloc_dma_multiple()
2165 path = tunnel2->paths[0]; in tb_test_credit_alloc_dma_multiple()
2166 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2167 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2168 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2169 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2170 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dma_multiple()
2172 path = tunnel2->paths[1]; in tb_test_credit_alloc_dma_multiple()
2173 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2174 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2175 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2176 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2177 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in tb_test_credit_alloc_dma_multiple()
2191 path = tunnel3->paths[0]; in tb_test_credit_alloc_dma_multiple()
2192 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2193 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2194 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2195 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2196 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2198 path = tunnel3->paths[1]; in tb_test_credit_alloc_dma_multiple()
2199 KUNIT_ASSERT_EQ(test, path->path_length, 2); in tb_test_credit_alloc_dma_multiple()
2200 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2201 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2202 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in tb_test_credit_alloc_dma_multiple()
2203 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in tb_test_credit_alloc_dma_multiple()
2216 down = &host->ports[8]; in TB_TEST_PCIE_TUNNEL()
2217 up = &dev->ports[9]; in TB_TEST_PCIE_TUNNEL()
2220 KUNIT_ASSERT_EQ(test, pcie_tunnel->npaths, (size_t)2); in TB_TEST_PCIE_TUNNEL()
2222 path = pcie_tunnel->paths[0]; in TB_TEST_PCIE_TUNNEL()
2223 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_PCIE_TUNNEL()
2224 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2225 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_PCIE_TUNNEL()
2226 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2227 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in TB_TEST_PCIE_TUNNEL()
2229 path = pcie_tunnel->paths[1]; in TB_TEST_PCIE_TUNNEL()
2230 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_PCIE_TUNNEL()
2231 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2232 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_PCIE_TUNNEL()
2233 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_PCIE_TUNNEL()
2234 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 64U); in TB_TEST_PCIE_TUNNEL()
2242 struct tb_port *in, *out; in TB_TEST_DP_TUNNEL1() local
2246 in = &host->ports[5]; in TB_TEST_DP_TUNNEL1()
2247 out = &dev->ports[13]; in TB_TEST_DP_TUNNEL1()
2248 dp_tunnel1 = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in TB_TEST_DP_TUNNEL1()
2250 KUNIT_ASSERT_EQ(test, dp_tunnel1->npaths, (size_t)3); in TB_TEST_DP_TUNNEL1()
2252 path = dp_tunnel1->paths[0]; in TB_TEST_DP_TUNNEL1()
2253 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2254 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in TB_TEST_DP_TUNNEL1()
2255 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DP_TUNNEL1()
2256 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in TB_TEST_DP_TUNNEL1()
2257 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in TB_TEST_DP_TUNNEL1()
2259 path = dp_tunnel1->paths[1]; in TB_TEST_DP_TUNNEL1()
2260 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2261 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2262 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2263 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2264 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2266 path = dp_tunnel1->paths[2]; in TB_TEST_DP_TUNNEL1()
2267 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL1()
2268 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2269 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2270 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL1()
2271 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL1()
2279 struct tb_port *in, *out; in TB_TEST_DP_TUNNEL2() local
2283 in = &host->ports[6]; in TB_TEST_DP_TUNNEL2()
2284 out = &dev->ports[14]; in TB_TEST_DP_TUNNEL2()
2285 dp_tunnel2 = tb_tunnel_alloc_dp(NULL, in, out, 0, 0); in TB_TEST_DP_TUNNEL2()
2287 KUNIT_ASSERT_EQ(test, dp_tunnel2->npaths, (size_t)3); in TB_TEST_DP_TUNNEL2()
2289 path = dp_tunnel2->paths[0]; in TB_TEST_DP_TUNNEL2()
2290 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2291 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 12U); in TB_TEST_DP_TUNNEL2()
2292 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DP_TUNNEL2()
2293 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 18U); in TB_TEST_DP_TUNNEL2()
2294 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 0U); in TB_TEST_DP_TUNNEL2()
2296 path = dp_tunnel2->paths[1]; in TB_TEST_DP_TUNNEL2()
2297 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2298 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2299 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2300 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2301 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2303 path = dp_tunnel2->paths[2]; in TB_TEST_DP_TUNNEL2()
2304 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DP_TUNNEL2()
2305 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2306 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2307 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DP_TUNNEL2()
2308 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DP_TUNNEL2()
2320 down = &host->ports[12]; in TB_TEST_USB3_TUNNEL()
2321 up = &dev->ports[16]; in TB_TEST_USB3_TUNNEL()
2324 KUNIT_ASSERT_EQ(test, usb3_tunnel->npaths, (size_t)2); in TB_TEST_USB3_TUNNEL()
2326 path = usb3_tunnel->paths[0]; in TB_TEST_USB3_TUNNEL()
2327 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_USB3_TUNNEL()
2328 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2329 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_USB3_TUNNEL()
2330 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2331 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_USB3_TUNNEL()
2333 path = usb3_tunnel->paths[1]; in TB_TEST_USB3_TUNNEL()
2334 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_USB3_TUNNEL()
2335 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2336 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 7U); in TB_TEST_USB3_TUNNEL()
2337 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_USB3_TUNNEL()
2338 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 32U); in TB_TEST_USB3_TUNNEL()
2350 nhi = &host->ports[7]; in TB_TEST_DMA_TUNNEL1()
2351 port = &dev->ports[3]; in TB_TEST_DMA_TUNNEL1()
2354 KUNIT_ASSERT_EQ(test, dma_tunnel1->npaths, (size_t)2); in TB_TEST_DMA_TUNNEL1()
2356 path = dma_tunnel1->paths[0]; in TB_TEST_DMA_TUNNEL1()
2357 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL1()
2358 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2359 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2360 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2361 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2363 path = dma_tunnel1->paths[1]; in TB_TEST_DMA_TUNNEL1()
2364 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL1()
2365 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2366 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2367 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL1()
2368 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 14U); in TB_TEST_DMA_TUNNEL1()
2380 nhi = &host->ports[7]; in TB_TEST_DMA_TUNNEL2()
2381 port = &dev->ports[3]; in TB_TEST_DMA_TUNNEL2()
2384 KUNIT_ASSERT_EQ(test, dma_tunnel2->npaths, (size_t)2); in TB_TEST_DMA_TUNNEL2()
2386 path = dma_tunnel2->paths[0]; in TB_TEST_DMA_TUNNEL2()
2387 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL2()
2388 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2389 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 14U); in TB_TEST_DMA_TUNNEL2()
2390 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2391 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DMA_TUNNEL2()
2393 path = dma_tunnel2->paths[1]; in TB_TEST_DMA_TUNNEL2()
2394 KUNIT_ASSERT_EQ(test, path->path_length, 2); in TB_TEST_DMA_TUNNEL2()
2395 KUNIT_EXPECT_EQ(test, path->hops[0].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2396 KUNIT_EXPECT_EQ(test, path->hops[0].initial_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2397 KUNIT_EXPECT_EQ(test, path->hops[1].nfc_credits, 0U); in TB_TEST_DMA_TUNNEL2()
2398 KUNIT_EXPECT_EQ(test, path->hops[1].initial_credits, 1U); in TB_TEST_DMA_TUNNEL2()
2506 KUNIT_EXPECT_STREQ(test, p->value.text, "Apple Inc."); in tb_test_property_parse()
2510 KUNIT_EXPECT_EQ(test, p->value.immediate, 0xa27); in tb_test_property_parse()
2514 KUNIT_EXPECT_STREQ(test, p->value.text, "Macintosh"); in tb_test_property_parse()
2518 KUNIT_EXPECT_EQ(test, p->value.immediate, 0xa); in tb_test_property_parse()
2526 network_dir = p->value.dir; in tb_test_property_parse()
2527 KUNIT_EXPECT_TRUE(test, uuid_equal(network_dir->uuid, &network_dir_uuid)); in tb_test_property_parse()
2531 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2535 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2539 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x1); in tb_test_property_parse()
2543 KUNIT_EXPECT_EQ(test, p->value.immediate, 0x0); in tb_test_property_parse()
2586 if (d1->uuid) { in compare_dirs()
2587 KUNIT_ASSERT_TRUE(test, d2->uuid != NULL); in compare_dirs()
2588 KUNIT_ASSERT_TRUE(test, uuid_equal(d1->uuid, d2->uuid)); in compare_dirs()
2590 KUNIT_ASSERT_TRUE(test, d2->uuid == NULL); in compare_dirs()
2613 KUNIT_ASSERT_STREQ(test, &p1->key[0], &p2->key[0]); in compare_dirs()
2614 KUNIT_ASSERT_EQ(test, p1->type, p2->type); in compare_dirs()
2615 KUNIT_ASSERT_EQ(test, p1->length, p2->length); in compare_dirs()
2617 switch (p1->type) { in compare_dirs()
2619 KUNIT_ASSERT_TRUE(test, p1->value.dir != NULL); in compare_dirs()
2620 KUNIT_ASSERT_TRUE(test, p2->value.dir != NULL); in compare_dirs()
2621 compare_dirs(test, p1->value.dir, p2->value.dir); in compare_dirs()
2625 KUNIT_ASSERT_TRUE(test, p1->value.data != NULL); in compare_dirs()
2626 KUNIT_ASSERT_TRUE(test, p2->value.data != NULL); in compare_dirs()
2628 !memcmp(p1->value.data, p2->value.data, in compare_dirs()
2629 p1->length * 4) in compare_dirs()
2634 KUNIT_ASSERT_TRUE(test, p1->value.text != NULL); in compare_dirs()
2635 KUNIT_ASSERT_TRUE(test, p2->value.text != NULL); in compare_dirs()
2636 KUNIT_ASSERT_STREQ(test, p1->value.text, p2->value.text); in compare_dirs()
2640 KUNIT_ASSERT_EQ(test, p1->value.immediate, in compare_dirs()
2641 p2->value.immediate); in compare_dirs()