mirror of https://gitee.com/openkylin/linux.git
net: tracepoint: exposing sk_faimily in tracepoint inet_sock_set_state
As of now, there're two sk_family are traced with sock:inet_sock_set_state, which are AF_INET and AF_INET6. So the sk_family are exposed as well. Then we can conveniently use it to do the filter. Both sk_family and sk_protocol are showed in the printk message, so we need not expose them as tracepoint arguments. Suggested-by: Brendan Gregg <brendan.d.gregg@gmail.com> Suggested-by: Song Liu <songliubraving@fb.com> Signed-off-by: Yafang Shao <laoar.shao@gmail.com> Reviewed-by: Song Liu <songliubraving@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
23fe846f9a
commit
0c3b34d804
|
@ -11,7 +11,11 @@
|
||||||
#include <linux/ipv6.h>
|
#include <linux/ipv6.h>
|
||||||
#include <linux/tcp.h>
|
#include <linux/tcp.h>
|
||||||
|
|
||||||
/* The protocol traced by sock_set_state */
|
#define family_names \
|
||||||
|
EM(AF_INET) \
|
||||||
|
EMe(AF_INET6)
|
||||||
|
|
||||||
|
/* The protocol traced by inet_sock_set_state */
|
||||||
#define inet_protocol_names \
|
#define inet_protocol_names \
|
||||||
EM(IPPROTO_TCP) \
|
EM(IPPROTO_TCP) \
|
||||||
EM(IPPROTO_DCCP) \
|
EM(IPPROTO_DCCP) \
|
||||||
|
@ -37,6 +41,7 @@
|
||||||
#define EM(a) TRACE_DEFINE_ENUM(a);
|
#define EM(a) TRACE_DEFINE_ENUM(a);
|
||||||
#define EMe(a) TRACE_DEFINE_ENUM(a);
|
#define EMe(a) TRACE_DEFINE_ENUM(a);
|
||||||
|
|
||||||
|
family_names
|
||||||
inet_protocol_names
|
inet_protocol_names
|
||||||
tcp_state_names
|
tcp_state_names
|
||||||
|
|
||||||
|
@ -45,6 +50,9 @@ tcp_state_names
|
||||||
#define EM(a) { a, #a },
|
#define EM(a) { a, #a },
|
||||||
#define EMe(a) { a, #a }
|
#define EMe(a) { a, #a }
|
||||||
|
|
||||||
|
#define show_family_name(val) \
|
||||||
|
__print_symbolic(val, family_names)
|
||||||
|
|
||||||
#define show_inet_protocol_name(val) \
|
#define show_inet_protocol_name(val) \
|
||||||
__print_symbolic(val, inet_protocol_names)
|
__print_symbolic(val, inet_protocol_names)
|
||||||
|
|
||||||
|
@ -118,6 +126,7 @@ TRACE_EVENT(inet_sock_set_state,
|
||||||
__field(int, newstate)
|
__field(int, newstate)
|
||||||
__field(__u16, sport)
|
__field(__u16, sport)
|
||||||
__field(__u16, dport)
|
__field(__u16, dport)
|
||||||
|
__field(__u16, family)
|
||||||
__field(__u8, protocol)
|
__field(__u8, protocol)
|
||||||
__array(__u8, saddr, 4)
|
__array(__u8, saddr, 4)
|
||||||
__array(__u8, daddr, 4)
|
__array(__u8, daddr, 4)
|
||||||
|
@ -134,6 +143,7 @@ TRACE_EVENT(inet_sock_set_state,
|
||||||
__entry->oldstate = oldstate;
|
__entry->oldstate = oldstate;
|
||||||
__entry->newstate = newstate;
|
__entry->newstate = newstate;
|
||||||
|
|
||||||
|
__entry->family = sk->sk_family;
|
||||||
__entry->protocol = sk->sk_protocol;
|
__entry->protocol = sk->sk_protocol;
|
||||||
__entry->sport = ntohs(inet->inet_sport);
|
__entry->sport = ntohs(inet->inet_sport);
|
||||||
__entry->dport = ntohs(inet->inet_dport);
|
__entry->dport = ntohs(inet->inet_dport);
|
||||||
|
@ -160,7 +170,8 @@ TRACE_EVENT(inet_sock_set_state,
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
||||||
TP_printk("protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s",
|
TP_printk("family=%s protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s",
|
||||||
|
show_family_name(__entry->family),
|
||||||
show_inet_protocol_name(__entry->protocol),
|
show_inet_protocol_name(__entry->protocol),
|
||||||
__entry->sport, __entry->dport,
|
__entry->sport, __entry->dport,
|
||||||
__entry->saddr, __entry->daddr,
|
__entry->saddr, __entry->daddr,
|
||||||
|
|
Loading…
Reference in New Issue