diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2008-01-12 06:17:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:01:47 -0500 |
commit | 490d5046930276aae50dd16942649bfc626056f7 (patch) | |
tree | 91e15e68c70361239773b63324b028b64e9687ce | |
parent | 389f661224cdbdf178553fb09a52dc6c8bf86890 (diff) |
[TCP]: Uninline tcp_set_state
net/ipv4/tcp.c:
tcp_close_state | -226
tcp_done | -145
tcp_close | -564
tcp_disconnect | -141
4 functions changed, 1076 bytes removed, diff: -1076
net/ipv4/tcp_input.c:
tcp_fin | -86
tcp_rcv_state_process | -164
2 functions changed, 250 bytes removed, diff: -250
net/ipv4/tcp_ipv4.c:
tcp_v4_connect | -209
1 function changed, 209 bytes removed, diff: -209
net/ipv4/arp.c:
arp_ignore | +5
1 function changed, 5 bytes added, diff: +5
net/ipv6/tcp_ipv6.c:
tcp_v6_connect | -158
1 function changed, 158 bytes removed, diff: -158
net/sunrpc/xprtsock.c:
xs_sendpages | -2
1 function changed, 2 bytes removed, diff: -2
net/dccp/ccids/ccid3.c:
ccid3_update_send_interval | +7
1 function changed, 7 bytes added, diff: +7
net/ipv4/tcp.c:
tcp_set_state | +238
1 function changed, 238 bytes added, diff: +238
built-in.o:
12 functions changed, 250 bytes added, 1695 bytes removed, diff: -1445
I've no explanation why some unrelated changes seem to occur
consistently as well (arp_ignore, ccid3_update_send_interval;
I checked the arp_ignore asm and it seems to be due to some
reordered of operation order causing some extra opcodes to be
generated). Still, the benefits are pretty obvious from the
codiff's results.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/tcp.h | 35 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 35 |
2 files changed, 36 insertions, 34 deletions
diff --git a/include/net/tcp.h b/include/net/tcp.h index 48081ada92a7..306580ce1e53 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -926,40 +926,7 @@ static const char *statename[]={ | |||
926 | "Close Wait","Last ACK","Listen","Closing" | 926 | "Close Wait","Last ACK","Listen","Closing" |
927 | }; | 927 | }; |
928 | #endif | 928 | #endif |
929 | 929 | extern void tcp_set_state(struct sock *sk, int state); | |
930 | static inline void tcp_set_state(struct sock *sk, int state) | ||
931 | { | ||
932 | int oldstate = sk->sk_state; | ||
933 | |||
934 | switch (state) { | ||
935 | case TCP_ESTABLISHED: | ||
936 | if (oldstate != TCP_ESTABLISHED) | ||
937 | TCP_INC_STATS(TCP_MIB_CURRESTAB); | ||
938 | break; | ||
939 | |||
940 | case TCP_CLOSE: | ||
941 | if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) | ||
942 | TCP_INC_STATS(TCP_MIB_ESTABRESETS); | ||
943 | |||
944 | sk->sk_prot->unhash(sk); | ||
945 | if (inet_csk(sk)->icsk_bind_hash && | ||
946 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
947 | inet_put_port(&tcp_hashinfo, sk); | ||
948 | /* fall through */ | ||
949 | default: | ||
950 | if (oldstate==TCP_ESTABLISHED) | ||
951 | TCP_DEC_STATS(TCP_MIB_CURRESTAB); | ||
952 | } | ||
953 | |||
954 | /* Change state AFTER socket is unhashed to avoid closed | ||
955 | * socket sitting in hash tables. | ||
956 | */ | ||
957 | sk->sk_state = state; | ||
958 | |||
959 | #ifdef STATE_TRACE | ||
960 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | ||
961 | #endif | ||
962 | } | ||
963 | 930 | ||
964 | extern void tcp_done(struct sock *sk); | 931 | extern void tcp_done(struct sock *sk); |
965 | 932 | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 34085e3a4096..a0d373bd9065 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1652,6 +1652,41 @@ recv_urg: | |||
1652 | goto out; | 1652 | goto out; |
1653 | } | 1653 | } |
1654 | 1654 | ||
1655 | void tcp_set_state(struct sock *sk, int state) | ||
1656 | { | ||
1657 | int oldstate = sk->sk_state; | ||
1658 | |||
1659 | switch (state) { | ||
1660 | case TCP_ESTABLISHED: | ||
1661 | if (oldstate != TCP_ESTABLISHED) | ||
1662 | TCP_INC_STATS(TCP_MIB_CURRESTAB); | ||
1663 | break; | ||
1664 | |||
1665 | case TCP_CLOSE: | ||
1666 | if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) | ||
1667 | TCP_INC_STATS(TCP_MIB_ESTABRESETS); | ||
1668 | |||
1669 | sk->sk_prot->unhash(sk); | ||
1670 | if (inet_csk(sk)->icsk_bind_hash && | ||
1671 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
1672 | inet_put_port(&tcp_hashinfo, sk); | ||
1673 | /* fall through */ | ||
1674 | default: | ||
1675 | if (oldstate==TCP_ESTABLISHED) | ||
1676 | TCP_DEC_STATS(TCP_MIB_CURRESTAB); | ||
1677 | } | ||
1678 | |||
1679 | /* Change state AFTER socket is unhashed to avoid closed | ||
1680 | * socket sitting in hash tables. | ||
1681 | */ | ||
1682 | sk->sk_state = state; | ||
1683 | |||
1684 | #ifdef STATE_TRACE | ||
1685 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | ||
1686 | #endif | ||
1687 | } | ||
1688 | EXPORT_SYMBOL_GPL(tcp_set_state); | ||
1689 | |||
1655 | /* | 1690 | /* |
1656 | * State processing on a close. This implements the state shift for | 1691 | * State processing on a close. This implements the state shift for |
1657 | * sending our FIN frame. Note that we only send a FIN for some | 1692 | * sending our FIN frame. Note that we only send a FIN for some |