Lines Matching refs:pcb
192 __hvs_remove_pcb_from_list(struct hvs_pcb *pcb, unsigned char list) in __hvs_remove_pcb_from_list() argument
196 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_pcb_from_list()
198 if (!pcb) in __hvs_remove_pcb_from_list()
203 if (p == pcb) in __hvs_remove_pcb_from_list()
209 if (p == pcb) in __hvs_remove_pcb_from_list()
210 LIST_REMOVE(pcb, connected_next); in __hvs_remove_pcb_from_list()
217 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list() local
219 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_socket_from_list()
221 __hvs_remove_pcb_from_list(pcb, list); in __hvs_remove_socket_from_list()
227 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list() local
231 pcb, bound_next); in __hvs_insert_socket_on_list()
235 pcb, connected_next); in __hvs_insert_socket_on_list()
356 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach() local
370 if (pcb != NULL) in hvs_trans_attach()
372 pcb = malloc(sizeof(struct hvs_pcb), M_HVSOCK, M_NOWAIT | M_ZERO); in hvs_trans_attach()
373 if (pcb == NULL) in hvs_trans_attach()
376 pcb->so = so; in hvs_trans_attach()
377 so->so_pcb = (void *)pcb; in hvs_trans_attach()
385 struct hvs_pcb *pcb; in hvs_trans_detach() local
394 pcb = so2hvspcb(so); in hvs_trans_detach()
395 if (pcb == NULL) { in hvs_trans_detach()
401 bzero(pcb, sizeof(*pcb)); in hvs_trans_detach()
402 free(pcb, M_HVSOCK); in hvs_trans_detach()
413 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind() local
424 if (pcb == NULL) { in hvs_trans_bind()
453 hvs_addr_set(&pcb->local_addr, sa->hvs_port); in hvs_trans_bind()
454 hvs_addr_set(&pcb->remote_addr, HVADDR_PORT_ANY); in hvs_trans_bind()
465 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen() local
472 if (pcb == NULL) in hvs_trans_listen()
476 bound_so = hvs_find_socket_on_list(&pcb->local_addr, HVS_LIST_BOUND); in hvs_trans_listen()
497 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept() local
502 if (pcb == NULL) in hvs_trans_accept()
505 *nam = sodupsockaddr((struct sockaddr *) &pcb->remote_addr, in hvs_trans_accept()
514 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect() local
523 if (pcb == NULL) in hvs_trans_connect()
548 hvs_addr_set(&pcb->local_addr, 0); in hvs_trans_connect()
555 pcb->local_addr.hvs_port = i; in hvs_trans_connect()
557 if (__hvs_find_socket_on_list(&pcb->local_addr, in hvs_trans_connect()
563 __func__, pcb->local_addr.hvs_port); in hvs_trans_connect()
572 pcb->vm_srv_id = srv_id_template; in hvs_trans_connect()
573 set_port_by_srv_id(&pcb->vm_srv_id, pcb->local_addr.hvs_port); in hvs_trans_connect()
575 pcb->host_srv_id = srv_id_template; in hvs_trans_connect()
576 set_port_by_srv_id(&pcb->host_srv_id, raddr->hvs_port); in hvs_trans_connect()
577 hvs_addr_set(&pcb->remote_addr, raddr->hvs_port); in hvs_trans_connect()
589 hvsock_print_guid(&pcb->vm_srv_id); in hvs_trans_connect()
591 hvsock_print_guid(&pcb->host_srv_id); in hvs_trans_connect()
597 vmbus_req_tl_connect(&pcb->vm_srv_id, &pcb->host_srv_id); in hvs_trans_connect()
605 struct hvs_pcb *pcb; in hvs_trans_disconnect() local
614 pcb = so2hvspcb(so); in hvs_trans_disconnect()
615 if (pcb == NULL) { in hvs_trans_disconnect()
638 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive() local
650 if (pcb == NULL) in hvs_trans_soreceive()
694 (canread = hvsock_canread_check(pcb)) > 0) { in hvs_trans_soreceive()
699 pcb->recv_data_off)); in hvs_trans_soreceive()
701 error = vmbus_chan_recv_peek_call(pcb->chan, to_read, in hvs_trans_soreceive()
702 sizeof(struct hvs_pkt_header) + pcb->recv_data_off, in hvs_trans_soreceive()
714 pcb->recv_data_len -= to_read; in hvs_trans_soreceive()
715 pcb->recv_data_off += to_read; in hvs_trans_soreceive()
774 __func__, vmbus_chan_read_available(pcb->chan)); in hvs_trans_soreceive()
803 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend() local
815 if (pcb == NULL) in hvs_trans_sosend()
842 canwrite = hvsock_canwrite_check(pcb); in hvs_trans_sosend()
872 vmbus_chan_write_available(pcb->chan)); in hvs_trans_sosend()
883 error = hvsock_send_data(pcb->chan, uio, to_write, sb); in hvs_trans_sosend()
899 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr() local
904 if (pcb == NULL) in hvs_trans_peeraddr()
907 *nam = sodupsockaddr((struct sockaddr *) &pcb->remote_addr, M_NOWAIT); in hvs_trans_peeraddr()
915 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr() local
920 if (pcb == NULL) in hvs_trans_sockaddr()
923 *nam = sodupsockaddr((struct sockaddr *) &pcb->local_addr, M_NOWAIT); in hvs_trans_sockaddr()
931 struct hvs_pcb *pcb; in hvs_trans_close() local
940 pcb = so2hvspcb(so); in hvs_trans_close()
941 if (!pcb) { in hvs_trans_close()
950 (void) hvsock_send_data(pcb->chan, NULL, 0, NULL); in hvs_trans_close()
957 pcb->chan = NULL; in hvs_trans_close()
958 pcb->so = NULL; in hvs_trans_close()
975 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort() local
984 if (pcb == NULL) { in hvs_trans_abort()
1007 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown() local
1013 if (pcb == NULL) in hvs_trans_shutdown()
1036 (void) hvsock_send_data(pcb->chan, NULL, 0, sb); in hvs_trans_shutdown()
1098 struct hvs_pcb *pcb; member
1113 struct hvs_pcb *pcb = (struct hvs_pcb *) context; in hvsock_chan_cb() local
1119 __func__, pcb); in hvsock_chan_cb()
1127 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1129 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1137 vmbus_chan_read_available(pcb->chan)); in hvsock_chan_cb()
1139 if (hvsock_chan_readable(pcb->chan)) in hvsock_chan_cb()
1148 canwrite = hvsock_canwrite_check(pcb); in hvsock_chan_cb()
1268 hvsock_canread_check(struct hvs_pcb *pcb) in hvsock_canread_check() argument
1275 if (pcb == NULL || pcb->chan == NULL) { in hvsock_canread_check()
1276 pcb->so->so_error = EIO; in hvsock_canread_check()
1281 if (pcb->recv_data_len > 0) in hvsock_canread_check()
1282 return (pcb->recv_data_len); in hvsock_canread_check()
1284 if (pcb->rb_init) in hvsock_canread_check()
1286 VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1290 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1296 if (pcb->rb_init && bytes_canread == (advance + sizeof(uint64_t))) { in hvsock_canread_check()
1302 error = vmbus_chan_recv_idxadv(pcb->chan, advance); in hvsock_canread_check()
1309 pcb->rb_init = false; in hvsock_canread_check()
1310 pcb->recv_data_len = 0; in hvsock_canread_check()
1311 pcb->recv_data_off = 0; in hvsock_canread_check()
1312 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1330 error = vmbus_chan_recv_peek(pcb->chan, &pcb->hvs_pkt, in hvsock_canread_check()
1344 tlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1345 hlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_hlen); in hvsock_canread_check()
1346 dlen = pcb->hvs_pkt.vmpipe_pkt_hdr.vmpipe_data_size; in hvsock_canread_check()
1353 pcb->so->so_error = EIO; in hvsock_canread_check()
1356 if (pcb->rb_init == false) in hvsock_canread_check()
1357 pcb->rb_init = true; in hvsock_canread_check()
1368 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1374 pcb->recv_data_len = dlen; in hvsock_canread_check()
1375 pcb->recv_data_off = 0; in hvsock_canread_check()
1377 return (pcb->recv_data_len); in hvsock_canread_check()
1381 hvsock_canwrite_check(struct hvs_pcb *pcb) in hvsock_canwrite_check() argument
1386 if (pcb == NULL || pcb->chan == NULL) in hvsock_canwrite_check()
1389 writeable = vmbus_chan_write_available(pcb->chan); in hvsock_canwrite_check()
1425 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel() local
1447 hvsock_chan_cb, pcb); in hvsock_open_channel()
1477 struct hvs_pcb *new_pcb, *pcb; in hvsock_open_conn_passive() local
1513 pcb = so->so_pcb; in hvsock_open_conn_passive()
1516 hvs_addr_set(&(new_pcb->local_addr), pcb->local_addr.hvs_port); in hvsock_open_conn_passive()
1529 sc->pcb = new_pcb; in hvsock_open_conn_passive()
1546 struct hvs_pcb *pcb; in hvsock_open_conn_active() local
1555 pcb = so->so_pcb; in hvsock_open_conn_active()
1556 pcb->chan = chan; in hvsock_open_conn_active()
1557 pcb->recv_data_len = 0; in hvsock_open_conn_active()
1558 pcb->recv_data_off = 0; in hvsock_open_conn_active()
1559 pcb->rb_init = false; in hvsock_open_conn_active()
1580 struct hvs_pcb *pcb; in hvsock_open_connection() local
1622 pcb = so->so_pcb; in hvsock_open_connection()
1623 if (pcb && pcb->so) { in hvsock_open_connection()
1624 sc->pcb = so2hvspcb(so); in hvsock_open_connection()
1685 if (sc->pcb != NULL) { in hvsock_detach()
1688 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1697 __hvs_remove_pcb_from_list(sc->pcb, in hvsock_detach()
1731 bzero(sc->pcb, sizeof(struct hvs_pcb)); in hvsock_detach()
1732 free(sc->pcb, M_HVSOCK); in hvsock_detach()
1733 sc->pcb = NULL; in hvsock_detach()