Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 1 | #ifndef _RDS_TCP_H |
| 2 | #define _RDS_TCP_H |
| 3 | |
| 4 | #define RDS_TCP_PORT 16385 |
| 5 | |
| 6 | struct rds_tcp_incoming { |
| 7 | struct rds_incoming ti_inc; |
| 8 | struct sk_buff_head ti_skb_list; |
| 9 | }; |
| 10 | |
| 11 | struct rds_tcp_connection { |
| 12 | |
| 13 | struct list_head t_tcp_node; |
| 14 | struct rds_connection *conn; |
Sowmini Varadhan | bd7c5f9 | 2016-05-02 11:24:52 -0700 | [diff] [blame^] | 15 | /* t_conn_lock synchronizes the connection establishment between |
| 16 | * rds_tcp_accept_one and rds_tcp_conn_connect |
| 17 | */ |
| 18 | struct mutex t_conn_lock; |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 19 | 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 | |
| 41 | struct 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 Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 50 | void rds_tcp_tune(struct socket *sock); |
| 51 | void rds_tcp_nonagle(struct socket *sock); |
| 52 | void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn); |
| 53 | void rds_tcp_restore_callbacks(struct socket *sock, |
| 54 | struct rds_tcp_connection *tc); |
| 55 | u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc); |
| 56 | u32 rds_tcp_snd_una(struct rds_tcp_connection *tc); |
| 57 | u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq); |
| 58 | extern struct rds_transport rds_tcp_transport; |
Sowmini Varadhan | 467fa15 | 2015-08-05 01:43:26 -0400 | [diff] [blame] | 59 | void rds_tcp_accept_work(struct sock *sk); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 60 | |
| 61 | /* tcp_connect.c */ |
| 62 | int rds_tcp_conn_connect(struct rds_connection *conn); |
| 63 | void rds_tcp_conn_shutdown(struct rds_connection *conn); |
| 64 | void rds_tcp_state_change(struct sock *sk); |
| 65 | |
| 66 | /* tcp_listen.c */ |
Sowmini Varadhan | 467fa15 | 2015-08-05 01:43:26 -0400 | [diff] [blame] | 67 | struct socket *rds_tcp_listen_init(struct net *); |
| 68 | void rds_tcp_listen_stop(struct socket *); |
David S. Miller | 676d236 | 2014-04-11 16:15:36 -0400 | [diff] [blame] | 69 | void rds_tcp_listen_data_ready(struct sock *sk); |
Sowmini Varadhan | 467fa15 | 2015-08-05 01:43:26 -0400 | [diff] [blame] | 70 | int rds_tcp_accept_one(struct socket *sock); |
| 71 | int rds_tcp_keepalive(struct socket *sock); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 72 | |
| 73 | /* tcp_recv.c */ |
Zach Brown | ef87b7e | 2010-07-09 12:26:20 -0700 | [diff] [blame] | 74 | int rds_tcp_recv_init(void); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 75 | void rds_tcp_recv_exit(void); |
David S. Miller | 676d236 | 2014-04-11 16:15:36 -0400 | [diff] [blame] | 76 | void rds_tcp_data_ready(struct sock *sk); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 77 | int rds_tcp_recv(struct rds_connection *conn); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 78 | void rds_tcp_inc_free(struct rds_incoming *inc); |
Al Viro | c310e72 | 2014-11-20 09:21:14 -0500 | [diff] [blame] | 79 | int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 80 | |
| 81 | /* tcp_send.c */ |
| 82 | void rds_tcp_xmit_prepare(struct rds_connection *conn); |
| 83 | void rds_tcp_xmit_complete(struct rds_connection *conn); |
| 84 | int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm, |
| 85 | unsigned int hdr_off, unsigned int sg, unsigned int off); |
| 86 | void rds_tcp_write_space(struct sock *sk); |
Andy Grover | 7004108 | 2009-08-21 12:28:31 +0000 | [diff] [blame] | 87 | |
| 88 | /* tcp_stats.c */ |
| 89 | DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats); |
| 90 | #define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member) |
| 91 | unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter, |
| 92 | unsigned int avail); |
| 93 | |
| 94 | #endif |