Commit | Line | Data |
---|---|---|
61b1ab45 HS |
1 | /* |
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 | ||
17 | struct ip_vs_stats; | |
18 | struct ip_vs_sync_buff; | |
19 | struct ctl_table_header; | |
20 | ||
21 | struct netns_ipvs { | |
22 | int gen; /* Generation */ | |
fc723250 HS |
23 | /* |
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]; | |
ab8a5e84 HS |
31 | /* ip_vs_app */ |
32 | struct list_head app_list; | |
33 | struct mutex app_mutex; | |
34 | struct lock_class_key app_key; /* mutex debuging */ | |
35 | ||
252c6410 HS |
36 | /* 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]; | |
4a85b96c HS |
39 | /* 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 | |
78b16bde HS |
47 | /* 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 | |
9d934878 HS |
55 | /* 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 | |
a0840e2e HS |
64 | /* ip_vs_conn */ |
65 | atomic_t conn_count; /* connection counter */ | |
66 | ||
b17fc996 HS |
67 | /* ip_vs_ctl */ |
68 | struct ip_vs_stats *tot_stats; /* Statistics & est. */ | |
69 | struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */ | |
70 | seqcount_t *ustats_seq; /* u64 read retry */ | |
d0a1eef9 | 71 | |
a0840e2e HS |
72 | int num_services; /* no of virtual services */ |
73 | /* 1/rate drop and drop-entry variables */ | |
74 | int drop_rate; | |
75 | int drop_counter; | |
76 | atomic_t dropentry; | |
77 | /* locks in ctl.c */ | |
78 | spinlock_t dropentry_lock; /* drop entry handling */ | |
79 | spinlock_t droppacket_lock; /* drop packet handling */ | |
80 | spinlock_t securetcp_lock; /* state and timeout tables */ | |
81 | rwlock_t rs_lock; /* real services table */ | |
82 | /* semaphore for IPVS sockopts. And, [gs]etsockopt may sleep. */ | |
83 | struct lock_class_key ctl_key; /* ctl_mutex debuging */ | |
84 | /* sys-ctl struct */ | |
85 | struct ctl_table_header *sysctl_hdr; | |
86 | struct ctl_table *sysctl_tbl; | |
87 | /* sysctl variables */ | |
88 | int sysctl_amemthresh; | |
89 | int sysctl_am_droprate; | |
90 | int sysctl_drop_entry; | |
91 | int sysctl_drop_packet; | |
92 | int sysctl_secure_tcp; | |
93 | #ifdef CONFIG_IP_VS_NFCT | |
94 | int sysctl_conntrack; | |
95 | #endif | |
96 | int sysctl_snat_reroute; | |
97 | int sysctl_sync_ver; | |
98 | int sysctl_cache_bypass; | |
99 | int sysctl_expire_nodest_conn; | |
100 | int sysctl_expire_quiescent_template; | |
101 | int sysctl_sync_threshold[2]; | |
102 | int sysctl_nat_icmp_send; | |
103 | ||
b6e885dd HS |
104 | /* ip_vs_lblc */ |
105 | int sysctl_lblc_expiration; | |
106 | struct ctl_table_header *lblc_ctl_header; | |
107 | struct ctl_table *lblc_ctl_table; | |
d0a1eef9 HS |
108 | /* ip_vs_lblcr */ |
109 | int sysctl_lblcr_expiration; | |
110 | struct ctl_table_header *lblcr_ctl_header; | |
111 | struct ctl_table *lblcr_ctl_table; | |
29c2026f HS |
112 | /* ip_vs_est */ |
113 | struct list_head est_list; /* estimator list */ | |
114 | spinlock_t est_lock; | |
115 | struct timer_list est_timer; /* Estimation timer */ | |
f131315f HS |
116 | /* ip_vs_sync */ |
117 | struct list_head sync_queue; | |
118 | spinlock_t sync_lock; | |
119 | struct ip_vs_sync_buff *sync_buff; | |
120 | spinlock_t sync_buff_lock; | |
121 | struct sockaddr_in sync_mcast_addr; | |
122 | struct task_struct *master_thread; | |
123 | struct task_struct *backup_thread; | |
124 | int send_mesg_maxlen; | |
125 | int recv_mesg_maxlen; | |
126 | volatile int sync_state; | |
127 | volatile int master_syncid; | |
128 | volatile int backup_syncid; | |
129 | /* multicast interface name */ | |
130 | char master_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | |
131 | char backup_mcast_ifn[IP_VS_IFNAME_MAXLEN]; | |
61b1ab45 HS |
132 | }; |
133 | ||
134 | #endif /* IP_VS_H_ */ |