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>
This commit is contained in:

committed by
David S. Miller

parent
d7b850a7de
commit
563e0bb0dc
@@ -9,37 +9,6 @@
|
||||
#include <linux/tracepoint.h>
|
||||
#include <net/ipv6.h>
|
||||
|
||||
#define tcp_state_names \
|
||||
EM(TCP_ESTABLISHED) \
|
||||
EM(TCP_SYN_SENT) \
|
||||
EM(TCP_SYN_RECV) \
|
||||
EM(TCP_FIN_WAIT1) \
|
||||
EM(TCP_FIN_WAIT2) \
|
||||
EM(TCP_TIME_WAIT) \
|
||||
EM(TCP_CLOSE) \
|
||||
EM(TCP_CLOSE_WAIT) \
|
||||
EM(TCP_LAST_ACK) \
|
||||
EM(TCP_LISTEN) \
|
||||
EM(TCP_CLOSING) \
|
||||
EMe(TCP_NEW_SYN_RECV) \
|
||||
|
||||
/* enums need to be exported to user space */
|
||||
#undef EM
|
||||
#undef EMe
|
||||
#define EM(a) TRACE_DEFINE_ENUM(a);
|
||||
#define EMe(a) TRACE_DEFINE_ENUM(a);
|
||||
|
||||
tcp_state_names
|
||||
|
||||
#undef EM
|
||||
#undef EMe
|
||||
#define EM(a) tcp_state_name(a),
|
||||
#define EMe(a) tcp_state_name(a)
|
||||
|
||||
#define tcp_state_name(state) { state, #state }
|
||||
#define show_tcp_state_name(val) \
|
||||
__print_symbolic(val, tcp_state_names)
|
||||
|
||||
/*
|
||||
* tcp event with arguments sk and skb
|
||||
*
|
||||
|
Reference in New Issue
Block a user