From: Christoph Hellwig <hch@lst.de>
To: davem@redhat.com
Cc: netdev@oss.sgi.com
Subject: [PATCH] convert ip6_tunnel to per-cpu data
Date: Sun, 31 Aug 2003 12:06:21 +0200 [thread overview]
Message-ID: <20030831100621.GC18663@lst.de> (raw)
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;
}
}
next reply other threads:[~2003-08-31 10:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-31 10:06 Christoph Hellwig [this message]
2003-08-31 10:15 ` [PATCH] convert ip6_tunnel to per-cpu data David S. Miller
2003-08-31 12:14 ` Ville Nuorvala
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030831100621.GC18663@lst.de \
--to=hch@lst.de \
--cc=davem@redhat.com \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).