Lines Matching refs:pcb
179 __hvs_remove_pcb_from_list(struct hvs_pcb *pcb, unsigned char list) in __hvs_remove_pcb_from_list() argument
183 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_pcb_from_list()
185 if (!pcb) in __hvs_remove_pcb_from_list()
190 if (p == pcb) in __hvs_remove_pcb_from_list()
196 if (p == pcb) in __hvs_remove_pcb_from_list()
197 LIST_REMOVE(pcb, connected_next); in __hvs_remove_pcb_from_list()
204 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list() local
206 HVSOCK_DBG(HVSOCK_DBG_VERBOSE, "%s: pcb is %p\n", __func__, pcb); in __hvs_remove_socket_from_list()
208 __hvs_remove_pcb_from_list(pcb, list); in __hvs_remove_socket_from_list()
214 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list() local
218 pcb, bound_next); in __hvs_insert_socket_on_list()
222 pcb, connected_next); in __hvs_insert_socket_on_list()
349 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach() local
360 if (pcb != NULL) in hvs_trans_attach()
362 pcb = malloc(sizeof(struct hvs_pcb), M_HVSOCK, M_NOWAIT | M_ZERO); in hvs_trans_attach()
363 if (pcb == NULL) in hvs_trans_attach()
366 pcb->so = so; in hvs_trans_attach()
367 so->so_pcb = (void *)pcb; in hvs_trans_attach()
375 struct hvs_pcb *pcb; in hvs_trans_detach() local
381 pcb = so2hvspcb(so); in hvs_trans_detach()
382 if (pcb == NULL) { in hvs_trans_detach()
388 bzero(pcb, sizeof(*pcb)); in hvs_trans_detach()
389 free(pcb, M_HVSOCK); in hvs_trans_detach()
400 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind() local
411 if (pcb == NULL) { in hvs_trans_bind()
440 hvs_addr_set(&pcb->local_addr, sa->hvs_port); in hvs_trans_bind()
441 hvs_addr_set(&pcb->remote_addr, HVADDR_PORT_ANY); in hvs_trans_bind()
452 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen() local
459 if (pcb == NULL) in hvs_trans_listen()
463 bound_so = hvs_find_socket_on_list(&pcb->local_addr, HVS_LIST_BOUND); in hvs_trans_listen()
484 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept() local
489 if (pcb == NULL) in hvs_trans_accept()
492 *nam = sodupsockaddr((struct sockaddr *) &pcb->remote_addr, in hvs_trans_accept()
501 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect() local
510 if (pcb == NULL) in hvs_trans_connect()
535 hvs_addr_set(&pcb->local_addr, 0); in hvs_trans_connect()
542 pcb->local_addr.hvs_port = i; in hvs_trans_connect()
544 if (__hvs_find_socket_on_list(&pcb->local_addr, in hvs_trans_connect()
550 __func__, pcb->local_addr.hvs_port); in hvs_trans_connect()
559 pcb->vm_srv_id = srv_id_template; in hvs_trans_connect()
560 set_port_by_srv_id(&pcb->vm_srv_id, pcb->local_addr.hvs_port); in hvs_trans_connect()
562 pcb->host_srv_id = srv_id_template; in hvs_trans_connect()
563 set_port_by_srv_id(&pcb->host_srv_id, raddr->hvs_port); in hvs_trans_connect()
564 hvs_addr_set(&pcb->remote_addr, raddr->hvs_port); in hvs_trans_connect()
576 hvsock_print_guid(&pcb->vm_srv_id); in hvs_trans_connect()
578 hvsock_print_guid(&pcb->host_srv_id); in hvs_trans_connect()
584 vmbus_req_tl_connect(&pcb->vm_srv_id, &pcb->host_srv_id); in hvs_trans_connect()
592 struct hvs_pcb *pcb; in hvs_trans_disconnect() local
598 pcb = so2hvspcb(so); in hvs_trans_disconnect()
599 if (pcb == NULL) { in hvs_trans_disconnect()
622 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive() local
634 if (pcb == NULL) in hvs_trans_soreceive()
678 (canread = hvsock_canread_check(pcb)) > 0) { in hvs_trans_soreceive()
683 pcb->recv_data_off)); in hvs_trans_soreceive()
685 error = vmbus_chan_recv_peek_call(pcb->chan, to_read, in hvs_trans_soreceive()
686 sizeof(struct hvs_pkt_header) + pcb->recv_data_off, in hvs_trans_soreceive()
698 pcb->recv_data_len -= to_read; in hvs_trans_soreceive()
699 pcb->recv_data_off += to_read; in hvs_trans_soreceive()
758 __func__, vmbus_chan_read_available(pcb->chan)); in hvs_trans_soreceive()
787 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend() local
799 if (pcb == NULL) in hvs_trans_sosend()
826 canwrite = hvsock_canwrite_check(pcb); in hvs_trans_sosend()
856 vmbus_chan_write_available(pcb->chan)); in hvs_trans_sosend()
867 error = hvsock_send_data(pcb->chan, uio, to_write, sb); in hvs_trans_sosend()
883 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr() local
888 if (pcb == NULL) in hvs_trans_peeraddr()
891 *nam = sodupsockaddr((struct sockaddr *) &pcb->remote_addr, M_NOWAIT); in hvs_trans_peeraddr()
899 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr() local
904 if (pcb == NULL) in hvs_trans_sockaddr()
907 *nam = sodupsockaddr((struct sockaddr *) &pcb->local_addr, M_NOWAIT); in hvs_trans_sockaddr()
915 struct hvs_pcb *pcb; in hvs_trans_close() local
921 pcb = so2hvspcb(so); in hvs_trans_close()
922 if (!pcb) { in hvs_trans_close()
931 (void) hvsock_send_data(pcb->chan, NULL, 0, NULL); in hvs_trans_close()
938 pcb->chan = NULL; in hvs_trans_close()
939 pcb->so = NULL; in hvs_trans_close()
956 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort() local
962 if (pcb == NULL) { in hvs_trans_abort()
985 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown() local
991 if (pcb == NULL) in hvs_trans_shutdown()
1014 (void) hvsock_send_data(pcb->chan, NULL, 0, sb); in hvs_trans_shutdown()
1076 struct hvs_pcb *pcb; member
1091 struct hvs_pcb *pcb = (struct hvs_pcb *) context; in hvsock_chan_cb() local
1097 __func__, pcb); in hvsock_chan_cb()
1105 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1107 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1115 vmbus_chan_read_available(pcb->chan)); in hvsock_chan_cb()
1117 if (hvsock_chan_readable(pcb->chan)) in hvsock_chan_cb()
1126 canwrite = hvsock_canwrite_check(pcb); in hvsock_chan_cb()
1246 hvsock_canread_check(struct hvs_pcb *pcb) in hvsock_canread_check() argument
1253 if (pcb == NULL || pcb->chan == NULL) { in hvsock_canread_check()
1254 pcb->so->so_error = EIO; in hvsock_canread_check()
1259 if (pcb->recv_data_len > 0) in hvsock_canread_check()
1260 return (pcb->recv_data_len); in hvsock_canread_check()
1262 if (pcb->rb_init) in hvsock_canread_check()
1264 VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1268 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1274 if (pcb->rb_init && bytes_canread == (advance + sizeof(uint64_t))) { in hvsock_canread_check()
1280 error = vmbus_chan_recv_idxadv(pcb->chan, advance); in hvsock_canread_check()
1287 pcb->rb_init = false; in hvsock_canread_check()
1288 pcb->recv_data_len = 0; in hvsock_canread_check()
1289 pcb->recv_data_off = 0; in hvsock_canread_check()
1290 bytes_canread = vmbus_chan_read_available(pcb->chan); in hvsock_canread_check()
1308 error = vmbus_chan_recv_peek(pcb->chan, &pcb->hvs_pkt, in hvsock_canread_check()
1322 tlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_tlen); in hvsock_canread_check()
1323 hlen = VMBUS_CHANPKT_GETLEN(pcb->hvs_pkt.chan_pkt_hdr.cph_hlen); in hvsock_canread_check()
1324 dlen = pcb->hvs_pkt.vmpipe_pkt_hdr.vmpipe_data_size; in hvsock_canread_check()
1331 pcb->so->so_error = EIO; in hvsock_canread_check()
1334 if (pcb->rb_init == false) in hvsock_canread_check()
1335 pcb->rb_init = true; in hvsock_canread_check()
1346 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1352 pcb->recv_data_len = dlen; in hvsock_canread_check()
1353 pcb->recv_data_off = 0; in hvsock_canread_check()
1355 return (pcb->recv_data_len); in hvsock_canread_check()
1359 hvsock_canwrite_check(struct hvs_pcb *pcb) in hvsock_canwrite_check() argument
1364 if (pcb == NULL || pcb->chan == NULL) in hvsock_canwrite_check()
1367 writeable = vmbus_chan_write_available(pcb->chan); in hvsock_canwrite_check()
1403 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel() local
1425 hvsock_chan_cb, pcb); in hvsock_open_channel()
1455 struct hvs_pcb *new_pcb, *pcb; in hvsock_open_conn_passive() local
1491 pcb = so->so_pcb; in hvsock_open_conn_passive()
1494 hvs_addr_set(&(new_pcb->local_addr), pcb->local_addr.hvs_port); in hvsock_open_conn_passive()
1507 sc->pcb = new_pcb; in hvsock_open_conn_passive()
1524 struct hvs_pcb *pcb; in hvsock_open_conn_active() local
1533 pcb = so->so_pcb; in hvsock_open_conn_active()
1534 pcb->chan = chan; in hvsock_open_conn_active()
1535 pcb->recv_data_len = 0; in hvsock_open_conn_active()
1536 pcb->recv_data_off = 0; in hvsock_open_conn_active()
1537 pcb->rb_init = false; in hvsock_open_conn_active()
1558 struct hvs_pcb *pcb; in hvsock_open_connection() local
1600 pcb = so->so_pcb; in hvsock_open_connection()
1601 if (pcb && pcb->so) { in hvsock_open_connection()
1602 sc->pcb = so2hvspcb(so); in hvsock_open_connection()
1663 if (sc->pcb != NULL) { in hvsock_detach()
1666 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1675 __hvs_remove_pcb_from_list(sc->pcb, in hvsock_detach()
1709 bzero(sc->pcb, sizeof(struct hvs_pcb)); in hvsock_detach()
1710 free(sc->pcb, M_HVSOCK); in hvsock_detach()
1711 sc->pcb = NULL; in hvsock_detach()