netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next 0/4] IPVS
@ 2010-08-26 12:54 Simon Horman
  2010-08-26 12:54 ` [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation Simon Horman
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Simon Horman @ 2010-08-26 12:54 UTC (permalink / raw)
  To: lvs-devel, netdev, netfilter-devel
  Cc: Wensong Zhang, Julian Anastasov, Patrick McHardy, David S. Miller

Hi Dave,

as mentioned earlier today I have a handful of IPVS patches queued up.
Please consider them for net-next.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation
  2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
@ 2010-08-26 12:54 ` Simon Horman
  2010-08-26 19:36   ` Julian Anastasov
  2010-08-26 12:54 ` [patch net-next 2/4] [patch nf-next] IPVS: convert __ip_vs_sched_lock to a spinlock Simon Horman
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: Simon Horman @ 2010-08-26 12:54 UTC (permalink / raw)
  To: lvs-devel, netdev, netfilter-devel
  Cc: Wensong Zhang, Julian Anastasov, Patrick McHardy, David S. Miller,
	Xiaoyu Du

[-- Attachment #1: ipvs-icmpv6-checksum-calulation.patch --]
[-- Type: text/plain, Size: 969 bytes --]

Cc: Xiaoyu Du <tingsrain@gmail.com>
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>

Index: nf-next-2.6/net/netfilter/ipvs/ip_vs_core.c
===================================================================
--- nf-next-2.6.orig/net/netfilter/ipvs/ip_vs_core.c	2010-08-25 16:57:37.000000000 +0900
+++ nf-next-2.6/net/netfilter/ipvs/ip_vs_core.c	2010-08-25 17:02:35.000000000 +0900
@@ -637,9 +637,11 @@ void ip_vs_nat_icmp_v6(struct sk_buff *s
 	}
 
 	/* And finally the ICMP checksum */
-	icmph->icmp6_cksum = 0;
-	/* TODO IPv6: is this correct for ICMPv6? */
-	ip_vs_checksum_complete(skb, icmp_offset);
+	icmph->icmp6_cksum = ~csum_ipv6_magic(&iph->saddr, &iph->daddr,
+					      skb->len - icmp_offset,
+					      IPPROTO_ICMPV6, 0);
+	skb->csum_start = skb_network_header(skb) - skb->head + icmp_offset;
+	skb->csum_offset = offsetof(struct icmp6hdr, icmp6_cksum);
 	skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 	if (inout)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch net-next 2/4] [patch nf-next] IPVS: convert __ip_vs_sched_lock to a spinlock
  2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
  2010-08-26 12:54 ` [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation Simon Horman
@ 2010-08-26 12:54 ` Simon Horman
  2010-08-26 12:54 ` [patch net-next 3/4] [patch nf-next] IPVS: convert __ip_vs_securetcp_lock " Simon Horman
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2010-08-26 12:54 UTC (permalink / raw)
  To: lvs-devel, netdev, netfilter-devel
  Cc: Wensong Zhang, Julian Anastasov, Patrick McHardy, David S. Miller,
	Stephen Hemminger, Eric Dumazet

[-- Attachment #1: __ip_vs_sched_lock.patch --]
[-- Type: text/plain, Size: 3133 bytes --]

Also rename __ip_vs_sched_lock to ip_vs_sched_lock.

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

--- 

Compile tested only

Index: nf-next-2.6/net/netfilter/ipvs/ip_vs_sched.c
===================================================================
--- nf-next-2.6.orig/net/netfilter/ipvs/ip_vs_sched.c	2010-08-20 23:43:29.000000000 +0900
+++ nf-next-2.6/net/netfilter/ipvs/ip_vs_sched.c	2010-08-20 23:46:02.000000000 +0900
@@ -35,7 +35,7 @@
 static LIST_HEAD(ip_vs_schedulers);
 
 /* lock for service table */
-static DEFINE_RWLOCK(__ip_vs_sched_lock);
+static DEFINE_SPINLOCK(ip_vs_sched_lock);
 
 
 /*
@@ -108,7 +108,7 @@ static struct ip_vs_scheduler *ip_vs_sch
 
 	IP_VS_DBG(2, "%s(): sched_name \"%s\"\n", __func__, sched_name);
 
-	read_lock_bh(&__ip_vs_sched_lock);
+	spin_lock_bh(&ip_vs_sched_lock);
 
 	list_for_each_entry(sched, &ip_vs_schedulers, n_list) {
 		/*
@@ -122,14 +122,14 @@ static struct ip_vs_scheduler *ip_vs_sch
 		}
 		if (strcmp(sched_name, sched->name)==0) {
 			/* HIT */
-			read_unlock_bh(&__ip_vs_sched_lock);
+			spin_unlock_bh(&ip_vs_sched_lock);
 			return sched;
 		}
 		if (sched->module)
 			module_put(sched->module);
 	}
 
-	read_unlock_bh(&__ip_vs_sched_lock);
+	spin_unlock_bh(&ip_vs_sched_lock);
 	return NULL;
 }
 
@@ -184,10 +184,10 @@ int register_ip_vs_scheduler(struct ip_v
 	/* increase the module use count */
 	ip_vs_use_count_inc();
 
-	write_lock_bh(&__ip_vs_sched_lock);
+	spin_lock_bh(&ip_vs_sched_lock);
 
 	if (!list_empty(&scheduler->n_list)) {
-		write_unlock_bh(&__ip_vs_sched_lock);
+		spin_unlock_bh(&ip_vs_sched_lock);
 		ip_vs_use_count_dec();
 		pr_err("%s(): [%s] scheduler already linked\n",
 		       __func__, scheduler->name);
@@ -200,7 +200,7 @@ int register_ip_vs_scheduler(struct ip_v
 	 */
 	list_for_each_entry(sched, &ip_vs_schedulers, n_list) {
 		if (strcmp(scheduler->name, sched->name) == 0) {
-			write_unlock_bh(&__ip_vs_sched_lock);
+			spin_unlock_bh(&ip_vs_sched_lock);
 			ip_vs_use_count_dec();
 			pr_err("%s(): [%s] scheduler already existed "
 			       "in the system\n", __func__, scheduler->name);
@@ -211,7 +211,7 @@ int register_ip_vs_scheduler(struct ip_v
 	 *	Add it into the d-linked scheduler list
 	 */
 	list_add(&scheduler->n_list, &ip_vs_schedulers);
-	write_unlock_bh(&__ip_vs_sched_lock);
+	spin_unlock_bh(&ip_vs_sched_lock);
 
 	pr_info("[%s] scheduler registered.\n", scheduler->name);
 
@@ -229,9 +229,9 @@ int unregister_ip_vs_scheduler(struct ip
 		return -EINVAL;
 	}
 
-	write_lock_bh(&__ip_vs_sched_lock);
+	spin_lock_bh(&ip_vs_sched_lock);
 	if (list_empty(&scheduler->n_list)) {
-		write_unlock_bh(&__ip_vs_sched_lock);
+		spin_unlock_bh(&ip_vs_sched_lock);
 		pr_err("%s(): [%s] scheduler is not in the list. failed\n",
 		       __func__, scheduler->name);
 		return -EINVAL;
@@ -241,7 +241,7 @@ int unregister_ip_vs_scheduler(struct ip
 	 *	Remove it from the d-linked scheduler list
 	 */
 	list_del(&scheduler->n_list);
-	write_unlock_bh(&__ip_vs_sched_lock);
+	spin_unlock_bh(&ip_vs_sched_lock);
 
 	/* decrease the module use count */
 	ip_vs_use_count_dec();


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch net-next 3/4] [patch nf-next] IPVS: convert __ip_vs_securetcp_lock to a spinlock
  2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
  2010-08-26 12:54 ` [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation Simon Horman
  2010-08-26 12:54 ` [patch net-next 2/4] [patch nf-next] IPVS: convert __ip_vs_sched_lock to a spinlock Simon Horman
@ 2010-08-26 12:54 ` Simon Horman
  2010-08-26 12:54 ` [patch net-next 4/4] [PATCH net-next-2.6] ipvs: switch to GFP_KERNEL allocations Simon Horman
  2010-08-26 20:22 ` [patch net-next 0/4] IPVS David Miller
  4 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2010-08-26 12:54 UTC (permalink / raw)
  To: lvs-devel, netdev, netfilter-devel
  Cc: Wensong Zhang, Julian Anastasov, Patrick McHardy, David S. Miller,
	Stephen Hemminger, Eric Dumazet

[-- Attachment #1: __ip_vs_securetcp_lock.patch --]
[-- Type: text/plain, Size: 1412 bytes --]

Also rename __ip_vs_securetcp_lock to ip_vs_securetcp_lock.

Spinlock conversion was suggested by Eric Dumazet.

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

--- 

Compile tested only

Index: nf-next-2.6/net/netfilter/ipvs/ip_vs_ctl.c
===================================================================
--- nf-next-2.6.orig/net/netfilter/ipvs/ip_vs_ctl.c	2010-08-20 22:41:52.000000000 +0900
+++ nf-next-2.6/net/netfilter/ipvs/ip_vs_ctl.c	2010-08-20 23:29:49.000000000 +0900
@@ -61,7 +61,7 @@ static DEFINE_RWLOCK(__ip_vs_svc_lock);
 static DEFINE_RWLOCK(__ip_vs_rs_lock);
 
 /* lock for state and timeout tables */
-static DEFINE_RWLOCK(__ip_vs_securetcp_lock);
+static DEFINE_SPINLOCK(ip_vs_securetcp_lock);
 
 /* lock for drop entry handling */
 static DEFINE_SPINLOCK(__ip_vs_dropentry_lock);
@@ -204,7 +204,7 @@ static void update_defense_level(void)
 	spin_unlock(&__ip_vs_droppacket_lock);
 
 	/* secure_tcp */
-	write_lock(&__ip_vs_securetcp_lock);
+	spin_lock(&ip_vs_securetcp_lock);
 	switch (sysctl_ip_vs_secure_tcp) {
 	case 0:
 		if (old_secure_tcp >= 2)
@@ -238,7 +238,7 @@ static void update_defense_level(void)
 	old_secure_tcp = sysctl_ip_vs_secure_tcp;
 	if (to_change >= 0)
 		ip_vs_protocol_timeout_change(sysctl_ip_vs_secure_tcp>1);
-	write_unlock(&__ip_vs_securetcp_lock);
+	spin_unlock(&ip_vs_securetcp_lock);
 
 	local_bh_enable();
 }


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [patch net-next 4/4] [PATCH net-next-2.6] ipvs: switch to GFP_KERNEL allocations
  2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
                   ` (2 preceding siblings ...)
  2010-08-26 12:54 ` [patch net-next 3/4] [patch nf-next] IPVS: convert __ip_vs_securetcp_lock " Simon Horman
@ 2010-08-26 12:54 ` Simon Horman
  2010-08-26 20:22 ` [patch net-next 0/4] IPVS David Miller
  4 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2010-08-26 12:54 UTC (permalink / raw)
  To: lvs-devel, netdev, netfilter-devel
  Cc: Wensong Zhang, Julian Anastasov, Patrick McHardy, David S. Miller,
	Eric Dumazet

[-- Attachment #1: ipvs-switch-to-GFP_KERNEL-allocations.patch --]
[-- Type: text/plain, Size: 1161 bytes --]

Switch from GFP_ATOMIC allocations to GFP_KERNEL ones in
ip_vs_add_service() and ip_vs_new_dest(), as we hold a mutex and are
allowed to sleep in this context.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

---
 net/netfilter/ipvs/ip_vs_ctl.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index 0f0c079..896f34b 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -843,7 +843,7 @@ ip_vs_new_dest(struct ip_vs_service *svc, struct ip_vs_dest_user_kern *udest,
 			return -EINVAL;
 	}
 
-	dest = kzalloc(sizeof(struct ip_vs_dest), GFP_ATOMIC);
+	dest = kzalloc(sizeof(struct ip_vs_dest), GFP_KERNEL);
 	if (dest == NULL) {
 		pr_err("%s(): no memory.\n", __func__);
 		return -ENOMEM;
@@ -1177,7 +1177,7 @@ ip_vs_add_service(struct ip_vs_service_user_kern *u,
 	}
 #endif
 
-	svc = kzalloc(sizeof(struct ip_vs_service), GFP_ATOMIC);
+	svc = kzalloc(sizeof(struct ip_vs_service), GFP_KERNEL);
 	if (svc == NULL) {
 		IP_VS_DBG(1, "%s(): no memory\n", __func__);
 		ret = -ENOMEM;



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation
  2010-08-26 12:54 ` [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation Simon Horman
@ 2010-08-26 19:36   ` Julian Anastasov
  2010-08-26 20:18     ` David Miller
  0 siblings, 1 reply; 9+ messages in thread
From: Julian Anastasov @ 2010-08-26 19:36 UTC (permalink / raw)
  To: Simon Horman
  Cc: lvs-devel, netdev, netfilter-devel, Wensong Zhang,
	Patrick McHardy, David S. Miller, Xiaoyu Du


	Hello,

On Thu, 26 Aug 2010, Simon Horman wrote:

> Cc: Xiaoyu Du <tingsrain@gmail.com>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> Signed-off-by: Simon Horman <horms@verge.net.au>
> 
> Index: nf-next-2.6/net/netfilter/ipvs/ip_vs_core.c
> ===================================================================
> --- nf-next-2.6.orig/net/netfilter/ipvs/ip_vs_core.c	2010-08-25 16:57:37.000000000 +0900
> +++ nf-next-2.6/net/netfilter/ipvs/ip_vs_core.c	2010-08-25 17:02:35.000000000 +0900
> @@ -637,9 +637,11 @@ void ip_vs_nat_icmp_v6(struct sk_buff *s
>  	}
>  
>  	/* And finally the ICMP checksum */
> -	icmph->icmp6_cksum = 0;
> -	/* TODO IPv6: is this correct for ICMPv6? */
> -	ip_vs_checksum_complete(skb, icmp_offset);
> +	icmph->icmp6_cksum = ~csum_ipv6_magic(&iph->saddr, &iph->daddr,
> +					      skb->len - icmp_offset,
> +					      IPPROTO_ICMPV6, 0);
> +	skb->csum_start = skb_network_header(skb) - skb->head + icmp_offset;
> +	skb->csum_offset = offsetof(struct icmp6hdr, icmp6_cksum);
>  	skb->ip_summed = CHECKSUM_UNNECESSARY;

	Ops, this should be CHECKSUM_PARTIAL

>  	if (inout)

Regards

--
Julian Anastasov <ja@ssi.bg>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation
  2010-08-26 19:36   ` Julian Anastasov
@ 2010-08-26 20:18     ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2010-08-26 20:18 UTC (permalink / raw)
  To: ja; +Cc: horms, lvs-devel, netdev, netfilter-devel, wensong, kaber,
	tingsrain

From: Julian Anastasov <ja@ssi.bg>
Date: Thu, 26 Aug 2010 22:36:24 +0300 (EEST)

>> +	skb->csum_offset = offsetof(struct icmp6hdr, icmp6_cksum);
>>  	skb->ip_summed = CHECKSUM_UNNECESSARY;
> 
> 	Ops, this should be CHECKSUM_PARTIAL

I'll fix this up when I apply the patch.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch net-next 0/4] IPVS
  2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
                   ` (3 preceding siblings ...)
  2010-08-26 12:54 ` [patch net-next 4/4] [PATCH net-next-2.6] ipvs: switch to GFP_KERNEL allocations Simon Horman
@ 2010-08-26 20:22 ` David Miller
  2010-08-27  5:28   ` Simon Horman
  4 siblings, 1 reply; 9+ messages in thread
From: David Miller @ 2010-08-26 20:22 UTC (permalink / raw)
  To: horms; +Cc: lvs-devel, netdev, netfilter-devel, wensong, ja, kaber

From: Simon Horman <horms@verge.net.au>
Date: Thu, 26 Aug 2010 21:54:27 +0900

> Hi Dave,
> 
> as mentioned earlier today I have a handful of IPVS patches queued up.
> Please consider them for net-next.

All applied with the CHECKSUM_PARTIAL fix as noticed by Julian.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [patch net-next 0/4] IPVS
  2010-08-26 20:22 ` [patch net-next 0/4] IPVS David Miller
@ 2010-08-27  5:28   ` Simon Horman
  0 siblings, 0 replies; 9+ messages in thread
From: Simon Horman @ 2010-08-27  5:28 UTC (permalink / raw)
  To: David Miller; +Cc: lvs-devel, netdev, netfilter-devel, wensong, ja, kaber

On Thu, Aug 26, 2010 at 01:22:09PM -0700, David Miller wrote:
> From: Simon Horman <horms@verge.net.au>
> Date: Thu, 26 Aug 2010 21:54:27 +0900
> 
> > Hi Dave,
> > 
> > as mentioned earlier today I have a handful of IPVS patches queued up.
> > Please consider them for net-next.
> 
> All applied with the CHECKSUM_PARTIAL fix as noticed by Julian.

Thanks Dave.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-08-27  5:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-26 12:54 [patch net-next 0/4] IPVS Simon Horman
2010-08-26 12:54 ` [patch net-next 1/4] [patch nf-next v2] IPVS: ICMPv6 checksum calculation Simon Horman
2010-08-26 19:36   ` Julian Anastasov
2010-08-26 20:18     ` David Miller
2010-08-26 12:54 ` [patch net-next 2/4] [patch nf-next] IPVS: convert __ip_vs_sched_lock to a spinlock Simon Horman
2010-08-26 12:54 ` [patch net-next 3/4] [patch nf-next] IPVS: convert __ip_vs_securetcp_lock " Simon Horman
2010-08-26 12:54 ` [patch net-next 4/4] [PATCH net-next-2.6] ipvs: switch to GFP_KERNEL allocations Simon Horman
2010-08-26 20:22 ` [patch net-next 0/4] IPVS David Miller
2010-08-27  5:28   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).