[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210805185750.4522-8-xiyou.wangcong@gmail.com>
Date: Thu, 5 Aug 2021 11:57:44 -0700
From: Cong Wang <xiyou.wangcong@...il.com>
To: netdev@...r.kernel.org
Cc: Qitao Xu <qitao.xu@...edance.com>,
Cong Wang <cong.wang@...edance.com>
Subject: [Patch net-next 07/13] ipv6: introduce tracepoint trace_ipv6_rcv()
From: Qitao Xu <qitao.xu@...edance.com>
Tracepoint trace_ipv6_rcv() is introduced to trace skb at the
entrance of IPv6 layer on RX side.
Reviewed-by: Cong Wang <cong.wang@...edance.com>
Signed-off-by: Qitao Xu <qitao.xu@...edance.com>
---
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 <net/xfrm.h>
#include <net/inet_ecn.h>
#include <net/dst_metadata.h>
+#include <trace/events/ip.h>
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)
--
2.27.0
Powered by blists - more mailing lists