From patchwork Thu Aug 5 18:57:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2463FC432BE for ; Thu, 5 Aug 2021 18:57:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0599660EE9 for ; Thu, 5 Aug 2021 18:57:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241868AbhHES6L (ORCPT ); Thu, 5 Aug 2021 14:58:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241061AbhHES6L (ORCPT ); Thu, 5 Aug 2021 14:58:11 -0400 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BF8C061765 for ; Thu, 5 Aug 2021 11:57:55 -0700 (PDT) Received: by mail-ot1-x334.google.com with SMTP id z6-20020a0568302906b02904f268d34f86so5870043otu.2 for ; Thu, 05 Aug 2021 11:57:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nsRwK3nV8f5bjMv6jFFTlnHRWwO4N1j6c3q+aaDgWjk=; b=p+ctxhe6pqTDt9ZQSPT3CZnCK6CrfSZprtQEPUW/kodux9lPWnH7DAfaGd657mnrJi GOpHV+U69K/yv1apyLzSsRIoQ/Mab00jWhkNNdrFyGqPpelHfYgZ2dbBXaClDhXWpOyc bKiowGgzyphVJTovVSeahTDch4RvM4ZzOf3bBy0HdA5jRoDxCuElVB9ks9fjOFKoDXRN AEPI5jqHoKV5FWzTdll1Aj4nx7vztdGsWAnKiWAPUx5jZBCnSjJBCC7Si9eED1i/JVaG o1qJUkDjU7iUItc7KcdKAEG7q+nBlV6l3k0ise0+wD6IQa90uH63jF+O6G+snNWnlm0t TlSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nsRwK3nV8f5bjMv6jFFTlnHRWwO4N1j6c3q+aaDgWjk=; b=mhZLdcZLvb1mfa52aCJFV3KVIFnhKhxqN4EgzgMmQhGbLc+rW9HKaH2wAXmQn096Fd Nh0+5D0owoFkVHFh96wlfcGwP0FcZMqNhb9z2lbDHaUItys14rol8sa8JXFEmZQPtaGw YUYXUhg610lZgkNQW7vx5YxVk/y1tnWlYvvz2p9kD4c5CABK8D1msRyFG8Wdu6brCzk8 iQZ1UZ/Q0TMwvloBFrMCqLtvvdhpFIaKBwzIneUz+zdGNBAvHiWNj39qttyWMex12I76 IDGXMAoJkRPNaa5V/hMUqLO7Y3wry5N8c1tgjgQZu6/iGuLf55/4n9u2c+JC/KzVDbIc Rryg== X-Gm-Message-State: AOAM532j6G5ENpNGwmjUzFbLLRDLOMgpARu2WyDwILX073MXscHvytmH qVMH5DbBN39KuxYG5iSEDdGRRX536VY= X-Google-Smtp-Source: ABdhPJwWMz7ODnEKth7YEYpAajCchjvEm7Xfu80AQG3RqGFVusPeNXFhd4sbAtw0KbEU7pfCNiM8xA== X-Received: by 2002:a9d:206c:: with SMTP id n99mr4717411ota.64.1628189874108; Thu, 05 Aug 2021 11:57:54 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:53 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 01/13] net: introduce a new header file include/trace/events/ip.h Date: Thu, 5 Aug 2021 11:57:38 -0700 Message-Id: <20210805185750.4522-2-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Header file include/trace/events/ip.h is introduced to define IP/IPv6 layer tracepoints. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/ip.h | 47 +++++++++++++++++++++++++++++++++++++++ net/core/net-traces.c | 1 + 2 files changed, 48 insertions(+) create mode 100644 include/trace/events/ip.h diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h new file mode 100644 index 000000000000..008f821ebc50 --- /dev/null +++ b/include/trace/events/ip.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM ip + +#if !defined(_TRACE_IP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_IP_H + +#include +#include +#include +#include +#include +#include + +#define TP_STORE_V4MAPPED(__entry, saddr, daddr) \ + do { \ + struct in6_addr *pin6; \ + \ + pin6 = (struct in6_addr *)__entry->saddr_v6; \ + ipv6_addr_set_v4mapped(saddr, pin6); \ + pin6 = (struct in6_addr *)__entry->daddr_v6; \ + ipv6_addr_set_v4mapped(daddr, pin6); \ + } while (0) + +#if IS_ENABLED(CONFIG_IPV6) +#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \ + do { \ + if (sk->sk_family == AF_INET6) { \ + struct in6_addr *pin6; \ + \ + pin6 = (struct in6_addr *)__entry->saddr_v6; \ + *pin6 = saddr6; \ + pin6 = (struct in6_addr *)__entry->daddr_v6; \ + *pin6 = daddr6; \ + } else { \ + TP_STORE_V4MAPPED(__entry, saddr, daddr); \ + } \ + } while (0) +#else +#define TP_STORE_ADDRS(__entry, saddr, daddr, saddr6, daddr6) \ + TP_STORE_V4MAPPED(__entry, saddr, daddr) +#endif + +#endif /* _TRACE_IP_H */ + +/* This part must be outside protection */ +#include diff --git a/net/core/net-traces.c b/net/core/net-traces.c index c40cd8dd75c7..e1bd46076ad0 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -35,6 +35,7 @@ #include #include #include +#include #if IS_ENABLED(CONFIG_BRIDGE) #include EXPORT_TRACEPOINT_SYMBOL_GPL(br_fdb_add); From patchwork Thu Aug 5 18:57:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EAB7C4338F for ; Thu, 5 Aug 2021 18:58:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5BA1E60F42 for ; Thu, 5 Aug 2021 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241893AbhHES6N (ORCPT ); Thu, 5 Aug 2021 14:58:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241866AbhHES6L (ORCPT ); Thu, 5 Aug 2021 14:58:11 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D27C0613D5 for ; Thu, 5 Aug 2021 11:57:56 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id v8-20020a0568301bc8b02904d5b4e5ca3aso6148691ota.13 for ; Thu, 05 Aug 2021 11:57:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6kT6Vk2sprR6tKH7a6ctkmsP8co54EU62v99qfPXUNQ=; b=KUJwPCbniDvY5WKL7bjZ5L+6JhmrplMy61KVPoW8kJKGbWzSU1z1ph+BwELAXz8uMG yPA6udV25RLamSjOqI0Fews2kPAQTaA7YeIoHkTCTIv4WYNr16iCx5wQAwvkawLGUS3S TqGUzhVivDM0PC2fcG63KzwkhAdD4e8R2XBu9VPvbO0rLA/SREduA1YfRgWpyidJX5+2 dm4Fe1VssnLWi9BqPK1l7ACho0ZYT6RN+UnYJe9mQG8RIwwjnBPfrTJLGIQSFM1N1QZh hXOZiTgcftmP1KvMOKpd2WVEPmsuf0vTGzlpsqxyqLy+VQLW9DlHAtuQYZ09DnjY+Hdn OaTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6kT6Vk2sprR6tKH7a6ctkmsP8co54EU62v99qfPXUNQ=; b=HMsy7qA72Kct071IcwWbLuhX+pntD7t5Bp802Wm2+EyXe9inzN/hAHVncQ9lYbNgW/ decUxYGWj7dNewWqciXeG9EFsOkHMdrv4RuMT7YUBX5pL8FBNavzkYtuJnX/JrRpwg4A sOlbCk0YuXZd4CZ4McCJqQNJv7b/5AjFJ4wYOshHNTwDLhbqb52cxjAySuzKBFhBbkKR 2NLoV+aKGaKP5tPE5Xto5uQyDmlO6WpG+T7/EW4YNRoFBi0lyIQ9xr0DadDdcjQ3HG53 xw8dnMWLSIPZF4g/exdoXY3MjQxI9OlmTdAXVyXfVYtNtL3d4j7fLowHNobX3xXNII/m UraQ== X-Gm-Message-State: AOAM531BOXjESd7QXiKX7Z3r8XzM7q6Rc5xPSvQkcvJYK4ZTGDBYihS6 11Nks4E0Jc/3fIeuPXstxN/X7RkSvX4= X-Google-Smtp-Source: ABdhPJw6kZDFSIDLG/PrYGmrCQAwI1DPfvWNZ1jnMxW8s3/e8EMhGEl4acNG0jMqtjUvmBpAzWFmRQ== X-Received: by 2002:a9d:eed:: with SMTP id 100mr4951820otj.50.1628189875751; Thu, 05 Aug 2021 11:57:55 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:55 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 02/13] ipv4: introduce tracepoint trace_ip_queue_xmit() Date: Thu, 5 Aug 2021 11:57:39 -0700 Message-Id: <20210805185750.4522-3-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_ip_queue_xmit() is introduced to trace skb at the entrance of IP layer on TX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/ip.h | 42 +++++++++++++++++++++++++++++++++++++++ net/ipv4/ip_output.c | 10 +++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h index 008f821ebc50..553ae7276732 100644 --- a/include/trace/events/ip.h +++ b/include/trace/events/ip.h @@ -41,6 +41,48 @@ TP_STORE_V4MAPPED(__entry, saddr, daddr) #endif +TRACE_EVENT(ip_queue_xmit, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + __field(const void *, skaddr) + __field(__u16, sport) + __field(__u16, dport) + __array(__u8, saddr, 4) + __array(__u8, daddr, 4) + __array(__u8, saddr_v6, 16) + __array(__u8, daddr_v6, 16) + ), + + TP_fast_assign( + struct inet_sock *inet = inet_sk(sk); + __be32 *p32; + + __entry->skbaddr = skb; + __entry->skaddr = sk; + + __entry->sport = ntohs(inet->inet_sport); + __entry->dport = ntohs(inet->inet_dport); + + 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); + ), + + TP_printk("sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c skbaddr=%px", + __entry->sport, __entry->dport, __entry->saddr, __entry->daddr, + __entry->saddr_v6, __entry->daddr_v6, __entry->skbaddr) +); + #endif /* _TRACE_IP_H */ /* This part must be outside protection */ diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c index 6b04a88466b2..dcf94059112e 100644 --- a/net/ipv4/ip_output.c +++ b/net/ipv4/ip_output.c @@ -82,6 +82,7 @@ #include #include #include +#include static int ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, @@ -536,7 +537,14 @@ EXPORT_SYMBOL(__ip_queue_xmit); int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl) { - return __ip_queue_xmit(sk, skb, fl, inet_sk(sk)->tos); + int ret; + + ret = __ip_queue_xmit(sk, skb, fl, inet_sk(sk)->tos); + if (!ret) + trace_ip_queue_xmit(sk, skb); + + return ret; + } EXPORT_SYMBOL(ip_queue_xmit); From patchwork Thu Aug 5 18:57:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CFE3C432BE for ; Thu, 5 Aug 2021 18:58:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 130B360F42 for ; Thu, 5 Aug 2021 18:58:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241922AbhHES6P (ORCPT ); Thu, 5 Aug 2021 14:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241061AbhHES6M (ORCPT ); Thu, 5 Aug 2021 14:58:12 -0400 Received: from mail-oo1-xc31.google.com (mail-oo1-xc31.google.com [IPv6:2607:f8b0:4864:20::c31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D14C061765 for ; Thu, 5 Aug 2021 11:57:57 -0700 (PDT) Received: by mail-oo1-xc31.google.com with SMTP id t1-20020a4a54010000b02902638ef0f883so1574324ooa.11 for ; Thu, 05 Aug 2021 11:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=McPiBDHkFlEeo+/bDbhJFKtuMToZTHJqpAeNdBcA7WE=; b=FtYYn0/EXNO9zPob1GSYc2LSUhoIujAjNCKWcalY0Aa9VRAUD+eYIlyii0t6WRKM2x w9wIDwH19yNchkNBVJHmrPs70L2REPnWYyuGCzsTPcI7XiP99I6qWjLgPohzOW38IFDN HmjLogBmtPOeZ3bwv1nUFF4tyPgcHFLObKumgLPm1dFqiTDFJeUgxSEW/xE/+JhwSFz1 iyEBVqKxwpiOVs90nNs1I5fmgDCV/2kDQ07lhsw14HEUCiIUp7tr3S/e3XystttckjNg HkGQb8pN/oaUqMqGekWJU0W/RYlt8I8um8+9Kv4rKAhv6dP8yJHMrLoH1uF34iee7Zhw 8bHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=McPiBDHkFlEeo+/bDbhJFKtuMToZTHJqpAeNdBcA7WE=; b=F4Y30Rg/eKpP0HgrbuOD7kZHNVa6hYdyB3Mf62pEA8caObIxzh1o3fEo8GOQIrm242 n7XAWeX0gKl6mZRJwta+mgIjQF77p7FznD43u/92lDEJisck/sZapHYBVGJdxsBlbOPt GRqh+T6sptI6jKnhLrVaf8IDOGKtivQSPXtp/9soEPzifm8jA3TUrKBY+LJ5VFarfbRp trVhtJMGkHmMctDWWkDnM1GAb1A1vX5pawnU3L3gKieP9iv4bZT1ftutyisDosyEO3n9 aDsy6Sj0COWbczExXjgjL2o2VwGab1EAh1y5v7nQW9gHCJ36iD0zTnQIXsR7xnZ3Exo7 RMSQ== X-Gm-Message-State: AOAM530cT0TL1YYs4r9pInnzNt/F5+/AOZeMhbLeg/BV6ooHXJUrp14m AYsdz2y0GzlWgPiEjiUW4L62aRU2wT8= X-Google-Smtp-Source: ABdhPJzBDFqQS/AacMf4L02mHdvy6sYJN5r0OOTjR9UxBYK5OHuk7XIcnk51zkfWXKg1auOBjCFyLg== X-Received: by 2002:a4a:4c55:: with SMTP id a82mr4380273oob.66.1628189876814; Thu, 05 Aug 2021 11:57:56 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:56 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 03/13] tcp: introduce tracepoint trace_tcp_transmit_skb() Date: Thu, 5 Aug 2021 11:57:40 -0700 Message-Id: <20210805185750.4522-4-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_tcp_transmit_skb() is introduced to trace skb at the exit of TCP layer on TX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/tcp.h | 11 +++++++++-- net/ipv4/tcp_output.c | 8 +++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 521059d8dc0a..6147528d93ba 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -88,11 +88,18 @@ DECLARE_EVENT_CLASS(tcp_event_sk_skb, sk->sk_v6_rcv_saddr, sk->sk_v6_daddr); ), - TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s", + TP_printk("family=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c state=%s skbaddr=%px", show_family_name(__entry->family), __entry->sport, __entry->dport, __entry->saddr, __entry->daddr, __entry->saddr_v6, __entry->daddr_v6, - show_tcp_state_name(__entry->state)) + show_tcp_state_name(__entry->state), __entry->skbaddr) +); + +DEFINE_EVENT(tcp_event_sk_skb, tcp_transmit_skb, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb) ); DEFINE_EVENT(tcp_event_sk_skb, tcp_retransmit_skb, diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 29553fce8502..628b28332851 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -1420,8 +1420,14 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, gfp_t gfp_mask) { - return __tcp_transmit_skb(sk, skb, clone_it, gfp_mask, + int ret; + + ret = __tcp_transmit_skb(sk, skb, clone_it, gfp_mask, tcp_sk(sk)->rcv_nxt); + if (!ret) + trace_tcp_transmit_skb(sk, skb); + return ret; + } /* This routine just queues the buffer for sending. From patchwork Thu Aug 5 18:57:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D002FC4338F for ; Thu, 5 Aug 2021 18:58:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A933860EE9 for ; Thu, 5 Aug 2021 18:58:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241061AbhHES6S (ORCPT ); Thu, 5 Aug 2021 14:58:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241866AbhHES6O (ORCPT ); Thu, 5 Aug 2021 14:58:14 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2910C06179A for ; Thu, 5 Aug 2021 11:57:58 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id d10-20020a9d4f0a0000b02904f51c5004e3so1814236otl.9 for ; Thu, 05 Aug 2021 11:57:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5gXqt201hXQPzHGNu6FBADW/OpgGLxD/Q2DnkbRCYQs=; b=btL3zEcHti9xHY6bFF3zqG+rClYmeB4FIwPChMnYj17KN58DKmgVyMJoDDjHr4yhCm kwajc6plXcPB/MC1S3b6LsziMfcQfPOsyaiMbK/BjAC8rmciabHRS5CmeSFRUAYlQSDk bs3CrJm1Gom/QbDlyDpX9OCxFRDAvJhjXPvLsbhseW7GA0SvZJojfWQWfkskLfNTvP9E aysi4lovf9vbePeZYsGALx500CetTtW+4nLpWXrhgifFlTE8Ez5dSBd9WTMTBAUwdxZk 4AzCW7HTYm8xCMzOrO2PTfrYCGHkBP4Y+3fzn29WhlcTMfxtZLcTMPiw9xJ3WXSZe30/ gD/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5gXqt201hXQPzHGNu6FBADW/OpgGLxD/Q2DnkbRCYQs=; b=pmEooaaxX3NTd7ULBFg+j2eMMKMAZ74KKw9JKmBO/2lb5Oa88yp+am7pUlxW3ZKYzA OjwISDSdWPKfRXbBQSuyLrnNxAQcaqxZ4E4nyKu7ttDYUmiPkr9i0X1dO6loAbQgmmCd 7G03ywW5NdwEoJ4ws0Bzi10OWtrKGn4p9+hhtEWjty+eWfdGOACARHzmnuU+6grA2snC 8lMiNkIyEQpEbsrYNWwB7WzTcrUqLBsJ1tosVS15YXvoRav7jq9qV6YCOA32V7E7gToq zMWk9ZXDP85N7edaw2YokBvgV4eaSW3Yz82IgoIl5vjPOrCXs7QZKrdarc/j7l8CyqyO o6lQ== X-Gm-Message-State: AOAM533ig3IeVOU3Ine+Uo0BKqGzuGUpZt5wVhdLFej+6QlNOoo/+P7w tMxYvjzgJ85NkE4bkjZ9ks2B+2D+Tx0= X-Google-Smtp-Source: ABdhPJxdF86KmgBFU0b2g3TfaPv9PtSts+bYnalBB9PU8Nb/s69EG/Za2ZbEqaPiR/hk7cEcZNDCSg== X-Received: by 2002:a05:6830:3113:: with SMTP id b19mr4767289ots.152.1628189877849; Thu, 05 Aug 2021 11:57:57 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:57 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 04/13] udp: introduce tracepoint trace_udp_send_skb() Date: Thu, 5 Aug 2021 11:57:41 -0700 Message-Id: <20210805185750.4522-5-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_udp_send_skb() is introduced to trace skb at the exit of UDP layer on TX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/udp.h | 19 +++++++++++++++++++ net/ipv4/udp.c | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h index 336fe272889f..7babc1a11693 100644 --- a/include/trace/events/udp.h +++ b/include/trace/events/udp.h @@ -27,6 +27,25 @@ TRACE_EVENT(udp_fail_queue_rcv_skb, TP_printk("rc=%d port=%hu", __entry->rc, __entry->lport) ); +TRACE_EVENT(udp_send_skb, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb), + + TP_STRUCT__entry( + __field(const void *, skaddr) + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skaddr = sk; + __entry->skbaddr = skb; + ), + + TP_printk("skaddr=%px, skbaddr=%px", __entry->skaddr, __entry->skbaddr) +); + #endif /* _TRACE_UDP_H */ /* This part must be outside protection */ diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 1a742b710e54..daa618465a1d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -970,9 +970,11 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4, UDP_MIB_SNDBUFERRORS, is_udplite); err = 0; } - } else + } else { UDP_INC_STATS(sock_net(sk), UDP_MIB_OUTDATAGRAMS, is_udplite); + trace_udp_send_skb(sk, skb); + } return err; } From patchwork Thu Aug 5 18:57:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CD2C432BE for ; Thu, 5 Aug 2021 18:58:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D71A960F58 for ; Thu, 5 Aug 2021 18:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241882AbhHES6T (ORCPT ); Thu, 5 Aug 2021 14:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241878AbhHES6P (ORCPT ); Thu, 5 Aug 2021 14:58:15 -0400 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90104C06179C for ; Thu, 5 Aug 2021 11:57:59 -0700 (PDT) Received: by mail-oo1-xc2d.google.com with SMTP id 13-20020a4ae1ad0000b029024b19a4d98eso1586894ooy.5 for ; Thu, 05 Aug 2021 11:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Er+z0V/78NtCvK3pvfWA7OY3Y0ErSPtfUBuSQfWUBy4=; b=Yo3gz8BHOlbKfCzNggFthMBzBqj4KE7ZuqBdT0BMfjEla3GtOGZjT7cmHEmNlQZC7N 2pkxId5RatKY92R306cUZkRxGqSRKu1TP0e3iKnC2TO6SLHmBzYnhlsiX5AwpwePV7FK 1S7pIPPybc9yThCyREmhpDMUC4HBtLh8drkPbeyvCvGUQDdsEgMIG0UV5r5XsTfZE8ET U5Ksa+6LLX9h1R2BWfkboDvtyeLp7FbVPLnAHtwROA5f6uMyB20/VBRl3df2fJYiCGLy rBJzLpx3WiuJK3hHbnebHXZZZTmBIzdIbBLdPGtce/4rNTxM+Mfvu/xjoaxsu2Bzp2Q/ ZTIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Er+z0V/78NtCvK3pvfWA7OY3Y0ErSPtfUBuSQfWUBy4=; b=nRh10/Z5WsVEreXsVl4r3ZoyksSi/S0UEyfsSJHvhcifqogM2aht9k7ijUJvahi0X4 Qn5fz8Jw0rEyFL0PbyleQQ/zt+1PbvhakhW7pujLv759o9xf73mf/2+YJAiar8IcF/fD ATUV4HwdqTVCdwO/uQxHApOPorbAvNWf/iKnUSSMA0b+0ByyJZm7FmzAl6sBShY7hzKH f5agS7Iiyi2Kq20KIzFWx7mSmB0ubVnp0Ia59UZeZRtYBxmzdIToWIxkFECZaHQphZaQ XyuTkIHX1MZMqrztiui5w2iNZd1uk/HzXurcngjp3/6kJymg28qpD0hePSsIz8G5UKU2 AoVQ== X-Gm-Message-State: AOAM532HouwEp3YdoeN5tM4sTYTQpDRLCXtGCi2PpUFVYCwusTo/6vsl qmHcdP/4xTfQa1Ns1rptooSQLyptEwk= X-Google-Smtp-Source: ABdhPJyYzEEY+OJUzeNcpDc59JwjHwA3XTZeo47Oezp3CAyaP7Q7cp9xLT7A9S3A52/x3NjrE5OPug== X-Received: by 2002:a4a:e703:: with SMTP id y3mr4348002oou.24.1628189878741; Thu, 05 Aug 2021 11:57:58 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:58 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 05/13] udp: introduce tracepoint trace_udp_v6_send_skb() Date: Thu, 5 Aug 2021 11:57:42 -0700 Message-Id: <20210805185750.4522-6-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_udp_v6_send_skb() is introduced to trace skb at the exit of UDPv6 layer on TX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/udp.h | 21 +++++++++++++++++++++ net/core/net-traces.c | 3 +++ net/ipv6/udp.c | 2 ++ 3 files changed, 26 insertions(+) diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h index 7babc1a11693..6af4b402237a 100644 --- a/include/trace/events/udp.h +++ b/include/trace/events/udp.h @@ -46,6 +46,27 @@ TRACE_EVENT(udp_send_skb, TP_printk("skaddr=%px, skbaddr=%px", __entry->skaddr, __entry->skbaddr) ); +#if IS_ENABLED(CONFIG_IPV6) +TRACE_EVENT(udp_v6_send_skb, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb), + + TP_STRUCT__entry( + __field(const void *, skaddr) + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skaddr = sk; + __entry->skbaddr = skb; + ), + + TP_printk("skaddr=%px, skbaddr=%px", __entry->skaddr, __entry->skbaddr) +); +#endif + #endif /* _TRACE_UDP_H */ /* This part must be outside protection */ diff --git a/net/core/net-traces.c b/net/core/net-traces.c index e1bd46076ad0..0aca299dfb55 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -62,3 +62,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(napi_poll); EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset); EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); +#if IS_ENABLED(CONFIG_IPV6) +EXPORT_TRACEPOINT_SYMBOL_GPL(udp_v6_send_skb); +#endif diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index c5e15e94bb00..84895ca40e5c 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -52,6 +52,7 @@ #include #include #include +#include #include "udp_impl.h" static u32 udp6_ehashfn(const struct net *net, @@ -1255,6 +1256,7 @@ static int udp_v6_send_skb(struct sk_buff *skb, struct flowi6 *fl6, } else { UDP6_INC_STATS(sock_net(sk), UDP_MIB_OUTDATAGRAMS, is_udplite); + trace_udp_v6_send_skb(sk, skb); } return err; } From patchwork Thu Aug 5 18:57:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B73FBC4338F for ; Thu, 5 Aug 2021 18:58:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D0DB60F01 for ; Thu, 5 Aug 2021 18:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241966AbhHES6U (ORCPT ); Thu, 5 Aug 2021 14:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241874AbhHES6P (ORCPT ); Thu, 5 Aug 2021 14:58:15 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85A58C061765 for ; Thu, 5 Aug 2021 11:58:00 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id g5-20020a9d6b050000b02904f21e977c3eso6198144otp.5 for ; Thu, 05 Aug 2021 11:58:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f9xNd5eeH//uZK4rdGG0Bkb7evn7uqrFuY6PgG+WyoA=; b=uG0MUaokP1mOWoOw5+u2f657Wq7I6C3aP3Dt2HxjIVN55vW8jJnUe9NDW+Ws5KEcJ1 b9IgIAzZA/9iVJ0xanW3vCEwgdi+Ua40CwhEEm/thAGY8mlT0r0nZm7EBCRMkI8SoEfz YOJGHegJhXjp2F8aq6X+I2wHGYjg9Gl9DQpQ5hua0jcGop7qpuCK5a53wsT9tWX78aXo mSApIM/KHv7WvoxKGIK0L9ivwiyJB+FT2ejbsvcnSowR7xE9fbMxnDViu5UwC3jR1zDr VgA4UPbJm3Dy52I0+3AEqqHI8k/mIfcpvY6pV2xpZiXzZ/gt1zL5L7EFN+bWss5QHXYY 53fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f9xNd5eeH//uZK4rdGG0Bkb7evn7uqrFuY6PgG+WyoA=; b=G+d0lBH1hTO0uEKubvmZLQ4TZv4UrCOk0Pm0wqr4W9Wh8eRpHVNmK9CalHRCJKI9Ed WKAdaNOI3KEqVitN1IMF8tjFZigMcoGbUCDi23d6FiJf9VwEgLL9ufG+U4ZMwYlVGtSu OOwJKV/9e1qJFZnc1XkGEA8hSXMM2dhYP9ygWtt8SuL14d23lJx1jYJOa1nLpAjyYOtA 76ciRW30lmlAlnbA4Toa863Krvi3ZomJoD4xNIr/dBHe24TJvBOc74WN2Z8Oc/LlI1k+ be9PXT55wa21lcSuseYCA8EPUOtEsgUOi/GujqpnF9hthipZF4lJGPvPUkrWjHdpx5ej 8aQw== X-Gm-Message-State: AOAM530g177/46ueya1YOwzdKGZb7nG5UqVO+VV3PnDcpOaVGGMzQW+L koROiZCzt+ZN4dpolKV+KPEQ9yG4FoU= X-Google-Smtp-Source: ABdhPJyAD9IqL1Cxf8X3dUioenrzcM4BOZ/hGxi6T/AftevlskBPGMl0XB2pCWgSv8J68FB0lrKSag== X-Received: by 2002:a05:6830:150e:: with SMTP id k14mr4852874otp.351.1628189879752; Thu, 05 Aug 2021 11:57:59 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:57:59 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 06/13] ipv4: introduce tracepoint trace_ip_rcv() Date: Thu, 5 Aug 2021 11:57:43 -0700 Message-Id: <20210805185750.4522-7-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_ip_rcv() is introduced to trace skb at the entrance of IP layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/ip.h | 16 ++++++++++++++++ net/ipv4/ip_input.c | 2 ++ 2 files changed, 18 insertions(+) diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h index 553ae7276732..20ee1a81405c 100644 --- a/include/trace/events/ip.h +++ b/include/trace/events/ip.h @@ -83,6 +83,22 @@ TRACE_EVENT(ip_queue_xmit, __entry->saddr_v6, __entry->daddr_v6, __entry->skbaddr) ); +TRACE_EVENT(ip_rcv, + TP_PROTO(const struct sk_buff *skb), + + TP_ARGS(skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skbaddr = skb; + ), + + TP_printk("skbaddr=%px", __entry->skbaddr) +); + #endif /* _TRACE_IP_H */ /* This part must be outside protection */ diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 3a025c011971..2eb7a0cbc0d3 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -141,6 +141,7 @@ #include #include #include +#include /* * Process Router Attention IP option (RFC 2113) @@ -400,6 +401,7 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk, goto drop; } + trace_ip_rcv(skb); return NET_RX_SUCCESS; drop: From patchwork Thu Aug 5 18:57:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8DD5C432BE for ; Thu, 5 Aug 2021 18:58:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BDFCC60EE9 for ; Thu, 5 Aug 2021 18:58:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241996AbhHES6W (ORCPT ); Thu, 5 Aug 2021 14:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241923AbhHES6Q (ORCPT ); Thu, 5 Aug 2021 14:58:16 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BA30C06179F for ; Thu, 5 Aug 2021 11:58:01 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id w6so8665087oiv.11 for ; Thu, 05 Aug 2021 11:58:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uHLR0MavhDSaNhIg+Yt96bJSeYOMhkrDg2qD+caZse0=; b=kuxIx4Ia71vnyH30uqBRVt1/WNq8KzYvh04IeOG3IgJKE+XPncgeT0Fj1HJ3rNXZ0J nUGcvT7xNzbxpDqvZCDvhKTakyI+EMgr1pwA63Usjv1P7QktaF03XCNvqahXtkut0BJx gs03bc9M6fTMaTX+2/M2A5UT3DgPGpMjW2UM9UpQ3O9gcfFyrwOOwBsGC0xHML8vUjy3 22wFAw0SS6UIMmaiivm3pYLXuopGfS2yGE7Sf6mJpcfTxfuXU1bDzcPYWB79bTwUm+EQ SwXkPfmeHCvOCB8FP6lTXLhhOMSTsiaIlhycGFtMIZ5qr1VjhyfuoqUcAID0VhiklpuW UAtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uHLR0MavhDSaNhIg+Yt96bJSeYOMhkrDg2qD+caZse0=; b=BtyByI5fkzkWOqowJfEIzoJUmkz0kSdyNM3u3w0VpVFUa4p7VGAzvsCJ7A+jv32g+8 edXD0LPF838TBirD/RW5Df8mGgxF7ujlmZRFSS0hIujqpTLiA0JP7QZoAeOUTvjWnjDL M9Pm3UT6b8RxacDDFsCiHad0ml4/NBqAwJXDwmSwlJsbdhXaISUFYrJpYXdEoVbNz/5r 1fxNYYx4buKuVI15YEgt7yfY1pguVM9LShRYpy/VLUH4T3ff1phlmU5lUZLuCEdFdHfO Zqn4bVARSCyQD0HjKDSRCXd8aAVAqSr9YZUjhP+qscJeHNqXbstUK9k/Yx+Jyftgdctg 7xNQ== X-Gm-Message-State: AOAM530ZKNf3/grL5J/CfYYhmM3ipsmOdLXTxwhWuBe7eiVQ5PeAbqHa OaOQ032+TMRRzrAyCLpgvC7JA1UovwA= X-Google-Smtp-Source: ABdhPJyprhj1I92oNj+V9Q53k7sYbbG1OXJOTvWpkA+cSlvxA5h07yQTUlIhmFDYBeR4eX/s4o/XYw== X-Received: by 2002:a05:6808:bd2:: with SMTP id o18mr4877554oik.20.1628189880647; Thu, 05 Aug 2021 11:58:00 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.57.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:00 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 07/13] ipv6: introduce tracepoint trace_ipv6_rcv() Date: Thu, 5 Aug 2021 11:57:44 -0700 Message-Id: <20210805185750.4522-8-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_ipv6_rcv() is introduced to trace skb at the entrance of IPv6 layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/ip.h | 18 ++++++++++++++++++ net/core/net-traces.c | 1 + net/ipv6/ip6_input.c | 5 ++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h index 20ee1a81405c..6cd0907728ce 100644 --- a/include/trace/events/ip.h +++ b/include/trace/events/ip.h @@ -99,6 +99,24 @@ TRACE_EVENT(ip_rcv, TP_printk("skbaddr=%px", __entry->skbaddr) ); +#if IS_ENABLED(CONFIG_IPV6) +TRACE_EVENT(ipv6_rcv, + TP_PROTO(const struct sk_buff *skb), + + TP_ARGS(skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skbaddr = skb; + ), + + TP_printk("skbaddr=%px", __entry->skbaddr) +); +#endif + #endif /* _TRACE_IP_H */ /* This part must be outside protection */ diff --git a/net/core/net-traces.c b/net/core/net-traces.c index 0aca299dfb55..de5a13ae933c 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -64,4 +64,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_send_reset); EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); #if IS_ENABLED(CONFIG_IPV6) EXPORT_TRACEPOINT_SYMBOL_GPL(udp_v6_send_skb); +EXPORT_TRACEPOINT_SYMBOL_GPL(ipv6_rcv); #endif diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index 80256717868e..8ce23ef5f011 100644 --- a/net/ipv6/ip6_input.c +++ b/net/ipv6/ip6_input.c @@ -44,6 +44,7 @@ #include #include #include +#include INDIRECT_CALLABLE_DECLARE(void tcp_v6_early_demux(struct sk_buff *)); static void ip6_rcv_finish_core(struct net *net, struct sock *sk, @@ -59,8 +60,10 @@ static void ip6_rcv_finish_core(struct net *net, struct sock *sk, INDIRECT_CALL_2(edemux, tcp_v6_early_demux, udp_v6_early_demux, skb); } - if (!skb_valid_dst(skb)) + if (!skb_valid_dst(skb)) { + trace_ipv6_rcv(skb); ip6_route_input(skb); + } } int ip6_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) From patchwork Thu Aug 5 18:57:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492682 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2CBDC4338F for ; Thu, 5 Aug 2021 18:58:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 98A3360EE9 for ; Thu, 5 Aug 2021 18:58:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242015AbhHES6X (ORCPT ); Thu, 5 Aug 2021 14:58:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241889AbhHES6R (ORCPT ); Thu, 5 Aug 2021 14:58:17 -0400 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47855C0617A3 for ; Thu, 5 Aug 2021 11:58:02 -0700 (PDT) Received: by mail-ot1-x32a.google.com with SMTP id f20-20020a9d6c140000b02904bb9756274cso6201918otq.6 for ; Thu, 05 Aug 2021 11:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3NDv+2mkKlSB+W/MaDynaGijbuMKowO0Dp3HF5S/4+Y=; b=GsM45pdYOR2O9617KOLK5xeKEBAJYLFbA5Lu6DlxDfa9w0PhjZtNMHFJcgqSGAOnnt 6Cp4h7hSXyGCHvmzodP8arOaByohsS+wOxD5btYqedZbn3L6M3qnmhFhoRQbF83JOqps 9aRltHXr29frrxLy+YdtoadEeIydfVd/4RKD0D3ijICv/prCHd5H2BRplxQoJt6/LLx0 FthtaSPlshxQlcbdg+e7YNkaxiik6/clvU/2rUz2xtjG7h1F2naFtFRXP2JlYOkWaG8O FmqeCZeSRAeNiOLBaJXCVNUe4SzW7G1OAXaJipJWJjm1oUAeN9KNKy5yZ9qQXrsPBcQ8 u2Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3NDv+2mkKlSB+W/MaDynaGijbuMKowO0Dp3HF5S/4+Y=; b=YQgjoo7BoDWfnrP6Wwm4CG/PcFW8S/pmUhrjYEmxKoxvsfJrKo2k/FpSWI+fJ8fwD8 /Hfp12aAST2785Kv9b/Xhq2Ab5bpQway913ZeByCgt+pe+35xqU4ASyHqCJ09NQwInMP XpXmU15Ol4KyQUezi+RJh+ohaFus/eKs4FAgU+PDP8oDPzWtd4yAoOsWMhHThOW1bwxk wdXSldaebcwcBsi/GWWu7eq6k6nRVN2on0tdLp/2ORRCo2vY24c/m6J9laEpokcgOOG9 MdW/gF6JEahv+WRWHBQJ+4HgK38tdGnBYtgdSSLJ39uhjMp1CC/Az400TDQS+g+WVMJ3 7Kjg== X-Gm-Message-State: AOAM532SsYxEWi2Qu0lLULsybNGiKPN56Uyil1kYrKavuWngYNmL3YDP s26GsUA55toKdc6nP7f5FmBKUT2Nsr8= X-Google-Smtp-Source: ABdhPJwqJadlgsrL8ORkjVJvstrOA1JZpTysudp+/k6/+8qXAQyJ3PP7SS32MdtX2mflOLd0pNJjQg== X-Received: by 2002:a05:6830:b84:: with SMTP id a4mr4661375otv.357.1628189881551; Thu, 05 Aug 2021 11:58:01 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:01 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 08/13] ipv4: introduce tracepoint trace_ip_local_deliver_finish() Date: Thu, 5 Aug 2021 11:57:45 -0700 Message-Id: <20210805185750.4522-9-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_ip_local_deliver_finish() is introduced to trace skb at the exit of IP layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/ip.h | 17 +++++++++++++++++ net/ipv4/ip_input.c | 7 ++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/include/trace/events/ip.h b/include/trace/events/ip.h index 6cd0907728ce..9653bc3c7fa0 100644 --- a/include/trace/events/ip.h +++ b/include/trace/events/ip.h @@ -117,6 +117,23 @@ TRACE_EVENT(ipv6_rcv, ); #endif +TRACE_EVENT(ip_local_deliver_finish, + + TP_PROTO(const struct sk_buff *skb), + + TP_ARGS(skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skbaddr = skb; + ), + + TP_printk("skbaddr=%px", __entry->skbaddr) +); + #endif /* _TRACE_IP_H */ /* This part must be outside protection */ diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 2eb7a0cbc0d3..31c5c6903fff 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c @@ -244,15 +244,20 @@ int ip_local_deliver(struct sk_buff *skb) * Reassemble IP fragments. */ struct net *net = dev_net(skb->dev); + int ret; if (ip_is_fragment(ip_hdr(skb))) { if (ip_defrag(net, skb, IP_DEFRAG_LOCAL_DELIVER)) return 0; } - return NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN, + ret = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_IN, net, NULL, skb, skb->dev, NULL, ip_local_deliver_finish); + if (!ret) + trace_ip_local_deliver_finish(skb); + return ret; + } EXPORT_SYMBOL(ip_local_deliver); From patchwork Thu Aug 5 18:57:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8705C4338F for ; Thu, 5 Aug 2021 18:58:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD99860F01 for ; Thu, 5 Aug 2021 18:58:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241878AbhHES6Y (ORCPT ); Thu, 5 Aug 2021 14:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241899AbhHES6R (ORCPT ); Thu, 5 Aug 2021 14:58:17 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46D91C0617A5 for ; Thu, 5 Aug 2021 11:58:03 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id o185so8650036oih.13 for ; Thu, 05 Aug 2021 11:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DUY4lKwppCJiRHA1jTheA/1frTIkO707O3tPxlgy9nw=; b=gINrXuu5PsHTcbrHVnaX2UnZB3cdCoxzlCivJ+OXOgD1K6SfPBm8Ucnjsb/u5RMVdo 71G+AwgrUrFrO/pSMF3CVn6BS7f/pccKH7tyfjgxpZEcIKJa+vG93JnsRfHZFKYsHDWV y5MaxINlLpICA9249ZDe4AFN5xQbZDHDKXMRNgXdZSYQ4C0nGm8PtJll6mOs4fJYDqOd 0mVKzvV4ubhDt+pkB/GFnru4vwp0LW0S3QZEOQE/qS/b+56uGqzn/BthQAc+tP89UcZW xqjGIJ2zgcrnwzxsU8rRA+xrWHb4M95Nb/ogavx47zz/19Aqo5o1wcR7/mjyb1lAR23C BXQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=DUY4lKwppCJiRHA1jTheA/1frTIkO707O3tPxlgy9nw=; b=m06DbKmvBZyhcvD+hJ3fTMdC25QG1Je/RgT+mdxxjBHi3FfQia1LhPGD5SlTgeZyxg yVED46mcscZXu1mn5fTntr8yYm9sY8/68sH05kRQ8g/phFQ+a7fZOYN2SKdD2l+nTOKf 7lhjngJe8b6fs4YRpsgGqngwlbn1cTqGPO3bErHgOnnWU22bCt0PkGRTjCNKHW2hq9go vT4fQVZBtCIzEKM+aDCwe19fq+uvlerACjNIkpJ1R+4J44u1lfY7hOWK8fw1GEGN/sT4 f67povuU9JdZSEB9cnTmD8RotIQPY/vY0hiFqCqYth62kCm56o0VWZrD0KnjUYubDT2t 6XeQ== X-Gm-Message-State: AOAM530Oe8lvHfQwT32akW+JGRVdb49Atj82ybPM2G3GzL82sRHefZV2 6s48GB5RLadwGB2VjqwNSKp/hCj/M6M= X-Google-Smtp-Source: ABdhPJyk2ZhWGYIeugzoshqsRhY8SItQic8sIZE+EQohEXyUdRMu0aKLttK4q0It+7bVOuLL/qmG+w== X-Received: by 2002:aca:4e94:: with SMTP id c142mr1869700oib.177.1628189882425; Thu, 05 Aug 2021 11:58:02 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:02 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 09/13] udp: introduce tracepoint trace_udp_rcv() Date: Thu, 5 Aug 2021 11:57:46 -0700 Message-Id: <20210805185750.4522-10-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_udp_rcv() is introduced to trace skb at the entrance of UDP layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/udp.h | 17 +++++++++++++++++ net/ipv4/udp.c | 8 +++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h index 6af4b402237a..5008bdd546e8 100644 --- a/include/trace/events/udp.h +++ b/include/trace/events/udp.h @@ -27,6 +27,23 @@ TRACE_EVENT(udp_fail_queue_rcv_skb, TP_printk("rc=%d port=%hu", __entry->rc, __entry->lport) ); +TRACE_EVENT(udp_rcv, + + TP_PROTO(const struct sk_buff *skb), + + TP_ARGS(skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skbaddr = skb; + ), + + TP_printk("skbaddr=%px", __entry->skbaddr) +); + TRACE_EVENT(udp_send_skb, TP_PROTO(const struct sock *sk, const struct sk_buff *skb), diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index daa618465a1d..4751a8f9acff 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2617,7 +2617,13 @@ int udp_v4_early_demux(struct sk_buff *skb) int udp_rcv(struct sk_buff *skb) { - return __udp4_lib_rcv(skb, &udp_table, IPPROTO_UDP); + int ret; + + ret = __udp4_lib_rcv(skb, &udp_table, IPPROTO_UDP); + if (!ret) + trace_udp_rcv(skb); + return ret; + } void udp_destroy_sock(struct sock *sk) From patchwork Thu Aug 5 18:57:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77729C4320A for ; Thu, 5 Aug 2021 18:58:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D57160EE9 for ; Thu, 5 Aug 2021 18:58:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241905AbhHES60 (ORCPT ); Thu, 5 Aug 2021 14:58:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241934AbhHES6T (ORCPT ); Thu, 5 Aug 2021 14:58:19 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F027C061765 for ; Thu, 5 Aug 2021 11:58:04 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id g5-20020a9d6b050000b02904f21e977c3eso6198328otp.5 for ; Thu, 05 Aug 2021 11:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JhVNFKHX7KCG3m9GzU5C3V7Q3Qmnfsp2E43288A6Qq4=; b=kc0fKfh5/CRktRiWU20j2YTz1uRfO2nWtNQ0DLN17FbRqkHF+Hw+lk7xHr9ADROpv1 0EK38ySUBRHgd/1pEx5kl53XOBsyebDm8nqEjYPrfbaZcb+D/bnva5H0FKy/j4f+KpEX NtQdjPUlgeojneOkhW7nc23yJVsW083UKVCaoruGu6+lgHvwYfdB9kN5ob/KdLusATmz KTxAkQ27YonnRgFJ5KeFe78IJFBT2Z726xAzYUBhnwlGzJpQEyRHl0dqvQ6Fal8Gb/Zu k7zezSOr05/acdEF3ACIIvjYZnUEj5/JEiB7YQ1XLe52+6UBmUco86H10FJztkiNJMza m0qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JhVNFKHX7KCG3m9GzU5C3V7Q3Qmnfsp2E43288A6Qq4=; b=Md08HCBq97Vf7/u+8cJnVlDjYPi/OPmulAmXFx7+IOFvGE8qnOQt4zC0hIXuzjV+aD GCv/nvdyq87aZMvId+k+fg0m90YUNOEe2f5gq0FAuECB4AVJXCi/luMKh16FxiGng6a5 FBEJqgYt/KU1MqQh0MnBSdKpGjrY18ZmQzJ72Y4nsmQL8U+RJ+yeSi+YAWAdyOfkCzuE adhMKf46P6y/NvlZUfvpxZUeyPgWSCX+jcF/JFBkJZmZ6gtC24fc/UdWUt2I5YuWS2Pz 9b1ORNhVdSXDHb+/Ty12lHozMQv+uo4JSIH/TIqIYxlRz0yP2dcN190Txj1XqSEyXsVD 2XXg== X-Gm-Message-State: AOAM533Nzc8EkqWpdOznXfNhOmyZ0q46Zi9b0g5U/IXPqtm+iWkPplnb fyqKB2pGBRcys3dWSAy+A7VAYAdc7TQ= X-Google-Smtp-Source: ABdhPJy9vfWNuFpMbHGsUfGlEQuCzG3ARjPY2TX9rejuM+aWOX1S9I0jnsQD3P6nl3DariEcy2Rd6Q== X-Received: by 2002:a9d:6b1a:: with SMTP id g26mr4881352otp.96.1628189883373; Thu, 05 Aug 2021 11:58:03 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:02 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 10/13] ipv6: introduce tracepoint trace_udpv6_rcv() Date: Thu, 5 Aug 2021 11:57:47 -0700 Message-Id: <20210805185750.4522-11-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_udpv6_rcv() is introduced to trace skb at the entrance of UDPv6 layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/udp.h | 17 +++++++++++++++++ net/core/net-traces.c | 1 + net/ipv6/udp.c | 7 ++++++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/include/trace/events/udp.h b/include/trace/events/udp.h index 5008bdd546e8..01e026a3f542 100644 --- a/include/trace/events/udp.h +++ b/include/trace/events/udp.h @@ -82,6 +82,23 @@ TRACE_EVENT(udp_v6_send_skb, TP_printk("skaddr=%px, skbaddr=%px", __entry->skaddr, __entry->skbaddr) ); + +TRACE_EVENT(udpv6_rcv, + + TP_PROTO(const struct sk_buff *skb), + + TP_ARGS(skb), + + TP_STRUCT__entry( + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skbaddr = skb; + ), + + TP_printk("skbaddr=%px", __entry->skbaddr) +); #endif #endif /* _TRACE_UDP_H */ diff --git a/net/core/net-traces.c b/net/core/net-traces.c index de5a13ae933c..83df315708ba 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -65,4 +65,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); #if IS_ENABLED(CONFIG_IPV6) EXPORT_TRACEPOINT_SYMBOL_GPL(udp_v6_send_skb); EXPORT_TRACEPOINT_SYMBOL_GPL(ipv6_rcv); +EXPORT_TRACEPOINT_SYMBOL_GPL(udpv6_rcv); #endif diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 84895ca40e5c..1c8b36fe7218 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1085,7 +1085,12 @@ INDIRECT_CALLABLE_SCOPE void udp_v6_early_demux(struct sk_buff *skb) INDIRECT_CALLABLE_SCOPE int udpv6_rcv(struct sk_buff *skb) { - return __udp6_lib_rcv(skb, &udp_table, IPPROTO_UDP); + int ret; + + ret = __udp6_lib_rcv(skb, &udp_table, IPPROTO_UDP); + if (!ret) + trace_udpv6_rcv(skb); + return ret; } /* From patchwork Thu Aug 5 18:57:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E355AC4338F for ; Thu, 5 Aug 2021 18:58:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5F0860F01 for ; Thu, 5 Aug 2021 18:58:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242089AbhHES61 (ORCPT ); Thu, 5 Aug 2021 14:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241909AbhHES6T (ORCPT ); Thu, 5 Aug 2021 14:58:19 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA14C0613D5 for ; Thu, 5 Aug 2021 11:58:04 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id u25so8699038oiv.5 for ; Thu, 05 Aug 2021 11:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k0oWnw1iEzGMxCm97S2VjsBDNn5HqcZNLXK2S6kEYuc=; b=bcFzV2AicWck3498wHLkQ4LAahxz4vUuDfO/1AEdjppHx8UlCMVIB5pDdWqnVoAsIW l6Lux6H5pMyelGL/0/asyRCWYwvhwwY3+Suud3JOGLusG+LxOleSd1AqKFK3TEJs42ta oU05g1MHkxNylEWz9QACUZvnE5YZcqPsVmYVSKbmn4k7KU2MOmCbeGToAj8rMIpeU4ma PacRiwgSI9hrvYrrgcAkQy1qPUAE2mOyi3MwRNv3ZvRN/ny0x3A3RAWyik/IfNbQVvkm W1fVy55B2bDG3/gDhNFs5KkMcubR1+VYKwnf40y4xq8LqYKKvRdduuucxbTPNxIDogG3 cdZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k0oWnw1iEzGMxCm97S2VjsBDNn5HqcZNLXK2S6kEYuc=; b=BYUzrmG0O7M+ypgzCSnJXGdj3cfNQibeVz6cj4YokaBgQDA/l8Hy8Mg54I6aqe186S xSkdKxhspfZVD2SB0eBhZFx9ZJRGLCb8F0cZ/XJctV0Zr/VfdZpV4HTAqyPWdL0KSnzE CXN8ZsOIXesIY8Eie3VV2HhhMn5kQSWxqK+/uYHOFYwriQIZTfivXbKmMa9wkoIqJ0SX fuJwjQqhQYzN5jRUnsvZ53H+fMAHlR+S7UdqopaQ3tcm6tKe/QBSYo//lj06oeTOyLnT vKfIxVqC6OowD74fE9mkRUSkGfC7t0mq97xeI+44q4s+psgr7YukWMsXsGmcx/WErUcT qqgA== X-Gm-Message-State: AOAM532FtCqp3NQv0P495zR9hzMr9LjotTqbig7odQjYwRlyKBDycIA9 6QRCEUyHC5NQxVczKu/KS4iZXjN1u1E= X-Google-Smtp-Source: ABdhPJz14R3OHwaMBgxymiZxVSm1SuKUYJwvDaKZPW3HBPkV7TmrkvjrNARm4Ripc2QZh9X+bJ1gcQ== X-Received: by 2002:a05:6808:4d0:: with SMTP id a16mr1394030oie.166.1628189884251; Thu, 05 Aug 2021 11:58:04 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:03 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 11/13] tcp: introduce tracepoint trace_tcp_v4_rcv() Date: Thu, 5 Aug 2021 11:57:48 -0700 Message-Id: <20210805185750.4522-12-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_tcp_v4_rcv() is introduced to trace skb at the entrance of TCP layer on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/tcp.h | 7 +++++++ net/ipv4/tcp_ipv4.c | 2 ++ 2 files changed, 9 insertions(+) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index 6147528d93ba..adf84866dee9 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -109,6 +109,13 @@ DEFINE_EVENT(tcp_event_sk_skb, tcp_retransmit_skb, TP_ARGS(sk, skb) ); +DEFINE_EVENT(tcp_event_sk_skb, tcp_v4_rcv, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb) +); + /* * skb of trace_tcp_send_reset is the skb that caused RST. In case of * active reset, skb should be NULL diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 2e62e0d6373a..a0c4aa488659 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -2093,6 +2093,8 @@ int tcp_v4_rcv(struct sk_buff *skb) bh_unlock_sock(sk); if (skb_to_free) __kfree_skb(skb_to_free); + if (!ret) + trace_tcp_v4_rcv(sk, skb); put_and_return: if (refcounted) From patchwork Thu Aug 5 18:57:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 492680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4788BC4338F for ; Thu, 5 Aug 2021 18:58:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 314C360EE9 for ; Thu, 5 Aug 2021 18:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242145AbhHES63 (ORCPT ); Thu, 5 Aug 2021 14:58:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241963AbhHES6U (ORCPT ); Thu, 5 Aug 2021 14:58:20 -0400 Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBC9DC06179B for ; Thu, 5 Aug 2021 11:58:05 -0700 (PDT) Received: by mail-ot1-x333.google.com with SMTP id v24-20020a0568300918b02904f3d10c9742so2825355ott.4 for ; Thu, 05 Aug 2021 11:58:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EgqUcHAG2vGcpdpfUay6hx8j72N34L2yrkDeZsCR+8g=; b=rIBKNd3iR4OCpBzAGkH5S6JawdLLkwwoYcK5YOA7ZPPXUaaCVFQZEgKtRk2nLS9+3w 8UVdd7ol6HOyO3f58zHXcFMk4isI8IMwiDTFPofPnNAk1U+SnRcuVD7XBxUInSLYGa3i ogJ+XNyzum6/mi9po8tJ73x6sRk2NzYe0qWOl7aVBmEnbaDHh5ANC6nJp+VvsS2ms9gK FPyais9JW0+9av1chGcYKbyrZqtmDHpmIKNShglR+p+XcaW5pvNaWNTblz27W7X1OBEz iqA8UVSWcyevBlDSz7FIgWzI24M4kA1L9quj0CpqsOYBRSs3EhpKSWELQBDLDjO1NZ4w m8jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EgqUcHAG2vGcpdpfUay6hx8j72N34L2yrkDeZsCR+8g=; b=P17wOBecHydwpw+UPJB0Wl4ER4N3I/mn87AVWspXcwPQPggonYy+ed4zVAE41Iwnc3 kILKbVoOmo4+FLtf4bIQ0DWKfNvBFP29h/+yrwQco2o3CoSAR0CGNf74Bcq6sflNU8B0 Gh6ETULUFkHOg4HEBveE1CILRA58Gg9W2smJWkA8FuW+dytImGg4FMTa38LeD0E7S3zZ 0asay0ATarO17D2pn6PX9OBXt+LCBCZdBycu+9Jj8/oV48OK2M/+bT3GJS5dcnCbQ6a1 YDScjCzncWdgnp9klAxdCzvR6c26cJf0QcKvWWdTLIxMcJFw8gkLq4nqPvXD3StiQb2Z B74Q== X-Gm-Message-State: AOAM530A5gPY7WpqRQiSztA6j9CE58Ztngr3UwHJw5QdcyFVPxIb7QaU gaSgW4CO0KEg6pTEuGS3Ld80r1egzU0= X-Google-Smtp-Source: ABdhPJxjQmGYINWWR+9NB5HoR4duuCb3QnFoiNis8vpbKNkwD24usAaS6OCjJu0tl9skTwdfYYJNYQ== X-Received: by 2002:a9d:6a93:: with SMTP id l19mr2448355otq.252.1628189885081; Thu, 05 Aug 2021 11:58:05 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:04 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 12/13] ipv6: introduce tracepoint trace_tcp_v6_rcv() Date: Thu, 5 Aug 2021 11:57:49 -0700 Message-Id: <20210805185750.4522-13-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_tcp_v6_rcv() is introduced to trace skb at the entrance of TCPv6 on RX side. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/tcp.h | 9 +++++++++ net/core/net-traces.c | 1 + net/ipv6/tcp_ipv6.c | 3 +++ 3 files changed, 13 insertions(+) diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h index adf84866dee9..f788ac43c4bf 100644 --- a/include/trace/events/tcp.h +++ b/include/trace/events/tcp.h @@ -116,6 +116,15 @@ DEFINE_EVENT(tcp_event_sk_skb, tcp_v4_rcv, TP_ARGS(sk, skb) ); +#if IS_ENABLED(CONFIG_IPV6) +DEFINE_EVENT(tcp_event_sk_skb, tcp_v6_rcv, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb) +); +#endif + /* * skb of trace_tcp_send_reset is the skb that caused RST. In case of * active reset, skb should be NULL diff --git a/net/core/net-traces.c b/net/core/net-traces.c index 83df315708ba..e0840efe479a 100644 --- a/net/core/net-traces.c +++ b/net/core/net-traces.c @@ -66,4 +66,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_bad_csum); EXPORT_TRACEPOINT_SYMBOL_GPL(udp_v6_send_skb); EXPORT_TRACEPOINT_SYMBOL_GPL(ipv6_rcv); EXPORT_TRACEPOINT_SYMBOL_GPL(udpv6_rcv); +EXPORT_TRACEPOINT_SYMBOL_GPL(tcp_v6_rcv); #endif diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 0ce52d46e4f8..eb9586d798b7 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -1765,6 +1765,9 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb) bh_unlock_sock(sk); if (skb_to_free) __kfree_skb(skb_to_free); + if (!ret) + trace_tcp_v6_rcv(sk, skb); + put_and_return: if (refcounted) sock_put(sk); From patchwork Thu Aug 5 18:57:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cong Wang X-Patchwork-Id: 493246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E87EC4320A for ; Thu, 5 Aug 2021 18:58:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 386A360EE9 for ; Thu, 5 Aug 2021 18:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241947AbhHES6a (ORCPT ); Thu, 5 Aug 2021 14:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241976AbhHES6V (ORCPT ); Thu, 5 Aug 2021 14:58:21 -0400 Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA216C06179C for ; Thu, 5 Aug 2021 11:58:06 -0700 (PDT) Received: by mail-ot1-x336.google.com with SMTP id x15-20020a05683000cfb02904d1f8b9db81so6165500oto.12 for ; Thu, 05 Aug 2021 11:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TfANmzxuxCY2gvVM/g2uHx9GgAPY4q4Zm0u5kvWrtVE=; b=qiom+Gue2FS4mIZMbZPuH6HG899nTXv0Tvb0mP82YiFve1hUd4znCCg0VQ+zloUC61 cZk53WupcbWo0rMy1lm9CC7A8T7GmQVeFM9knFs+QAkYVm25m/lB8wV6PGNyJep6I/RL AvRgBeWksrOL9wuoyLCA+44BBlt6ijZhq8uAxVXhY7HKlQRO0caqb1lTC6qi7fd/iYlM 4xqUVi9n9FMtECg0pF98cZVGjbZ6wcNm399+MEyePRifC9EUifuwl1PA4eRLBIZD5VLS GcF2lghXsHOiUf8cHR/ojSkyej9XMK5Uytpd5WqKX1VGUbX/WNTjr4Ht9e5EyXwlu6k7 RlWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TfANmzxuxCY2gvVM/g2uHx9GgAPY4q4Zm0u5kvWrtVE=; b=KE/xhVL023PEuHAw77QggyxyaZie/AO77i9EnVYlRsSnw67dAerLLX2kb3BkznZIzC OMEqqJn8TmFu/af3zCxUM/TCXWvDZmNmcbUqvrBoVFkmTlp7EtFxKs/Kn7wjb9876Enf HvgR0+4Coz5NjvUrqkWM5xl69gZ/JeoBB7PoCciL816NgXQEMHQOszQ+9DJLazjxG62A cjJnAKl2CQaffItdZm1yl/DIt9/mJ7objz1zndUBMSu/5AGjYUInnqAP8PBqQAsjNo5P WBRo+jj54+phjL30okLMSw/aCe6ebAp5WqQyzN5ypiEGZ5x7XVh/X/bqjvV/h2FZWnGz mQyw== X-Gm-Message-State: AOAM530OIyIXgu6ViT2UadNypnhs+ht7FbU3JtAv5Oew1Q1pzIgQAn+d bT1InBSXiekpy3qkVzmJkN8XQ3cOEqM= X-Google-Smtp-Source: ABdhPJyUH6p3ypu0Ow/W/piO27aKavA0yS+cPHnJOphWnvv0ZRuMnyHneMh8gdTyqipT+rfNrEdB8g== X-Received: by 2002:a05:6830:278b:: with SMTP id x11mr4954674otu.146.1628189885946; Thu, 05 Aug 2021 11:58:05 -0700 (PDT) Received: from unknown.attlocal.net ([2600:1700:65a0:ab60:c64b:2366:2e53:c024]) by smtp.gmail.com with ESMTPSA id r5sm358678otk.71.2021.08.05.11.58.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Aug 2021 11:58:05 -0700 (PDT) From: Cong Wang To: netdev@vger.kernel.org Cc: Qitao Xu , Cong Wang Subject: [Patch net-next 13/13] sock: introduce tracepoint trace_sk_data_ready() Date: Thu, 5 Aug 2021 11:57:50 -0700 Message-Id: <20210805185750.4522-14-xiyou.wangcong@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com> References: <20210805185750.4522-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Qitao Xu Tracepoint trace_sk_data_ready is introduced to trace skb at exit of socket layer on RX side. Here we only implement it for UDP and TCP. Reviewed-by: Cong Wang Signed-off-by: Qitao Xu --- include/trace/events/sock.h | 19 +++++++++++++++++++ net/ipv4/tcp_input.c | 8 +++++++- net/ipv4/udp.c | 5 ++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 12c315782766..860d8b0f02c5 100644 --- a/include/trace/events/sock.h +++ b/include/trace/events/sock.h @@ -261,6 +261,25 @@ TRACE_EVENT(inet_sk_error_report, __entry->error) ); +TRACE_EVENT(sk_data_ready, + + TP_PROTO(const struct sock *sk, const struct sk_buff *skb), + + TP_ARGS(sk, skb), + + TP_STRUCT__entry( + __field(const void *, skaddr) + __field(const void *, skbaddr) + ), + + TP_fast_assign( + __entry->skaddr = sk; + __entry->skbaddr = skb; + ), + + TP_printk("skaddr=%px, skbaddr=%px", __entry->skaddr, __entry->skbaddr) +); + #endif /* _TRACE_SOCK_H */ /* This part must be outside protection */ diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 3f7bd7ae7d7a..16edb9d37529 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -77,6 +77,7 @@ #include #include #include +#include #include #include #include @@ -5034,6 +5035,8 @@ static void tcp_data_queue(struct sock *sk, struct sk_buff *skb) tcp_fast_path_check(sk); + if (!sock_flag(sk, SOCK_DEAD)) + trace_sk_data_ready(sk, skb); if (eaten > 0) kfree_skb_partial(skb, fragstolen); if (!sock_flag(sk, SOCK_DEAD)) @@ -5601,8 +5604,10 @@ static void tcp_urg(struct sock *sk, struct sk_buff *skb, const struct tcphdr *t if (skb_copy_bits(skb, ptr, &tmp, 1)) BUG(); tp->urg_data = TCP_URG_VALID | tmp; - if (!sock_flag(sk, SOCK_DEAD)) + if (!sock_flag(sk, SOCK_DEAD)) { + trace_sk_data_ready(sk, skb); sk->sk_data_ready(sk); + } } } } @@ -5894,6 +5899,7 @@ void tcp_rcv_established(struct sock *sk, struct sk_buff *skb) __tcp_ack_snd_check(sk, 0); no_ack: + trace_sk_data_ready(sk, skb); if (eaten) kfree_skb_partial(skb, fragstolen); tcp_data_ready(sk); diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4751a8f9acff..b58cc943a862 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -108,6 +108,7 @@ #include #include #include +#include #include #include "udp_impl.h" #include @@ -1579,8 +1580,10 @@ int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb) __skb_queue_tail(list, skb); spin_unlock(&list->lock); - if (!sock_flag(sk, SOCK_DEAD)) + if (!sock_flag(sk, SOCK_DEAD)) { + trace_sk_data_ready(sk, skb); sk->sk_data_ready(sk); + } busylock_release(busy); return 0;