ip_vs.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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_ctl */
  59. struct ip_vs_stats *tot_stats; /* Statistics & est. */
  60. struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
  61. seqcount_t *ustats_seq; /* u64 read retry */
  62. /* ip_vs_lblc */
  63. int sysctl_lblc_expiration;
  64. struct ctl_table_header *lblc_ctl_header;
  65. struct ctl_table *lblc_ctl_table;
  66. /* ip_vs_lblcr */
  67. int sysctl_lblcr_expiration;
  68. struct ctl_table_header *lblcr_ctl_header;
  69. struct ctl_table *lblcr_ctl_table;
  70. /* ip_vs_est */
  71. struct list_head est_list; /* estimator list */
  72. spinlock_t est_lock;
  73. struct timer_list est_timer; /* Estimation timer */
  74. /* ip_vs_sync */
  75. struct list_head sync_queue;
  76. spinlock_t sync_lock;
  77. struct ip_vs_sync_buff *sync_buff;
  78. spinlock_t sync_buff_lock;
  79. struct sockaddr_in sync_mcast_addr;
  80. struct task_struct *master_thread;
  81. struct task_struct *backup_thread;
  82. int send_mesg_maxlen;
  83. int recv_mesg_maxlen;
  84. volatile int sync_state;
  85. volatile int master_syncid;
  86. volatile int backup_syncid;
  87. /* multicast interface name */
  88. char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  89. char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  90. };
  91. #endif /* IP_VS_H_ */