1 /* SPDX-License-Identifier: GPL-2.0 */
5 #define RDS_TCP_PORT 16385
7 struct rds_tcp_incoming
{
8 struct rds_incoming ti_inc
;
9 struct sk_buff_head ti_skb_list
;
12 struct rds_tcp_connection
{
14 struct list_head t_tcp_node
;
15 struct rds_conn_path
*t_cpath
;
16 /* t_conn_path_lock synchronizes the connection establishment between
17 * rds_tcp_accept_one and rds_tcp_conn_path_connect
19 struct mutex t_conn_path_lock
;
20 struct socket
*t_sock
;
21 void *t_orig_write_space
;
22 void *t_orig_data_ready
;
23 void *t_orig_state_change
;
25 struct rds_tcp_incoming
*t_tinc
;
26 size_t t_tinc_hdr_rem
;
27 size_t t_tinc_data_rem
;
29 /* XXX error report? */
30 struct work_struct t_conn_w
;
31 struct work_struct t_send_w
;
32 struct work_struct t_down_w
;
33 struct work_struct t_recv_w
;
35 /* for info exporting only */
36 struct list_head t_list_item
;
38 u32 t_last_expected_una
;
42 struct rds_tcp_statistics
{
43 uint64_t s_tcp_data_ready_calls
;
44 uint64_t s_tcp_write_space_calls
;
45 uint64_t s_tcp_sndbuf_full
;
46 uint64_t s_tcp_connect_raced
;
47 uint64_t s_tcp_listen_closed_stale
;
51 void rds_tcp_tune(struct socket
*sock
);
52 void rds_tcp_nonagle(struct socket
*sock
);
53 void rds_tcp_set_callbacks(struct socket
*sock
, struct rds_conn_path
*cp
);
54 void rds_tcp_reset_callbacks(struct socket
*sock
, struct rds_conn_path
*cp
);
55 void rds_tcp_restore_callbacks(struct socket
*sock
,
56 struct rds_tcp_connection
*tc
);
57 u32
rds_tcp_snd_nxt(struct rds_tcp_connection
*tc
);
58 u32
rds_tcp_snd_una(struct rds_tcp_connection
*tc
);
59 u64
rds_tcp_map_seq(struct rds_tcp_connection
*tc
, u32 seq
);
60 extern struct rds_transport rds_tcp_transport
;
61 void rds_tcp_accept_work(struct sock
*sk
);
64 int rds_tcp_conn_path_connect(struct rds_conn_path
*cp
);
65 void rds_tcp_conn_path_shutdown(struct rds_conn_path
*conn
);
66 void rds_tcp_state_change(struct sock
*sk
);
69 struct socket
*rds_tcp_listen_init(struct net
*);
70 void rds_tcp_listen_stop(struct socket
*sock
, struct work_struct
*acceptor
);
71 void rds_tcp_listen_data_ready(struct sock
*sk
);
72 int rds_tcp_accept_one(struct socket
*sock
);
73 int rds_tcp_keepalive(struct socket
*sock
);
74 void *rds_tcp_listen_sock_def_readable(struct net
*net
);
75 void rds_tcp_set_linger(struct socket
*sock
);
78 int rds_tcp_recv_init(void);
79 void rds_tcp_recv_exit(void);
80 void rds_tcp_data_ready(struct sock
*sk
);
81 int rds_tcp_recv_path(struct rds_conn_path
*cp
);
82 void rds_tcp_inc_free(struct rds_incoming
*inc
);
83 int rds_tcp_inc_copy_to_user(struct rds_incoming
*inc
, struct iov_iter
*to
);
86 void rds_tcp_xmit_path_prepare(struct rds_conn_path
*cp
);
87 void rds_tcp_xmit_path_complete(struct rds_conn_path
*cp
);
88 int rds_tcp_xmit(struct rds_connection
*conn
, struct rds_message
*rm
,
89 unsigned int hdr_off
, unsigned int sg
, unsigned int off
);
90 void rds_tcp_write_space(struct sock
*sk
);
93 DECLARE_PER_CPU(struct rds_tcp_statistics
, rds_tcp_stats
);
94 #define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member)
95 unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator
*iter
,