From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Ricardo Leitner Subject: Re: [PATCH v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint Date: Fri, 8 Dec 2017 09:03:56 -0200 Message-ID: <20171208110356.GS13341@localhost.localdomain> References: <1512655842-17784-1-git-send-email-laoar.shao@gmail.com> <20171207200245.GQ13341@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: David Miller , Song Liu , Alexey Kuznetsov , yoshfuji@linux-ipv6.org, Steven Rostedt , Brendan Gregg , netdev@vger.kernel.org, LKML To: Yafang Shao Return-path: Received: from mail-qt0-f181.google.com ([209.85.216.181]:40588 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753256AbdLHLEE (ORCPT ); Fri, 8 Dec 2017 06:04:04 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Fri, Dec 08, 2017 at 11:40:23AM +0800, Yafang Shao wrote: > 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. Agreed. Hmpf, looks like one way or another, we have to add the sk_ functions to do such check, and then the tcp_* won't help much. I'm okay with this v5 then, can't see a better way around it. Marcelo