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);