aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorHans Schillstrom <hans.schillstrom@ericsson.com>2011-01-03 08:44:58 -0500
committerSimon Horman <horms@verge.net.au>2011-01-12 20:30:28 -0500
commita0840e2e165a370ca24a59545e564e9881a55891 (patch)
treedeb10e3931be9410aebbb55e5fccbd42a5edd633 /include/net
parent6e67e586e7289c144d5a189d6e0fa7141d025746 (diff)
IPVS: netns, ip_vs_ctl local vars moved to ipvs struct.
Moving global vars to ipvs struct, except for svc table lock. Next patch for ctl will be drop-rate handling. *v3 __ip_vs_mutex remains global ip_vs_conntrack_enabled(struct netns_ipvs *ipvs) Signed-off-by: Hans Schillstrom <hans.schillstrom@ericsson.com> Acked-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ip_vs.h27
-rw-r--r--include/net/netns/ip_vs.h37
2 files changed, 46 insertions, 18 deletions
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index f82c0ffdee74..af9acf44e40a 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -41,7 +41,7 @@ static inline struct netns_ipvs *net_ipvs(struct net* net)
41 * Get net ptr from skb in traffic cases 41 * Get net ptr from skb in traffic cases
42 * use skb_sknet when call is from userland (ioctl or netlink) 42 * use skb_sknet when call is from userland (ioctl or netlink)
43 */ 43 */
44static inline struct net *skb_net(struct sk_buff *skb) 44static inline struct net *skb_net(const struct sk_buff *skb)
45{ 45{
46#ifdef CONFIG_NET_NS 46#ifdef CONFIG_NET_NS
47#ifdef CONFIG_IP_VS_DEBUG 47#ifdef CONFIG_IP_VS_DEBUG
@@ -69,7 +69,7 @@ static inline struct net *skb_net(struct sk_buff *skb)
69#endif 69#endif
70} 70}
71 71
72static inline struct net *skb_sknet(struct sk_buff *skb) 72static inline struct net *skb_sknet(const struct sk_buff *skb)
73{ 73{
74#ifdef CONFIG_NET_NS 74#ifdef CONFIG_NET_NS
75#ifdef CONFIG_IP_VS_DEBUG 75#ifdef CONFIG_IP_VS_DEBUG
@@ -1023,13 +1023,6 @@ extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1023/* 1023/*
1024 * IPVS control data and functions (from ip_vs_ctl.c) 1024 * IPVS control data and functions (from ip_vs_ctl.c)
1025 */ 1025 */
1026extern int sysctl_ip_vs_cache_bypass;
1027extern int sysctl_ip_vs_expire_nodest_conn;
1028extern int sysctl_ip_vs_expire_quiescent_template;
1029extern int sysctl_ip_vs_sync_threshold[2];
1030extern int sysctl_ip_vs_nat_icmp_send;
1031extern int sysctl_ip_vs_conntrack;
1032extern int sysctl_ip_vs_snat_reroute;
1033extern struct ip_vs_stats ip_vs_stats; 1026extern struct ip_vs_stats ip_vs_stats;
1034extern const struct ctl_path net_vs_ctl_path[]; 1027extern const struct ctl_path net_vs_ctl_path[];
1035extern int sysctl_ip_vs_sync_ver; 1028extern int sysctl_ip_vs_sync_ver;
@@ -1119,11 +1112,13 @@ extern int ip_vs_icmp_xmit_v6
1119extern int ip_vs_drop_rate; 1112extern int ip_vs_drop_rate;
1120extern int ip_vs_drop_counter; 1113extern int ip_vs_drop_counter;
1121 1114
1122static __inline__ int ip_vs_todrop(void) 1115static inline int ip_vs_todrop(struct netns_ipvs *ipvs)
1123{ 1116{
1124 if (!ip_vs_drop_rate) return 0; 1117 if (!ipvs->drop_rate)
1125 if (--ip_vs_drop_counter > 0) return 0; 1118 return 0;
1126 ip_vs_drop_counter = ip_vs_drop_rate; 1119 if (--ipvs->drop_counter > 0)
1120 return 0;
1121 ipvs->drop_counter = ipvs->drop_rate;
1127 return 1; 1122 return 1;
1128} 1123}
1129 1124
@@ -1211,9 +1206,9 @@ static inline void ip_vs_notrack(struct sk_buff *skb)
1211 * Netfilter connection tracking 1206 * Netfilter connection tracking
1212 * (from ip_vs_nfct.c) 1207 * (from ip_vs_nfct.c)
1213 */ 1208 */
1214static inline int ip_vs_conntrack_enabled(void) 1209static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1215{ 1210{
1216 return sysctl_ip_vs_conntrack; 1211 return ipvs->sysctl_conntrack;
1217} 1212}
1218 1213
1219extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1214extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
@@ -1226,7 +1221,7 @@ extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1226 1221
1227#else 1222#else
1228 1223
1229static inline int ip_vs_conntrack_enabled(void) 1224static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1230{ 1225{
1231 return 0; 1226 return 0;
1232} 1227}
diff --git a/include/net/netns/ip_vs.h b/include/net/netns/ip_vs.h
index 1acfb334e69b..c4b1abf258e4 100644
--- a/include/net/netns/ip_vs.h
+++ b/include/net/netns/ip_vs.h
@@ -61,13 +61,46 @@ struct netns_ipvs {
61 struct list_head sctp_apps[SCTP_APP_TAB_SIZE]; 61 struct list_head sctp_apps[SCTP_APP_TAB_SIZE];
62 spinlock_t sctp_app_lock; 62 spinlock_t sctp_app_lock;
63#endif 63#endif
64 /* ip_vs_conn */
65 atomic_t conn_count; /* connection counter */
66
64 /* ip_vs_ctl */ 67 /* ip_vs_ctl */
65 struct ip_vs_stats *tot_stats; /* Statistics & est. */ 68 struct ip_vs_stats *tot_stats; /* Statistics & est. */
66 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */ 69 struct ip_vs_cpu_stats __percpu *cpustats; /* Stats per cpu */
67 seqcount_t *ustats_seq; /* u64 read retry */ 70 seqcount_t *ustats_seq; /* u64 read retry */
68 71
69 /* ip_vs_conn */ 72 int num_services; /* no of virtual services */
70 atomic_t conn_count; /* connection counter */ 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
71 /* ip_vs_lblc */ 104 /* ip_vs_lblc */
72 int sysctl_lblc_expiration; 105 int sysctl_lblc_expiration;
73 struct ctl_table_header *lblc_ctl_header; 106 struct ctl_table_header *lblc_ctl_header;