ip_vs.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_lblc */
  59. int sysctl_lblc_expiration;
  60. struct ctl_table_header *lblc_ctl_header;
  61. struct ctl_table *lblc_ctl_table;
  62. /* ip_vs_lblcr */
  63. int sysctl_lblcr_expiration;
  64. struct ctl_table_header *lblcr_ctl_header;
  65. struct ctl_table *lblcr_ctl_table;
  66. /* ip_vs_est */
  67. struct list_head est_list; /* estimator list */
  68. spinlock_t est_lock;
  69. struct timer_list est_timer; /* Estimation timer */
  70. /* ip_vs_sync */
  71. struct list_head sync_queue;
  72. spinlock_t sync_lock;
  73. struct ip_vs_sync_buff *sync_buff;
  74. spinlock_t sync_buff_lock;
  75. struct sockaddr_in sync_mcast_addr;
  76. struct task_struct *master_thread;
  77. struct task_struct *backup_thread;
  78. int send_mesg_maxlen;
  79. int recv_mesg_maxlen;
  80. volatile int sync_state;
  81. volatile int master_syncid;
  82. volatile int backup_syncid;
  83. /* multicast interface name */
  84. char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  85. char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
  86. };
  87. #endif /* IP_VS_H_ */