tcp.h 3.1 KB

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