blob: bd1dad872178a1eb482306ca1ec41141b900f523 [file] [log] [blame]
Hans Schillstrom61b1ab42011-01-03 14:44:42 +01001/*
2 * IP Virtual Server
3 * Data structure for network namspace
4 *
5 */
6
7#ifndef IP_VS_H_
8#define IP_VS_H_
9
10#include <linux/list.h>
11#include <linux/mutex.h>
12#include <linux/list_nulls.h>
13#include <linux/ip_vs.h>
14#include <asm/atomic.h>
15#include <linux/in.h>
16
17struct ip_vs_stats;
18struct ip_vs_sync_buff;
19struct ctl_table_header;
20
21struct netns_ipvs {
22 int gen; /* Generation */
Hans Schillstromfc723252011-01-03 14:44:43 +010023 /*
24 * Hash table: for real service lookups
25 */
26 #define IP_VS_RTAB_BITS 4
27 #define IP_VS_RTAB_SIZE (1 << IP_VS_RTAB_BITS)
28 #define IP_VS_RTAB_MASK (IP_VS_RTAB_SIZE - 1)
29
30 struct list_head rs_table[IP_VS_RTAB_SIZE];
Hans Schillstromab8a5e82011-01-03 14:44:53 +010031 /* ip_vs_app */
32 struct list_head app_list;
33 struct mutex app_mutex;
34 struct lock_class_key app_key; /* mutex debuging */
35
Hans Schillstrom252c6412011-01-03 14:44:46 +010036 /* ip_vs_proto */
37 #define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
38 struct ip_vs_proto_data *proto_data_table[IP_VS_PROTO_TAB_SIZE];
Hans Schillstrom4a85b962011-01-03 14:44:47 +010039 /* ip_vs_proto_tcp */
40#ifdef CONFIG_IP_VS_PROTO_TCP
41 #define TCP_APP_TAB_BITS 4
42 #define TCP_APP_TAB_SIZE (1 << TCP_APP_TAB_BITS)
43 #define TCP_APP_TAB_MASK (TCP_APP_TAB_SIZE - 1)
44 struct list_head tcp_apps[TCP_APP_TAB_SIZE];
45 spinlock_t tcp_app_lock;
46#endif
Hans Schillstrom78b16bd2011-01-03 14:44:48 +010047 /* ip_vs_proto_udp */
48#ifdef CONFIG_IP_VS_PROTO_UDP
49 #define UDP_APP_TAB_BITS 4
50 #define UDP_APP_TAB_SIZE (1 << UDP_APP_TAB_BITS)
51 #define UDP_APP_TAB_MASK (UDP_APP_TAB_SIZE - 1)
52 struct list_head udp_apps[UDP_APP_TAB_SIZE];
53 spinlock_t udp_app_lock;
54#endif
Hans Schillstrom9d934872011-01-03 14:44:49 +010055 /* ip_vs_proto_sctp */
56#ifdef CONFIG_IP_VS_PROTO_SCTP
57 #define SCTP_APP_TAB_BITS 4
58 #define SCTP_APP_TAB_SIZE (1 << SCTP_APP_TAB_BITS)
59 #define SCTP_APP_TAB_MASK (SCTP_APP_TAB_SIZE - 1)
60 /* Hash table for SCTP application incarnations */
61 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
62 spinlock_t sctp_app_lock;
63#endif
Hans Schillstromb17fc992011-01-03 14:44:56 +010064 /* ip_vs_ctl */
65 struct ip_vs_stats *tot_stats; /* Statistics & est. */
66 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
67 seqcount_t *ustats_seq; /* u64 read retry */
Hans Schillstromd0a1eef2011-01-03 14:44:44 +010068
Hans Schillstromb6e885d2011-01-03 14:44:45 +010069 /* ip_vs_lblc */
70 int sysctl_lblc_expiration;
71 struct ctl_table_header *lblc_ctl_header;
72 struct ctl_table *lblc_ctl_table;
Hans Schillstromd0a1eef2011-01-03 14:44:44 +010073 /* ip_vs_lblcr */
74 int sysctl_lblcr_expiration;
75 struct ctl_table_header *lblcr_ctl_header;
76 struct ctl_table *lblcr_ctl_table;
Hans Schillstrom29c20262011-01-03 14:44:54 +010077 /* ip_vs_est */
78 struct list_head est_list; /* estimator list */
79 spinlock_t est_lock;
80 struct timer_list est_timer; /* Estimation timer */
Hans Schillstromf1313152011-01-03 14:44:55 +010081 /* ip_vs_sync */
82 struct list_head sync_queue;
83 spinlock_t sync_lock;
84 struct ip_vs_sync_buff *sync_buff;
85 spinlock_t sync_buff_lock;
86 struct sockaddr_in sync_mcast_addr;
87 struct task_struct *master_thread;
88 struct task_struct *backup_thread;
89 int send_mesg_maxlen;
90 int recv_mesg_maxlen;
91 volatile int sync_state;
92 volatile int master_syncid;
93 volatile int backup_syncid;
94 /* multicast interface name */
95 char master_mcast_ifn[IP_VS_IFNAME_MAXLEN];
96 char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN];
Hans Schillstrom61b1ab42011-01-03 14:44:42 +010097};
98
99#endif /* IP_VS_H_ */