Lines Matching refs:sock
42 #include <net/sock.h>
202 struct socket * sock;
203 struct sock * inet;
234 void (*old_data_ready)(struct sock *, int);
235 void (*old_state_change)(struct sock *);
236 void (*old_write_space)(struct sock *);
237 void (*old_error_report)(struct sock *);
341 static int xs_send_kvec(struct socket *sock, struct sockaddr *addr, int addrlen, struct kvec *vec, unsigned int base, int more)
354 return kernel_sendmsg(sock, &msg, &iov, 1, iov.iov_len);
355 return kernel_sendmsg(sock, &msg, NULL, 0, 0);
358 static int xs_send_pagedata(struct socket *sock, struct xdr_buf *xdr, unsigned int base, int more)
375 err = sock->ops->sendpage(sock, *ppage, base, len, flags);
391 * @sock: socket to send on
398 static int xs_sendpages(struct socket *sock, struct sockaddr *addr, int addrlen, struct xdr_buf *xdr, unsigned int base)
403 if (unlikely(!sock))
406 clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
415 err = xs_send_kvec(sock, addr, addrlen, &xdr->head[0], base, remainder != 0);
426 err = xs_send_pagedata(sock, xdr, base, remainder != 0);
436 err = xs_send_kvec(sock, NULL, 0, &xdr->tail[0], base, 0);
450 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
474 if (test_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags)) {
480 set_bit(SOCK_NOSPACE, &transport->sock->flags);
486 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
519 status = xs_sendpages(transport->sock,
551 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
567 struct socket *sock = transport->sock;
569 if (sock != NULL)
570 kernel_sock_shutdown(sock, SHUT_WR);
598 status = xs_sendpages(transport->sock,
638 clear_bit(SOCK_ASYNC_NOSPACE, &transport->sock->flags);
671 static void xs_save_old_callbacks(struct sock_xprt *transport, struct sock *sk)
679 static void xs_restore_old_callbacks(struct sock_xprt *transport, struct sock *sk)
689 struct socket *sock = transport->sock;
690 struct sock *sk = transport->inet;
697 transport->sock = NULL;
706 sock_release(sock);
764 static inline struct rpc_xprt *xprt_from_sock(struct sock *sk)
775 static void xs_udp_data_ready(struct sock *sk, int len)
1206 static void xs_tcp_data_ready(struct sock *sk, int bytes)
1282 static void xs_tcp_state_change(struct sock *sk)
1357 static void xs_error_report(struct sock *sk)
1372 static void xs_write_space(struct sock *sk)
1374 struct socket *sock;
1377 if (unlikely(!(sock = sk->sk_socket)))
1379 clear_bit(SOCK_NOSPACE, &sock->flags);
1383 if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0)
1399 static void xs_udp_write_space(struct sock *sk)
1403 /* from net/core/sock.c:sock_def_write_space */
1420 static void xs_tcp_write_space(struct sock *sk)
1434 struct sock *sk = transport->inet;
1501 static unsigned short xs_get_srcport(struct sock_xprt *transport, struct socket *sock)
1510 static unsigned short xs_next_srcport(struct sock_xprt *transport, struct socket *sock, unsigned short port)
1521 static int xs_bind4(struct sock_xprt *transport, struct socket *sock)
1528 unsigned short port = xs_get_srcport(transport, sock);
1535 err = kernel_bind(sock, (struct sockaddr *) &myaddr,
1544 port = xs_next_srcport(transport, sock, port);
1554 static int xs_bind6(struct sock_xprt *transport, struct socket *sock)
1561 unsigned short port = xs_get_srcport(transport, sock);
1568 err = kernel_bind(sock, (struct sockaddr *) &myaddr,
1577 port = xs_next_srcport(transport, sock, port);
1590 static inline void xs_reclassify_socket4(struct socket *sock)
1592 struct sock *sk = sock->sk;
1599 static inline void xs_reclassify_socket6(struct socket *sock)
1601 struct sock *sk = sock->sk;
1608 static inline void xs_reclassify_socket4(struct socket *sock)
1612 static inline void xs_reclassify_socket6(struct socket *sock)
1617 static void xs_udp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1622 struct sock *sk = sock->sk;
1638 transport->sock = sock;
1657 struct socket *sock = transport->sock;
1666 err = sock_create_kern(PF_INET, SOCK_DGRAM, IPPROTO_UDP, &sock);
1671 xs_reclassify_socket4(sock);
1673 if (xs_bind4(transport, sock)) {
1674 sock_release(sock);
1684 xs_udp_finish_connecting(xprt, sock);
1702 struct socket *sock = transport->sock;
1711 err = sock_create_kern(PF_INET6, SOCK_DGRAM, IPPROTO_UDP, &sock);
1716 xs_reclassify_socket6(sock);
1718 if (xs_bind6(transport, sock) < 0) {
1719 sock_release(sock);
1729 xs_udp_finish_connecting(xprt, sock);
1753 result = kernel_connect(transport->sock, &any, sizeof(any), 0);
1765 if (state == TCP_CLOSE && transport->sock->state == SS_UNCONNECTED) {
1787 static int xs_tcp_finish_connecting(struct rpc_xprt *xprt, struct socket *sock)
1792 struct sock *sk = sock->sk;
1814 transport->sock = sock;
1826 return kernel_connect(sock, xs_addr(xprt), xprt->addrlen, O_NONBLOCK);
1842 struct socket *sock = transport->sock;
1848 if (!sock) {
1850 sock = create_sock(xprt, transport);
1851 if (IS_ERR(sock)) {
1852 status = PTR_ERR(sock);
1873 status = xs_tcp_finish_connecting(xprt, sock);
1874 dprintk("RPC: %p connect status %d connected %d sock state %d\n",
1876 sock->sk->sk_state);
1913 struct socket *sock;
1917 err = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
1923 xs_reclassify_socket4(sock);
1925 if (xs_bind4(transport, sock) < 0) {
1926 sock_release(sock);
1929 return sock;
1952 struct socket *sock;
1956 err = sock_create_kern(PF_INET6, SOCK_STREAM, IPPROTO_TCP, &sock);
1962 xs_reclassify_socket6(sock);
1964 if (xs_bind6(transport, sock) < 0) {
1965 sock_release(sock);
1968 return sock;
2006 if (transport->sock != NULL && !RPC_IS_SOFTCONN(task)) {
2119 struct socket *sock = transport->sock;
2130 len = svc_send_common(sock, xbufp,
2472 transport->sock = bc_sock->sk_sock;