Commit 14c0c8e8 authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller

[TCP]: Replace socket with sock for reset sending.

Replace tcp_socket with tcp_sock. This is more effective (less
derefferences on fast paths). Additionally, the approach is unified to
one used in ICMP.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Acked-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a4aa834a
...@@ -89,7 +89,7 @@ int sysctl_tcp_low_latency __read_mostly; ...@@ -89,7 +89,7 @@ int sysctl_tcp_low_latency __read_mostly;
#define ICMP_MIN_LENGTH 8 #define ICMP_MIN_LENGTH 8
/* Socket used for sending RSTs */ /* Socket used for sending RSTs */
static struct socket *tcp_socket __read_mostly; static struct sock *tcp_sock __read_mostly;
void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb); void tcp_v4_send_check(struct sock *sk, int len, struct sk_buff *skb);
...@@ -598,7 +598,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb) ...@@ -598,7 +598,7 @@ static void tcp_v4_send_reset(struct sock *sk, struct sk_buff *skb)
sizeof(struct tcphdr), IPPROTO_TCP, 0); sizeof(struct tcphdr), IPPROTO_TCP, 0);
arg.csumoffset = offsetof(struct tcphdr, check) / 2; arg.csumoffset = offsetof(struct tcphdr, check) / 2;
ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len); ip_send_reply(tcp_sock, skb, &arg, arg.iov[0].iov_len);
TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
TCP_INC_STATS_BH(TCP_MIB_OUTRSTS); TCP_INC_STATS_BH(TCP_MIB_OUTRSTS);
...@@ -693,7 +693,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk, ...@@ -693,7 +693,7 @@ static void tcp_v4_send_ack(struct tcp_timewait_sock *twsk,
if (twsk) if (twsk)
arg.bound_dev_if = twsk->tw_sk.tw_bound_dev_if; arg.bound_dev_if = twsk->tw_sk.tw_bound_dev_if;
ip_send_reply(tcp_socket->sk, skb, &arg, arg.iov[0].iov_len); ip_send_reply(tcp_sock, skb, &arg, arg.iov[0].iov_len);
TCP_INC_STATS_BH(TCP_MIB_OUTSEGS); TCP_INC_STATS_BH(TCP_MIB_OUTSEGS);
} }
...@@ -2490,9 +2490,11 @@ struct proto tcp_prot = { ...@@ -2490,9 +2490,11 @@ struct proto tcp_prot = {
void __init tcp_v4_init(void) void __init tcp_v4_init(void)
{ {
if (inet_csk_ctl_sock_create(&tcp_socket, PF_INET, SOCK_RAW, struct socket *__tcp_socket;
if (inet_csk_ctl_sock_create(&__tcp_socket, PF_INET, SOCK_RAW,
IPPROTO_TCP) < 0) IPPROTO_TCP) < 0)
panic("Failed to create the TCP control socket.\n"); panic("Failed to create the TCP control socket.\n");
tcp_sock = __tcp_socket->sk;
} }
EXPORT_SYMBOL(ipv4_specific); EXPORT_SYMBOL(ipv4_specific);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment