Lines Matching refs:xprt
60 static void xs_close(struct rpc_xprt *xprt);
62 static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt,
233 static inline struct sockaddr *xs_addr(struct rpc_xprt *xprt) in xs_addr() argument
235 return (struct sockaddr *) &xprt->addr; in xs_addr()
238 static inline struct sockaddr_un *xs_addr_un(struct rpc_xprt *xprt) in xs_addr_un() argument
240 return (struct sockaddr_un *) &xprt->addr; in xs_addr_un()
243 static inline struct sockaddr_in *xs_addr_in(struct rpc_xprt *xprt) in xs_addr_in() argument
245 return (struct sockaddr_in *) &xprt->addr; in xs_addr_in()
248 static inline struct sockaddr_in6 *xs_addr_in6(struct rpc_xprt *xprt) in xs_addr_in6() argument
250 return (struct sockaddr_in6 *) &xprt->addr; in xs_addr_in6()
253 static void xs_format_common_peer_addresses(struct rpc_xprt *xprt) in xs_format_common_peer_addresses() argument
255 struct sockaddr *sap = xs_addr(xprt); in xs_format_common_peer_addresses()
263 sun = xs_addr_un(xprt); in xs_format_common_peer_addresses()
265 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
270 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
272 sin = xs_addr_in(xprt); in xs_format_common_peer_addresses()
277 xprt->address_strings[RPC_DISPLAY_ADDR] = in xs_format_common_peer_addresses()
279 sin6 = xs_addr_in6(xprt); in xs_format_common_peer_addresses()
286 xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_addresses()
289 static void xs_format_common_peer_ports(struct rpc_xprt *xprt) in xs_format_common_peer_ports() argument
291 struct sockaddr *sap = xs_addr(xprt); in xs_format_common_peer_ports()
295 xprt->address_strings[RPC_DISPLAY_PORT] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_ports()
298 xprt->address_strings[RPC_DISPLAY_HEX_PORT] = kstrdup(buf, GFP_KERNEL); in xs_format_common_peer_ports()
301 static void xs_format_peer_addresses(struct rpc_xprt *xprt, in xs_format_peer_addresses() argument
305 xprt->address_strings[RPC_DISPLAY_PROTO] = protocol; in xs_format_peer_addresses()
306 xprt->address_strings[RPC_DISPLAY_NETID] = netid; in xs_format_peer_addresses()
307 xs_format_common_peer_addresses(xprt); in xs_format_peer_addresses()
308 xs_format_common_peer_ports(xprt); in xs_format_peer_addresses()
311 static void xs_update_peer_port(struct rpc_xprt *xprt) in xs_update_peer_port() argument
313 kfree(xprt->address_strings[RPC_DISPLAY_HEX_PORT]); in xs_update_peer_port()
314 kfree(xprt->address_strings[RPC_DISPLAY_PORT]); in xs_update_peer_port()
316 xs_format_common_peer_ports(xprt); in xs_update_peer_port()
319 static void xs_free_peer_addresses(struct rpc_xprt *xprt) in xs_free_peer_addresses() argument
329 kfree(xprt->address_strings[i]); in xs_free_peer_addresses()
563 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_call() local
568 if (!xprt->bc_serv) in xs_read_stream_call()
572 req = xprt_lookup_bc_request(xprt, transport->recv.xid); in xs_read_stream_call()
599 struct rpc_xprt *xprt = &transport->xprt; in xs_read_stream_reply() local
604 spin_lock(&xprt->queue_lock); in xs_read_stream_reply()
605 req = xprt_lookup_rqst(xprt, transport->recv.xid); in xs_read_stream_reply()
611 spin_unlock(&xprt->queue_lock); in xs_read_stream_reply()
615 spin_lock(&xprt->queue_lock); in xs_read_stream_reply()
622 spin_unlock(&xprt->queue_lock); in xs_read_stream_reply()
733 trace_xs_stream_read_data(&transport->xprt, ret, read); in xs_stream_data_receive()
758 transport->xprt.stat.connect_count++; in xs_stream_start_connect()
759 transport->xprt.stat.connect_start = jiffies; in xs_stream_start_connect()
772 struct rpc_xprt *xprt = &transport->xprt; in xs_nospace() local
779 spin_lock(&xprt->transport_lock); in xs_nospace()
782 if (xprt_connected(xprt)) { in xs_nospace()
787 xprt_wait_for_buffer_space(xprt); in xs_nospace()
791 spin_unlock(&xprt->transport_lock); in xs_nospace()
798 container_of(req->rq_xprt, struct sock_xprt, xprt); in xs_sock_nospace()
812 container_of(req->rq_xprt, struct sock_xprt, xprt); in xs_stream_nospace()
864 struct rpc_xprt *xprt = req->rq_xprt; in xs_local_send_request() local
866 container_of(xprt, struct sock_xprt, xprt); in xs_local_send_request()
879 xprt_force_disconnect(xprt); in xs_local_send_request()
915 xprt_force_disconnect(xprt); in xs_local_send_request()
935 struct rpc_xprt *xprt = req->rq_xprt; in xs_udp_send_request() local
936 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_send_request()
939 .msg_name = xs_addr(xprt), in xs_udp_send_request()
940 .msg_namelen = xprt->addrlen, in xs_udp_send_request()
950 if (!xprt_bound(xprt)) in xs_udp_send_request()
953 if (!xprt_request_get_cong(xprt, req)) in xs_udp_send_request()
1021 struct rpc_xprt *xprt = req->rq_xprt; in xs_tcp_send_request() local
1022 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_send_request()
1047 xs_tcp_set_socket_timeouts(xprt, transport->sock); in xs_tcp_send_request()
1073 if (atomic_long_read(&xprt->xmit_queuelen) == 1) in xs_tcp_send_request()
1124 static void xs_sock_reset_state_flags(struct rpc_xprt *xprt) in xs_sock_reset_state_flags() argument
1126 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_sock_reset_state_flags()
1141 static void xs_sock_reset_connection_flags(struct rpc_xprt *xprt) in xs_sock_reset_connection_flags() argument
1143 xprt->connect_cookie++; in xs_sock_reset_connection_flags()
1145 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_sock_reset_connection_flags()
1146 clear_bit(XPRT_CLOSING, &xprt->state); in xs_sock_reset_connection_flags()
1147 xs_sock_reset_state_flags(xprt); in xs_sock_reset_connection_flags()
1161 struct rpc_xprt *xprt; in xs_error_report() local
1163 if (!(xprt = xprt_from_sock(sk))) in xs_error_report()
1166 transport = container_of(xprt, struct sock_xprt, xprt); in xs_error_report()
1171 xprt, -transport->xprt_err); in xs_error_report()
1172 trace_rpc_socket_error(xprt, sk->sk_socket, transport->xprt_err); in xs_error_report()
1183 struct rpc_xprt *xprt = &transport->xprt; in xs_reset_transport() local
1195 set_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_reset_transport()
1199 if (atomic_read(&transport->xprt.swapper)) in xs_reset_transport()
1213 xprt_clear_connected(xprt); in xs_reset_transport()
1214 xs_sock_reset_connection_flags(xprt); in xs_reset_transport()
1220 trace_rpc_socket_close(xprt, sock); in xs_reset_transport()
1223 xprt_disconnect_done(xprt); in xs_reset_transport()
1236 static void xs_close(struct rpc_xprt *xprt) in xs_close() argument
1238 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_close()
1240 dprintk("RPC: xs_close xprt %p\n", xprt); in xs_close()
1243 xprt->reestablish_timeout = 0; in xs_close()
1246 static void xs_inject_disconnect(struct rpc_xprt *xprt) in xs_inject_disconnect() argument
1249 xprt); in xs_inject_disconnect()
1250 xprt_disconnect_done(xprt); in xs_inject_disconnect()
1253 static void xs_xprt_free(struct rpc_xprt *xprt) in xs_xprt_free() argument
1255 xs_free_peer_addresses(xprt); in xs_xprt_free()
1256 xprt_free(xprt); in xs_xprt_free()
1264 static void xs_destroy(struct rpc_xprt *xprt) in xs_destroy() argument
1266 struct sock_xprt *transport = container_of(xprt, in xs_destroy()
1267 struct sock_xprt, xprt); in xs_destroy()
1268 dprintk("RPC: xs_destroy xprt %p\n", xprt); in xs_destroy()
1271 xs_close(xprt); in xs_destroy()
1274 xs_xprt_free(xprt); in xs_destroy()
1285 static void xs_udp_data_read_skb(struct rpc_xprt *xprt, in xs_udp_data_read_skb() argument
1307 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1308 rovr = xprt_lookup_rqst(xprt, *xp); in xs_udp_data_read_skb()
1313 spin_unlock(&xprt->queue_lock); in xs_udp_data_read_skb()
1321 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1327 spin_lock(&xprt->transport_lock); in xs_udp_data_read_skb()
1328 xprt_adjust_cwnd(xprt, task, copied); in xs_udp_data_read_skb()
1329 spin_unlock(&xprt->transport_lock); in xs_udp_data_read_skb()
1330 spin_lock(&xprt->queue_lock); in xs_udp_data_read_skb()
1336 spin_unlock(&xprt->queue_lock); in xs_udp_data_read_skb()
1353 xs_udp_data_read_skb(&transport->xprt, sk, skb); in xs_udp_data_receive()
1379 struct rpc_xprt *xprt; in xs_data_ready() local
1381 xprt = xprt_from_sock(sk); in xs_data_ready()
1382 if (xprt != NULL) { in xs_data_ready()
1383 struct sock_xprt *transport = container_of(xprt, in xs_data_ready()
1384 struct sock_xprt, xprt); in xs_data_ready()
1386 trace_xs_data_ready(xprt); in xs_data_ready()
1392 if (xprt->reestablish_timeout) in xs_data_ready()
1393 xprt->reestablish_timeout = 0; in xs_data_ready()
1403 static void xs_tcp_force_close(struct rpc_xprt *xprt) in xs_tcp_force_close() argument
1405 xprt_force_disconnect(xprt); in xs_tcp_force_close()
1409 static size_t xs_tcp_bc_maxpayload(struct rpc_xprt *xprt) in xs_tcp_bc_maxpayload() argument
1422 struct rpc_xprt *xprt; in xs_local_state_change() local
1425 if (!(xprt = xprt_from_sock(sk))) in xs_local_state_change()
1427 transport = container_of(xprt, struct sock_xprt, xprt); in xs_local_state_change()
1429 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_local_state_change()
1442 struct rpc_xprt *xprt; in xs_tcp_state_change() local
1445 if (!(xprt = xprt_from_sock(sk))) in xs_tcp_state_change()
1447 dprintk("RPC: xs_tcp_state_change client %p...\n", xprt); in xs_tcp_state_change()
1449 sk->sk_state, xprt_connected(xprt), in xs_tcp_state_change()
1454 transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_state_change()
1455 trace_rpc_socket_state_change(xprt, sk->sk_socket); in xs_tcp_state_change()
1458 if (!xprt_test_and_set_connected(xprt)) { in xs_tcp_state_change()
1459 xprt->connect_cookie++; in xs_tcp_state_change()
1461 xprt_clear_connecting(xprt); in xs_tcp_state_change()
1463 xprt->stat.connect_count++; in xs_tcp_state_change()
1464 xprt->stat.connect_time += (long)jiffies - in xs_tcp_state_change()
1465 xprt->stat.connect_start; in xs_tcp_state_change()
1471 xprt->connect_cookie++; in xs_tcp_state_change()
1472 xprt->reestablish_timeout = 0; in xs_tcp_state_change()
1473 set_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1475 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1476 clear_bit(XPRT_CLOSE_WAIT, &xprt->state); in xs_tcp_state_change()
1481 xprt->connect_cookie++; in xs_tcp_state_change()
1482 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1490 if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) in xs_tcp_state_change()
1491 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_tcp_state_change()
1494 set_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1496 clear_bit(XPRT_CONNECTED, &xprt->state); in xs_tcp_state_change()
1502 xprt_clear_connecting(xprt); in xs_tcp_state_change()
1503 clear_bit(XPRT_CLOSING, &xprt->state); in xs_tcp_state_change()
1512 struct rpc_xprt *xprt; in xs_write_space() local
1518 if (unlikely(!(xprt = xprt_from_sock(sk)))) in xs_write_space()
1520 transport = container_of(xprt, struct sock_xprt, xprt); in xs_write_space()
1561 static void xs_udp_do_set_buffer_size(struct rpc_xprt *xprt) in xs_udp_do_set_buffer_size() argument
1563 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_do_set_buffer_size()
1568 sk->sk_rcvbuf = transport->rcvsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1572 sk->sk_sndbuf = transport->sndsize * xprt->max_reqs * 2; in xs_udp_do_set_buffer_size()
1585 static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize) in xs_udp_set_buffer_size() argument
1587 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_set_buffer_size()
1596 xs_udp_do_set_buffer_size(xprt); in xs_udp_set_buffer_size()
1606 static void xs_udp_timer(struct rpc_xprt *xprt, struct rpc_task *task) in xs_udp_timer() argument
1608 spin_lock(&xprt->transport_lock); in xs_udp_timer()
1609 xprt_adjust_cwnd(xprt, task, -ETIMEDOUT); in xs_udp_timer()
1610 spin_unlock(&xprt->transport_lock); in xs_udp_timer()
1650 static void xs_set_port(struct rpc_xprt *xprt, unsigned short port) in xs_set_port() argument
1652 dprintk("RPC: setting port for xprt %p to %u\n", xprt, port); in xs_set_port()
1654 rpc_set_port(xs_addr(xprt), port); in xs_set_port()
1655 xs_update_peer_port(xprt); in xs_set_port()
1660 if (transport->srcport == 0 && transport->xprt.reuseport) in xs_set_srcport()
1668 if (port == 0 && transport->xprt.resvport) in xs_get_srcport()
1673 static unsigned short xs_sock_srcport(struct rpc_xprt *xprt) in xs_sock_srcport() argument
1675 struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); in xs_sock_srcport()
1684 static int xs_sock_srcaddr(struct rpc_xprt *xprt, char *buf, size_t buflen) in xs_sock_srcaddr() argument
1686 struct sock_xprt *sock = container_of(xprt, struct sock_xprt, xprt); in xs_sock_srcaddr()
1707 if (!transport->xprt.resvport) in xs_next_srcport()
1738 memcpy(&myaddr, &transport->srcaddr, transport->xprt.addrlen); in xs_bind()
1742 transport->xprt.addrlen); in xs_bind()
1744 if (transport->xprt.reuseport) in xs_bind()
1773 static void xs_local_set_port(struct rpc_xprt *xprt, unsigned short port) in xs_local_set_port() argument
1832 static struct socket *xs_create_sock(struct rpc_xprt *xprt, in xs_create_sock() argument
1840 err = __sock_create(xprt->xprt_net, family, type, protocol, &sock, 1); in xs_create_sock()
1867 static int xs_local_finish_connecting(struct rpc_xprt *xprt, in xs_local_finish_connecting() argument
1870 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_local_finish_connecting()
1871 xprt); in xs_local_finish_connecting()
1880 sk->sk_user_data = xprt; in xs_local_finish_connecting()
1886 xprt_clear_connected(xprt); in xs_local_finish_connecting()
1897 return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, 0); in xs_local_finish_connecting()
1906 struct rpc_xprt *xprt = &transport->xprt; in xs_local_setup_socket() local
1911 status = __sock_create(xprt->xprt_net, AF_LOCAL, in xs_local_setup_socket()
1928 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1930 status = xs_local_finish_connecting(xprt, sock); in xs_local_setup_socket()
1931 trace_rpc_socket_connect(xprt, sock, status); in xs_local_setup_socket()
1935 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1936 xprt->stat.connect_count++; in xs_local_setup_socket()
1937 xprt->stat.connect_time += (long)jiffies - in xs_local_setup_socket()
1938 xprt->stat.connect_start; in xs_local_setup_socket()
1939 xprt_set_connected(xprt); in xs_local_setup_socket()
1945 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1949 xprt, xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1954 xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_local_setup_socket()
1958 xprt_clear_connecting(xprt); in xs_local_setup_socket()
1959 xprt_wake_pending_tasks(xprt, status); in xs_local_setup_socket()
1963 static void xs_local_connect(struct rpc_xprt *xprt, struct rpc_task *task) in xs_local_connect() argument
1965 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_local_connect()
1989 xprt_force_disconnect(xprt); in xs_local_connect()
1991 xprt_clear_connecting(xprt); in xs_local_connect()
1992 xprt_wake_pending_tasks(xprt, -ENOTCONN); in xs_local_connect()
2001 static void xs_set_memalloc(struct rpc_xprt *xprt) in xs_set_memalloc() argument
2003 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, in xs_set_memalloc()
2004 xprt); in xs_set_memalloc()
2012 if (atomic_read(&xprt->swapper)) in xs_set_memalloc()
2024 xs_enable_swap(struct rpc_xprt *xprt) in xs_enable_swap() argument
2026 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); in xs_enable_swap()
2029 if (atomic_inc_return(&xprt->swapper) == 1 && in xs_enable_swap()
2044 xs_disable_swap(struct rpc_xprt *xprt) in xs_disable_swap() argument
2046 struct sock_xprt *xs = container_of(xprt, struct sock_xprt, xprt); in xs_disable_swap()
2049 if (atomic_dec_and_test(&xprt->swapper) && in xs_disable_swap()
2055 static void xs_set_memalloc(struct rpc_xprt *xprt) in xs_set_memalloc() argument
2060 xs_enable_swap(struct rpc_xprt *xprt) in xs_enable_swap() argument
2066 xs_disable_swap(struct rpc_xprt *xprt) in xs_disable_swap() argument
2071 static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) in xs_udp_finish_connecting() argument
2073 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_finish_connecting()
2082 sk->sk_user_data = xprt; in xs_udp_finish_connecting()
2086 xprt_set_connected(xprt); in xs_udp_finish_connecting()
2092 xs_set_memalloc(xprt); in xs_udp_finish_connecting()
2096 xs_udp_do_set_buffer_size(xprt); in xs_udp_finish_connecting()
2098 xprt->stat.connect_start = jiffies; in xs_udp_finish_connecting()
2105 struct rpc_xprt *xprt = &transport->xprt; in xs_udp_setup_socket() local
2110 if (atomic_read(&xprt->swapper)) in xs_udp_setup_socket()
2112 sock = xs_create_sock(xprt, transport, in xs_udp_setup_socket()
2113 xs_addr(xprt)->sa_family, SOCK_DGRAM, in xs_udp_setup_socket()
2119 "%s (port %s)\n", xprt, in xs_udp_setup_socket()
2120 xprt->address_strings[RPC_DISPLAY_PROTO], in xs_udp_setup_socket()
2121 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_udp_setup_socket()
2122 xprt->address_strings[RPC_DISPLAY_PORT]); in xs_udp_setup_socket()
2124 xs_udp_finish_connecting(xprt, sock); in xs_udp_setup_socket()
2125 trace_rpc_socket_connect(xprt, sock, 0); in xs_udp_setup_socket()
2128 xprt_clear_connecting(xprt); in xs_udp_setup_socket()
2129 xprt_unlock_connect(xprt, transport); in xs_udp_setup_socket()
2130 xprt_wake_pending_tasks(xprt, status); in xs_udp_setup_socket()
2141 static void xs_tcp_shutdown(struct rpc_xprt *xprt) in xs_tcp_shutdown() argument
2143 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_shutdown()
2149 if (!xprt->reuseport) { in xs_tcp_shutdown()
2150 xs_close(xprt); in xs_tcp_shutdown()
2160 trace_rpc_socket_shutdown(xprt, sock); in xs_tcp_shutdown()
2167 static void xs_tcp_set_socket_timeouts(struct rpc_xprt *xprt, in xs_tcp_set_socket_timeouts() argument
2170 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_socket_timeouts()
2175 spin_lock(&xprt->transport_lock); in xs_tcp_set_socket_timeouts()
2176 keepidle = DIV_ROUND_UP(xprt->timeout->to_initval, HZ); in xs_tcp_set_socket_timeouts()
2177 keepcnt = xprt->timeout->to_retries + 1; in xs_tcp_set_socket_timeouts()
2178 timeo = jiffies_to_msecs(xprt->timeout->to_initval) * in xs_tcp_set_socket_timeouts()
2179 (xprt->timeout->to_retries + 1); in xs_tcp_set_socket_timeouts()
2181 spin_unlock(&xprt->transport_lock); in xs_tcp_set_socket_timeouts()
2193 static void xs_tcp_set_connect_timeout(struct rpc_xprt *xprt, in xs_tcp_set_connect_timeout() argument
2197 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_set_connect_timeout()
2201 spin_lock(&xprt->transport_lock); in xs_tcp_set_connect_timeout()
2202 if (reconnect_timeout < xprt->max_reconnect_timeout) in xs_tcp_set_connect_timeout()
2203 xprt->max_reconnect_timeout = reconnect_timeout; in xs_tcp_set_connect_timeout()
2204 if (connect_timeout < xprt->connect_timeout) { in xs_tcp_set_connect_timeout()
2205 memcpy(&to, xprt->timeout, sizeof(to)); in xs_tcp_set_connect_timeout()
2214 xprt->timeout = &transport->tcp_timeout; in xs_tcp_set_connect_timeout()
2215 xprt->connect_timeout = connect_timeout; in xs_tcp_set_connect_timeout()
2218 spin_unlock(&xprt->transport_lock); in xs_tcp_set_connect_timeout()
2221 static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock) in xs_tcp_finish_connecting() argument
2223 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_finish_connecting()
2235 if (xs_addr(xprt)->sa_family == PF_INET6) { in xs_tcp_finish_connecting()
2240 xs_tcp_set_socket_timeouts(xprt, sock); in xs_tcp_finish_connecting()
2247 sk->sk_user_data = xprt; in xs_tcp_finish_connecting()
2256 xprt_clear_connected(xprt); in xs_tcp_finish_connecting()
2265 if (!xprt_bound(xprt)) in xs_tcp_finish_connecting()
2268 xs_set_memalloc(xprt); in xs_tcp_finish_connecting()
2274 return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK); in xs_tcp_finish_connecting()
2288 struct rpc_xprt *xprt = &transport->xprt; in xs_tcp_setup_socket() local
2292 if (atomic_read(&xprt->swapper)) in xs_tcp_setup_socket()
2295 if (xprt_connected(xprt)) in xs_tcp_setup_socket()
2301 sock = xs_create_sock(xprt, transport, xs_addr(xprt)->sa_family, in xs_tcp_setup_socket()
2304 xprt_wake_pending_tasks(xprt, PTR_ERR(sock)); in xs_tcp_setup_socket()
2310 "%s (port %s)\n", xprt, in xs_tcp_setup_socket()
2311 xprt->address_strings[RPC_DISPLAY_PROTO], in xs_tcp_setup_socket()
2312 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_tcp_setup_socket()
2313 xprt->address_strings[RPC_DISPLAY_PORT]); in xs_tcp_setup_socket()
2315 status = xs_tcp_finish_connecting(xprt, sock); in xs_tcp_setup_socket()
2316 trace_rpc_socket_connect(xprt, sock, status); in xs_tcp_setup_socket()
2318 xprt, -status, xprt_connected(xprt), in xs_tcp_setup_socket()
2325 if (xprt->reestablish_timeout < XS_TCP_INIT_REEST_TO) in xs_tcp_setup_socket()
2326 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_tcp_setup_socket()
2356 xprt_wake_pending_tasks(xprt, status); in xs_tcp_setup_socket()
2357 xs_tcp_force_close(xprt); in xs_tcp_setup_socket()
2359 xprt_clear_connecting(xprt); in xs_tcp_setup_socket()
2361 xprt_unlock_connect(xprt, transport); in xs_tcp_setup_socket()
2379 static void xs_connect(struct rpc_xprt *xprt, struct rpc_task *task) in xs_connect() argument
2381 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_connect()
2384 WARN_ON_ONCE(!xprt_lock_connect(xprt, task, transport)); in xs_connect()
2388 "seconds\n", xprt, xprt->reestablish_timeout / HZ); in xs_connect()
2390 delay = xprt_reconnect_delay(xprt); in xs_connect()
2391 xprt_reconnect_backoff(xprt, XS_TCP_INIT_REEST_TO); in xs_connect()
2394 dprintk("RPC: xs_connect scheduled xprt %p\n", xprt); in xs_connect()
2404 xs_tcp_force_close(&transport->xprt); in xs_wake_disconnect()
2410 xprt_write_space(&transport->xprt); in xs_wake_write()
2426 xprt_wake_pending_tasks(&transport->xprt, sockerr); in xs_wake_error()
2434 xprt_wake_pending_tasks(&transport->xprt, -EAGAIN); in xs_wake_pending()
2454 static void xs_local_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_local_print_stats() argument
2458 if (xprt_connected(xprt)) in xs_local_print_stats()
2459 idle_time = (long)(jiffies - xprt->last_used) / HZ; in xs_local_print_stats()
2463 xprt->stat.bind_count, in xs_local_print_stats()
2464 xprt->stat.connect_count, in xs_local_print_stats()
2465 xprt->stat.connect_time / HZ, in xs_local_print_stats()
2467 xprt->stat.sends, in xs_local_print_stats()
2468 xprt->stat.recvs, in xs_local_print_stats()
2469 xprt->stat.bad_xids, in xs_local_print_stats()
2470 xprt->stat.req_u, in xs_local_print_stats()
2471 xprt->stat.bklog_u, in xs_local_print_stats()
2472 xprt->stat.max_slots, in xs_local_print_stats()
2473 xprt->stat.sending_u, in xs_local_print_stats()
2474 xprt->stat.pending_u); in xs_local_print_stats()
2483 static void xs_udp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_udp_print_stats() argument
2485 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_udp_print_stats()
2490 xprt->stat.bind_count, in xs_udp_print_stats()
2491 xprt->stat.sends, in xs_udp_print_stats()
2492 xprt->stat.recvs, in xs_udp_print_stats()
2493 xprt->stat.bad_xids, in xs_udp_print_stats()
2494 xprt->stat.req_u, in xs_udp_print_stats()
2495 xprt->stat.bklog_u, in xs_udp_print_stats()
2496 xprt->stat.max_slots, in xs_udp_print_stats()
2497 xprt->stat.sending_u, in xs_udp_print_stats()
2498 xprt->stat.pending_u); in xs_udp_print_stats()
2507 static void xs_tcp_print_stats(struct rpc_xprt *xprt, struct seq_file *seq) in xs_tcp_print_stats() argument
2509 struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); in xs_tcp_print_stats()
2512 if (xprt_connected(xprt)) in xs_tcp_print_stats()
2513 idle_time = (long)(jiffies - xprt->last_used) / HZ; in xs_tcp_print_stats()
2518 xprt->stat.bind_count, in xs_tcp_print_stats()
2519 xprt->stat.connect_count, in xs_tcp_print_stats()
2520 xprt->stat.connect_time / HZ, in xs_tcp_print_stats()
2522 xprt->stat.sends, in xs_tcp_print_stats()
2523 xprt->stat.recvs, in xs_tcp_print_stats()
2524 xprt->stat.bad_xids, in xs_tcp_print_stats()
2525 xprt->stat.req_u, in xs_tcp_print_stats()
2526 xprt->stat.bklog_u, in xs_tcp_print_stats()
2527 xprt->stat.max_slots, in xs_tcp_print_stats()
2528 xprt->stat.sending_u, in xs_tcp_print_stats()
2529 xprt->stat.pending_u); in xs_tcp_print_stats()
2578 container_of(req->rq_xprt, struct sock_xprt, xprt); in bc_sendto()
2611 struct svc_xprt *xprt; in bc_send_request() local
2617 xprt = req->rq_xprt->bc_xprt; in bc_send_request()
2623 mutex_lock(&xprt->xpt_mutex); in bc_send_request()
2624 if (test_bit(XPT_DEAD, &xprt->xpt_flags)) in bc_send_request()
2628 mutex_unlock(&xprt->xpt_mutex); in bc_send_request()
2640 static void bc_close(struct rpc_xprt *xprt) in bc_close() argument
2642 xprt_disconnect_done(xprt); in bc_close()
2650 static void bc_destroy(struct rpc_xprt *xprt) in bc_destroy() argument
2652 dprintk("RPC: bc_destroy xprt %p\n", xprt); in bc_destroy()
2654 xs_xprt_free(xprt); in bc_destroy()
2786 struct rpc_xprt *xprt; in xs_setup_xprt() local
2789 if (args->addrlen > sizeof(xprt->addr)) { in xs_setup_xprt()
2794 xprt = xprt_alloc(args->net, sizeof(*new), slot_table_size, in xs_setup_xprt()
2796 if (xprt == NULL) { in xs_setup_xprt()
2802 new = container_of(xprt, struct sock_xprt, xprt); in xs_setup_xprt()
2804 memcpy(&xprt->addr, args->dstaddr, args->addrlen); in xs_setup_xprt()
2805 xprt->addrlen = args->addrlen; in xs_setup_xprt()
2813 xprt_free(xprt); in xs_setup_xprt()
2818 return xprt; in xs_setup_xprt()
2837 struct rpc_xprt *xprt; in xs_setup_local() local
2840 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_local()
2842 if (IS_ERR(xprt)) in xs_setup_local()
2843 return xprt; in xs_setup_local()
2844 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_local()
2846 xprt->prot = 0; in xs_setup_local()
2847 xprt->xprt_class = &xs_local_transport; in xs_setup_local()
2848 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_local()
2850 xprt->bind_timeout = XS_BIND_TO; in xs_setup_local()
2851 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_setup_local()
2852 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_local()
2854 xprt->ops = &xs_local_ops; in xs_setup_local()
2855 xprt->timeout = &xs_local_default_timeout; in xs_setup_local()
2869 xprt_set_bound(xprt); in xs_setup_local()
2870 xs_format_peer_addresses(xprt, "local", RPCBIND_NETID_LOCAL); in xs_setup_local()
2878 xprt->address_strings[RPC_DISPLAY_ADDR]); in xs_setup_local()
2881 return xprt; in xs_setup_local()
2884 xs_xprt_free(xprt); in xs_setup_local()
2903 struct rpc_xprt *xprt; in xs_setup_udp() local
2907 xprt = xs_setup_xprt(args, xprt_udp_slot_table_entries, in xs_setup_udp()
2909 if (IS_ERR(xprt)) in xs_setup_udp()
2910 return xprt; in xs_setup_udp()
2911 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_udp()
2913 xprt->prot = IPPROTO_UDP; in xs_setup_udp()
2914 xprt->xprt_class = &xs_udp_transport; in xs_setup_udp()
2916 xprt->max_payload = (1U << 16) - (MAX_HEADER << 3); in xs_setup_udp()
2918 xprt->bind_timeout = XS_BIND_TO; in xs_setup_udp()
2919 xprt->reestablish_timeout = XS_UDP_REEST_TO; in xs_setup_udp()
2920 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_udp()
2922 xprt->ops = &xs_udp_ops; in xs_setup_udp()
2924 xprt->timeout = &xs_udp_default_timeout; in xs_setup_udp()
2933 xprt_set_bound(xprt); in xs_setup_udp()
2935 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP); in xs_setup_udp()
2939 xprt_set_bound(xprt); in xs_setup_udp()
2941 xs_format_peer_addresses(xprt, "udp", RPCBIND_NETID_UDP6); in xs_setup_udp()
2948 if (xprt_bound(xprt)) in xs_setup_udp()
2950 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_udp()
2951 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_udp()
2952 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_udp()
2955 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_udp()
2956 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_udp()
2959 return xprt; in xs_setup_udp()
2962 xs_xprt_free(xprt); in xs_setup_udp()
2980 struct rpc_xprt *xprt; in xs_setup_tcp() local
2988 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_tcp()
2990 if (IS_ERR(xprt)) in xs_setup_tcp()
2991 return xprt; in xs_setup_tcp()
2992 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_tcp()
2994 xprt->prot = IPPROTO_TCP; in xs_setup_tcp()
2995 xprt->xprt_class = &xs_tcp_transport; in xs_setup_tcp()
2996 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_tcp()
2998 xprt->bind_timeout = XS_BIND_TO; in xs_setup_tcp()
2999 xprt->reestablish_timeout = XS_TCP_INIT_REEST_TO; in xs_setup_tcp()
3000 xprt->idle_timeout = XS_IDLE_DISC_TO; in xs_setup_tcp()
3002 xprt->ops = &xs_tcp_ops; in xs_setup_tcp()
3003 xprt->timeout = &xs_tcp_default_timeout; in xs_setup_tcp()
3005 xprt->max_reconnect_timeout = xprt->timeout->to_maxval; in xs_setup_tcp()
3006 xprt->connect_timeout = xprt->timeout->to_initval * in xs_setup_tcp()
3007 (xprt->timeout->to_retries + 1); in xs_setup_tcp()
3016 xprt_set_bound(xprt); in xs_setup_tcp()
3018 xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP); in xs_setup_tcp()
3022 xprt_set_bound(xprt); in xs_setup_tcp()
3024 xs_format_peer_addresses(xprt, "tcp", RPCBIND_NETID_TCP6); in xs_setup_tcp()
3031 if (xprt_bound(xprt)) in xs_setup_tcp()
3033 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_tcp()
3034 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_tcp()
3035 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_tcp()
3038 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_tcp()
3039 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_tcp()
3042 return xprt; in xs_setup_tcp()
3045 xs_xprt_free(xprt); in xs_setup_tcp()
3057 struct rpc_xprt *xprt; in xs_setup_bc_tcp() local
3062 xprt = xs_setup_xprt(args, xprt_tcp_slot_table_entries, in xs_setup_bc_tcp()
3064 if (IS_ERR(xprt)) in xs_setup_bc_tcp()
3065 return xprt; in xs_setup_bc_tcp()
3066 transport = container_of(xprt, struct sock_xprt, xprt); in xs_setup_bc_tcp()
3068 xprt->prot = IPPROTO_TCP; in xs_setup_bc_tcp()
3069 xprt->xprt_class = &xs_bc_tcp_transport; in xs_setup_bc_tcp()
3070 xprt->max_payload = RPC_MAX_FRAGMENT_SIZE; in xs_setup_bc_tcp()
3071 xprt->timeout = &xs_tcp_default_timeout; in xs_setup_bc_tcp()
3074 xprt_set_bound(xprt); in xs_setup_bc_tcp()
3075 xprt->bind_timeout = 0; in xs_setup_bc_tcp()
3076 xprt->reestablish_timeout = 0; in xs_setup_bc_tcp()
3077 xprt->idle_timeout = 0; in xs_setup_bc_tcp()
3079 xprt->ops = &bc_tcp_ops; in xs_setup_bc_tcp()
3083 xs_format_peer_addresses(xprt, "tcp", in xs_setup_bc_tcp()
3087 xs_format_peer_addresses(xprt, "tcp", in xs_setup_bc_tcp()
3096 xprt->address_strings[RPC_DISPLAY_ADDR], in xs_setup_bc_tcp()
3097 xprt->address_strings[RPC_DISPLAY_PORT], in xs_setup_bc_tcp()
3098 xprt->address_strings[RPC_DISPLAY_PROTO]); in xs_setup_bc_tcp()
3106 xprt_get(xprt); in xs_setup_bc_tcp()
3107 args->bc_xprt->xpt_bc_xprt = xprt; in xs_setup_bc_tcp()
3108 xprt->bc_xprt = args->bc_xprt; in xs_setup_bc_tcp()
3117 xprt_set_connected(xprt); in xs_setup_bc_tcp()
3120 return xprt; in xs_setup_bc_tcp()
3124 xprt_put(xprt); in xs_setup_bc_tcp()
3127 xs_xprt_free(xprt); in xs_setup_bc_tcp()