Lines Matching full:pcb

178 __hvs_remove_pcb_from_list(struct hvs_pcb *pcb, unsigned char list)  in __hvs_remove_pcb_from_list()  argument
182 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_pcb_from_list()
184 if (!pcb) in __hvs_remove_pcb_from_list()
189 if (p == pcb) in __hvs_remove_pcb_from_list()
195 if (p == pcb) in __hvs_remove_pcb_from_list()
196 LIST_REMOVE(pcb, connected_next); in __hvs_remove_pcb_from_list()
203 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list() local
205 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_socket_from_list()
207 __hvs_remove_pcb_from_list(pcb, list); in __hvs_remove_socket_from_list()
213 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list() local
217 pcb, bound_next); in __hvs_insert_socket_on_list()
221 pcb, connected_next); in __hvs_insert_socket_on_list()
348 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach() local
359 if (pcb != NULL) in hvs_trans_attach()
361 pcb = malloc(sizeof(struct hvs_pcb), M_HVSOCK, M_NOWAIT | M_ZERO); in hvs_trans_attach()
362 if (pcb == NULL) in hvs_trans_attach()
365 pcb->so = so; in hvs_trans_attach()
366 so->so_pcb = (void *)pcb; in hvs_trans_attach()
374 struct hvs_pcb *pcb; in hvs_trans_detach() local
380 pcb = so2hvspcb(so); in hvs_trans_detach()
381 if (pcb == NULL) { in hvs_trans_detach()
387 bzero(pcb, sizeof(*pcb)); in hvs_trans_detach()
388 free(pcb, M_HVSOCK); in hvs_trans_detach()
399 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind() local
410 if (pcb == NULL) { in hvs_trans_bind()
439 hvs_addr_set(&pcb->local_addr, sa->hvs_port); in hvs_trans_bind()
440 hvs_addr_set(&pcb->remote_addr, HVADDR_PORT_ANY); in hvs_trans_bind()
451 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen() local
458 if (pcb == NULL) in hvs_trans_listen()
462 bound_so = hvs_find_socket_on_list(&pcb->local_addr, HVS_LIST_BOUND); in hvs_trans_listen()
483 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept() local
488 if (pcb == NULL) in hvs_trans_accept()
491 memcpy(sa, &pcb->remote_addr, pcb->remote_addr.sa_len); in hvs_trans_accept()
499 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect() local
508 if (pcb == NULL) in hvs_trans_connect()
533 hvs_addr_set(&pcb->local_addr, 0); in hvs_trans_connect()
540 pcb->local_addr.hvs_port = i; in hvs_trans_connect()
542 if (__hvs_find_socket_on_list(&pcb->local_addr, in hvs_trans_connect()
548 __func__, pcb->local_addr.hvs_port); in hvs_trans_connect()
557 pcb->vm_srv_id = srv_id_template; in hvs_trans_connect()
558 set_port_by_srv_id(&pcb->vm_srv_id, pcb->local_addr.hvs_port); in hvs_trans_connect()
560 pcb->host_srv_id = srv_id_template; in hvs_trans_connect()
561 set_port_by_srv_id(&pcb->host_srv_id, raddr->hvs_port); in hvs_trans_connect()
562 hvs_addr_set(&pcb->remote_addr, raddr->hvs_port); in hvs_trans_connect()
574 hvsock_print_guid(&pcb->vm_srv_id); in hvs_trans_connect()
576 hvsock_print_guid(&pcb->host_srv_id); in hvs_trans_connect()
582 vmbus_req_tl_connect(&pcb->vm_srv_id, &pcb->host_srv_id); in hvs_trans_connect()
590 struct hvs_pcb *pcb; in hvs_trans_disconnect() local
596 pcb = so2hvspcb(so); in hvs_trans_disconnect()
597 if (pcb == NULL) { in hvs_trans_disconnect()
620 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive() local
632 if (pcb == NULL) in hvs_trans_soreceive()
676 (canread = hvsock_canread_check(pcb)) > 0) { in hvs_trans_soreceive()
681 pcb->recv_data_off)); in hvs_trans_soreceive()
683 error = vmbus_chan_recv_peek_call(pcb->chan, to_read, in hvs_trans_soreceive()
684 sizeof(struct hvs_pkt_header) + pcb->recv_data_off, in hvs_trans_soreceive()
696 pcb->recv_data_len -= to_read; in hvs_trans_soreceive()
697 pcb->recv_data_off += to_read; in hvs_trans_soreceive()
756 __func__, vmbus_chan_read_available(pcb->chan)); in hvs_trans_soreceive()
785 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend() local
797 if (pcb == NULL) in hvs_trans_sosend()
824 canwrite = hvsock_canwrite_check(pcb); in hvs_trans_sosend()
854 vmbus_chan_write_available(pcb->chan)); in hvs_trans_sosend()
865 error = hvsock_send_data(pcb->chan, uio, to_write, sb); in hvs_trans_sosend()
881 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr() local
886 if (pcb == NULL) in hvs_trans_peeraddr()
889 memcpy(sa, &pcb->remote_addr, pcb->remote_addr.sa_len); in hvs_trans_peeraddr()
897 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr() local
902 if (pcb == NULL) in hvs_trans_sockaddr()
905 memcpy(sa, &pcb->local_addr, pcb->local_addr.sa_len); in hvs_trans_sockaddr()
913 struct hvs_pcb *pcb; in hvs_trans_close() local
919 pcb = so2hvspcb(so); in hvs_trans_close()
920 if (!pcb) { in hvs_trans_close()
929 (void) hvsock_send_data(pcb->chan, NULL, 0, NULL); in hvs_trans_close()
936 pcb->chan = NULL; in hvs_trans_close()
937 pcb->so = NULL; in hvs_trans_close()
954 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort() local
960 if (pcb == NULL) { in hvs_trans_abort()
983 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown() local
996 if (pcb == NULL) in hvs_trans_shutdown()
1008 (void) hvsock_send_data(pcb->chan, NULL, 0, in hvs_trans_shutdown()
1074 struct hvs_pcb *pcb; member
1089 struct hvs_pcb *pcb = (struct hvs_pcb *) context; in hvsock_chan_cb() local
1094 "%s: host send us a wakeup on rb data, pcb = %p\n", in hvsock_chan_cb()
1095 __func__, pcb); in hvsock_chan_cb()
1103 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1105 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1113 vmbus_chan_read_available(pcb->chan)); in hvsock_chan_cb()
1115 if (hvsock_chan_readable(pcb->chan)) in hvsock_chan_cb()
1124 canwrite = hvsock_canwrite_check(pcb); in hvsock_chan_cb()
1244 hvsock_canread_check(struct hvs_pcb *pcb) in hvsock_canread_check() argument
1251 if (pcb == NULL || pcb->chan == NULL) { in hvsock_canread_check()
1252 pcb->so->so_error = EIO; in hvsock_canread_check()
1257 if (pcb->recv_data_len > 0) in hvsock_canread_check()
1258 return (pcb->recv_data_len); in hvsock_canread_check()
1260 if (pcb->rb_init) in hvsock_canread_check()
1262 VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1266 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1272 if (pcb->rb_init && bytes_canread == (advance + sizeof(uint64_t))) { in hvsock_canread_check()
1278 error = vmbus_chan_recv_idxadv(pcb->chan, advance); in hvsock_canread_check()
1285 pcb->rb_init = false; in hvsock_canread_check()
1286 pcb->recv_data_len = 0; in hvsock_canread_check()
1287 pcb->recv_data_off = 0; in hvsock_canread_check()
1288 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1306 error = vmbus_chan_recv_peek(pcb->chan, &pcb->hvs_pkt, in hvsock_canread_check()
1320 tlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1321 hlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_hlen); in hvsock_canread_check()
1322 dlen = pcb->hvs_pkt.vmpipe_pkt_hdr.vmpipe_data_size; in hvsock_canread_check()
1329 pcb->so->so_error = EIO; in hvsock_canread_check()
1332 if (pcb->rb_init == false) in hvsock_canread_check()
1333 pcb->rb_init = true; in hvsock_canread_check()
1344 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1350 pcb->recv_data_len = dlen; in hvsock_canread_check()
1351 pcb->recv_data_off = 0; in hvsock_canread_check()
1353 return (pcb->recv_data_len); in hvsock_canread_check()
1357 hvsock_canwrite_check(struct hvs_pcb *pcb) in hvsock_canwrite_check() argument
1362 if (pcb == NULL || pcb->chan == NULL) in hvsock_canwrite_check()
1365 writeable = vmbus_chan_write_available(pcb->chan); in hvsock_canwrite_check()
1401 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel() local
1423 hvsock_chan_cb, pcb); in hvsock_open_channel()
1453 struct hvs_pcb *new_pcb, *pcb; in hvsock_open_conn_passive() local
1471 * channel and filling out its pcb information. in hvsock_open_conn_passive()
1489 pcb = so->so_pcb; in hvsock_open_conn_passive()
1492 hvs_addr_set(&(new_pcb->local_addr), pcb->local_addr.hvs_port); in hvsock_open_conn_passive()
1505 sc->pcb = new_pcb; in hvsock_open_conn_passive()
1522 struct hvs_pcb *pcb; in hvsock_open_conn_active() local
1531 pcb = so->so_pcb; in hvsock_open_conn_active()
1532 pcb->chan = chan; in hvsock_open_conn_active()
1533 pcb->recv_data_len = 0; in hvsock_open_conn_active()
1534 pcb->recv_data_off = 0; in hvsock_open_conn_active()
1535 pcb->rb_init = false; in hvsock_open_conn_active()
1556 struct hvs_pcb *pcb; in hvsock_open_connection() local
1598 pcb = so->so_pcb; in hvsock_open_connection()
1599 if (pcb && pcb->so) { in hvsock_open_connection()
1600 sc->pcb = so2hvspcb(so); in hvsock_open_connection()
1661 if (sc->pcb != NULL) { in hvsock_detach()
1664 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1673 __hvs_remove_pcb_from_list(sc->pcb, in hvsock_detach()
1707 bzero(sc->pcb, sizeof(struct hvs_pcb)); in hvsock_detach()
1708 free(sc->pcb, M_HVSOCK); in hvsock_detach()
1709 sc->pcb = NULL; in hvsock_detach()