1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * linux/include/linux/sunrpc/xprtsock.h 4 * 5 * Declarations for the RPC transport socket provider. 6 */ 7 8 #ifndef _LINUX_SUNRPC_XPRTSOCK_H 9 #define _LINUX_SUNRPC_XPRTSOCK_H 10 11 int init_socket_xprt(void); 12 void cleanup_socket_xprt(void); 13 unsigned short get_srcport(struct rpc_xprt *); 14 15 #define RPC_MIN_RESVPORT (1U) 16 #define RPC_MAX_RESVPORT (65535U) 17 #define RPC_DEF_MIN_RESVPORT (665U) 18 #define RPC_DEF_MAX_RESVPORT (1023U) 19 20 struct sock_xprt { 21 struct rpc_xprt xprt; 22 23 /* 24 * Network layer 25 */ 26 struct socket * sock; 27 struct sock * inet; 28 struct file * file; 29 30 /* 31 * State of TCP reply receive 32 */ 33 struct { 34 struct { 35 __be32 fraghdr, 36 xid, 37 calldir; 38 } __attribute__((packed)); 39 40 u32 offset, 41 len; 42 43 unsigned long copied; 44 } recv; 45 46 /* 47 * State of TCP transmit queue 48 */ 49 struct { 50 u32 offset; 51 } xmit; 52 53 /* 54 * Connection of transports 55 */ 56 unsigned long sock_state; 57 struct delayed_work connect_worker; 58 struct work_struct error_worker; 59 struct work_struct recv_worker; 60 struct mutex recv_mutex; 61 struct sockaddr_storage srcaddr; 62 unsigned short srcport; 63 int xprt_err; 64 65 /* 66 * UDP socket buffer size parameters 67 */ 68 size_t rcvsize, 69 sndsize; 70 71 struct rpc_timeout tcp_timeout; 72 73 /* 74 * Saved socket callback addresses 75 */ 76 void (*old_data_ready)(struct sock *); 77 void (*old_state_change)(struct sock *); 78 void (*old_write_space)(struct sock *); 79 void (*old_error_report)(struct sock *); 80 }; 81 82 /* 83 * TCP RPC flags 84 */ 85 #define XPRT_SOCK_CONNECTING 1U 86 #define XPRT_SOCK_DATA_READY (2) 87 #define XPRT_SOCK_UPD_TIMEOUT (3) 88 #define XPRT_SOCK_WAKE_ERROR (4) 89 #define XPRT_SOCK_WAKE_WRITE (5) 90 #define XPRT_SOCK_WAKE_PENDING (6) 91 #define XPRT_SOCK_WAKE_DISCONNECT (7) 92 #define XPRT_SOCK_CONNECT_SENT (8) 93 94 #endif /* _LINUX_SUNRPC_XPRTSOCK_H */ 95