ip_vs.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * IP Virtual Server
  3. * Data structure for network namspace
  4. *
  5. */
  6. #ifndef IP_VS_H_
  7. #define IP_VS_H_
  8. #include <linux/list.h>
  9. #include <linux/mutex.h>
  10. #include <linux/list_nulls.h>
  11. #include <linux/ip_vs.h>
  12. #include <asm/atomic.h>
  13. #include <linux/in.h>
  14. struct ip_vs_stats;
  15. struct ip_vs_sync_buff;
  16. struct ctl_table_header;
  17. struct netns_ipvs {
  18. int gen; /* Generation */
  19. /*
  20. * Hash table: for real service lookups
  21. */
  22. #define IP_VS_RTAB_BITS 4
  23. #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
  24. #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
  25. struct list_head rs_table[IP_VS_RTAB_SIZE];
  26. /* ip_vs_app */
  27. struct list_head app_list;
  28. struct mutex app_mutex;
  29. struct lock_class_key app_key; /* mutex debuging */
  30. /* ip_vs_proto */
  31. #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
  32. struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
  33. /* ip_vs_proto_tcp */
  34. #ifdef CONFIG_IP_VS_PROTO_TCP
  35. #define TCP_APP_TAB_BITS 4
  36. #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
  37. #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
  38. struct list_head tcp_apps[TCP_APP_TAB_SIZE];
  39. spinlock_t tcp_app_lock;
  40. #endif
  41. /* ip_vs_proto_udp */
  42. #ifdef CONFIG_IP_VS_PROTO_UDP
  43. #define UDP_APP_TAB_BITS 4
  44. #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
  45. #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
  46. struct list_head udp_apps[UDP_APP_TAB_SIZE];
  47. spinlock_t udp_app_lock;
  48. #endif
  49. /* ip_vs_proto_sctp */
  50. #ifdef CONFIG_IP_VS_PROTO_SCTP
  51. #define SCTP_APP_TAB_BITS 4
  52. #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
  53. #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
  54. /* Hash table for SCTP application incarnations */
  55. struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
  56. spinlock_t sctp_app_lock;
  57. #endif
  58. /* ip_vs_conn */
  59. atomic_t conn_count; /* connection counter */
  60. /* ip_vs_ctl */
  61. struct ip_vs_stats *tot_stats; /* Statistics & est. */
  62. struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
  63. seqcount_t *ustats_seq; /* u64 read retry */
  64. int num_services; /* no of virtual services */
  65. /* 1/rate drop and drop-entry variables */
  66. int drop_rate;
  67. int drop_counter;
  68. atomic_t dropentry;
  69. /* locks in ctl.c */
  70. spinlock_t dropentry_lock; /* drop entry handling */
  71. spinlock_t droppacket_lock; /* drop packet handling */
  72. spinlock_t securetcp_lock; /* state and timeout tables */
  73. rwlock_t rs_lock; /* real services table */
  74. /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */
  75. struct lock_class_key ctl_key; /* ctl_mutex debuging */
  76. /* sys-ctl struct */
  77. struct ctl_table_header *sysctl_hdr;
  78. struct ctl_table *sysctl_tbl;
  79. /* sysctl variables */
  80. int sysctl_amemthresh;
  81. int sysctl_am_droprate;
  82. int sysctl_drop_entry;
  83. int sysctl_drop_packet;
  84. int sysctl_secure_tcp;
  85. #ifdef CONFIG_IP_VS_NFCT
  86. int sysctl_conntrack;
  87. #endif
  88. int sysctl_snat_reroute;
  89. int sysctl_sync_ver;
  90. int sysctl_cache_bypass;
  91. int sysctl_expire_nodest_conn;
  92. int sysctl_expire_quiescent_template;
  93. int sysctl_sync_threshold[2];
  94. int sysctl_nat_icmp_send;
  95. /* ip_vs_lblc */
  96. int sysctl_lblc_expiration;
  97. struct ctl_table_header *lblc_ctl_header;
  98. struct ctl_table *lblc_ctl_table;
  99. /* ip_vs_lblcr */
  100. int sysctl_lblcr_expiration;
  101. struct ctl_table_header *lblcr_ctl_header;
  102. struct ctl_table *lblcr_ctl_table;
  103. /* ip_vs_est */
  104. struct list_head est_list; /* estimator list */
  105. spinlock_t est_lock;
  106. struct timer_list est_timer; /* Estimation timer */
  107. /* ip_vs_sync */
  108. struct list_head sync_queue;
  109. spinlock_t sync_lock;
  110. struct ip_vs_sync_buff *sync_buff;
  111. spinlock_t sync_buff_lock;
  112. struct sockaddr_in sync_mcast_addr;
  113. struct task_struct *master_thread;
  114. struct task_struct *backup_thread;
  115. int send_mesg_maxlen;
  116. int recv_mesg_maxlen;
  117. volatile int sync_state;
  118. volatile int master_syncid;
  119. volatile int backup_syncid;
  120. /* multicast interface name */
  121. char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  122. char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  123. };
  124. #endif /* IP_VS_H_ */