linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: laoar.shao@gmail.com
Cc: marcelo.leitner@gmail.com, songliubraving@fb.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 v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint
Date: Fri, 08 Dec 2017 11:28:25 -0500 (EST)	[thread overview]
Message-ID: <20171208.112825.301687304435692797.davem@davemloft.net> (raw)
In-Reply-To: <CALOAHbDNSaHqeQCSeNMfT7udN32VEciZA0bHgtt=coeXr4xj+g@mail.gmail.com>

From: Yafang Shao <laoar.shao@gmail.com>
Date: Fri, 8 Dec 2017 23:50:44 +0800

> 2017-12-08 23:42 GMT+08:00 David Miller <davem@davemloft.net>:
>> From: Yafang Shao <laoar.shao@gmail.com>
>> Date: Fri, 8 Dec 2017 11:40:23 +0800
>>
>>> It will looks like these,
>>>
>>>     if (sk->sk_protocol == IPPROTO_TCP)
>>>         __tcp_set_state(newsk, TCP_SYN_RECV);
>>>     else
>>>         newsk->sk_state = TCP_SYN_RECV;
>>>
>>>
>>>     if (sk->sk_protocol == IPPROTO_TCP)
>>>           __tcp_set_state(sk, TCP_CLOSE);
>>>     else
>>>           sk->sk_state = TCP_CLOSE;
>>>
>>>     if (sk->sk_protocol == IPPROTO_TCP)
>>>           tcp_state_store(sk,  state);
>>>     else
>>>           sk_state_store(sk, state);
>>>
>>>
>>> Some redundant code.
>>>
>>> IMO, put these similar code into a wrapper is more nice.
>>
>> I think this discussion and how ugly this is getting shows that
>> tracing the state transitions of a socket is perhaps not best as a TCP
>> specific feature.
> 
> Do you mean that tcp_set_state tracepoint should be replaced with
> sk_set_state tracepoint and move that tracepoint to
> trace/events/sock.h ?

Yes, something like that.

It will avoid all of these protocol specific checks and weird
dependencies.

  reply	other threads:[~2017-12-08 16:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 14:10 [PATCH v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint Yafang Shao
2017-12-07 20:02 ` Marcelo Ricardo Leitner
2017-12-07 20:04   ` David Miller
2017-12-08  1:41   ` Yafang Shao
2017-12-08  3:40     ` Yafang Shao
2017-12-08 11:03       ` Marcelo Ricardo Leitner
2017-12-08 16:03         ` David Miller
2017-12-08 15:42       ` David Miller
2017-12-08 15:50         ` Yafang Shao
2017-12-08 16:28           ` David Miller [this message]
2017-12-09  0:47             ` Yafang Shao

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=20171208.112825.301687304435692797.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).