Lines Matching +full:0 +full:xd

36 #define TBNET_E2E		BIT(0)
49 #define TBNET_L0_PORT_NUM(route) ((route) & GENMASK(5, 0))
60 * supported then @frame_id is filled, otherwise it stays %0.
92 #define TBIP_HDR_LENGTH_MASK GENMASK(5, 0)
151 * @xd: XDomain the service belongs to
182 struct tb_xdomain *xd; member
206 UUID_INIT(0xc66189ca, 0x1cce, 0x4195,
207 0xbd, 0xb8, 0x49, 0x59, 0x2e, 0x5f, 0x5a, 0x4f);
211 UUID_INIT(0x798f589e, 0x3616, 0x8a47,
212 0x97, 0xc6, 0x56, 0x64, 0xa9, 0x20, 0xc8, 0xdd);
244 struct tb_xdomain *xd = net->xd; in tbnet_login_response() local
246 memset(&reply, 0, sizeof(reply)); in tbnet_login_response()
247 tbnet_fill_header(&reply.hdr, route, sequence, xd->local_uuid, in tbnet_login_response()
248 xd->remote_uuid, TBIP_LOGIN_RESPONSE, sizeof(reply), in tbnet_login_response()
253 return tb_xdomain_response(xd, &reply, sizeof(reply), in tbnet_login_response()
261 struct tb_xdomain *xd = net->xd; in tbnet_login_request() local
263 memset(&request, 0, sizeof(request)); in tbnet_login_request()
264 tbnet_fill_header(&request.hdr, xd->route, sequence, xd->local_uuid, in tbnet_login_request()
265 xd->remote_uuid, TBIP_LOGIN, sizeof(request), in tbnet_login_request()
271 return tb_xdomain_request(xd, &request, sizeof(request), in tbnet_login_request()
281 struct tb_xdomain *xd = net->xd; in tbnet_logout_response() local
283 memset(&reply, 0, sizeof(reply)); in tbnet_logout_response()
284 tbnet_fill_header(&reply.hdr, route, sequence, xd->local_uuid, in tbnet_logout_response()
285 xd->remote_uuid, TBIP_STATUS, sizeof(reply), in tbnet_logout_response()
287 return tb_xdomain_response(xd, &reply, sizeof(reply), in tbnet_logout_response()
295 struct tb_xdomain *xd = net->xd; in tbnet_logout_request() local
297 memset(&request, 0, sizeof(request)); in tbnet_logout_request()
298 tbnet_fill_header(&request.hdr, xd->route, 0, xd->local_uuid, in tbnet_logout_request()
299 xd->remote_uuid, TBIP_LOGOUT, sizeof(request), in tbnet_logout_request()
302 return tb_xdomain_request(xd, &request, sizeof(request), in tbnet_logout_request()
338 for (i = 0; i < TBNET_RING_SIZE; i++) { in tbnet_free_buffers()
350 order = 0; in tbnet_free_buffers()
368 ring->cons = 0; in tbnet_free_buffers()
369 ring->prod = 0; in tbnet_free_buffers()
384 while (send_logout && retries-- > 0) { in tbnet_tear_down()
397 ret = tb_xdomain_disable_paths(net->xd, in tbnet_tear_down()
405 tb_xdomain_release_in_hopid(net->xd, net->remote_transmit_path); in tbnet_tear_down()
406 net->remote_transmit_path = 0; in tbnet_tear_down()
409 net->login_retries = 0; in tbnet_tear_down()
423 int ret = 0; in tbnet_handle_packet()
429 return 0; in tbnet_handle_packet()
430 if (!uuid_equal(&pkg->hdr.initiator_uuid, net->xd->remote_uuid)) in tbnet_handle_packet()
431 return 0; in tbnet_handle_packet()
432 if (!uuid_equal(&pkg->hdr.target_uuid, net->xd->local_uuid)) in tbnet_handle_packet()
433 return 0; in tbnet_handle_packet()
437 if (route != net->xd->route) in tbnet_handle_packet()
438 return 0; in tbnet_handle_packet()
465 net->login_retries = 0; in tbnet_handle_packet()
467 &net->login_work, 0); in tbnet_handle_packet()
485 return 0; in tbnet_handle_packet()
513 /* Allocate page (order > 0) so that it can hold maximum in tbnet_alloc_rx_buffers()
523 dma_addr = dma_map_page(dma_dev, tf->page, 0, in tbnet_alloc_rx_buffers()
541 return 0; in tbnet_alloc_rx_buffers()
561 tf->frame.size = 0; in tbnet_get_tx_buffer()
588 for (i = 0; i < TBNET_RING_SIZE; i++) { in tbnet_alloc_tx_buffers()
598 dma_addr = dma_map_page(dma_dev, tf->page, 0, TBNET_FRAME_SIZE, in tbnet_alloc_tx_buffers()
616 ring->cons = 0; in tbnet_alloc_tx_buffers()
619 return 0; in tbnet_alloc_tx_buffers()
640 ret = tb_xdomain_alloc_in_hopid(net->xd, net->remote_transmit_path); in tbnet_connected_work()
664 ret = tb_xdomain_enable_paths(net->xd, net->local_transmit_path, in tbnet_connected_work()
686 tb_xdomain_release_in_hopid(net->xd, net->remote_transmit_path); in tbnet_connected_work()
714 net->login_retries = 0; in tbnet_login_work()
790 if (frame_count == 0 || frame_count > TBNET_RING_SIZE / 4) { in tbnet_check_frame()
794 if (frame_index != 0) { in tbnet_check_frame()
807 unsigned int rx_packets = 0; in tbnet_poll()
825 cleaned_count = 0; in tbnet_poll()
919 struct tb_xdomain *xd = net->xd; in tbnet_open() local
927 ring = tb_ring_alloc_tx(xd->tb->nhi, -1, TBNET_RING_SIZE, in tbnet_open()
935 hopid = tb_xdomain_alloc_out_hopid(xd, -1); in tbnet_open()
936 if (hopid < 0) { in tbnet_open()
952 ring = tb_ring_alloc_rx(xd->tb->nhi, -1, TBNET_RING_SIZE, flags, in tbnet_open()
957 tb_xdomain_release_out_hopid(xd, hopid); in tbnet_open()
967 return 0; in tbnet_open()
982 tb_xdomain_release_out_hopid(net->xd, net->local_transmit_path); in tbnet_stop()
986 return 0; in tbnet_stop()
992 struct thunderbolt_ip_frame_header *hdr = page_address(frames[0]->page); in tbnet_xmit_csum_and_map()
1007 for (i = 0; i < frame_count; i++) { in tbnet_xmit_csum_and_map()
1038 *ipcso = 0; in tbnet_xmit_csum_and_map()
1050 ip_hdr(skb)->daddr, 0, in tbnet_xmit_csum_and_map()
1051 ip_hdr(skb)->protocol, 0); in tbnet_xmit_csum_and_map()
1055 &ipv6_hdr(skb)->daddr, 0, in tbnet_xmit_csum_and_map()
1056 IPPROTO_TCP, 0); in tbnet_xmit_csum_and_map()
1060 &ipv6_hdr(skb)->daddr, 0, in tbnet_xmit_csum_and_map()
1061 ipv6_hdr(skb)->nexthdr, 0); in tbnet_xmit_csum_and_map()
1069 for (i = 0; i < frame_count; i++) { in tbnet_xmit_csum_and_map()
1078 offset = 0; in tbnet_xmit_csum_and_map()
1086 for (i = 0; i < frame_count; i++) { in tbnet_xmit_csum_and_map()
1113 unsigned int frag = 0; in tbnet_start_xmit()
1115 u32 frame_index = 0; in tbnet_start_xmit()
1169 } else if (unlikely(size_left > 0)) { in tbnet_start_xmit()
1172 } while (size_left > 0); in tbnet_start_xmit()
1205 } else if (unlikely(data_len > 0)) { in tbnet_start_xmit()
1218 for (i = 0; i < frame_index + 1; i++) in tbnet_start_xmit()
1271 const struct tb_xdomain *xd = net->xd; in tbnet_generate_mac() local
1276 phy_port = tb_phy_port_from_link(TBNET_L0_PORT_NUM(xd->route)); in tbnet_generate_mac()
1279 addr[0] = phy_port << 4 | 0x02; in tbnet_generate_mac()
1280 hash = jhash2((u32 *)xd->local_uuid, 4, 0); in tbnet_generate_mac()
1282 hash = jhash2((u32 *)xd->local_uuid, 4, hash); in tbnet_generate_mac()
1283 addr[5] = hash & 0xff; in tbnet_generate_mac()
1289 struct tb_xdomain *xd = tb_service_parent(svc); in tbnet_probe() local
1305 atomic_set(&net->command_id, 0); in tbnet_probe()
1306 atomic_set(&net->frame_id, 0); in tbnet_probe()
1309 net->xd = xd; in tbnet_probe()
1354 return 0; in tbnet_probe()
1383 return 0; in tbnet_suspend()
1399 return 0; in tbnet_resume()
1448 return 0; in tbnet_init()