diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-29 14:16:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-29 14:16:46 -0500 |
commit | 405666db84b984b68fc75794069f424c02e5796c (patch) | |
tree | d764573e97686f02c2a47fc7da96aefe97cbc458 /net/ipv6/icmp.c | |
parent | b7e729c4b4778aac4dbbec9dc070acde93071f4d (diff) |
[ICMP]: Pass proper ICMP socket into icmp(v6)_xmit_(un)lock.
We have to get socket lock inside icmp(v6)_xmit_lock/unlock. The socket
is get from global variable now. When this code became namespaces, one
should pass a namespace and get socket from it.
Though, above is useless. Socket is available in the caller, just pass
it inside. This saves a bit of code now and saves more later.
add/remove: 0/0 grow/shrink: 1/3 up/down: 1/-169 (-168)
function old new delta
icmp_rcv 718 719 +1
icmpv6_rcv 2343 2303 -40
icmp_send 1566 1518 -48
icmp_reply 549 468 -81
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r-- | net/ipv6/icmp.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c index 875bdc725dc4..18f220a04486 100644 --- a/net/ipv6/icmp.c +++ b/net/ipv6/icmp.c | |||
@@ -90,11 +90,11 @@ static struct inet6_protocol icmpv6_protocol = { | |||
90 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, | 90 | .flags = INET6_PROTO_NOPOLICY|INET6_PROTO_FINAL, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | static __inline__ int icmpv6_xmit_lock(void) | 93 | static __inline__ int icmpv6_xmit_lock(struct sock *sk) |
94 | { | 94 | { |
95 | local_bh_disable(); | 95 | local_bh_disable(); |
96 | 96 | ||
97 | if (unlikely(!spin_trylock(&icmpv6_sk->sk_lock.slock))) { | 97 | if (unlikely(!spin_trylock(&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. |
@@ -105,9 +105,9 @@ static __inline__ int icmpv6_xmit_lock(void) | |||
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
107 | 107 | ||
108 | static __inline__ void icmpv6_xmit_unlock(void) | 108 | static __inline__ void icmpv6_xmit_unlock(struct sock *sk) |
109 | { | 109 | { |
110 | spin_unlock_bh(&icmpv6_sk->sk_lock.slock); | 110 | spin_unlock_bh(&sk->sk_lock.slock); |
111 | } | 111 | } |
112 | 112 | ||
113 | /* | 113 | /* |
@@ -389,12 +389,12 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, | |||
389 | fl.fl_icmp_code = code; | 389 | fl.fl_icmp_code = code; |
390 | security_skb_classify_flow(skb, &fl); | 390 | security_skb_classify_flow(skb, &fl); |
391 | 391 | ||
392 | if (icmpv6_xmit_lock()) | ||
393 | return; | ||
394 | |||
395 | sk = icmpv6_sk; | 392 | sk = icmpv6_sk; |
396 | np = inet6_sk(sk); | 393 | np = inet6_sk(sk); |
397 | 394 | ||
395 | if (icmpv6_xmit_lock(sk)) | ||
396 | return; | ||
397 | |||
398 | if (!icmpv6_xrlim_allow(sk, type, &fl)) | 398 | if (!icmpv6_xrlim_allow(sk, type, &fl)) |
399 | goto out; | 399 | goto out; |
400 | 400 | ||
@@ -498,7 +498,7 @@ out_put: | |||
498 | out_dst_release: | 498 | out_dst_release: |
499 | dst_release(dst); | 499 | dst_release(dst); |
500 | out: | 500 | out: |
501 | icmpv6_xmit_unlock(); | 501 | icmpv6_xmit_unlock(sk); |
502 | } | 502 | } |
503 | 503 | ||
504 | EXPORT_SYMBOL(icmpv6_send); | 504 | EXPORT_SYMBOL(icmpv6_send); |
@@ -535,12 +535,12 @@ static void icmpv6_echo_reply(struct sk_buff *skb) | |||
535 | fl.fl_icmp_type = ICMPV6_ECHO_REPLY; | 535 | fl.fl_icmp_type = ICMPV6_ECHO_REPLY; |
536 | security_skb_classify_flow(skb, &fl); | 536 | security_skb_classify_flow(skb, &fl); |
537 | 537 | ||
538 | if (icmpv6_xmit_lock()) | ||
539 | return; | ||
540 | |||
541 | sk = icmpv6_sk; | 538 | sk = icmpv6_sk; |
542 | np = inet6_sk(sk); | 539 | np = inet6_sk(sk); |
543 | 540 | ||
541 | if (icmpv6_xmit_lock(sk)) | ||
542 | return; | ||
543 | |||
544 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) | 544 | if (!fl.oif && ipv6_addr_is_multicast(&fl.fl6_dst)) |
545 | fl.oif = np->mcast_oif; | 545 | fl.oif = np->mcast_oif; |
546 | 546 | ||
@@ -584,7 +584,7 @@ out_put: | |||
584 | in6_dev_put(idev); | 584 | in6_dev_put(idev); |
585 | dst_release(dst); | 585 | dst_release(dst); |
586 | out: | 586 | out: |
587 | icmpv6_xmit_unlock(); | 587 | icmpv6_xmit_unlock(sk); |
588 | } | 588 | } |
589 | 589 | ||
590 | static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info) | 590 | static void icmpv6_notify(struct sk_buff *skb, int type, int code, __be32 info) |