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