From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753526AbdLHLEG (ORCPT ); Fri, 8 Dec 2017 06:04:06 -0500 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 X-Google-Smtp-Source: AGs4zMYW6ynlLOR0RJqCBgIrB1xzHv1LRcAQD8nz324gAgKphx8aNaJu6SZYiZAmh+JjTd1IByi6vQ== Date: Fri, 8 Dec 2017 09:03:56 -0200 From: Marcelo Ricardo Leitner To: Yafang Shao Cc: David Miller , Song Liu , Alexey Kuznetsov , yoshfuji@linux-ipv6.org, Steven Rostedt , Brendan Gregg , netdev@vger.kernel.org, LKML Subject: Re: [PATCH v5 net-next] net/tcp: trace all TCP/IP state transition with tcp_set_state tracepoint 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 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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