Lines Matching full:transport
5 * Client-side transport implementation for sockets.
16 * IP socket transport implementation, (C) 2005 Chuck Lever <cel@netapp.com>
65 static void xs_reset_srcport(struct sock_xprt *transport);
66 static void xs_set_srcport(struct sock_xprt *transport, struct socket *sock);
181 * transport connection with the server. Some servers like to drop a TCP
188 * TCP idle timeout; client drops the transport socket if it is idle
528 xs_read_header(struct sock_xprt *transport, struct xdr_buf *buf) in xs_read_header() argument
530 if (!transport->recv.copied) { in xs_read_header()
531 if (buf->head[0].iov_len >= transport->recv.offset) in xs_read_header()
533 &transport->recv.xid, in xs_read_header()
534 transport->recv.offset); in xs_read_header()
535 transport->recv.copied = transport->recv.offset; in xs_read_header()
540 xs_read_stream_request_done(struct sock_xprt *transport) in xs_read_stream_request_done() argument
542 return transport->recv.fraghdr & cpu_to_be32(RPC_LAST_STREAM_FRAGMENT); in xs_read_stream_request_done()
546 xs_read_stream_check_eor(struct sock_xprt *transport, in xs_read_stream_check_eor() argument
549 if (xs_read_stream_request_done(transport)) in xs_read_stream_check_eor()
554 xs_read_stream_request(struct sock_xprt *transport, struct msghdr *msg, in xs_read_stream_request() argument
561 xs_read_header(transport, buf); in xs_read_stream_request()
563 want = transport->recv.len - transport->recv.offset; in xs_read_stream_request()
565 ret = xs_read_xdr_buf(transport->sock, msg, flags, buf, in xs_read_stream_request()
566 transport->recv.copied + want, in xs_read_stream_request()
567 transport->recv.copied, in xs_read_stream_request()
569 transport->recv.offset += read; in xs_read_stream_request()
570 transport->recv.copied += read; in xs_read_stream_request()
573 if (transport->recv.offset == transport->recv.len) in xs_read_stream_request()
574 xs_read_stream_check_eor(transport, msg); in xs_read_stream_request()
601 xs_read_stream_header(struct sock_xprt *transport, struct msghdr *msg, in xs_read_stream_header() argument
605 .iov_base = &transport->recv.fraghdr, in xs_read_stream_header()
608 return xs_read_kvec(transport->sock, msg, flags, &kvec, want, seek); in xs_read_stream_header()
613 xs_read_stream_call(struct sock_xprt *transport, struct msghdr *msg, int flags) in xs_read_stream_call() argument
615 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_call()
619 /* Is this transport associated with the backchannel? */ in xs_read_stream_call()
624 req = xprt_lookup_bc_request(xprt, transport->recv.xid); in xs_read_stream_call()
629 if (transport->recv.copied && !req->rq_private_buf.len) in xs_read_stream_call()
632 ret = xs_read_stream_request(transport, msg, flags, req); in xs_read_stream_call()
634 xprt_complete_bc_request(req, transport->recv.copied); in xs_read_stream_call()
636 req->rq_private_buf.len = transport->recv.copied; in xs_read_stream_call()
642 xs_read_stream_call(struct sock_xprt *transport, struct msghdr *msg, int flags) in xs_read_stream_call() argument
649 xs_read_stream_reply(struct sock_xprt *transport, struct msghdr *msg, int flags) in xs_read_stream_reply() argument
651 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_reply()
657 req = xprt_lookup_rqst(xprt, transport->recv.xid); in xs_read_stream_reply()
658 if (!req || (transport->recv.copied && !req->rq_private_buf.len)) { in xs_read_stream_reply()
665 ret = xs_read_stream_request(transport, msg, flags, req); in xs_read_stream_reply()
669 xprt_complete_rqst(req->rq_task, transport->recv.copied); in xs_read_stream_reply()
671 req->rq_private_buf.len = transport->recv.copied; in xs_read_stream_reply()
679 xs_read_stream(struct sock_xprt *transport, int flags) in xs_read_stream() argument
685 if (transport->recv.len == 0) { in xs_read_stream()
686 want = xs_read_stream_headersize(transport->recv.copied != 0); in xs_read_stream()
687 ret = xs_read_stream_header(transport, &msg, flags, want, in xs_read_stream()
688 transport->recv.offset); in xs_read_stream()
691 transport->recv.offset = ret; in xs_read_stream()
692 if (transport->recv.offset != want) in xs_read_stream()
693 return transport->recv.offset; in xs_read_stream()
694 transport->recv.len = be32_to_cpu(transport->recv.fraghdr) & in xs_read_stream()
696 transport->recv.offset -= sizeof(transport->recv.fraghdr); in xs_read_stream()
700 switch (be32_to_cpu(transport->recv.calldir)) { in xs_read_stream()
705 ret = xs_read_stream_call(transport, &msg, flags); in xs_read_stream()
708 ret = xs_read_stream_reply(transport, &msg, flags); in xs_read_stream()
711 transport->recv.calldir = cpu_to_be32(-1); in xs_read_stream()
712 transport->recv.copied = -1; in xs_read_stream()
717 if (transport->recv.offset < transport->recv.len) { in xs_read_stream()
721 ret = xs_read_discard(transport->sock, &msg, flags, in xs_read_stream()
722 transport->recv.len - transport->recv.offset); in xs_read_stream()
725 transport->recv.offset += ret; in xs_read_stream()
727 if (transport->recv.offset != transport->recv.len) in xs_read_stream()
730 if (xs_read_stream_request_done(transport)) { in xs_read_stream()
731 trace_xs_stream_read_request(transport); in xs_read_stream()
732 transport->recv.copied = 0; in xs_read_stream()
734 transport->recv.offset = 0; in xs_read_stream()
735 transport->recv.len = 0; in xs_read_stream()
741 static __poll_t xs_poll_socket(struct sock_xprt *transport) in xs_poll_socket() argument
743 return transport->sock->ops->poll(transport->file, transport->sock, in xs_poll_socket()
747 static bool xs_poll_socket_readable(struct sock_xprt *transport) in xs_poll_socket_readable() argument
749 __poll_t events = xs_poll_socket(transport); in xs_poll_socket_readable()
754 static void xs_poll_check_readable(struct sock_xprt *transport) in xs_poll_check_readable() argument
757 clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state); in xs_poll_check_readable()
758 if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) in xs_poll_check_readable()
760 if (!xs_poll_socket_readable(transport)) in xs_poll_check_readable()
762 if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) in xs_poll_check_readable()
763 queue_work(xprtiod_workqueue, &transport->recv_worker); in xs_poll_check_readable()
766 static void xs_stream_data_receive(struct sock_xprt *transport) in xs_stream_data_receive() argument
771 mutex_lock(&transport->recv_mutex); in xs_stream_data_receive()
772 if (transport->sock == NULL) in xs_stream_data_receive()
775 ret = xs_read_stream(transport, MSG_DONTWAIT); in xs_stream_data_receive()
782 kernel_sock_shutdown(transport->sock, SHUT_RDWR); in xs_stream_data_receive()
784 xprt_wake_pending_tasks(&transport->xprt, -EACCES); in xs_stream_data_receive()
786 xs_poll_check_readable(transport); in xs_stream_data_receive()
788 mutex_unlock(&transport->recv_mutex); in xs_stream_data_receive()
789 trace_xs_stream_read_data(&transport->xprt, ret, read); in xs_stream_data_receive()
794 struct sock_xprt *transport = in xs_stream_data_receive_workfn() local
798 xs_stream_data_receive(transport); in xs_stream_data_receive_workfn()
803 xs_stream_reset_connect(struct sock_xprt *transport) in xs_stream_reset_connect() argument
805 transport->recv.offset = 0; in xs_stream_reset_connect()
806 transport->recv.len = 0; in xs_stream_reset_connect()
807 transport->recv.copied = 0; in xs_stream_reset_connect()
808 transport->xmit.offset = 0; in xs_stream_reset_connect()
812 xs_stream_start_connect(struct sock_xprt *transport) in xs_stream_start_connect() argument
814 transport->xprt.stat.connect_count++; in xs_stream_start_connect()
815 transport->xprt.stat.connect_start = jiffies; in xs_stream_start_connect()
823 * @transport: pointer to struct sock_xprt
826 static int xs_nospace(struct rpc_rqst *req, struct sock_xprt *transport) in xs_nospace() argument
828 struct rpc_xprt *xprt = &transport->xprt; in xs_nospace()
829 struct sock *sk = transport->inet; in xs_nospace()
832 trace_rpc_socket_nospace(req, transport); in xs_nospace()
840 set_bit(XPRT_SOCK_NOSPACE, &transport->sock_state); in xs_nospace()
853 struct sock_xprt *transport = in xs_sock_nospace() local
855 struct sock *sk = transport->inet; in xs_sock_nospace()
860 ret = xs_nospace(req, transport); in xs_sock_nospace()
867 struct sock_xprt *transport = in xs_stream_nospace() local
869 struct sock *sk = transport->inet; in xs_stream_nospace()
876 ret = xs_nospace(req, transport); in xs_stream_nospace()
889 struct sock_xprt *transport = in xs_stream_abort_send_request() local
892 if (transport->xmit.offset != 0 && in xs_stream_abort_send_request()
902 xs_send_request_was_aborted(struct sock_xprt *transport, struct rpc_rqst *req) in xs_send_request_was_aborted() argument
904 return transport->xmit.offset != 0 && req->rq_bytes_sent == 0; in xs_send_request_was_aborted()
932 struct sock_xprt *transport = in xs_local_send_request() local
945 if (xs_send_request_was_aborted(transport, req)) { in xs_local_send_request()
953 vm_wait = sk_stream_is_writeable(transport->inet) ? true : false; in xs_local_send_request()
956 status = xprt_sock_sendmsg(transport->sock, &msg, xdr, in xs_local_send_request()
957 transport->xmit.offset, rm, &sent); in xs_local_send_request()
959 __func__, xdr->len - transport->xmit.offset, status); in xs_local_send_request()
962 transport->xmit.offset += sent; in xs_local_send_request()
963 req->rq_bytes_sent = transport->xmit.offset; in xs_local_send_request()
965 req->rq_xmit_bytes_sent += transport->xmit.offset; in xs_local_send_request()
966 transport->xmit.offset = 0; in xs_local_send_request()
1003 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_send_request() local
1027 status = xprt_sock_sendmsg(transport->sock, &msg, xdr, 0, 0, &sent); in xs_udp_send_request()
1036 if (status == -EAGAIN && sock_writeable(transport->inet)) in xs_udp_send_request()
1089 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_send_request() local
1101 if (xs_send_request_was_aborted(transport, req)) { in xs_tcp_send_request()
1102 if (transport->sock != NULL) in xs_tcp_send_request()
1103 kernel_sock_shutdown(transport->sock, SHUT_RDWR); in xs_tcp_send_request()
1106 if (!transport->inet) in xs_tcp_send_request()
1113 if (test_bit(XPRT_SOCK_UPD_TIMEOUT, &transport->sock_state)) in xs_tcp_send_request()
1114 xs_tcp_set_socket_timeouts(xprt, transport->sock); in xs_tcp_send_request()
1116 xs_set_srcport(transport, transport->sock); in xs_tcp_send_request()
1122 tcp_sock_set_cork(transport->inet, true); in xs_tcp_send_request()
1124 vm_wait = sk_stream_is_writeable(transport->inet) ? true : false; in xs_tcp_send_request()
1127 status = xprt_sock_sendmsg(transport->sock, &msg, xdr, in xs_tcp_send_request()
1128 transport->xmit.offset, rm, &sent); in xs_tcp_send_request()
1131 xdr->len - transport->xmit.offset, status); in xs_tcp_send_request()
1135 transport->xmit.offset += sent; in xs_tcp_send_request()
1136 req->rq_bytes_sent = transport->xmit.offset; in xs_tcp_send_request()
1138 req->rq_xmit_bytes_sent += transport->xmit.offset; in xs_tcp_send_request()
1139 transport->xmit.offset = 0; in xs_tcp_send_request()
1141 tcp_sock_set_cork(transport->inet, false); in xs_tcp_send_request()
1175 static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk) in xs_save_old_callbacks() argument
1177 transport->old_data_ready = sk->sk_data_ready; in xs_save_old_callbacks()
1178 transport->old_state_change = sk->sk_state_change; in xs_save_old_callbacks()
1179 transport->old_write_space = sk->sk_write_space; in xs_save_old_callbacks()
1180 transport->old_error_report = sk->sk_error_report; in xs_save_old_callbacks()
1183 static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk) in xs_restore_old_callbacks() argument
1185 sk->sk_data_ready = transport->old_data_ready; in xs_restore_old_callbacks()
1186 sk->sk_state_change = transport->old_state_change; in xs_restore_old_callbacks()
1187 sk->sk_write_space = transport->old_write_space; in xs_restore_old_callbacks()
1188 sk->sk_error_report = transport->old_error_report; in xs_restore_old_callbacks()
1193 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_sock_reset_state_flags() local
1195 transport->xprt_err = 0; in xs_sock_reset_state_flags()
1196 clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state); in xs_sock_reset_state_flags()
1197 clear_bit(XPRT_SOCK_WAKE_ERROR, &transport->sock_state); in xs_sock_reset_state_flags()
1198 clear_bit(XPRT_SOCK_WAKE_WRITE, &transport->sock_state); in xs_sock_reset_state_flags()
1199 clear_bit(XPRT_SOCK_WAKE_DISCONNECT, &transport->sock_state); in xs_sock_reset_state_flags()
1200 clear_bit(XPRT_SOCK_NOSPACE, &transport->sock_state); in xs_sock_reset_state_flags()
1203 static void xs_run_error_worker(struct sock_xprt *transport, unsigned int nr) in xs_run_error_worker() argument
1205 set_bit(nr, &transport->sock_state); in xs_run_error_worker()
1206 queue_work(xprtiod_workqueue, &transport->error_worker); in xs_run_error_worker()
1228 struct sock_xprt *transport; in xs_error_report() local
1234 transport = container_of(xprt, struct sock_xprt, xprt); in xs_error_report()
1235 transport->xprt_err = -sk->sk_err; in xs_error_report()
1236 if (transport->xprt_err == 0) in xs_error_report()
1239 xprt, -transport->xprt_err); in xs_error_report()
1240 trace_rpc_socket_error(xprt, sk->sk_socket, transport->xprt_err); in xs_error_report()
1244 xs_run_error_worker(transport, XPRT_SOCK_WAKE_ERROR); in xs_error_report()
1247 static void xs_reset_transport(struct sock_xprt *transport) in xs_reset_transport() argument
1249 struct socket *sock = transport->sock; in xs_reset_transport()
1250 struct sock *sk = transport->inet; in xs_reset_transport()
1251 struct rpc_xprt *xprt = &transport->xprt; in xs_reset_transport()
1252 struct file *filp = transport->file; in xs_reset_transport()
1267 if (atomic_read(&transport->xprt.swapper)) in xs_reset_transport()
1274 mutex_lock(&transport->recv_mutex); in xs_reset_transport()
1276 transport->inet = NULL; in xs_reset_transport()
1277 transport->sock = NULL; in xs_reset_transport()
1278 transport->file = NULL; in xs_reset_transport()
1282 xs_restore_old_callbacks(transport, sk); in xs_reset_transport()
1286 xs_stream_reset_connect(transport); in xs_reset_transport()
1288 mutex_unlock(&transport->recv_mutex); in xs_reset_transport()
1298 * @xprt: transport
1308 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_close() local
1312 if (transport->sock) in xs_close()
1313 tls_handshake_close(transport->sock); in xs_close()
1314 xs_reset_transport(transport); in xs_close()
1320 dprintk("RPC: injecting transport disconnect on xprt=%p\n", in xs_inject_disconnect()
1332 * xs_destroy - prepare to shutdown a transport
1333 * @xprt: doomed transport
1338 struct sock_xprt *transport = container_of(xprt, in xs_destroy() local
1342 cancel_delayed_work_sync(&transport->connect_worker); in xs_destroy()
1344 cancel_work_sync(&transport->recv_worker); in xs_destroy()
1345 cancel_work_sync(&transport->error_worker); in xs_destroy()
1352 * @xprt: transport
1411 static void xs_udp_data_receive(struct sock_xprt *transport) in xs_udp_data_receive() argument
1417 mutex_lock(&transport->recv_mutex); in xs_udp_data_receive()
1418 sk = transport->inet; in xs_udp_data_receive()
1425 xs_udp_data_read_skb(&transport->xprt, sk, skb); in xs_udp_data_receive()
1429 xs_poll_check_readable(transport); in xs_udp_data_receive()
1431 mutex_unlock(&transport->recv_mutex); in xs_udp_data_receive()
1436 struct sock_xprt *transport = in xs_udp_data_receive_workfn() local
1440 xs_udp_data_receive(transport); in xs_udp_data_receive_workfn()
1457 struct sock_xprt *transport = container_of(xprt, in xs_data_ready() local
1462 transport->old_data_ready(sk); in xs_data_ready()
1464 if (test_bit(XPRT_SOCK_IGNORE_RECV, &transport->sock_state)) in xs_data_ready()
1472 if (!test_and_set_bit(XPRT_SOCK_DATA_READY, &transport->sock_state)) in xs_data_ready()
1473 queue_work(xprtiod_workqueue, &transport->recv_worker); in xs_data_ready()
1501 struct sock_xprt *transport; in xs_local_state_change() local
1505 transport = container_of(xprt, struct sock_xprt, xprt); in xs_local_state_change()
1509 xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT); in xs_local_state_change()
1521 struct sock_xprt *transport; in xs_tcp_state_change() local
1532 transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_state_change()
1538 clear_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); in xs_tcp_state_change()
1544 xs_run_error_worker(transport, XPRT_SOCK_WAKE_PENDING); in xs_tcp_state_change()
1561 xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT); in xs_tcp_state_change()
1579 &transport->sock_state)) { in xs_tcp_state_change()
1580 xs_reset_srcport(transport); in xs_tcp_state_change()
1585 xs_run_error_worker(transport, XPRT_SOCK_WAKE_DISCONNECT); in xs_tcp_state_change()
1591 struct sock_xprt *transport; in xs_write_space() local
1600 transport = container_of(xprt, struct sock_xprt, xprt); in xs_write_space()
1601 if (!test_and_clear_bit(XPRT_SOCK_NOSPACE, &transport->sock_state)) in xs_write_space()
1603 xs_run_error_worker(transport, XPRT_SOCK_WAKE_WRITE); in xs_write_space()
1643 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_do_set_buffer_size() local
1644 struct sock *sk = transport->inet; in xs_udp_do_set_buffer_size()
1646 if (transport->rcvsize) { in xs_udp_do_set_buffer_size()
1648 sk->sk_rcvbuf = transport->rcvsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1650 if (transport->sndsize) { in xs_udp_do_set_buffer_size()
1652 sk->sk_sndbuf = transport->sndsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1659 * @xprt: generic transport
1667 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_set_buffer_size() local
1669 transport->sndsize = 0; in xs_udp_set_buffer_size()
1671 transport->sndsize = sndsize + 1024; in xs_udp_set_buffer_size()
1672 transport->rcvsize = 0; in xs_udp_set_buffer_size()
1674 transport->rcvsize = rcvsize + 1024; in xs_udp_set_buffer_size()
1680 * xs_udp_timer - called when a retransmit timeout occurs on a UDP transport
1681 * @xprt: controlling transport
1726 * @xprt: generic transport
1738 static void xs_reset_srcport(struct sock_xprt *transport) in xs_reset_srcport() argument
1740 transport->srcport = 0; in xs_reset_srcport()
1743 static void xs_set_srcport(struct sock_xprt *transport, struct socket *sock) in xs_set_srcport() argument
1745 if (transport->srcport == 0 && transport->xprt.reuseport) in xs_set_srcport()
1746 transport->srcport = xs_sock_getport(sock); in xs_set_srcport()
1749 static int xs_get_srcport(struct sock_xprt *transport) in xs_get_srcport() argument
1751 int port = transport->srcport; in xs_get_srcport()
1753 if (port == 0 && transport->xprt.resvport) in xs_get_srcport()
1788 static unsigned short xs_next_srcport(struct sock_xprt *transport, unsigned short port) in xs_next_srcport() argument
1790 if (transport->srcport != 0) in xs_next_srcport()
1791 transport->srcport = 0; in xs_next_srcport()
1792 if (!transport->xprt.resvport) in xs_next_srcport()
1798 static int xs_bind(struct sock_xprt *transport, struct socket *sock) in xs_bind() argument
1802 int port = xs_get_srcport(transport); in xs_bind()
1807 * transport->xprt.resvport == 0), don't bind. Let the local in xs_bind()
1817 * transport->xprt.resvport == 1) xs_get_srcport above will in xs_bind()
1823 memcpy(&myaddr, &transport->srcaddr, transport->xprt.addrlen); in xs_bind()
1827 transport->xprt.addrlen); in xs_bind()
1829 if (transport->xprt.reuseport) in xs_bind()
1830 transport->srcport = port; in xs_bind()
1834 port = xs_next_srcport(transport, port); in xs_bind()
1918 struct sock_xprt *transport, int family, int type, in xs_create_sock() argument
1927 dprintk("RPC: can't create %d transport socket (%d).\n", in xs_create_sock()
1936 err = xs_bind(transport, sock); in xs_create_sock()
1945 transport->file = filp; in xs_create_sock()
1955 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_local_finish_connecting() local
1958 if (!transport->inet) { in xs_local_finish_connecting()
1963 xs_save_old_callbacks(transport, sk); in xs_local_finish_connecting()
1975 transport->sock = sock; in xs_local_finish_connecting()
1976 transport->inet = sk; in xs_local_finish_connecting()
1981 xs_stream_start_connect(transport); in xs_local_finish_connecting()
1988 * @transport: socket transport to connect
1990 static int xs_local_setup_socket(struct sock_xprt *transport) in xs_local_setup_socket() argument
1992 struct rpc_xprt *xprt = &transport->xprt; in xs_local_setup_socket()
2001 "transport socket (%d).\n", -status); in xs_local_setup_socket()
2011 transport->file = filp; in xs_local_setup_socket()
2051 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_local_connect() local
2054 if (transport->file) in xs_local_connect()
2070 ret = xs_local_setup_socket(transport); in xs_local_connect()
2089 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_set_memalloc() local
2096 if (!transport->inet) in xs_set_memalloc()
2099 sk_set_memalloc(transport->inet); in xs_set_memalloc()
2103 * xs_enable_swap - Tag this transport as being used for swap.
2104 * @xprt: transport to tag
2106 * Take a reference to this transport on behalf of the rpc_clnt, and
2123 * xs_disable_swap - Untag this transport as being used for swap.
2124 * @xprt: transport to tag
2159 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_finish_connecting() local
2161 if (!transport->inet) { in xs_udp_finish_connecting()
2166 xs_save_old_callbacks(transport, sk); in xs_udp_finish_connecting()
2176 transport->sock = sock; in xs_udp_finish_connecting()
2177 transport->inet = sk; in xs_udp_finish_connecting()
2190 struct sock_xprt *transport = in xs_udp_setup_socket() local
2192 struct rpc_xprt *xprt = &transport->xprt; in xs_udp_setup_socket()
2199 sock = xs_create_sock(xprt, transport, in xs_udp_setup_socket()
2216 xprt_unlock_connect(xprt, transport); in xs_udp_setup_socket()
2223 * @xprt: transport
2230 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_shutdown() local
2231 struct socket *sock = transport->sock; in xs_tcp_shutdown()
2232 int skst = transport->inet ? transport->inet->sk_state : TCP_CLOSE; in xs_tcp_shutdown()
2251 xs_reset_transport(transport); in xs_tcp_shutdown()
2258 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_socket_timeouts() local
2272 clear_bit(XPRT_SOCK_UPD_TIMEOUT, &transport->sock_state); in xs_tcp_set_socket_timeouts()
2298 struct sock_xprt *transport = in xs_tcp_do_set_connect_timeout() local
2309 memcpy(&transport->tcp_timeout, &to, sizeof(transport->tcp_timeout)); in xs_tcp_do_set_connect_timeout()
2310 xprt->timeout = &transport->tcp_timeout; in xs_tcp_do_set_connect_timeout()
2318 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_connect_timeout() local
2325 set_bit(XPRT_SOCK_UPD_TIMEOUT, &transport->sock_state); in xs_tcp_set_connect_timeout()
2331 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_finish_connecting() local
2333 if (!transport->inet) { in xs_tcp_finish_connecting()
2353 xs_save_old_callbacks(transport, sk); in xs_tcp_finish_connecting()
2368 transport->sock = sock; in xs_tcp_finish_connecting()
2369 transport->inet = sk; in xs_tcp_finish_connecting()
2379 xs_stream_start_connect(transport); in xs_tcp_finish_connecting()
2382 set_bit(XPRT_SOCK_CONNECTING, &transport->sock_state); in xs_tcp_finish_connecting()
2394 struct sock_xprt *transport = in xs_tcp_setup_socket() local
2396 struct socket *sock = transport->sock; in xs_tcp_setup_socket()
2397 struct rpc_xprt *xprt = &transport->xprt; in xs_tcp_setup_socket()
2407 &transport->sock_state) || in xs_tcp_setup_socket()
2409 xs_reset_transport(transport); in xs_tcp_setup_socket()
2410 sock = xs_create_sock(xprt, transport, xs_addr(xprt)->sa_family, in xs_tcp_setup_socket()
2433 set_bit(XPRT_SOCK_CONNECT_SENT, &transport->sock_state); in xs_tcp_setup_socket()
2441 transport->srcport = 0; in xs_tcp_setup_socket()
2478 xprt_unlock_connect(xprt, transport); in xs_tcp_setup_socket()
2752 * @xprt: pointer to transport structure
2766 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_connect() local
2769 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); in xs_connect()
2771 if (transport->sock != NULL) { in xs_connect()
2781 transport->clnt = task->tk_client; in xs_connect()
2783 &transport->connect_worker, in xs_connect()
2787 static void xs_wake_disconnect(struct sock_xprt *transport) in xs_wake_disconnect() argument
2789 if (test_and_clear_bit(XPRT_SOCK_WAKE_DISCONNECT, &transport->sock_state)) in xs_wake_disconnect()
2790 xs_tcp_force_close(&transport->xprt); in xs_wake_disconnect()
2793 static void xs_wake_write(struct sock_xprt *transport) in xs_wake_write() argument
2795 if (test_and_clear_bit(XPRT_SOCK_WAKE_WRITE, &transport->sock_state)) in xs_wake_write()
2796 xprt_write_space(&transport->xprt); in xs_wake_write()
2799 static void xs_wake_error(struct sock_xprt *transport) in xs_wake_error() argument
2803 if (!test_and_clear_bit(XPRT_SOCK_WAKE_ERROR, &transport->sock_state)) in xs_wake_error()
2805 sockerr = xchg(&transport->xprt_err, 0); in xs_wake_error()
2807 xprt_wake_pending_tasks(&transport->xprt, sockerr); in xs_wake_error()
2808 xs_tcp_force_close(&transport->xprt); in xs_wake_error()
2812 static void xs_wake_pending(struct sock_xprt *transport) in xs_wake_pending() argument
2814 if (test_and_clear_bit(XPRT_SOCK_WAKE_PENDING, &transport->sock_state)) in xs_wake_pending()
2815 xprt_wake_pending_tasks(&transport->xprt, -EAGAIN); in xs_wake_pending()
2820 struct sock_xprt *transport = container_of(work, in xs_error_handle() local
2823 xs_wake_disconnect(transport); in xs_error_handle()
2824 xs_wake_write(transport); in xs_error_handle()
2825 xs_wake_error(transport); in xs_error_handle()
2826 xs_wake_pending(transport); in xs_error_handle()
2866 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_print_stats() local
2870 transport->srcport, in xs_udp_print_stats()
2890 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_print_stats() local
2898 transport->srcport, in xs_tcp_print_stats()
2958 struct sock_xprt *transport = in bc_sendto() local
2972 err = xprt_sock_sendmsg(transport->sock, &msg, xdr, 0, marker, &sent); in bc_sendto()
3202 * xs_setup_local - Set up transport to use an AF_LOCAL socket
3203 * @args: rpc transport creation arguments
3205 * AF_LOCAL is a "tpi_cots_ord" transport, just like TCP
3210 struct sock_xprt *transport; in xs_setup_local() local
3218 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_local()
3231 INIT_WORK(&transport->recv_worker, xs_stream_data_receive_workfn); in xs_setup_local()
3232 INIT_WORK(&transport->error_worker, xs_error_handle); in xs_setup_local()
3233 INIT_DELAYED_WORK(&transport->connect_worker, xs_dummy_setup_socket); in xs_setup_local()
3270 * xs_setup_udp - Set up transport to use a UDP socket
3271 * @args: rpc transport creation arguments
3278 struct sock_xprt *transport; in xs_setup_udp() local
3285 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_udp()
3300 INIT_WORK(&transport->recv_worker, xs_udp_data_receive_workfn); in xs_setup_udp()
3301 INIT_WORK(&transport->error_worker, xs_error_handle); in xs_setup_udp()
3302 INIT_DELAYED_WORK(&transport->connect_worker, xs_udp_setup_socket); in xs_setup_udp()
3347 * xs_setup_tcp - Set up transport to use a TCP socket
3348 * @args: rpc transport creation arguments
3355 struct sock_xprt *transport; in xs_setup_tcp() local
3366 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_tcp()
3388 INIT_WORK(&transport->recv_worker, xs_stream_data_receive_workfn); in xs_setup_tcp()
3389 INIT_WORK(&transport->error_worker, xs_error_handle); in xs_setup_tcp()
3390 INIT_DELAYED_WORK(&transport->connect_worker, xs_tcp_setup_socket); in xs_setup_tcp()
3429 * xs_setup_tcp_tls - Set up transport to use a TCP with TLS
3430 * @args: rpc transport creation arguments
3437 struct sock_xprt *transport; in xs_setup_tcp_tls() local
3448 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_tcp_tls()
3465 INIT_WORK(&transport->recv_worker, xs_stream_data_receive_workfn); in xs_setup_tcp_tls()
3466 INIT_WORK(&transport->error_worker, xs_error_handle); in xs_setup_tcp_tls()
3472 INIT_DELAYED_WORK(&transport->connect_worker, in xs_setup_tcp_tls()
3517 * xs_setup_bc_tcp - Set up transport to use a TCP backchannel socket
3518 * @args: rpc transport creation arguments
3525 struct sock_xprt *transport; in xs_setup_bc_tcp() local
3533 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_bc_tcp()
3577 transport->sock = bc_sock->sk_sock; in xs_setup_bc_tcp()
3578 transport->inet = bc_sock->sk_sk; in xs_setup_bc_tcp()