tcp.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef _RDS_TCP_H
  2. #define _RDS_TCP_H
  3. #define RDS_TCP_PORT 16385
  4. struct rds_tcp_incoming {
  5. struct rds_incoming ti_inc;
  6. struct sk_buff_head ti_skb_list;
  7. };
  8. struct rds_tcp_connection {
  9. struct list_head t_tcp_node;
  10. bool t_tcp_node_detached;
  11. struct rds_conn_path *t_cpath;
  12. /* t_conn_path_lock synchronizes the connection establishment between
  13. * rds_tcp_accept_one and rds_tcp_conn_path_connect
  14. */
  15. struct mutex t_conn_path_lock;
  16. struct socket *t_sock;
  17. void *t_orig_write_space;
  18. void *t_orig_data_ready;
  19. void *t_orig_state_change;
  20. struct rds_tcp_incoming *t_tinc;
  21. size_t t_tinc_hdr_rem;
  22. size_t t_tinc_data_rem;
  23. /* XXX error report? */
  24. struct work_struct t_conn_w;
  25. struct work_struct t_send_w;
  26. struct work_struct t_down_w;
  27. struct work_struct t_recv_w;
  28. /* for info exporting only */
  29. struct list_head t_list_item;
  30. u32 t_last_sent_nxt;
  31. u32 t_last_expected_una;
  32. u32 t_last_seen_una;
  33. };
  34. struct rds_tcp_statistics {
  35. uint64_t s_tcp_data_ready_calls;
  36. uint64_t s_tcp_write_space_calls;
  37. uint64_t s_tcp_sndbuf_full;
  38. uint64_t s_tcp_connect_raced;
  39. uint64_t s_tcp_listen_closed_stale;
  40. };
  41. /* tcp.c */
  42. void rds_tcp_tune(struct socket *sock);
  43. void rds_tcp_nonagle(struct socket *sock);
  44. void rds_tcp_set_callbacks(struct socket *sock, struct rds_conn_path *cp);
  45. void rds_tcp_reset_callbacks(struct socket *sock, struct rds_conn_path *cp);
  46. void rds_tcp_restore_callbacks(struct socket *sock,
  47. struct rds_tcp_connection *tc);
  48. u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
  49. u32 rds_tcp_snd_una(struct rds_tcp_connection *tc);
  50. u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq);
  51. extern struct rds_transport rds_tcp_transport;
  52. void rds_tcp_accept_work(struct sock *sk);
  53. /* tcp_connect.c */
  54. int rds_tcp_conn_path_connect(struct rds_conn_path *cp);
  55. void rds_tcp_conn_path_shutdown(struct rds_conn_path *conn);
  56. void rds_tcp_state_change(struct sock *sk);
  57. /* tcp_listen.c */
  58. struct socket *rds_tcp_listen_init(struct net *);
  59. void rds_tcp_listen_stop(struct socket *sock, struct work_struct *acceptor);
  60. void rds_tcp_listen_data_ready(struct sock *sk);
  61. int rds_tcp_accept_one(struct socket *sock);
  62. int rds_tcp_keepalive(struct socket *sock);
  63. void *rds_tcp_listen_sock_def_readable(struct net *net);
  64. /* tcp_recv.c */
  65. int rds_tcp_recv_init(void);
  66. void rds_tcp_recv_exit(void);
  67. void rds_tcp_data_ready(struct sock *sk);
  68. int rds_tcp_recv_path(struct rds_conn_path *cp);
  69. void rds_tcp_inc_free(struct rds_incoming *inc);
  70. int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to);
  71. /* tcp_send.c */
  72. void rds_tcp_xmit_path_prepare(struct rds_conn_path *cp);
  73. void rds_tcp_xmit_path_complete(struct rds_conn_path *cp);
  74. int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
  75. unsigned int hdr_off, unsigned int sg, unsigned int off);
  76. void rds_tcp_write_space(struct sock *sk);
  77. /* tcp_stats.c */
  78. DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
  79. #define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member)
  80. unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
  81. unsigned int avail);
  82. #endif