blob: 56ea6620fcf97ce40d0926089b5e5b188ea1a1fe [file] [log] [blame]
Andy Grover70041082009-08-21 12:28:31 +00001#ifndef _RDS_TCP_H
2#define _RDS_TCP_H
3
4#define RDS_TCP_PORT 16385
5
6struct rds_tcp_incoming {
7 struct rds_incoming ti_inc;
8 struct sk_buff_head ti_skb_list;
9};
10
11struct rds_tcp_connection {
12
13 struct list_head t_tcp_node;
Sowmini Varadhan02105b22016-06-30 16:11:12 -070014 struct rds_conn_path *t_cpath;
15 /* t_conn_path_lock synchronizes the connection establishment between
Sowmini Varadhanb04e8552016-06-30 16:11:16 -070016 * rds_tcp_accept_one and rds_tcp_conn_path_connect
Sowmini Varadhanbd7c5f92016-05-02 11:24:52 -070017 */
Sowmini Varadhan02105b22016-06-30 16:11:12 -070018 struct mutex t_conn_path_lock;
Andy Grover70041082009-08-21 12:28:31 +000019 struct socket *t_sock;
20 void *t_orig_write_space;
21 void *t_orig_data_ready;
22 void *t_orig_state_change;
23
24 struct rds_tcp_incoming *t_tinc;
25 size_t t_tinc_hdr_rem;
26 size_t t_tinc_data_rem;
27
28 /* XXX error report? */
29 struct work_struct t_conn_w;
30 struct work_struct t_send_w;
31 struct work_struct t_down_w;
32 struct work_struct t_recv_w;
33
34 /* for info exporting only */
35 struct list_head t_list_item;
36 u32 t_last_sent_nxt;
37 u32 t_last_expected_una;
38 u32 t_last_seen_una;
39};
40
41struct rds_tcp_statistics {
42 uint64_t s_tcp_data_ready_calls;
43 uint64_t s_tcp_write_space_calls;
44 uint64_t s_tcp_sndbuf_full;
45 uint64_t s_tcp_connect_raced;
46 uint64_t s_tcp_listen_closed_stale;
47};
48
49/* tcp.c */
Andy Grover70041082009-08-21 12:28:31 +000050void rds_tcp_tune(struct socket *sock);
51void rds_tcp_nonagle(struct socket *sock);
Sowmini Varadhanea3b1ea2016-06-30 16:11:14 -070052void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp);
53void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp);
Andy Grover70041082009-08-21 12:28:31 +000054void rds_tcp_restore_callbacks(struct socket *sock,
55 struct rds_tcp_connection *tc);
56u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
57u32 rds_tcp_snd_una(struct rds_tcp_connection *tc);
58u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq);
59extern struct rds_transport rds_tcp_transport;
Sowmini Varadhan467fa152015-08-05 01:43:26 -040060void rds_tcp_accept_work(struct sock *sk);
Andy Grover70041082009-08-21 12:28:31 +000061
62/* tcp_connect.c */
Sowmini Varadhanb04e8552016-06-30 16:11:16 -070063int rds_tcp_conn_path_connect(struct rds_conn_path *cp);
Sowmini Varadhan226f7a72016-06-30 16:11:10 -070064void rds_tcp_conn_path_shutdown(struct rds_conn_path *conn);
Andy Grover70041082009-08-21 12:28:31 +000065void rds_tcp_state_change(struct sock *sk);
66
67/* tcp_listen.c */
Sowmini Varadhan467fa152015-08-05 01:43:26 -040068struct socket *rds_tcp_listen_init(struct net *);
Sowmini Varadhanb21dd452017-03-04 08:57:35 -080069void rds_tcp_listen_stop(struct socket *sock, struct work_struct *acceptor);
David S. Miller676d2362014-04-11 16:15:36 -040070void rds_tcp_listen_data_ready(struct sock *sk);
Sowmini Varadhan467fa152015-08-05 01:43:26 -040071int rds_tcp_accept_one(struct socket *sock);
72int rds_tcp_keepalive(struct socket *sock);
Sowmini Varadhana93d01f2016-07-14 03:51:01 -070073void *rds_tcp_listen_sock_def_readable(struct net *net);
Andy Grover70041082009-08-21 12:28:31 +000074
75/* tcp_recv.c */
Zach Brownef87b7e2010-07-09 12:26:20 -070076int rds_tcp_recv_init(void);
Andy Grover70041082009-08-21 12:28:31 +000077void rds_tcp_recv_exit(void);
David S. Miller676d2362014-04-11 16:15:36 -040078void rds_tcp_data_ready(struct sock *sk);
Sowmini Varadhan2da43c42016-06-30 16:11:15 -070079int rds_tcp_recv_path(struct rds_conn_path *cp);
Andy Grover70041082009-08-21 12:28:31 +000080void rds_tcp_inc_free(struct rds_incoming *inc);
Al Viroc310e722014-11-20 09:21:14 -050081int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to);
Andy Grover70041082009-08-21 12:28:31 +000082
83/* tcp_send.c */
Sowmini Varadhan226f7a72016-06-30 16:11:10 -070084void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp);
85void rds_tcp_xmit_path_complete(struct rds_conn_path *cp);
Andy Grover70041082009-08-21 12:28:31 +000086int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
Joshua Houghton5c3da572016-06-18 15:46:31 +000087 unsigned int hdr_off, unsigned int sg, unsigned int off);
Andy Grover70041082009-08-21 12:28:31 +000088void rds_tcp_write_space(struct sock *sk);
Andy Grover70041082009-08-21 12:28:31 +000089
90/* tcp_stats.c */
91DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
92#define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member)
93unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
94 unsigned int avail);
95
96#endif