Lines Matching refs:so
215 __hvs_remove_socket_from_list(struct socket *so, unsigned char list) in __hvs_remove_socket_from_list() argument
217 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list()
225 __hvs_insert_socket_on_list(struct socket *so, unsigned char list) in __hvs_insert_socket_on_list() argument
227 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list()
239 hvs_remove_socket_from_list(struct socket *so, unsigned char list) in hvs_remove_socket_from_list() argument
241 if (!so || !so->so_pcb) { in hvs_remove_socket_from_list()
248 __hvs_remove_socket_from_list(so, list); in hvs_remove_socket_from_list()
253 hvs_insert_socket_on_list(struct socket *so, unsigned char list) in hvs_insert_socket_on_list() argument
255 if (!so || !so->so_pcb) { in hvs_insert_socket_on_list()
262 __hvs_insert_socket_on_list(so, list); in hvs_insert_socket_on_list()
273 if (p->so != NULL && in __hvs_find_socket_on_list()
275 return p->so; in __hvs_find_socket_on_list()
279 if (p->so != NULL && in __hvs_find_socket_on_list()
281 return p->so; in __hvs_find_socket_on_list()
354 hvs_trans_attach(struct socket *so, int proto, struct thread *td) in hvs_trans_attach() argument
356 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach()
364 if (so->so_type != SOCK_STREAM) in hvs_trans_attach()
376 pcb->so = so; in hvs_trans_attach()
377 so->so_pcb = (void *)pcb; in hvs_trans_attach()
383 hvs_trans_detach(struct socket *so) in hvs_trans_detach() argument
394 pcb = so2hvspcb(so); in hvs_trans_detach()
400 if (SOLISTENING(so)) { in hvs_trans_detach()
405 so->so_pcb = NULL; in hvs_trans_detach()
411 hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td) in hvs_trans_bind() argument
413 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind()
455 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_bind()
463 hvs_trans_listen(struct socket *so, int backlog, struct thread *td) in hvs_trans_listen() argument
465 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen()
477 if (bound_so == NULL || bound_so != so) { in hvs_trans_listen()
483 SOCK_LOCK(so); in hvs_trans_listen()
484 error = solisten_proto_check(so); in hvs_trans_listen()
486 solisten_proto(so, backlog); in hvs_trans_listen()
487 SOCK_UNLOCK(so); in hvs_trans_listen()
495 hvs_trans_accept(struct socket *so, struct sockaddr **nam) in hvs_trans_accept() argument
497 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept()
512 hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td) in hvs_trans_connect() argument
514 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect()
535 if (so->so_state & in hvs_trans_connect()
570 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_connect()
580 soisconnecting(so); in hvs_trans_connect()
603 hvs_trans_disconnect(struct socket *so) in hvs_trans_disconnect() argument
614 pcb = so2hvspcb(so); in hvs_trans_disconnect()
621 if ((so->so_state & SS_ISDISCONNECTED) == 0) in hvs_trans_disconnect()
622 soisdisconnecting(so); in hvs_trans_disconnect()
635 hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr, in hvs_trans_soreceive() argument
638 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive()
648 if (so->so_type != SOCK_STREAM) in hvs_trans_soreceive()
668 error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_soreceive()
675 sb = &so->so_rcv; in hvs_trans_soreceive()
686 (so->so_state & SS_ISDISCONNECTED)) { in hvs_trans_soreceive()
710 if (error || so->so_state & SS_ISDISCONNECTED) { in hvs_trans_soreceive()
722 if (so->so_error) { in hvs_trans_soreceive()
723 if (so->so_error == ESHUTDOWN && in hvs_trans_soreceive()
732 if (so->so_error != ESHUTDOWN) in hvs_trans_soreceive()
733 error = so->so_error; in hvs_trans_soreceive()
751 if ((so->so_state & SS_NBIO) || in hvs_trans_soreceive()
779 SOCK_IO_RECV_UNLOCK(so); in hvs_trans_soreceive()
782 if (so->so_error == ESHUTDOWN) { in hvs_trans_soreceive()
783 if (so->so_snd.sb_state & SBS_CANTSENDMORE) { in hvs_trans_soreceive()
785 soisdisconnecting(so); in hvs_trans_soreceive()
788 socantrcvmore(so); in hvs_trans_soreceive()
794 __func__, error, so->so_error); in hvs_trans_soreceive()
800 hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, in hvs_trans_sosend() argument
803 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend()
813 if (so->so_type != SOCK_STREAM) in hvs_trans_sosend()
825 error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_sosend()
832 sb = &so->so_snd; in hvs_trans_sosend()
836 so->so_error == ESHUTDOWN) { in hvs_trans_sosend()
851 if (so->so_state & SS_NBIO || in hvs_trans_sosend()
891 SOCK_IO_SEND_UNLOCK(so); in hvs_trans_sosend()
897 hvs_trans_peeraddr(struct socket *so, struct sockaddr **nam) in hvs_trans_peeraddr() argument
899 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr()
913 hvs_trans_sockaddr(struct socket *so, struct sockaddr **nam) in hvs_trans_sockaddr() argument
915 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr()
929 hvs_trans_close(struct socket *so) in hvs_trans_close() argument
940 pcb = so2hvspcb(so); in hvs_trans_close()
946 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_close()
953 if (so->so_state & in hvs_trans_close()
955 soisdisconnected(so); in hvs_trans_close()
958 pcb->so = NULL; in hvs_trans_close()
960 if (SOLISTENING(so)) { in hvs_trans_close()
963 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_close()
973 hvs_trans_abort(struct socket *so) in hvs_trans_abort() argument
975 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort()
989 if (SOLISTENING(so)) { in hvs_trans_abort()
992 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_abort()
996 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_abort()
997 (void) sodisconnect(so); in hvs_trans_abort()
1005 hvs_trans_shutdown(struct socket *so) in hvs_trans_shutdown() argument
1007 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown()
1023 if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0) { in hvs_trans_shutdown()
1029 socantsendmore(so); in hvs_trans_shutdown()
1032 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_shutdown()
1034 sb = &so->so_snd; in hvs_trans_shutdown()
1039 soisdisconnecting(so); in hvs_trans_shutdown()
1114 struct socket *so; in hvsock_chan_cb() local
1127 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1129 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1133 SOCKBUF_LOCK(&(so)->so_rcv); in hvsock_chan_cb()
1140 sorwakeup_locked(so); in hvsock_chan_cb()
1142 SOCKBUF_UNLOCK(&(so)->so_rcv); in hvsock_chan_cb()
1147 SOCKBUF_LOCK(&(so)->so_snd); in hvsock_chan_cb()
1154 sowwakeup_locked(so); in hvsock_chan_cb()
1156 SOCKBUF_UNLOCK(&(so)->so_snd); in hvsock_chan_cb()
1276 pcb->so->so_error = EIO; in hvsock_canread_check()
1353 pcb->so->so_error = EIO; in hvsock_canread_check()
1368 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1422 hvsock_open_channel(struct vmbus_channel *chan, struct socket *so) in hvsock_open_channel() argument
1425 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel()
1432 sndbuf = MAX(so->so_snd.sb_hiwat, HVS_RINGBUF_SND_SIZE); in hvsock_open_channel()
1435 rcvbuf = MAX(so->so_rcv.sb_hiwat, HVS_RINGBUF_RCV_SIZE); in hvsock_open_channel()
1473 hvsock_open_conn_passive(struct vmbus_channel *chan, struct socket *so, in hvsock_open_conn_passive() argument
1481 if (!SOLISTENING(so)) { in hvsock_open_conn_passive()
1497 new_so = sonewconn(so, 0); in hvsock_open_conn_passive()
1513 pcb = so->so_pcb; in hvsock_open_conn_passive()
1544 hvsock_open_conn_active(struct vmbus_channel *chan, struct socket *so) in hvsock_open_conn_active() argument
1549 error = hvsock_open_channel(chan, so); in hvsock_open_conn_active()
1551 so->so_error = error; in hvsock_open_conn_active()
1555 pcb = so->so_pcb; in hvsock_open_conn_active()
1562 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvsock_open_conn_active()
1563 __hvs_insert_socket_on_list(so, HVS_LIST_CONNECTED); in hvsock_open_conn_active()
1570 soisconnected(so); in hvsock_open_conn_active()
1579 struct socket *so; in hvsock_open_connection() local
1610 so = hvs_find_socket_on_list(&addr, HVS_LIST_BOUND); in hvsock_open_connection()
1611 if (!so) { in hvsock_open_connection()
1619 hvsock_open_conn_passive(chan, so, sc); in hvsock_open_connection()
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()
1625 hvsock_open_conn_active(chan, so); in hvsock_open_connection()
1677 struct socket *so; in hvsock_detach() local
1688 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1689 if (so) { in hvsock_detach()
1691 if (so->so_state & in hvsock_detach()
1693 soisdisconnected(so); in hvsock_detach()
1705 if (so) { in hvsock_detach()
1707 while (SOCK_IO_RECV_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1711 soisdisconnected(so); in hvsock_detach()
1718 while (SOCK_IO_SEND_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1722 soisdisconnected(so); in hvsock_detach()
1735 if (so) { in hvsock_detach()
1736 SOCK_IO_RECV_UNLOCK(so); in hvsock_detach()
1737 SOCK_IO_SEND_UNLOCK(so); in hvsock_detach()
1738 so->so_pcb = NULL; in hvsock_detach()