aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/icmp.c27
-rw-r--r--net/ipv6/icmp.c25
2 files changed, 26 insertions, 26 deletions
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index 831b6adbe4e0..3a4da43d8309 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -229,14 +229,14 @@ static const struct icmp_control icmp_pointers[NR_ICMP_TYPES+1];
229 * 229 *
230 * On SMP we have one ICMP socket per-cpu. 230 * On SMP we have one ICMP socket per-cpu.
231 */ 231 */
232static DEFINE_PER_CPU(struct socket *, __icmp_socket) = NULL; 232static DEFINE_PER_CPU(struct sock *, __icmp_sk) = NULL;
233#define icmp_socket __get_cpu_var(__icmp_socket) 233#define icmp_sk __get_cpu_var(__icmp_sk)
234 234
235static inline int icmp_xmit_lock(void) 235static inline int icmp_xmit_lock(void)
236{ 236{
237 local_bh_disable(); 237 local_bh_disable();
238 238
239 if (unlikely(!spin_trylock(&icmp_socket->sk->sk_lock.slock))) { 239 if (unlikely(!spin_trylock(&icmp_sk->sk_lock.slock))) {
240 /* This can happen if the output path signals a 240 /* This can happen if the output path signals a
241 * dst_link_failure() for an outgoing ICMP packet. 241 * dst_link_failure() for an outgoing ICMP packet.
242 */ 242 */
@@ -248,7 +248,7 @@ static inline int icmp_xmit_lock(void)
248 248
249static inline void icmp_xmit_unlock(void) 249static inline void icmp_xmit_unlock(void)
250{ 250{
251 spin_unlock_bh(&icmp_socket->sk->sk_lock.slock); 251 spin_unlock_bh(&icmp_sk->sk_lock.slock);
252} 252}
253 253
254/* 254/*
@@ -349,7 +349,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
349 struct sock *sk; 349 struct sock *sk;
350 struct sk_buff *skb; 350 struct sk_buff *skb;
351 351
352 sk = icmp_socket->sk; 352 sk = icmp_sk;
353 if (ip_append_data(sk, icmp_glue_bits, icmp_param, 353 if (ip_append_data(sk, icmp_glue_bits, icmp_param,
354 icmp_param->data_len+icmp_param->head_len, 354 icmp_param->data_len+icmp_param->head_len,
355 icmp_param->head_len, 355 icmp_param->head_len,
@@ -378,7 +378,7 @@ static void icmp_push_reply(struct icmp_bxm *icmp_param,
378 378
379static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb) 379static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
380{ 380{
381 struct sock *sk = icmp_socket->sk; 381 struct sock *sk = icmp_sk;
382 struct inet_sock *inet = inet_sk(sk); 382 struct inet_sock *inet = inet_sk(sk);
383 struct ipcm_cookie ipc; 383 struct ipcm_cookie ipc;
384 struct rtable *rt = (struct rtable *)skb->dst; 384 struct rtable *rt = (struct rtable *)skb->dst;
@@ -546,7 +546,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
546 icmp_param.data.icmph.checksum = 0; 546 icmp_param.data.icmph.checksum = 0;
547 icmp_param.skb = skb_in; 547 icmp_param.skb = skb_in;
548 icmp_param.offset = skb_network_offset(skb_in); 548 icmp_param.offset = skb_network_offset(skb_in);
549 inet_sk(icmp_socket->sk)->tos = tos; 549 inet_sk(icmp_sk)->tos = tos;
550 ipc.addr = iph->saddr; 550 ipc.addr = iph->saddr;
551 ipc.opt = &icmp_param.replyopts; 551 ipc.opt = &icmp_param.replyopts;
552 552
@@ -1146,13 +1146,13 @@ static void __exit icmp_exit(void)
1146 int i; 1146 int i;
1147 1147
1148 for_each_possible_cpu(i) { 1148 for_each_possible_cpu(i) {
1149 struct socket *sock; 1149 struct sock *sk;
1150 1150
1151 sock = per_cpu(__icmp_socket, i); 1151 sk = per_cpu(__icmp_sk, i);
1152 if (sock == NULL) 1152 if (sk == NULL)
1153 continue; 1153 continue;
1154 per_cpu(__icmp_socket, i) = NULL; 1154 per_cpu(__icmp_sk, i) = NULL;
1155 sock_release(sock); 1155 sock_release(sk->sk_socket);
1156 } 1156 }
1157} 1157}
1158 1158
@@ -1169,8 +1169,7 @@ int __init icmp_init(void)
1169 if (err < 0) 1169 if (err < 0)
1170 goto fail; 1170 goto fail;
1171 1171
1172 per_cpu(__icmp_socket, i) = sock; 1172 per_cpu(__icmp_sk, i) = sk = sock->sk;
1173 sk = sock->sk;
1174 sk->sk_allocation = GFP_ATOMIC; 1173 sk->sk_allocation = GFP_ATOMIC;
1175 1174
1176 /* Enough space for 2 64K ICMP packets, including 1175 /* Enough space for 2 64K ICMP packets, including
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index b9b13a77ba30..875bdc725dc4 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -80,8 +80,8 @@ EXPORT_SYMBOL(icmpv6msg_statistics);
80 * 80 *
81 * On SMP we have one ICMP socket per-cpu. 81 * On SMP we have one ICMP socket per-cpu.
82 */ 82 */
83static DEFINE_PER_CPU(struct socket *, __icmpv6_socket) = NULL; 83static DEFINE_PER_CPU(struct sock *, __icmpv6_sk) = NULL;
84#define icmpv6_socket __get_cpu_var(__icmpv6_socket) 84#define icmpv6_sk __get_cpu_var(__icmpv6_sk)
85 85
86static int icmpv6_rcv(struct sk_buff *skb); 86static int icmpv6_rcv(struct sk_buff *skb);
87 87
@@ -94,7 +94,7 @@ static __inline__ int icmpv6_xmit_lock(void)
94{ 94{
95 local_bh_disable(); 95 local_bh_disable();
96 96
97 if (unlikely(!spin_trylock(&icmpv6_socket->sk->sk_lock.slock))) { 97 if (unlikely(!spin_trylock(&icmpv6_sk->sk_lock.slock))) {
98 /* This can happen if the output path (f.e. SIT or 98 /* This can happen if the output path (f.e. SIT or
99 * ip6ip6 tunnel) signals dst_link_failure() for an 99 * ip6ip6 tunnel) signals dst_link_failure() for an
100 * outgoing ICMP6 packet. 100 * outgoing ICMP6 packet.
@@ -107,7 +107,7 @@ static __inline__ int icmpv6_xmit_lock(void)
107 107
108static __inline__ void icmpv6_xmit_unlock(void) 108static __inline__ void icmpv6_xmit_unlock(void)
109{ 109{
110 spin_unlock_bh(&icmpv6_socket->sk->sk_lock.slock); 110 spin_unlock_bh(&icmpv6_sk->sk_lock.slock);
111} 111}
112 112
113/* 113/*
@@ -392,7 +392,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
392 if (icmpv6_xmit_lock()) 392 if (icmpv6_xmit_lock())
393 return; 393 return;
394 394
395 sk = icmpv6_socket->sk; 395 sk = icmpv6_sk;
396 np = inet6_sk(sk); 396 np = inet6_sk(sk);
397 397
398 if (!icmpv6_xrlim_allow(sk, type, &fl)) 398 if (!icmpv6_xrlim_allow(sk, type, &fl))
@@ -538,7 +538,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
538 if (icmpv6_xmit_lock()) 538 if (icmpv6_xmit_lock())
539 return; 539 return;
540 540
541 sk = icmpv6_socket->sk; 541 sk = icmpv6_sk;
542 np = inet6_sk(sk); 542 np = inet6_sk(sk);
543 543
544 if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) 544 if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst))
@@ -776,7 +776,7 @@ drop_no_count:
776} 776}
777 777
778/* 778/*
779 * Special lock-class for __icmpv6_socket: 779 * Special lock-class for __icmpv6_sk:
780 */ 780 */
781static struct lock_class_key icmpv6_socket_sk_dst_lock_key; 781static struct lock_class_key icmpv6_socket_sk_dst_lock_key;
782 782
@@ -786,8 +786,9 @@ int __init icmpv6_init(void)
786 int err, i, j; 786 int err, i, j;
787 787
788 for_each_possible_cpu(i) { 788 for_each_possible_cpu(i) {
789 struct socket *sock;
789 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, 790 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6,
790 &per_cpu(__icmpv6_socket, i)); 791 &sock);
791 if (err < 0) { 792 if (err < 0) {
792 printk(KERN_ERR 793 printk(KERN_ERR
793 "Failed to initialize the ICMP6 control socket " 794 "Failed to initialize the ICMP6 control socket "
@@ -796,12 +797,12 @@ int __init icmpv6_init(void)
796 goto fail; 797 goto fail;
797 } 798 }
798 799
799 sk = per_cpu(__icmpv6_socket, i)->sk; 800 per_cpu(__icmpv6_sk, i) = sk = sock->sk;
800 sk->sk_allocation = GFP_ATOMIC; 801 sk->sk_allocation = GFP_ATOMIC;
801 /* 802 /*
802 * Split off their lock-class, because sk->sk_dst_lock 803 * Split off their lock-class, because sk->sk_dst_lock
803 * gets used from softirqs, which is safe for 804 * gets used from softirqs, which is safe for
804 * __icmpv6_socket (because those never get directly used 805 * __icmpv6_sk (because those never get directly used
805 * via userspace syscalls), but unsafe for normal sockets. 806 * via userspace syscalls), but unsafe for normal sockets.
806 */ 807 */
807 lockdep_set_class(&sk->sk_dst_lock, 808 lockdep_set_class(&sk->sk_dst_lock,
@@ -829,7 +830,7 @@ int __init icmpv6_init(void)
829 for (j = 0; j < i; j++) { 830 for (j = 0; j < i; j++) {
830 if (!cpu_possible(j)) 831 if (!cpu_possible(j))
831 continue; 832 continue;
832 sock_release(per_cpu(__icmpv6_socket, j)); 833 sock_release(per_cpu(__icmpv6_sk, j)->sk_socket);
833 } 834 }
834 835
835 return err; 836 return err;
@@ -840,7 +841,7 @@ void icmpv6_cleanup(void)
840 int i; 841 int i;
841 842
842 for_each_possible_cpu(i) { 843 for_each_possible_cpu(i) {
843 sock_release(per_cpu(__icmpv6_socket, i)); 844 sock_release(per_cpu(__icmpv6_sk, i)->sk_socket);
844 } 845 }
845 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); 846 inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6);
846} 847}