netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] convert ip6_tunnel to per-cpu data
@ 2003-08-31 10:06 Christoph Hellwig
  2003-08-31 10:15 ` David S. Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2003-08-31 10:06 UTC (permalink / raw)
  To: davem; +Cc: netdev

Code looks like copy & pasted from icmpv6 :)


--- 1.6/net/ipv6/ip6_tunnel.c	Mon Aug 18 13:52:14 2003
+++ edited/net/ipv6/ip6_tunnel.c	Fri Aug 29 12:11:40 2003
@@ -64,8 +64,8 @@
 #define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)
 
 /* socket(s) used by ip6ip6_tnl_xmit() for resending packets */
-static struct socket *__ip6_socket[NR_CPUS];
-#define ip6_socket __ip6_socket[smp_processor_id()]
+static DEFINE_PER_CPU(struct socket *, __ip6_socket) = NULL;
+#define ip6_socket	__get_cpu_var(__ip6_socket)
 
 static void ip6_xmit_lock(void)
 {
@@ -1168,7 +1168,7 @@
 			continue;
 
 		err = sock_create(PF_INET6, SOCK_RAW, IPPROTO_IPV6, 
-				  &__ip6_socket[i]);
+				  &per_cpu(__ip6_socket, i));
 		if (err < 0) {
 			printk(KERN_ERR 
 			       "Failed to create the IPv6 tunnel socket "
@@ -1176,7 +1176,7 @@
 			       err);
 			goto fail;
 		}
-		sk = __ip6_socket[i]->sk;
+		sk = per_cpu(__ip6_socket, i)->sk;
 		sk->sk_allocation = GFP_ATOMIC;
 
 		np = inet6_sk(sk);
@@ -1211,8 +1211,8 @@
 	for (j = 0; j < i; j++) {
 		if (!cpu_possible(j))
 			continue;
-		sock_release(__ip6_socket[j]);
-		__ip6_socket[j] = NULL;
+		sock_release(per_cpu(__ip6_socket, j));
+		per_cpu(__ip6_socket, j) = NULL;
 	}
 	return err;
 }
@@ -1232,8 +1232,8 @@
 	for (i = 0; i < NR_CPUS; i++) {
 		if (!cpu_possible(i))
 			continue;
-		sock_release(__ip6_socket[i]);
-		__ip6_socket[i] = NULL;
+		sock_release(per_cpu(__ip6_socket, i));
+		per_cpu(__ip6_socket, i) = NULL;
 	}
 }
 

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

* Re: [PATCH] convert ip6_tunnel to per-cpu data
  2003-08-31 10:06 [PATCH] convert ip6_tunnel to per-cpu data Christoph Hellwig
@ 2003-08-31 10:15 ` David S. Miller
  2003-08-31 12:14   ` Ville Nuorvala
  0 siblings, 1 reply; 3+ messages in thread
From: David S. Miller @ 2003-08-31 10:15 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: netdev

On Sun, 31 Aug 2003 12:06:21 +0200
Christoph Hellwig <hch@lst.de> wrote:

> Code looks like copy & pasted from icmpv6 :)

Hold on this one, we're in the process of killing
the sockets from this code.

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

* Re: [PATCH] convert ip6_tunnel to per-cpu data
  2003-08-31 10:15 ` David S. Miller
@ 2003-08-31 12:14   ` Ville Nuorvala
  0 siblings, 0 replies; 3+ messages in thread
From: Ville Nuorvala @ 2003-08-31 12:14 UTC (permalink / raw)
  To: David S. Miller; +Cc: Christoph Hellwig, netdev

On Sun, 31 Aug 2003, David S. Miller wrote:

> On Sun, 31 Aug 2003 12:06:21 +0200
> Christoph Hellwig <hch@lst.de> wrote:
>
> > Code looks like copy & pasted from icmpv6 :)
>
> Hold on this one, we're in the process of killing
> the sockets from this code.

Yes, I've been running socketless tunnels for a couple of days now and
everything seems to work all right. I'll send the patch shortly...


Ville
--
Ville Nuorvala
Research Assistant, Institute of Digital Communications,
Helsinki University of Technology
email: vnuorval@tcs.hut.fi, phone: +358 (0)9 451 5257

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

end of thread, other threads:[~2003-08-31 12:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-08-31 10:06 [PATCH] convert ip6_tunnel to per-cpu data Christoph Hellwig
2003-08-31 10:15 ` David S. Miller
2003-08-31 12:14   ` Ville Nuorvala

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).