[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210805185750.4522-4-xiyou.wangcong@gmail.com>
Date: Thu, 5 Aug 2021 11:57:40 -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 03/13] tcp: introduce tracepoint trace_tcp_transmit_skb()
From: Qitao Xu <qitao.xu@...edance.com>
Tracepoint trace_tcp_transmit_skb() is introduced to trace skb
at the exit of TCP layer on TX side.
Reviewed-by: Cong Wang <cong.wang@...edance.com>
Signed-off-by: Qitao Xu <qitao.xu@...edance.com>
---
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.
--
2.27.0
Powered by blists - more mailing lists