Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Qitao Xu <qitao.xu@bytedance.com>, Cong Wang <cong.wang@bytedance.com>
Subject: [Patch net-next 05/13] udp: introduce tracepoint trace_udp_v6_send_skb()
Date: Thu,  5 Aug 2021 11:57:42 -0700	[thread overview]
Message-ID: <20210805185750.4522-6-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <20210805185750.4522-1-xiyou.wangcong@gmail.com>

From: Qitao Xu <qitao.xu@bytedance.com>

Tracepoint trace_udp_v6_send_skb() is introduced to trace skb
at the exit of UDPv6 layer on TX side.

Reviewed-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Qitao Xu <qitao.xu@bytedance.com>
---
 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 <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <trace/events/skb.h>
+#include <trace/events/udp.h>
 #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;
 }
-- 
2.27.0


  parent reply	other threads:[~2021-08-05 18:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 18:57 [Patch net-next 00/13] net: add more tracepoints to TCP/IP stack Cong Wang
2021-08-05 18:57 ` [Patch net-next 01/13] net: introduce a new header file include/trace/events/ip.h Cong Wang
2021-08-05 18:57 ` [Patch net-next 02/13] ipv4: introduce tracepoint trace_ip_queue_xmit() Cong Wang
2021-08-06 10:08   ` Eric Dumazet
2021-08-09 20:32     ` Cong Wang
2021-08-11 21:22   ` Martin KaFai Lau
2021-08-11 22:48     ` Cong Wang
2021-08-11 23:08       ` Martin KaFai Lau
2021-08-12  0:37         ` Cong Wang
2021-08-12  5:46           ` Martin KaFai Lau
2021-08-05 18:57 ` [Patch net-next 03/13] tcp: introduce tracepoint trace_tcp_transmit_skb() Cong Wang
2021-08-05 18:57 ` [Patch net-next 04/13] udp: introduce tracepoint trace_udp_send_skb() Cong Wang
2021-08-05 18:57 ` Cong Wang [this message]
2021-08-05 18:57 ` [Patch net-next 06/13] ipv4: introduce tracepoint trace_ip_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 07/13] ipv6: introduce tracepoint trace_ipv6_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 08/13] ipv4: introduce tracepoint trace_ip_local_deliver_finish() Cong Wang
2021-08-05 18:57 ` [Patch net-next 09/13] udp: introduce tracepoint trace_udp_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 10/13] ipv6: introduce tracepoint trace_udpv6_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 11/13] tcp: introduce tracepoint trace_tcp_v4_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 12/13] ipv6: introduce tracepoint trace_tcp_v6_rcv() Cong Wang
2021-08-05 18:57 ` [Patch net-next 13/13] sock: introduce tracepoint trace_sk_data_ready() Cong Wang
2021-08-06  2:22 ` [Patch net-next 00/13] net: add more tracepoints to TCP/IP stack Cong Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805185750.4522-6-xiyou.wangcong@gmail.com \
    --to=xiyou.wangcong@gmail.com \
    --cc=cong.wang@bytedance.com \
    --cc=netdev@vger.kernel.org \
    --cc=qitao.xu@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).