tcp.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. struct rds_connection *conn;
  11. struct socket *t_sock;
  12. void *t_orig_write_space;
  13. void *t_orig_data_ready;
  14. void *t_orig_state_change;
  15. struct rds_tcp_incoming *t_tinc;
  16. size_t t_tinc_hdr_rem;
  17. size_t t_tinc_data_rem;
  18. /* XXX error report? */
  19. struct work_struct t_conn_w;
  20. struct work_struct t_send_w;
  21. struct work_struct t_down_w;
  22. struct work_struct t_recv_w;
  23. /* for info exporting only */
  24. struct list_head t_list_item;
  25. u32 t_last_sent_nxt;
  26. u32 t_last_expected_una;
  27. u32 t_last_seen_una;
  28. };
  29. struct rds_tcp_statistics {
  30. uint64_t s_tcp_data_ready_calls;
  31. uint64_t s_tcp_write_space_calls;
  32. uint64_t s_tcp_sndbuf_full;
  33. uint64_t s_tcp_connect_raced;
  34. uint64_t s_tcp_listen_closed_stale;
  35. };
  36. /* tcp.c */
  37. void rds_tcp_tune(struct socket *sock);
  38. void rds_tcp_nonagle(struct socket *sock);
  39. void rds_tcp_set_callbacks(struct socket *sock, struct rds_connection *conn);
  40. void rds_tcp_restore_callbacks(struct socket *sock,
  41. struct rds_tcp_connection *tc);
  42. u32 rds_tcp_snd_nxt(struct rds_tcp_connection *tc);
  43. u32 rds_tcp_snd_una(struct rds_tcp_connection *tc);
  44. u64 rds_tcp_map_seq(struct rds_tcp_connection *tc, u32 seq);
  45. extern struct rds_transport rds_tcp_transport;
  46. void rds_tcp_accept_work(struct sock *sk);
  47. /* tcp_connect.c */
  48. int rds_tcp_conn_connect(struct rds_connection *conn);
  49. void rds_tcp_conn_shutdown(struct rds_connection *conn);
  50. void rds_tcp_state_change(struct sock *sk);
  51. /* tcp_listen.c */
  52. struct socket *rds_tcp_listen_init(struct net *);
  53. void rds_tcp_listen_stop(struct socket *);
  54. void rds_tcp_listen_data_ready(struct sock *sk);
  55. int rds_tcp_accept_one(struct socket *sock);
  56. int rds_tcp_keepalive(struct socket *sock);
  57. /* tcp_recv.c */
  58. int rds_tcp_recv_init(void);
  59. void rds_tcp_recv_exit(void);
  60. void rds_tcp_data_ready(struct sock *sk);
  61. int rds_tcp_recv(struct rds_connection *conn);
  62. void rds_tcp_inc_free(struct rds_incoming *inc);
  63. int rds_tcp_inc_copy_to_user(struct rds_incoming *inc, struct iov_iter *to);
  64. /* tcp_send.c */
  65. void rds_tcp_xmit_prepare(struct rds_connection *conn);
  66. void rds_tcp_xmit_complete(struct rds_connection *conn);
  67. int rds_tcp_xmit(struct rds_connection *conn, struct rds_message *rm,
  68. unsigned int hdr_off, unsigned int sg, unsigned int off);
  69. void rds_tcp_write_space(struct sock *sk);
  70. /* tcp_stats.c */
  71. DECLARE_PER_CPU(struct rds_tcp_statistics, rds_tcp_stats);
  72. #define rds_tcp_stats_inc(member) rds_stats_inc_which(rds_tcp_stats, member)
  73. unsigned int rds_tcp_stats_info_copy(struct rds_info_iterator *iter,
  74. unsigned int avail);
  75. #endif