Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1816821rdg; Sat, 12 Aug 2023 19:11:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH5gz227VoFATDXt9OFoQvPpkiaRSUhbqYCdo3YYFHRWw2Bs4CDaZlR3ZVhkMQvxSHn9Ht+ X-Received: by 2002:a54:4592:0:b0:3a0:3495:c8d4 with SMTP id z18-20020a544592000000b003a03495c8d4mr6108784oib.28.1691892677145; Sat, 12 Aug 2023 19:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691892677; cv=none; d=google.com; s=arc-20160816; b=BmtgflyC8gWmUPrQ6P5VrPC150SIqTVwtGzdCAg8SdlimAaJtICkgtkNkHBUwhQfla gcustZXqHEvRSl+mnM1rQr+bvBSXNA/Ybv1FcCMZ26j14v7nf8YznX6ifhAB5ozGxGOY dcJ3Tt/cyYoqhubaVMnngtFlsNVWMECwOXFsYZBcx0sFQluQa88oBxTMyVzjA2glxvlQ r4TcmgvVp1uDEInmxWddFzw3jfuVgXx+mE7Iu4qseskn5SjxDeg5mAvt7eY1KwaXMgmA L6wtIBOgczDho4ox9juA7A9Wbd+0NABYGkBBu2kCJEmhxqV7bIqABGb3lREePX9h7RQz q+RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=3nuPELVjMKqbwv4LCohpZqE/3NBsBFEYyCcAI1V0xNc=; fh=Jxv3wWOfRz1oQZUpDmc4IrDGoQMpfM89wbX82qZdSCI=; b=mwmdOnHJp2CQvRkmgNbfnRhMntYQTu5cM3jWfLfGgZy4JYeHUsIE8vd7Jeaahoa5aW HkQU1eg7GQzZpZZ848y0DsKZQoKaIUOYa4vN23DaFN3k5y3kJWISBoJRFdcHXzLalRHj qKKoG+s9dcGDdXvPaJGgQa70qv4+tZy0mG7sUmVjh5QsFkpPI2+C7ovdjsdwFvQpOepY eYlqNarn72litYaz8tvI3QwTRAskw+iqZc/3HJ5iSK2TmYh+zvBgra9FlWzkI5cz/iA+ n+6AkmUqfwnJeDAAcxr6seO9UxNpqmuNqOpmEgn036IoiF3zbTi/4/P/4ufuLdkkgKnX tiOA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a63df53000000b00563856f6d3bsi5965231pgj.55.2023.08.12.19.11.04; Sat, 12 Aug 2023 19:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229968AbjHMA7H (ORCPT + 99 others); Sat, 12 Aug 2023 20:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbjHMA7G (ORCPT ); Sat, 12 Aug 2023 20:59:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7237E1706; Sat, 12 Aug 2023 17:59:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0313561C44; Sun, 13 Aug 2023 00:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7727C433C8; Sun, 13 Aug 2023 00:59:06 +0000 (UTC) Date: Sat, 12 Aug 2023 20:59:05 -0400 From: Steven Rostedt To: Zheao Li Cc: edumazet@google.com, bpf@vger.kernel.org, davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mhiramat@kernel.org, ncardwell@google.com, netdev@vger.kernel.org, pabeni@redhat.com Subject: Re: [PATCH v3] tracepoint: add new `tcp:tcp_ca_event` trace event Message-ID: <20230812205905.016106c0@rorschach.local.home> In-Reply-To: <20230812201249.62237-1-me@manjusaka.me> References: <20230812201249.62237-1-me@manjusaka.me> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 12 Aug 2023 20:12:50 +0000 Zheao Li wrote: > +TRACE_EVENT(tcp_ca_event, > + > + TP_PROTO(struct sock *sk, const u8 ca_event), > + > + TP_ARGS(sk, ca_event), > + > + TP_STRUCT__entry( > + __field(const void *, skaddr) > + __field(__u16, sport) > + __field(__u16, dport) > + __field(__u16, family) > + __array(__u8, saddr, 4) > + __array(__u8, daddr, 4) > + __array(__u8, saddr_v6, 16) > + __array(__u8, daddr_v6, 16) > + __field(__u8, ca_event) Please DO NOT LISTEN TO CHECKPATCH! The above looks horrendous! Put it back to: > + __field( const void *, skaddr ) > + __field( __u16, sport ) > + __field( __u16, dport ) > + __field( __u16, family ) > + __array( __u8, saddr, 4 ) > + __array( __u8, daddr, 4 ) > + __array( __u8, saddr_v6, 16 ) > + __array( __u8, daddr_v6, 16 ) > + __field( __u8, ca_event ) See how much better it looks I can see fields this way. The "checkpatch" way is a condensed mess. -- Steve > + ), > + > + TP_fast_assign( > + struct inet_sock *inet = inet_sk(sk); > + __be32 *p32; > + > + __entry->skaddr = sk; > + > + __entry->sport = ntohs(inet->inet_sport); > + __entry->dport = ntohs(inet->inet_dport); > + __entry->family = sk->sk_family; > + > + p32 = (__be32 *) __entry->saddr; > + *p32 = inet->inet_saddr; > + > + p32 = (__be32 *) __entry->daddr; > + *p32 = inet->inet_daddr; > + > + TP_STORE_ADDRS(__entry, inet->inet_saddr, > inet->inet_daddr, > + sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); > + > + __entry->ca_event = ca_event; > + ), > + > + TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 > daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c ca_event=%s", > + show_family_name(__entry->family), > + __entry->sport, __entry->dport, > + __entry->saddr, __entry->daddr, > + __entry->saddr_v6, __entry->daddr_v6, > + show_tcp_ca_event_names(__entry->ca_event)) > +); > + > #endif /* _TRACE_TCP_H */ >