From: David Miller <davem@davemloft.net>
To: laoar.shao@gmail.com
Cc: songliubraving@fb.com, marcelo.leitner@gmail.com,
kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
rostedt@goodmis.org, bgregg@netflix.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint
Date: Tue, 05 Dec 2017 15:11:59 -0500 (EST) [thread overview]
Message-ID: <20171205.151159.1781485937410298333.davem@davemloft.net> (raw)
In-Reply-To: <1512483162-5557-1-git-send-email-laoar.shao@gmail.com>
From: Yafang Shao <laoar.shao@gmail.com>
Date: Tue, 5 Dec 2017 14:12:42 +0000
> }
>
> +/* For tcp_set_state tracepoint */
> +void sk_state_store(struct sock *sk, int newstate);
> +
> void sock_enable_timestamp(struct sock *sk, int flag);
> int sock_get_timestamp(struct sock *, struct timeval __user *);
> int sock_get_timestampns(struct sock *, struct timespec __user *);
...
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2036,6 +2036,18 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int nonblock,
> }
> EXPORT_SYMBOL(tcp_recvmsg);
>
> +void sk_state_store(struct sock *sk, int newstate)
> +{
> + trace_tcp_set_state(sk, sk->sk_state, newstate);
> + __sk_state_store(sk, newstate);
> +}
> +
Please do not define a sock generic function in the TCP protocol code.
If it belongs in TCP and is only used by TCP, give is a tcp specific
name prefix rather than a generic sk_ one.
This is even more ugly because I see that inet_connection_sock.c and
inet_hashtables.c uses this thing too. Which means that DCCP sockets
will trigger this tracepoint.
inet_connection_sock.c and inet_hashtables.c are not guaranteed to
operate on only TCP sockets, and you must make amends to handle that
properly.
Thanks.
prev parent reply other threads:[~2017-12-05 20:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-05 14:12 [PATCH v3 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint Yafang Shao
2017-12-05 17:00 ` Marcelo Ricardo Leitner
2017-12-05 20:11 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171205.151159.1781485937410298333.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=bgregg@netflix.com \
--cc=kuznet@ms2.inr.ac.ru \
--cc=laoar.shao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).