• Home
  • Raw
  • Download

Lines Matching refs:xprt

60 static void xs_close(struct rpc_xprt *xprt);
61 static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt,
227 static inline struct sockaddr *xs_addr(struct rpc_xprt *xprt) in xs_addr() argument
229 return (struct sockaddr *) &xprt->addr; in xs_addr()
232 static inline struct sockaddr_un *xs_addr_un(struct rpc_xprt *xprt) in xs_addr_un() argument
234 return (struct sockaddr_un *) &xprt->addr; in xs_addr_un()
237 static inline struct sockaddr_in *xs_addr_in(struct rpc_xprt *xprt) in xs_addr_in() argument
239 return (struct sockaddr_in *) &xprt->addr; in xs_addr_in()
242 static inline struct sockaddr_in6 *xs_addr_in6(struct rpc_xprt *xprt) in xs_addr_in6() argument
244 return (struct sockaddr_in6 *) &xprt->addr; in xs_addr_in6()
247 static void xs_format_common_peer_addresses(struct rpc_xprt *xprt) in xs_format_common_peer_addresses() argument
249 struct sockaddr *sap = xs_addr(xprt); in xs_format_common_peer_addresses()
257 sun = xs_addr_un(xprt); in xs_format_common_peer_addresses()
259 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
264 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
266 sin = xs_addr_in(xprt); in xs_format_common_peer_addresses()
271 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
273 sin6 = xs_addr_in6(xprt); in xs_format_common_peer_addresses()
280 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_addresses()
283 static void xs_format_common_peer_ports(struct rpc_xprt *xprt) in xs_format_common_peer_ports() argument
285 struct sockaddr *sap = xs_addr(xprt); in xs_format_common_peer_ports()
289 xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_ports()
292 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_ports()
295 static void xs_format_peer_addresses(struct rpc_xprt *xprt, in xs_format_peer_addresses() argument
299 xprt->address_strings[RPC_DISPLAY_PROTO] = protocol; in xs_format_peer_addresses()
300 xprt->address_strings[RPC_DISPLAY_NETID] = netid; in xs_format_peer_addresses()
301 xs_format_common_peer_addresses(xprt); in xs_format_peer_addresses()
302 xs_format_common_peer_ports(xprt); in xs_format_peer_addresses()
305 static void xs_update_peer_port(struct rpc_xprt *xprt) in xs_update_peer_port() argument
307 kfree(xprt->address_strings[RPC_DISPLAY_HEX_PORT]); in xs_update_peer_port()
308 kfree(xprt->address_strings[RPC_DISPLAY_PORT]); in xs_update_peer_port()
310 xs_format_common_peer_ports(xprt); in xs_update_peer_port()
313 static void xs_free_peer_addresses(struct rpc_xprt *xprt) in xs_free_peer_addresses() argument
323 kfree(xprt->address_strings[i]); in xs_free_peer_addresses()
557 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_call() local
562 req = xprt_lookup_bc_request(xprt, transport->recv.xid); in xs_read_stream_call()
589 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_reply() local
594 spin_lock(&xprt->queue_lock); in xs_read_stream_reply()
595 req = xprt_lookup_rqst(xprt, transport->recv.xid); in xs_read_stream_reply()
601 spin_unlock(&xprt->queue_lock); in xs_read_stream_reply()
605 spin_lock(&xprt->queue_lock); in xs_read_stream_reply()
612 spin_unlock(&xprt->queue_lock); in xs_read_stream_reply()
723 trace_xs_stream_read_data(&transport->xprt, ret, read); in xs_stream_data_receive()
748 transport->xprt.stat.connect_count++; in xs_stream_start_connect()
749 transport->xprt.stat.connect_start = jiffies; in xs_stream_start_connect()
761 struct rpc_xprt *xprt = req->rq_xprt; in xs_nospace() local
762 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_nospace()
769 spin_lock(&xprt->transport_lock); in xs_nospace()
772 if (xprt_connected(xprt)) { in xs_nospace()
775 xprt_wait_for_buffer_space(xprt); in xs_nospace()
779 spin_unlock(&xprt->transport_lock); in xs_nospace()
836 struct rpc_xprt *xprt = req->rq_xprt; in xs_local_send_request() local
838 container_of(xprt, struct sock_xprt, xprt); in xs_local_send_request()
850 xprt_force_disconnect(xprt); in xs_local_send_request()
888 xprt_force_disconnect(xprt); in xs_local_send_request()
908 struct rpc_xprt *xprt = req->rq_xprt; in xs_udp_send_request() local
909 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_send_request()
912 .msg_name = xs_addr(xprt), in xs_udp_send_request()
913 .msg_namelen = xprt->addrlen, in xs_udp_send_request()
923 if (!xprt_bound(xprt)) in xs_udp_send_request()
926 if (!xprt_request_get_cong(xprt, req)) in xs_udp_send_request()
991 struct rpc_xprt *xprt = req->rq_xprt; in xs_tcp_send_request() local
992 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_send_request()
1015 xs_tcp_set_socket_timeouts(xprt, transport->sock); in xs_tcp_send_request()
1105 static void xs_sock_reset_state_flags(struct rpc_xprt *xprt) in xs_sock_reset_state_flags() argument
1107 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_sock_reset_state_flags()
1121 static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) in xs_sock_reset_connection_flags() argument
1124 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_sock_reset_connection_flags()
1125 clear_bit(XPRT_CLOSING, &xprt->state); in xs_sock_reset_connection_flags()
1126 xs_sock_reset_state_flags(xprt); in xs_sock_reset_connection_flags()
1140 struct rpc_xprt *xprt; in xs_error_report() local
1143 if (!(xprt = xprt_from_sock(sk))) in xs_error_report()
1146 transport = container_of(xprt, struct sock_xprt, xprt); in xs_error_report()
1151 xprt, -transport->xprt_err); in xs_error_report()
1152 trace_rpc_socket_error(xprt, sk->sk_socket, transport->xprt_err); in xs_error_report()
1165 struct rpc_xprt *xprt = &transport->xprt; in xs_reset_transport() local
1177 set_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_reset_transport()
1181 if (atomic_read(&transport->xprt.swapper)) in xs_reset_transport()
1195 xprt_clear_connected(xprt); in xs_reset_transport()
1197 xs_sock_reset_connection_flags(xprt); in xs_reset_transport()
1202 trace_rpc_socket_close(xprt, sock); in xs_reset_transport()
1205 xprt_disconnect_done(xprt); in xs_reset_transport()
1218 static void xs_close(struct rpc_xprt *xprt) in xs_close() argument
1220 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_close()
1222 dprintk("RPC: xs_close xprt %p\n", xprt); in xs_close()
1225 xprt->reestablish_timeout = 0; in xs_close()
1228 static void xs_inject_disconnect(struct rpc_xprt *xprt) in xs_inject_disconnect() argument
1231 xprt); in xs_inject_disconnect()
1232 xprt_disconnect_done(xprt); in xs_inject_disconnect()
1235 static void xs_xprt_free(struct rpc_xprt *xprt) in xs_xprt_free() argument
1237 xs_free_peer_addresses(xprt); in xs_xprt_free()
1238 xprt_free(xprt); in xs_xprt_free()
1246 static void xs_destroy(struct rpc_xprt *xprt) in xs_destroy() argument
1248 struct sock_xprt *transport = container_of(xprt, in xs_destroy()
1249 struct sock_xprt, xprt); in xs_destroy()
1250 dprintk("RPC: xs_destroy xprt %p\n", xprt); in xs_destroy()
1253 xs_close(xprt); in xs_destroy()
1256 xs_xprt_free(xprt); in xs_destroy()
1267 static void xs_udp_data_read_skb(struct rpc_xprt *xprt, in xs_udp_data_read_skb() argument
1289 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1290 rovr = xprt_lookup_rqst(xprt, *xp); in xs_udp_data_read_skb()
1295 spin_unlock(&xprt->queue_lock); in xs_udp_data_read_skb()
1303 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1309 spin_lock(&xprt->transport_lock); in xs_udp_data_read_skb()
1310 xprt_adjust_cwnd(xprt, task, copied); in xs_udp_data_read_skb()
1311 spin_unlock(&xprt->transport_lock); in xs_udp_data_read_skb()
1312 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1318 spin_unlock(&xprt->queue_lock); in xs_udp_data_read_skb()
1335 xs_udp_data_read_skb(&transport->xprt, sk, skb); in xs_udp_data_receive()
1361 struct rpc_xprt *xprt; in xs_data_ready() local
1365 xprt = xprt_from_sock(sk); in xs_data_ready()
1366 if (xprt != NULL) { in xs_data_ready()
1367 struct sock_xprt *transport = container_of(xprt, in xs_data_ready()
1368 struct sock_xprt, xprt); in xs_data_ready()
1373 if (xprt->reestablish_timeout) in xs_data_ready()
1374 xprt->reestablish_timeout = 0; in xs_data_ready()
1385 static void xs_tcp_force_close(struct rpc_xprt *xprt) in xs_tcp_force_close() argument
1387 xprt_force_disconnect(xprt); in xs_tcp_force_close()
1391 static size_t xs_tcp_bc_maxpayload(struct rpc_xprt *xprt) in xs_tcp_bc_maxpayload() argument
1404 struct rpc_xprt *xprt; in xs_tcp_state_change() local
1408 if (!(xprt = xprt_from_sock(sk))) in xs_tcp_state_change()
1410 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); in xs_tcp_state_change()
1412 sk->sk_state, xprt_connected(xprt), in xs_tcp_state_change()
1417 transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_state_change()
1418 trace_rpc_socket_state_change(xprt, sk->sk_socket); in xs_tcp_state_change()
1421 if (!xprt_test_and_set_connected(xprt)) { in xs_tcp_state_change()
1422 xprt->connect_cookie++; in xs_tcp_state_change()
1424 xprt_clear_connecting(xprt); in xs_tcp_state_change()
1426 xprt->stat.connect_count++; in xs_tcp_state_change()
1427 xprt->stat.connect_time += (long)jiffies - in xs_tcp_state_change()
1428 xprt->stat.connect_start; in xs_tcp_state_change()
1434 xprt->connect_cookie++; in xs_tcp_state_change()
1435 xprt->reestablish_timeout = 0; in xs_tcp_state_change()
1436 set_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1438 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1439 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_tcp_state_change()
1444 xprt->connect_cookie++; in xs_tcp_state_change()
1445 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1453 if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) in xs_tcp_state_change()
1454 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_tcp_state_change()
1457 set_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1459 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1465 xprt_clear_connecting(xprt); in xs_tcp_state_change()
1466 clear_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1478 struct rpc_xprt *xprt; in xs_write_space() local
1484 if (unlikely(!(xprt = xprt_from_sock(sk)))) in xs_write_space()
1486 transport = container_of(xprt, struct sock_xprt, xprt); in xs_write_space()
1540 static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt) in xs_udp_do_set_buffer_size() argument
1542 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_do_set_buffer_size()
1547 sk->sk_rcvbuf = transport->rcvsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1551 sk->sk_sndbuf = transport->sndsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1564 static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize) in xs_udp_set_buffer_size() argument
1566 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_set_buffer_size()
1575 xs_udp_do_set_buffer_size(xprt); in xs_udp_set_buffer_size()
1585 static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task) in xs_udp_timer() argument
1587 spin_lock(&xprt->transport_lock); in xs_udp_timer()
1588 xprt_adjust_cwnd(xprt, task, -ETIMEDOUT); in xs_udp_timer()
1589 spin_unlock(&xprt->transport_lock); in xs_udp_timer()
1629 static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) in xs_set_port() argument
1631 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); in xs_set_port()
1633 rpc_set_port(xs_addr(xprt), port); in xs_set_port()
1634 xs_update_peer_port(xprt); in xs_set_port()
1639 if (transport->srcport == 0 && transport->xprt.reuseport) in xs_set_srcport()
1647 if (port == 0 && transport->xprt.resvport) in xs_get_srcport()
1652 unsigned short get_srcport(struct rpc_xprt *xprt) in get_srcport() argument
1654 struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); in get_srcport()
1663 if (!transport->xprt.resvport) in xs_next_srcport()
1694 memcpy(&myaddr, &transport->srcaddr, transport->xprt.addrlen); in xs_bind()
1698 transport->xprt.addrlen); in xs_bind()
1700 if (transport->xprt.reuseport) in xs_bind()
1729 static void xs_local_set_port(struct rpc_xprt *xprt, unsigned short port) in xs_local_set_port() argument
1788 static struct socket *xs_create_sock(struct rpc_xprt *xprt, in xs_create_sock() argument
1796 err = __sock_create(xprt->xprt_net, family, type, protocol, &sock, 1); in xs_create_sock()
1823 static int xs_local_finish_connecting(struct rpc_xprt *xprt, in xs_local_finish_connecting() argument
1826 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_local_finish_connecting()
1827 xprt); in xs_local_finish_connecting()
1836 sk->sk_user_data = xprt; in xs_local_finish_connecting()
1842 xprt_clear_connected(xprt); in xs_local_finish_connecting()
1853 return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, 0); in xs_local_finish_connecting()
1862 struct rpc_xprt *xprt = &transport->xprt; in xs_local_setup_socket() local
1867 status = __sock_create(xprt->xprt_net, AF_LOCAL, in xs_local_setup_socket()
1884 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1886 status = xs_local_finish_connecting(xprt, sock); in xs_local_setup_socket()
1887 trace_rpc_socket_connect(xprt, sock, status); in xs_local_setup_socket()
1891 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1892 xprt->stat.connect_count++; in xs_local_setup_socket()
1893 xprt->stat.connect_time += (long)jiffies - in xs_local_setup_socket()
1894 xprt->stat.connect_start; in xs_local_setup_socket()
1895 xprt_set_connected(xprt); in xs_local_setup_socket()
1900 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1904 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1909 xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1913 xprt_clear_connecting(xprt); in xs_local_setup_socket()
1914 xprt_wake_pending_tasks(xprt, status); in xs_local_setup_socket()
1918 static void xs_local_connect(struct rpc_xprt *xprt, struct rpc_task *task) in xs_local_connect() argument
1920 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_local_connect()
1948 static void xs_set_memalloc(struct rpc_xprt *xprt) in xs_set_memalloc() argument
1950 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_set_memalloc()
1951 xprt); in xs_set_memalloc()
1959 if (atomic_read(&xprt->swapper)) in xs_set_memalloc()
1971 xs_enable_swap(struct rpc_xprt *xprt) in xs_enable_swap() argument
1973 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); in xs_enable_swap()
1975 if (atomic_inc_return(&xprt->swapper) != 1) in xs_enable_swap()
1977 if (wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_KILLABLE)) in xs_enable_swap()
1981 xprt_release_xprt(xprt, NULL); in xs_enable_swap()
1993 xs_disable_swap(struct rpc_xprt *xprt) in xs_disable_swap() argument
1995 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); in xs_disable_swap()
1997 if (!atomic_dec_and_test(&xprt->swapper)) in xs_disable_swap()
1999 if (wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_KILLABLE)) in xs_disable_swap()
2003 xprt_release_xprt(xprt, NULL); in xs_disable_swap()
2006 static void xs_set_memalloc(struct rpc_xprt *xprt) in xs_set_memalloc() argument
2011 xs_enable_swap(struct rpc_xprt *xprt) in xs_enable_swap() argument
2017 xs_disable_swap(struct rpc_xprt *xprt) in xs_disable_swap() argument
2022 static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) in xs_udp_finish_connecting() argument
2024 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_finish_connecting()
2033 sk->sk_user_data = xprt; in xs_udp_finish_connecting()
2038 xprt_set_connected(xprt); in xs_udp_finish_connecting()
2044 xs_set_memalloc(xprt); in xs_udp_finish_connecting()
2048 xs_udp_do_set_buffer_size(xprt); in xs_udp_finish_connecting()
2050 xprt->stat.connect_start = jiffies; in xs_udp_finish_connecting()
2057 struct rpc_xprt *xprt = &transport->xprt; in xs_udp_setup_socket() local
2061 sock = xs_create_sock(xprt, transport, in xs_udp_setup_socket()
2062 xs_addr(xprt)->sa_family, SOCK_DGRAM, in xs_udp_setup_socket()
2068 "%s (port %s)\n", xprt, in xs_udp_setup_socket()
2069 xprt->address_strings[RPC_DISPLAY_PROTO], in xs_udp_setup_socket()
2070 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_udp_setup_socket()
2071 xprt->address_strings[RPC_DISPLAY_PORT]); in xs_udp_setup_socket()
2073 xs_udp_finish_connecting(xprt, sock); in xs_udp_setup_socket()
2074 trace_rpc_socket_connect(xprt, sock, 0); in xs_udp_setup_socket()
2077 xprt_clear_connecting(xprt); in xs_udp_setup_socket()
2078 xprt_unlock_connect(xprt, transport); in xs_udp_setup_socket()
2079 xprt_wake_pending_tasks(xprt, status); in xs_udp_setup_socket()
2089 static void xs_tcp_shutdown(struct rpc_xprt *xprt) in xs_tcp_shutdown() argument
2091 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_shutdown()
2100 trace_rpc_socket_shutdown(xprt, sock); in xs_tcp_shutdown()
2108 static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt, in xs_tcp_set_socket_timeouts() argument
2111 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_socket_timeouts()
2116 spin_lock(&xprt->transport_lock); in xs_tcp_set_socket_timeouts()
2117 keepidle = DIV_ROUND_UP(xprt->timeout->to_initval, HZ); in xs_tcp_set_socket_timeouts()
2118 keepcnt = xprt->timeout->to_retries + 1; in xs_tcp_set_socket_timeouts()
2119 timeo = jiffies_to_msecs(xprt->timeout->to_initval) * in xs_tcp_set_socket_timeouts()
2120 (xprt->timeout->to_retries + 1); in xs_tcp_set_socket_timeouts()
2122 spin_unlock(&xprt->transport_lock); in xs_tcp_set_socket_timeouts()
2134 static void xs_tcp_set_connect_timeout(struct rpc_xprt *xprt, in xs_tcp_set_connect_timeout() argument
2138 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_connect_timeout()
2142 spin_lock(&xprt->transport_lock); in xs_tcp_set_connect_timeout()
2143 if (reconnect_timeout < xprt->max_reconnect_timeout) in xs_tcp_set_connect_timeout()
2144 xprt->max_reconnect_timeout = reconnect_timeout; in xs_tcp_set_connect_timeout()
2145 if (connect_timeout < xprt->connect_timeout) { in xs_tcp_set_connect_timeout()
2146 memcpy(&to, xprt->timeout, sizeof(to)); in xs_tcp_set_connect_timeout()
2155 xprt->timeout = &transport->tcp_timeout; in xs_tcp_set_connect_timeout()
2156 xprt->connect_timeout = connect_timeout; in xs_tcp_set_connect_timeout()
2159 spin_unlock(&xprt->transport_lock); in xs_tcp_set_connect_timeout()
2162 static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) in xs_tcp_finish_connecting() argument
2164 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_finish_connecting()
2177 if (xs_addr(xprt)->sa_family == PF_INET6) { in xs_tcp_finish_connecting()
2182 xs_tcp_set_socket_timeouts(xprt, sock); in xs_tcp_finish_connecting()
2188 sk->sk_user_data = xprt; in xs_tcp_finish_connecting()
2199 xprt_clear_connected(xprt); in xs_tcp_finish_connecting()
2208 if (!xprt_bound(xprt)) in xs_tcp_finish_connecting()
2211 xs_set_memalloc(xprt); in xs_tcp_finish_connecting()
2217 ret = kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); in xs_tcp_finish_connecting()
2224 if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) in xs_tcp_finish_connecting()
2225 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_tcp_finish_connecting()
2246 struct rpc_xprt *xprt = &transport->xprt; in xs_tcp_setup_socket() local
2250 sock = xs_create_sock(xprt, transport, in xs_tcp_setup_socket()
2251 xs_addr(xprt)->sa_family, SOCK_STREAM, in xs_tcp_setup_socket()
2260 "%s (port %s)\n", xprt, in xs_tcp_setup_socket()
2261 xprt->address_strings[RPC_DISPLAY_PROTO], in xs_tcp_setup_socket()
2262 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_tcp_setup_socket()
2263 xprt->address_strings[RPC_DISPLAY_PORT]); in xs_tcp_setup_socket()
2265 status = xs_tcp_finish_connecting(xprt, sock); in xs_tcp_setup_socket()
2266 trace_rpc_socket_connect(xprt, sock, status); in xs_tcp_setup_socket()
2268 xprt, -status, xprt_connected(xprt), in xs_tcp_setup_socket()
2279 xs_tcp_force_close(xprt); in xs_tcp_setup_socket()
2284 xprt_unlock_connect(xprt, transport); in xs_tcp_setup_socket()
2302 xprt_wake_pending_tasks(xprt, status); in xs_tcp_setup_socket()
2303 xs_tcp_force_close(xprt); in xs_tcp_setup_socket()
2308 xprt_clear_connecting(xprt); in xs_tcp_setup_socket()
2309 xprt_unlock_connect(xprt, transport); in xs_tcp_setup_socket()
2310 xprt_wake_pending_tasks(xprt, status); in xs_tcp_setup_socket()
2327 static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) in xs_connect() argument
2329 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_connect()
2332 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); in xs_connect()
2337 xprt, xprt->reestablish_timeout / HZ); in xs_connect()
2342 delay = xprt_reconnect_delay(xprt); in xs_connect()
2343 xprt_reconnect_backoff(xprt, XS_TCP_INIT_REEST_TO); in xs_connect()
2346 dprintk("RPC: xs_connect scheduled xprt %p\n", xprt); in xs_connect()
2356 xs_tcp_force_close(&transport->xprt); in xs_wake_disconnect()
2362 xprt_write_space(&transport->xprt); in xs_wake_write()
2378 xprt_wake_pending_tasks(&transport->xprt, sockerr); in xs_wake_error()
2386 xprt_wake_pending_tasks(&transport->xprt, -EAGAIN); in xs_wake_pending()
2406 static void xs_local_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_local_print_stats() argument
2410 if (xprt_connected(xprt)) in xs_local_print_stats()
2411 idle_time = (long)(jiffies - xprt->last_used) / HZ; in xs_local_print_stats()
2415 xprt->stat.bind_count, in xs_local_print_stats()
2416 xprt->stat.connect_count, in xs_local_print_stats()
2417 xprt->stat.connect_time / HZ, in xs_local_print_stats()
2419 xprt->stat.sends, in xs_local_print_stats()
2420 xprt->stat.recvs, in xs_local_print_stats()
2421 xprt->stat.bad_xids, in xs_local_print_stats()
2422 xprt->stat.req_u, in xs_local_print_stats()
2423 xprt->stat.bklog_u, in xs_local_print_stats()
2424 xprt->stat.max_slots, in xs_local_print_stats()
2425 xprt->stat.sending_u, in xs_local_print_stats()
2426 xprt->stat.pending_u); in xs_local_print_stats()
2435 static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_udp_print_stats() argument
2437 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_print_stats()
2442 xprt->stat.bind_count, in xs_udp_print_stats()
2443 xprt->stat.sends, in xs_udp_print_stats()
2444 xprt->stat.recvs, in xs_udp_print_stats()
2445 xprt->stat.bad_xids, in xs_udp_print_stats()
2446 xprt->stat.req_u, in xs_udp_print_stats()
2447 xprt->stat.bklog_u, in xs_udp_print_stats()
2448 xprt->stat.max_slots, in xs_udp_print_stats()
2449 xprt->stat.sending_u, in xs_udp_print_stats()
2450 xprt->stat.pending_u); in xs_udp_print_stats()
2459 static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_tcp_print_stats() argument
2461 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_print_stats()
2464 if (xprt_connected(xprt)) in xs_tcp_print_stats()
2465 idle_time = (long)(jiffies - xprt->last_used) / HZ; in xs_tcp_print_stats()
2470 xprt->stat.bind_count, in xs_tcp_print_stats()
2471 xprt->stat.connect_count, in xs_tcp_print_stats()
2472 xprt->stat.connect_time / HZ, in xs_tcp_print_stats()
2474 xprt->stat.sends, in xs_tcp_print_stats()
2475 xprt->stat.recvs, in xs_tcp_print_stats()
2476 xprt->stat.bad_xids, in xs_tcp_print_stats()
2477 xprt->stat.req_u, in xs_tcp_print_stats()
2478 xprt->stat.bklog_u, in xs_tcp_print_stats()
2479 xprt->stat.max_slots, in xs_tcp_print_stats()
2480 xprt->stat.sending_u, in xs_tcp_print_stats()
2481 xprt->stat.pending_u); in xs_tcp_print_stats()
2530 container_of(req->rq_xprt, struct sock_xprt, xprt); in bc_sendto()
2560 struct svc_xprt *xprt; in bc_send_request() local
2566 xprt = req->rq_xprt->bc_xprt; in bc_send_request()
2572 mutex_lock(&xprt->xpt_mutex); in bc_send_request()
2573 if (test_bit(XPT_DEAD, &xprt->xpt_flags)) in bc_send_request()
2577 mutex_unlock(&xprt->xpt_mutex); in bc_send_request()
2589 static void bc_close(struct rpc_xprt *xprt) in bc_close() argument
2591 xprt_disconnect_done(xprt); in bc_close()
2599 static void bc_destroy(struct rpc_xprt *xprt) in bc_destroy() argument
2601 dprintk("RPC: bc_destroy xprt %p\n", xprt); in bc_destroy()
2603 xs_xprt_free(xprt); in bc_destroy()
2731 struct rpc_xprt *xprt; in xs_setup_xprt() local
2734 if (args->addrlen > sizeof(xprt->addr)) { in xs_setup_xprt()
2739 xprt = xprt_alloc(args->net, sizeof(*new), slot_table_size, in xs_setup_xprt()
2741 if (xprt == NULL) { in xs_setup_xprt()
2747 new = container_of(xprt, struct sock_xprt, xprt); in xs_setup_xprt()
2749 memcpy(&xprt->addr, args->dstaddr, args->addrlen); in xs_setup_xprt()
2750 xprt->addrlen = args->addrlen; in xs_setup_xprt()
2758 xprt_free(xprt); in xs_setup_xprt()
2763 return xprt; in xs_setup_xprt()
2782 struct rpc_xprt *xprt; in xs_setup_local() local
2785 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_local()
2787 if (IS_ERR(xprt)) in xs_setup_local()
2788 return xprt; in xs_setup_local()
2789 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_local()
2791 xprt->prot = 0; in xs_setup_local()
2792 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_local()
2794 xprt->bind_timeout = XS_BIND_TO; in xs_setup_local()
2795 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_setup_local()
2796 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_local()
2798 xprt->ops = &xs_local_ops; in xs_setup_local()
2799 xprt->timeout = &xs_local_default_timeout; in xs_setup_local()
2813 xprt_set_bound(xprt); in xs_setup_local()
2814 xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); in xs_setup_local()
2825 xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_setup_local()
2828 return xprt; in xs_setup_local()
2831 xs_xprt_free(xprt); in xs_setup_local()
2850 struct rpc_xprt *xprt; in xs_setup_udp() local
2854 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries, in xs_setup_udp()
2856 if (IS_ERR(xprt)) in xs_setup_udp()
2857 return xprt; in xs_setup_udp()
2858 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_udp()
2860 xprt->prot = IPPROTO_UDP; in xs_setup_udp()
2862 xprt->max_payload = (1U << 16) - (MAX_HEADER << 3); in xs_setup_udp()
2864 xprt->bind_timeout = XS_BIND_TO; in xs_setup_udp()
2865 xprt->reestablish_timeout = XS_UDP_REEST_TO; in xs_setup_udp()
2866 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_udp()
2868 xprt->ops = &xs_udp_ops; in xs_setup_udp()
2870 xprt->timeout = &xs_udp_default_timeout; in xs_setup_udp()
2879 xprt_set_bound(xprt); in xs_setup_udp()
2881 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP); in xs_setup_udp()
2885 xprt_set_bound(xprt); in xs_setup_udp()
2887 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6); in xs_setup_udp()
2894 if (xprt_bound(xprt)) in xs_setup_udp()
2896 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_udp()
2897 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_udp()
2898 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_udp()
2901 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_udp()
2902 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_udp()
2905 return xprt; in xs_setup_udp()
2908 xs_xprt_free(xprt); in xs_setup_udp()
2926 struct rpc_xprt *xprt; in xs_setup_tcp() local
2934 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_tcp()
2936 if (IS_ERR(xprt)) in xs_setup_tcp()
2937 return xprt; in xs_setup_tcp()
2938 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_tcp()
2940 xprt->prot = IPPROTO_TCP; in xs_setup_tcp()
2941 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_tcp()
2943 xprt->bind_timeout = XS_BIND_TO; in xs_setup_tcp()
2944 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_setup_tcp()
2945 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_tcp()
2947 xprt->ops = &xs_tcp_ops; in xs_setup_tcp()
2948 xprt->timeout = &xs_tcp_default_timeout; in xs_setup_tcp()
2950 xprt->max_reconnect_timeout = xprt->timeout->to_maxval; in xs_setup_tcp()
2951 xprt->connect_timeout = xprt->timeout->to_initval * in xs_setup_tcp()
2952 (xprt->timeout->to_retries + 1); in xs_setup_tcp()
2961 xprt_set_bound(xprt); in xs_setup_tcp()
2963 xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP); in xs_setup_tcp()
2967 xprt_set_bound(xprt); in xs_setup_tcp()
2969 xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6); in xs_setup_tcp()
2976 if (xprt_bound(xprt)) in xs_setup_tcp()
2978 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_tcp()
2979 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_tcp()
2980 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_tcp()
2983 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_tcp()
2984 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_tcp()
2987 return xprt; in xs_setup_tcp()
2990 xs_xprt_free(xprt); in xs_setup_tcp()
3002 struct rpc_xprt *xprt; in xs_setup_bc_tcp() local
3007 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_bc_tcp()
3009 if (IS_ERR(xprt)) in xs_setup_bc_tcp()
3010 return xprt; in xs_setup_bc_tcp()
3011 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_bc_tcp()
3013 xprt->prot = IPPROTO_TCP; in xs_setup_bc_tcp()
3014 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_bc_tcp()
3015 xprt->timeout = &xs_tcp_default_timeout; in xs_setup_bc_tcp()
3018 xprt_set_bound(xprt); in xs_setup_bc_tcp()
3019 xprt->bind_timeout = 0; in xs_setup_bc_tcp()
3020 xprt->reestablish_timeout = 0; in xs_setup_bc_tcp()
3021 xprt->idle_timeout = 0; in xs_setup_bc_tcp()
3023 xprt->ops = &bc_tcp_ops; in xs_setup_bc_tcp()
3027 xs_format_peer_addresses(xprt, "tcp", in xs_setup_bc_tcp()
3031 xs_format_peer_addresses(xprt, "tcp", in xs_setup_bc_tcp()
3040 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_bc_tcp()
3041 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_bc_tcp()
3042 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_bc_tcp()
3050 xprt_get(xprt); in xs_setup_bc_tcp()
3051 args->bc_xprt->xpt_bc_xprt = xprt; in xs_setup_bc_tcp()
3052 xprt->bc_xprt = args->bc_xprt; in xs_setup_bc_tcp()
3061 xprt_set_connected(xprt); in xs_setup_bc_tcp()
3064 return xprt; in xs_setup_bc_tcp()
3068 xprt_put(xprt); in xs_setup_bc_tcp()
3071 xs_xprt_free(xprt); in xs_setup_bc_tcp()