aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp.c
diff options
context:
space:
mode:
authorYafang Shao <laoar.shao@gmail.com>2017-12-19 22:12:51 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-20 14:00:25 -0500
commit563e0bb0dc74b3ca888e24f8c08f0239fe4016b0 (patch)
treefcba71aa1af1eb252e0314782660e28986eb77f8 /net/ipv4/tcp.c
parentd7b850a7dedf163fbfdb7aa20226d8aff2836338 (diff)
net: tracepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint
As sk_state is a common field for struct sock, so the state transition tracepoint should not be a TCP specific feature. Currently it traces all AF_INET state transition, so I rename this tracepoint to inet_sock_set_state tracepoint with some minor changes and move it into trace/events/sock.h. We dont need to create a file named trace/events/inet_sock.h for this one single tracepoint. Two helpers are introduced to trace sk_state transition - void inet_sk_state_store(struct sock *sk, int newstate); - void inet_sk_set_state(struct sock *sk, int state); As trace header should not be included in other header files, so they are defined in sock.c. The protocol such as SCTP maybe compiled as a ko, hence export inet_sk_set_state(). Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r--net/ipv4/tcp.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index c470fec9062f..d408fb41c804 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -283,8 +283,6 @@
283#include <asm/ioctls.h> 283#include <asm/ioctls.h>
284#include <net/busy_poll.h> 284#include <net/busy_poll.h>
285 285
286#include <trace/events/tcp.h>
287
288struct percpu_counter tcp_orphan_count; 286struct percpu_counter tcp_orphan_count;
289EXPORT_SYMBOL_GPL(tcp_orphan_count); 287EXPORT_SYMBOL_GPL(tcp_orphan_count);
290 288
@@ -2040,8 +2038,6 @@ void tcp_set_state(struct sock *sk, int state)
2040{ 2038{
2041 int oldstate = sk->sk_state; 2039 int oldstate = sk->sk_state;
2042 2040
2043 trace_tcp_set_state(sk, oldstate, state);
2044
2045 switch (state) { 2041 switch (state) {
2046 case TCP_ESTABLISHED: 2042 case TCP_ESTABLISHED:
2047 if (oldstate != TCP_ESTABLISHED) 2043 if (oldstate != TCP_ESTABLISHED)
@@ -2065,7 +2061,7 @@ void tcp_set_state(struct sock *sk, int state)
2065 /* Change state AFTER socket is unhashed to avoid closed 2061 /* Change state AFTER socket is unhashed to avoid closed
2066 * socket sitting in hash tables. 2062 * socket sitting in hash tables.
2067 */ 2063 */
2068 sk_state_store(sk, state); 2064 inet_sk_state_store(sk, state);
2069 2065
2070#ifdef STATE_TRACE 2066#ifdef STATE_TRACE
2071 SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n", sk, statename[oldstate], statename[state]); 2067 SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n", sk, statename[oldstate], statename[state]);