Lines Matching refs:so
202 __hvs_remove_socket_from_list(struct socket *so, unsigned char list) in __hvs_remove_socket_from_list() argument
204 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_remove_socket_from_list()
212 __hvs_insert_socket_on_list(struct socket *so, unsigned char list) in __hvs_insert_socket_on_list() argument
214 struct hvs_pcb *pcb = so2hvspcb(so); in __hvs_insert_socket_on_list()
226 hvs_remove_socket_from_list(struct socket *so, unsigned char list) in hvs_remove_socket_from_list() argument
228 if (!so || !so->so_pcb) { in hvs_remove_socket_from_list()
235 __hvs_remove_socket_from_list(so, list); in hvs_remove_socket_from_list()
240 hvs_insert_socket_on_list(struct socket *so, unsigned char list) in hvs_insert_socket_on_list() argument
242 if (!so || !so->so_pcb) { in hvs_insert_socket_on_list()
249 __hvs_insert_socket_on_list(so, list); in hvs_insert_socket_on_list()
260 if (p->so != NULL && in __hvs_find_socket_on_list()
262 return p->so; in __hvs_find_socket_on_list()
266 if (p->so != NULL && in __hvs_find_socket_on_list()
268 return p->so; in __hvs_find_socket_on_list()
347 hvs_trans_attach(struct socket *so, int proto, struct thread *td) in hvs_trans_attach() argument
349 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_attach()
354 if (so->so_type != SOCK_STREAM) in hvs_trans_attach()
366 pcb->so = so; in hvs_trans_attach()
367 so->so_pcb = (void *)pcb; in hvs_trans_attach()
373 hvs_trans_detach(struct socket *so) in hvs_trans_detach() argument
381 pcb = so2hvspcb(so); in hvs_trans_detach()
387 if (SOLISTENING(so)) { in hvs_trans_detach()
392 so->so_pcb = NULL; in hvs_trans_detach()
398 hvs_trans_bind(struct socket *so, struct sockaddr *addr, struct thread *td) in hvs_trans_bind() argument
400 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_bind()
442 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_bind()
450 hvs_trans_listen(struct socket *so, int backlog, struct thread *td) in hvs_trans_listen() argument
452 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_listen()
464 if (bound_so == NULL || bound_so != so) { in hvs_trans_listen()
470 SOCK_LOCK(so); in hvs_trans_listen()
471 error = solisten_proto_check(so); in hvs_trans_listen()
473 solisten_proto(so, backlog); in hvs_trans_listen()
474 SOCK_UNLOCK(so); in hvs_trans_listen()
482 hvs_trans_accept(struct socket *so, struct sockaddr **nam) in hvs_trans_accept() argument
484 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_accept()
499 hvs_trans_connect(struct socket *so, struct sockaddr *nam, struct thread *td) in hvs_trans_connect() argument
501 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_connect()
522 if (so->so_state & in hvs_trans_connect()
557 __hvs_insert_socket_on_list(so, HVS_LIST_BOUND); in hvs_trans_connect()
567 soisconnecting(so); in hvs_trans_connect()
590 hvs_trans_disconnect(struct socket *so) in hvs_trans_disconnect() argument
598 pcb = so2hvspcb(so); in hvs_trans_disconnect()
605 if ((so->so_state & SS_ISDISCONNECTED) == 0) in hvs_trans_disconnect()
606 soisdisconnecting(so); in hvs_trans_disconnect()
619 hvs_trans_soreceive(struct socket *so, struct sockaddr **paddr, in hvs_trans_soreceive() argument
622 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_soreceive()
632 if (so->so_type != SOCK_STREAM) in hvs_trans_soreceive()
652 error = SOCK_IO_RECV_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_soreceive()
659 sb = &so->so_rcv; in hvs_trans_soreceive()
670 (so->so_state & SS_ISDISCONNECTED)) { in hvs_trans_soreceive()
694 if (error || so->so_state & SS_ISDISCONNECTED) { in hvs_trans_soreceive()
706 if (so->so_error) { in hvs_trans_soreceive()
707 if (so->so_error == ESHUTDOWN && in hvs_trans_soreceive()
716 if (so->so_error != ESHUTDOWN) in hvs_trans_soreceive()
717 error = so->so_error; in hvs_trans_soreceive()
735 if ((so->so_state & SS_NBIO) || in hvs_trans_soreceive()
751 error = sbwait(so, SO_RCV); in hvs_trans_soreceive()
763 SOCK_IO_RECV_UNLOCK(so); in hvs_trans_soreceive()
766 if (so->so_error == ESHUTDOWN) { in hvs_trans_soreceive()
767 if (so->so_snd.sb_state & SBS_CANTSENDMORE) { in hvs_trans_soreceive()
769 soisdisconnecting(so); in hvs_trans_soreceive()
772 socantrcvmore(so); in hvs_trans_soreceive()
778 __func__, error, so->so_error); in hvs_trans_soreceive()
784 hvs_trans_sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, in hvs_trans_sosend() argument
787 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sosend()
797 if (so->so_type != SOCK_STREAM) in hvs_trans_sosend()
809 error = SOCK_IO_SEND_LOCK(so, SBLOCKWAIT(flags)); in hvs_trans_sosend()
816 sb = &so->so_snd; in hvs_trans_sosend()
820 so->so_error == ESHUTDOWN) { in hvs_trans_sosend()
835 if (so->so_state & SS_NBIO || in hvs_trans_sosend()
847 error = sbwait(so, SO_SND); in hvs_trans_sosend()
875 SOCK_IO_SEND_UNLOCK(so); in hvs_trans_sosend()
881 hvs_trans_peeraddr(struct socket *so, struct sockaddr **nam) in hvs_trans_peeraddr() argument
883 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_peeraddr()
897 hvs_trans_sockaddr(struct socket *so, struct sockaddr **nam) in hvs_trans_sockaddr() argument
899 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_sockaddr()
913 hvs_trans_close(struct socket *so) in hvs_trans_close() argument
921 pcb = so2hvspcb(so); in hvs_trans_close()
927 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_close()
934 if (so->so_state & in hvs_trans_close()
936 soisdisconnected(so); in hvs_trans_close()
939 pcb->so = NULL; in hvs_trans_close()
941 if (SOLISTENING(so)) { in hvs_trans_close()
944 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_close()
954 hvs_trans_abort(struct socket *so) in hvs_trans_abort() argument
956 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_abort()
967 if (SOLISTENING(so)) { in hvs_trans_abort()
970 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvs_trans_abort()
974 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_abort()
975 (void) sodisconnect(so); in hvs_trans_abort()
983 hvs_trans_shutdown(struct socket *so) in hvs_trans_shutdown() argument
985 struct hvs_pcb *pcb = so2hvspcb(so); in hvs_trans_shutdown()
1001 if ((so->so_rcv.sb_state & SBS_CANTRCVMORE) == 0) { in hvs_trans_shutdown()
1007 socantsendmore(so); in hvs_trans_shutdown()
1010 if (so->so_state & SS_ISCONNECTED) { in hvs_trans_shutdown()
1012 sb = &so->so_snd; in hvs_trans_shutdown()
1017 soisdisconnecting(so); in hvs_trans_shutdown()
1092 struct socket *so; in hvsock_chan_cb() local
1105 so = hsvpcb2so(pcb); in hvsock_chan_cb()
1107 if (pcb->chan != NULL && so != NULL) { in hvsock_chan_cb()
1111 SOCKBUF_LOCK(&(so)->so_rcv); in hvsock_chan_cb()
1118 sorwakeup_locked(so); in hvsock_chan_cb()
1120 SOCKBUF_UNLOCK(&(so)->so_rcv); in hvsock_chan_cb()
1125 SOCKBUF_LOCK(&(so)->so_snd); in hvsock_chan_cb()
1132 sowwakeup_locked(so); in hvsock_chan_cb()
1134 SOCKBUF_UNLOCK(&(so)->so_snd); in hvsock_chan_cb()
1254 pcb->so->so_error = EIO; in hvsock_canread_check()
1331 pcb->so->so_error = EIO; in hvsock_canread_check()
1346 pcb->so->so_error = ESHUTDOWN; in hvsock_canread_check()
1400 hvsock_open_channel(struct vmbus_channel *chan, struct socket *so) in hvsock_open_channel() argument
1403 struct hvs_pcb *pcb = so2hvspcb(so); in hvsock_open_channel()
1410 sndbuf = MAX(so->so_snd.sb_hiwat, HVS_RINGBUF_SND_SIZE); in hvsock_open_channel()
1413 rcvbuf = MAX(so->so_rcv.sb_hiwat, HVS_RINGBUF_RCV_SIZE); in hvsock_open_channel()
1451 hvsock_open_conn_passive(struct vmbus_channel *chan, struct socket *so, in hvsock_open_conn_passive() argument
1459 if (!SOLISTENING(so)) { in hvsock_open_conn_passive()
1475 new_so = sonewconn(so, 0); in hvsock_open_conn_passive()
1491 pcb = so->so_pcb; in hvsock_open_conn_passive()
1522 hvsock_open_conn_active(struct vmbus_channel *chan, struct socket *so) in hvsock_open_conn_active() argument
1527 error = hvsock_open_channel(chan, so); in hvsock_open_conn_active()
1529 so->so_error = error; in hvsock_open_conn_active()
1533 pcb = so->so_pcb; in hvsock_open_conn_active()
1540 __hvs_remove_socket_from_list(so, HVS_LIST_BOUND); in hvsock_open_conn_active()
1541 __hvs_insert_socket_on_list(so, HVS_LIST_CONNECTED); in hvsock_open_conn_active()
1548 soisconnected(so); in hvsock_open_conn_active()
1557 struct socket *so; in hvsock_open_connection() local
1588 so = hvs_find_socket_on_list(&addr, HVS_LIST_BOUND); in hvsock_open_connection()
1589 if (!so) { in hvsock_open_connection()
1597 hvsock_open_conn_passive(chan, so, sc); in hvsock_open_connection()
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()
1603 hvsock_open_conn_active(chan, so); in hvsock_open_connection()
1655 struct socket *so; in hvsock_detach() local
1666 so = hsvpcb2so(sc->pcb); in hvsock_detach()
1667 if (so) { in hvsock_detach()
1669 if (so->so_state & in hvsock_detach()
1671 soisdisconnected(so); in hvsock_detach()
1683 if (so) { in hvsock_detach()
1685 while (SOCK_IO_RECV_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1689 soisdisconnected(so); in hvsock_detach()
1696 while (SOCK_IO_SEND_LOCK(so, 0) == EWOULDBLOCK) { in hvsock_detach()
1700 soisdisconnected(so); in hvsock_detach()
1713 if (so) { in hvsock_detach()
1714 SOCK_IO_RECV_UNLOCK(so); in hvsock_detach()
1715 SOCK_IO_SEND_UNLOCK(so); in hvsock_detach()
1716 so->so_pcb = NULL; in hvsock_detach()