From 004e49dd51094ea3492a3216ecd2c5a7c3daa63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Sat, 12 Jan 2008 03:17:20 -0800 Subject: [PATCH] --- yaml --- r: 78767 b: refs/heads/master c: 490d5046930276aae50dd16942649bfc626056f7 h: refs/heads/master i: 78765: f20540a86c689699bddb17468eec469eee40c24b 78763: c2cbda850f3cd5a917a8611fdd3bc759468c2959 78759: 267db221759418cc059066bd9fd5d5082629c55f 78751: a4ac4783dd9e22d951468cd8f1a260ba11143a7e v: v3 --- [refs] | 2 +- trunk/include/net/tcp.h | 35 +---------------------------------- trunk/net/ipv4/tcp.c | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/[refs] b/[refs] index c601413806e9..a3d6db332c41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 389f661224cdbdf178553fb09a52dc6c8bf86890 +refs/heads/master: 490d5046930276aae50dd16942649bfc626056f7 diff --git a/trunk/include/net/tcp.h b/trunk/include/net/tcp.h index 48081ada92a7..306580ce1e53 100644 --- a/trunk/include/net/tcp.h +++ b/trunk/include/net/tcp.h @@ -926,40 +926,7 @@ static const char *statename[]={ "Close Wait","Last ACK","Listen","Closing" }; #endif - -static inline void tcp_set_state(struct sock *sk, int state) -{ - int oldstate = sk->sk_state; - - switch (state) { - case TCP_ESTABLISHED: - if (oldstate != TCP_ESTABLISHED) - TCP_INC_STATS(TCP_MIB_CURRESTAB); - break; - - case TCP_CLOSE: - if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) - TCP_INC_STATS(TCP_MIB_ESTABRESETS); - - sk->sk_prot->unhash(sk); - if (inet_csk(sk)->icsk_bind_hash && - !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) - inet_put_port(&tcp_hashinfo, sk); - /* fall through */ - default: - if (oldstate==TCP_ESTABLISHED) - TCP_DEC_STATS(TCP_MIB_CURRESTAB); - } - - /* Change state AFTER socket is unhashed to avoid closed - * socket sitting in hash tables. - */ - sk->sk_state = state; - -#ifdef STATE_TRACE - SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); -#endif -} +extern void tcp_set_state(struct sock *sk, int state); extern void tcp_done(struct sock *sk); diff --git a/trunk/net/ipv4/tcp.c b/trunk/net/ipv4/tcp.c index 34085e3a4096..a0d373bd9065 100644 --- a/trunk/net/ipv4/tcp.c +++ b/trunk/net/ipv4/tcp.c @@ -1652,6 +1652,41 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, goto out; } +void tcp_set_state(struct sock *sk, int state) +{ + int oldstate = sk->sk_state; + + switch (state) { + case TCP_ESTABLISHED: + if (oldstate != TCP_ESTABLISHED) + TCP_INC_STATS(TCP_MIB_CURRESTAB); + break; + + case TCP_CLOSE: + if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) + TCP_INC_STATS(TCP_MIB_ESTABRESETS); + + sk->sk_prot->unhash(sk); + if (inet_csk(sk)->icsk_bind_hash && + !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) + inet_put_port(&tcp_hashinfo, sk); + /* fall through */ + default: + if (oldstate==TCP_ESTABLISHED) + TCP_DEC_STATS(TCP_MIB_CURRESTAB); + } + + /* Change state AFTER socket is unhashed to avoid closed + * socket sitting in hash tables. + */ + sk->sk_state = state; + +#ifdef STATE_TRACE + SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); +#endif +} +EXPORT_SYMBOL_GPL(tcp_set_state); + /* * State processing on a close. This implements the state shift for * sending our FIN frame. Note that we only send a FIN for some