Lines Matching full:so
201 __hvs_remove_socket_from_list(struct socket *so, unsigned char list) in __hvs_remove_socket_from_list() argument
203 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list()
211 __hvs_insert_socket_on_list(struct socket *so, unsigned char list) in __hvs_insert_socket_on_list() argument
213 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list()
225 hvs_remove_socket_from_list(struct socket *so, unsigned char list) in hvs_remove_socket_from_list() argument
227 if (!so || !so->so_pcb) { in hvs_remove_socket_from_list()
234 __hvs_remove_socket_from_list(so, list); in hvs_remove_socket_from_list()
239 hvs_insert_socket_on_list(struct socket *so, unsigned char list) in hvs_insert_socket_on_list() argument
241 if (!so || !so->so_pcb) { in hvs_insert_socket_on_list()
248 __hvs_insert_socket_on_list(so, list); in hvs_insert_socket_on_list()
259 if (p->so != NULL && in __hvs_find_socket_on_list()
261 return p->so; in __hvs_find_socket_on_list()
265 if (p->so != NULL && in __hvs_find_socket_on_list()
267 return p->so; in __hvs_find_socket_on_list()
346 hvs_trans_attach(struct socket *so, int proto, struct thread *td) in hvs_trans_attach() argument
348 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach()
353 if (so->so_type != SOCK_STREAM) in hvs_trans_attach()
365 pcb->so = so; in hvs_trans_attach()
366 so->so_pcb = (void *)pcb; in hvs_trans_attach()
372 hvs_trans_detach(struct socket *so) in hvs_trans_detach() argument
380 pcb = so2hvspcb(so); in hvs_trans_detach()
386 if (SOLISTENING(so)) { in hvs_trans_detach()
391 so->so_pcb = NULL; in hvs_trans_detach()
397 hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td) in hvs_trans_bind() argument
399 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind()
441 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_bind()
449 hvs_trans_listen(struct socket *so, int backlog, struct thread *td) in hvs_trans_listen() argument
451 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen()
463 if (bound_so == NULL || bound_so != so) { in hvs_trans_listen()
469 SOCK_LOCK(so); in hvs_trans_listen()
470 error = solisten_proto_check(so); in hvs_trans_listen()
472 solisten_proto(so, backlog); in hvs_trans_listen()
473 SOCK_UNLOCK(so); in hvs_trans_listen()
481 hvs_trans_accept(struct socket *so, struct sockaddr *sa) in hvs_trans_accept() argument
483 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept()
497 hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td) in hvs_trans_connect() argument
499 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect()
520 if (so->so_state & in hvs_trans_connect()
555 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_connect()
565 soisconnecting(so); in hvs_trans_connect()
588 hvs_trans_disconnect(struct socket *so) in hvs_trans_disconnect() argument
596 pcb = so2hvspcb(so); in hvs_trans_disconnect()
603 if ((so->so_state & SS_ISDISCONNECTED) == 0) in hvs_trans_disconnect()
604 soisdisconnecting(so); in hvs_trans_disconnect()
617 hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr, in hvs_trans_soreceive() argument
620 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive()
630 if (so->so_type != SOCK_STREAM) in hvs_trans_soreceive()
650 error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_soreceive()
657 sb = &so->so_rcv; in hvs_trans_soreceive()
668 (so->so_state & SS_ISDISCONNECTED)) { in hvs_trans_soreceive()
688 * we released lock in hvsock_br_callback. So we in hvs_trans_soreceive()
692 if (error || so->so_state & SS_ISDISCONNECTED) { in hvs_trans_soreceive()
704 if (so->so_error) { in hvs_trans_soreceive()
705 if (so->so_error == ESHUTDOWN && in hvs_trans_soreceive()
714 if (so->so_error != ESHUTDOWN) in hvs_trans_soreceive()
715 error = so->so_error; in hvs_trans_soreceive()
733 if ((so->so_state & SS_NBIO) || in hvs_trans_soreceive()
749 error = sbwait(so, SO_RCV); in hvs_trans_soreceive()
761 SOCK_IO_RECV_UNLOCK(so); in hvs_trans_soreceive()
764 if (so->so_error == ESHUTDOWN) { in hvs_trans_soreceive()
765 if (so->so_snd.sb_state & SBS_CANTSENDMORE) { in hvs_trans_soreceive()
767 soisdisconnecting(so); in hvs_trans_soreceive()
770 socantrcvmore(so); in hvs_trans_soreceive()
776 __func__, error, so->so_error); in hvs_trans_soreceive()
782 hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, in hvs_trans_sosend() argument
785 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend()
795 if (so->so_type != SOCK_STREAM) in hvs_trans_sosend()
807 error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_sosend()
814 sb = &so->so_snd; in hvs_trans_sosend()
818 so->so_error == ESHUTDOWN) { in hvs_trans_sosend()
833 if (so->so_state & SS_NBIO || in hvs_trans_sosend()
845 error = sbwait(so, SO_SND); in hvs_trans_sosend()
873 SOCK_IO_SEND_UNLOCK(so); in hvs_trans_sosend()
879 hvs_trans_peeraddr(struct socket *so, struct sockaddr *sa) in hvs_trans_peeraddr() argument
881 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr()
895 hvs_trans_sockaddr(struct socket *so, struct sockaddr *sa) in hvs_trans_sockaddr() argument
897 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr()
911 hvs_trans_close(struct socket *so) in hvs_trans_close() argument
919 pcb = so2hvspcb(so); in hvs_trans_close()
925 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_close()
932 if (so->so_state & in hvs_trans_close()
934 soisdisconnected(so); in hvs_trans_close()
937 pcb->so = NULL; in hvs_trans_close()
939 if (SOLISTENING(so)) { in hvs_trans_close()
942 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_close()
952 hvs_trans_abort(struct socket *so) in hvs_trans_abort() argument
954 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort()
965 if (SOLISTENING(so)) { in hvs_trans_abort()
968 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_abort()
972 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_abort()
973 (void) sodisconnect(so); in hvs_trans_abort()
981 hvs_trans_shutdown(struct socket *so, enum shutdown_how how) in hvs_trans_shutdown() argument
983 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown()
988 SOCK_LOCK(so); in hvs_trans_shutdown()
989 if ((so->so_state & in hvs_trans_shutdown()
991 SOCK_UNLOCK(so); in hvs_trans_shutdown()
994 SOCK_UNLOCK(so); in hvs_trans_shutdown()
1001 socantrcvmore(so); in hvs_trans_shutdown()
1004 socantrcvmore(so); in hvs_trans_shutdown()
1005 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_shutdown()
1007 SOCK_SENDBUF_LOCK(so); in hvs_trans_shutdown()
1009 &so->so_snd); in hvs_trans_shutdown()
1010 SOCK_SENDBUF_UNLOCK(so); in hvs_trans_shutdown()
1011 soisdisconnecting(so); in hvs_trans_shutdown()
1015 socantsendmore(so); in hvs_trans_shutdown()
1017 wakeup(&so->so_timeo); in hvs_trans_shutdown()
1043 * to limit the available GUID space of SOCKADDR_HV so that we can create
1090 struct socket *so; in hvsock_chan_cb() local
1103 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1105 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1109 SOCKBUF_LOCK(&(so)->so_rcv); in hvsock_chan_cb()
1116 sorwakeup_locked(so); in hvsock_chan_cb()
1118 SOCKBUF_UNLOCK(&(so)->so_rcv); in hvsock_chan_cb()
1123 SOCKBUF_LOCK(&(so)->so_snd); in hvsock_chan_cb()
1130 sowwakeup_locked(so); in hvsock_chan_cb()
1132 SOCKBUF_UNLOCK(&(so)->so_snd); in hvsock_chan_cb()
1252 pcb->so->so_error = EIO; in hvsock_canread_check()
1275 * calling sbwait, so host knows to wake us up when data in hvsock_canread_check()
1329 pcb->so->so_error = EIO; in hvsock_canread_check()
1344 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1398 hvsock_open_channel(struct vmbus_channel *chan, struct socket *so) in hvsock_open_channel() argument
1401 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel()
1408 sndbuf = MAX(so->so_snd.sb_hiwat, HVS_RINGBUF_SND_SIZE); in hvsock_open_channel()
1411 rcvbuf = MAX(so->so_rcv.sb_hiwat, HVS_RINGBUF_RCV_SIZE); in hvsock_open_channel()
1434 * Se the pending send size so to receive wakeup in hvsock_open_channel()
1449 hvsock_open_conn_passive(struct vmbus_channel *chan, struct socket *so, in hvsock_open_conn_passive() argument
1457 if (!SOLISTENING(so)) { in hvsock_open_conn_passive()
1470 * moment, so we don't need to hold its lock while opening in hvsock_open_conn_passive()
1473 new_so = sonewconn(so, 0); in hvsock_open_conn_passive()
1489 pcb = so->so_pcb; in hvsock_open_conn_passive()
1520 hvsock_open_conn_active(struct vmbus_channel *chan, struct socket *so) in hvsock_open_conn_active() argument
1525 error = hvsock_open_channel(chan, so); in hvsock_open_conn_active()
1527 so->so_error = error; in hvsock_open_conn_active()
1531 pcb = so->so_pcb; in hvsock_open_conn_active()
1538 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvsock_open_conn_active()
1539 __hvs_insert_socket_on_list(so, HVS_LIST_CONNECTED); in hvsock_open_conn_active()
1546 soisconnected(so); in hvsock_open_conn_active()
1555 struct socket *so; in hvsock_open_connection() local
1586 so = hvs_find_socket_on_list(&addr, HVS_LIST_BOUND); in hvsock_open_connection()
1587 if (!so) { in hvsock_open_connection()
1595 hvsock_open_conn_passive(chan, so, sc); in hvsock_open_connection()
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()
1601 hvsock_open_conn_active(chan, so); in hvsock_open_connection()
1653 struct socket *so; in hvsock_detach() local
1664 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1665 if (so) { in hvsock_detach()
1667 if (so->so_state & in hvsock_detach()
1669 soisdisconnected(so); in hvsock_detach()
1681 if (so) { in hvsock_detach()
1683 while (SOCK_IO_RECV_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1687 soisdisconnected(so); in hvsock_detach()
1694 while (SOCK_IO_SEND_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1698 soisdisconnected(so); in hvsock_detach()
1711 if (so) { in hvsock_detach()
1712 SOCK_IO_RECV_UNLOCK(so); in hvsock_detach()
1713 SOCK_IO_SEND_UNLOCK(so); in hvsock_detach()
1714 so->so_pcb = NULL; in hvsock_detach()