From mboxrd@z Thu Jan 1 00:00:00 1970 From: Song Liu Subject: Re: [PATCH v2 net-next] net: tracepoint: exposing sk_faimily in tracepoint inet_sock_set_state Date: Sun, 7 Jan 2018 20:55:26 +0000 Message-ID: <075DF50A-F4CD-4475-B393-1293BDF8E038@fb.com> References: <1515306707-1759-1-git-send-email-laoar.shao@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: David Miller , "brendan.d.gregg@gmail.com" , "marcelo.leitner@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: Yafang Shao Return-path: In-Reply-To: <1515306707-1759-1-git-send-email-laoar.shao@gmail.com> Content-Language: en-US Content-ID: <260E93C96C114846A579A69A1996238F@namprd15.prod.outlook.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org > On Jan 6, 2018, at 10:31 PM, Yafang Shao wrote: >=20 > As of now, there're two sk_family are traced with sock:inet_sock_set_stat= e, > 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. >=20 > Both sk_family and sk_protocol are showed in the printk message, so we ne= ed > not expose them as tracepoint arguments. >=20 > Suggested-by: Brendan Gregg > Suggested-by: Song Liu > Signed-off-by: Yafang Shao > --- > include/trace/events/sock.h | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) >=20 > diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h > index 3537c5f..3176a39 100644 > --- a/include/trace/events/sock.h > +++ b/include/trace/events/sock.h > @@ -11,7 +11,11 @@ > #include > #include >=20 > -/* 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 \ > EM(IPPROTO_TCP) \ > EM(IPPROTO_DCCP) \ > @@ -37,6 +41,7 @@ > #define EM(a) TRACE_DEFINE_ENUM(a); > #define EMe(a) TRACE_DEFINE_ENUM(a); >=20 > +family_names > inet_protocol_names > tcp_state_names >=20 > @@ -45,6 +50,9 @@ > #define EM(a) { a, #a }, > #define EMe(a) { a, #a } >=20 > +#define show_family_name(val) \ > + __print_symbolic(val, family_names) > + > #define show_inet_protocol_name(val) \ > __print_symbolic(val, inet_protocol_names) >=20 > @@ -118,6 +126,7 @@ > __field(int, newstate) > __field(__u16, sport) > __field(__u16, dport) > + __field(__u16, family) > __field(__u8, protocol) > __array(__u8, saddr, 4) > __array(__u8, daddr, 4) > @@ -134,6 +143,7 @@ > __entry->oldstate =3D oldstate; > __entry->newstate =3D newstate; >=20 > + __entry->family =3D sk->sk_family; > __entry->protocol =3D sk->sk_protocol; > __entry->sport =3D ntohs(inet->inet_sport); > __entry->dport =3D ntohs(inet->inet_dport); > @@ -160,7 +170,8 @@ > } > ), >=20 > - TP_printk("protocol=3D%s sport=3D%hu dport=3D%hu saddr=3D%pI4 daddr=3D%= pI4 saddrv6=3D%pI6c daddrv6=3D%pI6c oldstate=3D%s newstate=3D%s", > + TP_printk("family=3D%s protocol=3D%s sport=3D%hu dport=3D%hu saddr=3D%p= I4 daddr=3D%pI4 saddrv6=3D%pI6c daddrv6=3D%pI6c oldstate=3D%s newstate=3D%s= ", > + show_family_name(__entry->family), > show_inet_protocol_name(__entry->protocol), > __entry->sport, __entry->dport, > __entry->saddr, __entry->daddr, > -- > 1.8.3.1 >=20 Reviewed-by: Song Liu