Loading include/net/ip_vs.h +28 −4 Original line number Original line Diff line number Diff line Loading @@ -140,8 +140,24 @@ struct ip_vs_seq { /* /* * IPVS statistics object * IPVS statistics objects */ */ struct ip_vs_estimator { struct list_head list; u64 last_inbytes; u64 last_outbytes; u32 last_conns; u32 last_inpkts; u32 last_outpkts; u32 cps; u32 inpps; u32 outpps; u32 inbps; u32 outbps; }; struct ip_vs_stats struct ip_vs_stats { { __u32 conns; /* connections scheduled */ __u32 conns; /* connections scheduled */ Loading @@ -156,7 +172,15 @@ struct ip_vs_stats __u32 inbps; /* current in byte rate */ __u32 inbps; /* current in byte rate */ __u32 outbps; /* current out byte rate */ __u32 outbps; /* current out byte rate */ /* * Don't add anything before the lock, because we use memcpy() to copy * the members before the lock to struct ip_vs_stats_user in * ip_vs_ctl.c. */ spinlock_t lock; /* spin lock */ spinlock_t lock; /* spin lock */ struct ip_vs_estimator est; /* estimator */ }; }; struct dst_entry; struct dst_entry; Loading Loading @@ -440,7 +464,7 @@ struct ip_vs_app */ */ extern const char *ip_vs_proto_name(unsigned proto); extern const char *ip_vs_proto_name(unsigned proto); extern void ip_vs_init_hash_table(struct list_head *table, int rows); extern void ip_vs_init_hash_table(struct list_head *table, int rows); #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) #define IP_VS_APP_TYPE_FTP 1 #define IP_VS_APP_TYPE_FTP 1 Loading Loading @@ -620,7 +644,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; extern int sysctl_ip_vs_sync_threshold[2]; extern int sysctl_ip_vs_sync_threshold[2]; extern int sysctl_ip_vs_nat_icmp_send; extern int sysctl_ip_vs_nat_icmp_send; extern struct ip_vs_stats ip_vs_stats; extern struct ip_vs_stats ip_vs_stats; extern struct ctl_path net_vs_ctl_path[]; extern const struct ctl_path net_vs_ctl_path[]; extern struct ip_vs_service * extern struct ip_vs_service * ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); Loading Loading @@ -659,7 +683,7 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp); /* /* * IPVS rate estimator prototypes (from ip_vs_est.c) * IPVS rate estimator prototypes (from ip_vs_est.c) */ */ extern int ip_vs_new_estimator(struct ip_vs_stats *stats); extern void ip_vs_new_estimator(struct ip_vs_stats *stats); extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); Loading net/ipv4/ipvs/ip_vs_app.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -608,7 +608,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, } } int ip_vs_app_init(void) int __init ip_vs_app_init(void) { { /* we will replace it with proc_net_ipvs_create() soon */ /* we will replace it with proc_net_ipvs_create() soon */ proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); Loading net/ipv4/ipvs/ip_vs_conn.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -965,7 +965,7 @@ static void ip_vs_conn_flush(void) } } int ip_vs_conn_init(void) int __init ip_vs_conn_init(void) { { int idx; int idx; Loading net/ipv4/ipvs/ip_vs_ctl.c +20 −7 Original line number Original line Diff line number Diff line Loading @@ -683,9 +683,22 @@ static void ip_vs_zero_stats(struct ip_vs_stats *stats) ip_vs_zero_stats(struct ip_vs_stats *stats) { { spin_lock_bh(&stats->lock); spin_lock_bh(&stats->lock); memset(stats, 0, (char *)&stats->lock - (char *)stats); spin_unlock_bh(&stats->lock); stats->conns = 0; stats->inpkts = 0; stats->outpkts = 0; stats->inbytes = 0; stats->outbytes = 0; stats->cps = 0; stats->inpps = 0; stats->outpps = 0; stats->inbps = 0; stats->outbps = 0; ip_vs_zero_estimator(stats); ip_vs_zero_estimator(stats); spin_unlock_bh(&stats->lock); } } /* /* Loading Loading @@ -1589,7 +1602,7 @@ static struct ctl_table vs_vars[] = { { .ctl_name = 0 } { .ctl_name = 0 } }; }; struct ctl_path net_vs_ctl_path[] = { const struct ctl_path net_vs_ctl_path[] = { { .procname = "net", .ctl_name = CTL_NET, }, { .procname = "net", .ctl_name = CTL_NET, }, { .procname = "ipv4", .ctl_name = NET_IPV4, }, { .procname = "ipv4", .ctl_name = NET_IPV4, }, { .procname = "vs", }, { .procname = "vs", }, Loading Loading @@ -1784,7 +1797,9 @@ static const struct file_operations ip_vs_info_fops = { #endif #endif struct ip_vs_stats ip_vs_stats; struct ip_vs_stats ip_vs_stats = { .lock = __SPIN_LOCK_UNLOCKED(ip_vs_stats.lock), }; #ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS static int ip_vs_stats_show(struct seq_file *seq, void *v) static int ip_vs_stats_show(struct seq_file *seq, void *v) Loading Loading @@ -2306,7 +2321,7 @@ static struct nf_sockopt_ops ip_vs_sockopts = { }; }; int ip_vs_control_init(void) int __init ip_vs_control_init(void) { { int ret; int ret; int idx; int idx; Loading @@ -2333,8 +2348,6 @@ int ip_vs_control_init(void) INIT_LIST_HEAD(&ip_vs_rtable[idx]); INIT_LIST_HEAD(&ip_vs_rtable[idx]); } } memset(&ip_vs_stats, 0, sizeof(ip_vs_stats)); spin_lock_init(&ip_vs_stats.lock); ip_vs_new_estimator(&ip_vs_stats); ip_vs_new_estimator(&ip_vs_stats); /* Hook the defense timer */ /* Hook the defense timer */ Loading net/ipv4/ipvs/ip_vs_dh.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -233,6 +233,7 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = .name = "dh", .name = "dh", .refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0), .module = THIS_MODULE, .module = THIS_MODULE, .n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list), .init_service = ip_vs_dh_init_svc, .init_service = ip_vs_dh_init_svc, .done_service = ip_vs_dh_done_svc, .done_service = ip_vs_dh_done_svc, .update_service = ip_vs_dh_update_svc, .update_service = ip_vs_dh_update_svc, Loading @@ -242,7 +243,6 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = static int __init ip_vs_dh_init(void) static int __init ip_vs_dh_init(void) { { INIT_LIST_HEAD(&ip_vs_dh_scheduler.n_list); return register_ip_vs_scheduler(&ip_vs_dh_scheduler); return register_ip_vs_scheduler(&ip_vs_dh_scheduler); } } Loading Loading
include/net/ip_vs.h +28 −4 Original line number Original line Diff line number Diff line Loading @@ -140,8 +140,24 @@ struct ip_vs_seq { /* /* * IPVS statistics object * IPVS statistics objects */ */ struct ip_vs_estimator { struct list_head list; u64 last_inbytes; u64 last_outbytes; u32 last_conns; u32 last_inpkts; u32 last_outpkts; u32 cps; u32 inpps; u32 outpps; u32 inbps; u32 outbps; }; struct ip_vs_stats struct ip_vs_stats { { __u32 conns; /* connections scheduled */ __u32 conns; /* connections scheduled */ Loading @@ -156,7 +172,15 @@ struct ip_vs_stats __u32 inbps; /* current in byte rate */ __u32 inbps; /* current in byte rate */ __u32 outbps; /* current out byte rate */ __u32 outbps; /* current out byte rate */ /* * Don't add anything before the lock, because we use memcpy() to copy * the members before the lock to struct ip_vs_stats_user in * ip_vs_ctl.c. */ spinlock_t lock; /* spin lock */ spinlock_t lock; /* spin lock */ struct ip_vs_estimator est; /* estimator */ }; }; struct dst_entry; struct dst_entry; Loading Loading @@ -440,7 +464,7 @@ struct ip_vs_app */ */ extern const char *ip_vs_proto_name(unsigned proto); extern const char *ip_vs_proto_name(unsigned proto); extern void ip_vs_init_hash_table(struct list_head *table, int rows); extern void ip_vs_init_hash_table(struct list_head *table, int rows); #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) #define IP_VS_APP_TYPE_FTP 1 #define IP_VS_APP_TYPE_FTP 1 Loading Loading @@ -620,7 +644,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; extern int sysctl_ip_vs_sync_threshold[2]; extern int sysctl_ip_vs_sync_threshold[2]; extern int sysctl_ip_vs_nat_icmp_send; extern int sysctl_ip_vs_nat_icmp_send; extern struct ip_vs_stats ip_vs_stats; extern struct ip_vs_stats ip_vs_stats; extern struct ctl_path net_vs_ctl_path[]; extern const struct ctl_path net_vs_ctl_path[]; extern struct ip_vs_service * extern struct ip_vs_service * ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); Loading Loading @@ -659,7 +683,7 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp); /* /* * IPVS rate estimator prototypes (from ip_vs_est.c) * IPVS rate estimator prototypes (from ip_vs_est.c) */ */ extern int ip_vs_new_estimator(struct ip_vs_stats *stats); extern void ip_vs_new_estimator(struct ip_vs_stats *stats); extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); Loading
net/ipv4/ipvs/ip_vs_app.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -608,7 +608,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, } } int ip_vs_app_init(void) int __init ip_vs_app_init(void) { { /* we will replace it with proc_net_ipvs_create() soon */ /* we will replace it with proc_net_ipvs_create() soon */ proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); Loading
net/ipv4/ipvs/ip_vs_conn.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -965,7 +965,7 @@ static void ip_vs_conn_flush(void) } } int ip_vs_conn_init(void) int __init ip_vs_conn_init(void) { { int idx; int idx; Loading
net/ipv4/ipvs/ip_vs_ctl.c +20 −7 Original line number Original line Diff line number Diff line Loading @@ -683,9 +683,22 @@ static void ip_vs_zero_stats(struct ip_vs_stats *stats) ip_vs_zero_stats(struct ip_vs_stats *stats) { { spin_lock_bh(&stats->lock); spin_lock_bh(&stats->lock); memset(stats, 0, (char *)&stats->lock - (char *)stats); spin_unlock_bh(&stats->lock); stats->conns = 0; stats->inpkts = 0; stats->outpkts = 0; stats->inbytes = 0; stats->outbytes = 0; stats->cps = 0; stats->inpps = 0; stats->outpps = 0; stats->inbps = 0; stats->outbps = 0; ip_vs_zero_estimator(stats); ip_vs_zero_estimator(stats); spin_unlock_bh(&stats->lock); } } /* /* Loading Loading @@ -1589,7 +1602,7 @@ static struct ctl_table vs_vars[] = { { .ctl_name = 0 } { .ctl_name = 0 } }; }; struct ctl_path net_vs_ctl_path[] = { const struct ctl_path net_vs_ctl_path[] = { { .procname = "net", .ctl_name = CTL_NET, }, { .procname = "net", .ctl_name = CTL_NET, }, { .procname = "ipv4", .ctl_name = NET_IPV4, }, { .procname = "ipv4", .ctl_name = NET_IPV4, }, { .procname = "vs", }, { .procname = "vs", }, Loading Loading @@ -1784,7 +1797,9 @@ static const struct file_operations ip_vs_info_fops = { #endif #endif struct ip_vs_stats ip_vs_stats; struct ip_vs_stats ip_vs_stats = { .lock = __SPIN_LOCK_UNLOCKED(ip_vs_stats.lock), }; #ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS static int ip_vs_stats_show(struct seq_file *seq, void *v) static int ip_vs_stats_show(struct seq_file *seq, void *v) Loading Loading @@ -2306,7 +2321,7 @@ static struct nf_sockopt_ops ip_vs_sockopts = { }; }; int ip_vs_control_init(void) int __init ip_vs_control_init(void) { { int ret; int ret; int idx; int idx; Loading @@ -2333,8 +2348,6 @@ int ip_vs_control_init(void) INIT_LIST_HEAD(&ip_vs_rtable[idx]); INIT_LIST_HEAD(&ip_vs_rtable[idx]); } } memset(&ip_vs_stats, 0, sizeof(ip_vs_stats)); spin_lock_init(&ip_vs_stats.lock); ip_vs_new_estimator(&ip_vs_stats); ip_vs_new_estimator(&ip_vs_stats); /* Hook the defense timer */ /* Hook the defense timer */ Loading
net/ipv4/ipvs/ip_vs_dh.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -233,6 +233,7 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = .name = "dh", .name = "dh", .refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0), .module = THIS_MODULE, .module = THIS_MODULE, .n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list), .init_service = ip_vs_dh_init_svc, .init_service = ip_vs_dh_init_svc, .done_service = ip_vs_dh_done_svc, .done_service = ip_vs_dh_done_svc, .update_service = ip_vs_dh_update_svc, .update_service = ip_vs_dh_update_svc, Loading @@ -242,7 +243,6 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = static int __init ip_vs_dh_init(void) static int __init ip_vs_dh_init(void) { { INIT_LIST_HEAD(&ip_vs_dh_scheduler.n_list); return register_ip_vs_scheduler(&ip_vs_dh_scheduler); return register_ip_vs_scheduler(&ip_vs_dh_scheduler); } } Loading