netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Satoru Moriya <satoru.moriya@hds.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"nhorman@tuxdriver.com" <nhorman@tuxdriver.com>,
	"tgraf@infradead.org" <tgraf@infradead.org>,
	Stephen Hemminger <stephen.hemminger@vyatta.com>,
	Hagen Paul Pfeifer <hagen@jauu.net>,
	"eric.dumazet@gmail.com" <eric.dumazet@gmail.com>,
	Seiji Aguchi <seiji.aguchi@hds.com>
Subject: [PATCH v2 2/2] tcp: add tracepoint for tcp retransmission
Date: Fri, 20 Jan 2012 13:09:00 -0500	[thread overview]
Message-ID: <65795E11DBF1E645A09CEC7EAEE94B9CB728DD6C@USINDEVS02.corp.hds.com> (raw)
In-Reply-To: <65795E11DBF1E645A09CEC7EAEE94B9CB728DD67@USINDEVS02.corp.hds.com>

This patch adds a tracepoint to tcp_retransmit_skb() to get the
pointer to sk and skb, local port number  and return value. This helps
one understand whether problems are in a server or not.

Signed-off-by: Satoru Moriya <satoru.moriya@hds.com>
---
 include/trace/events/tcp.h |   38 ++++++++++++++++++++++++++++++++++++++
 net/core/net-traces.c      |    1 +
 net/ipv4/tcp_output.c      |    3 +++
 3 files changed, 42 insertions(+), 0 deletions(-)
 create mode 100644 include/trace/events/tcp.h

diff --git a/include/trace/events/tcp.h b/include/trace/events/tcp.h
new file mode 100644
index 0000000..311e783
--- /dev/null
+++ b/include/trace/events/tcp.h
@@ -0,0 +1,38 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM tcp
+
+#if !defined(_TRACE_TCP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_TCP_H
+
+#include <linux/skbuff.h>
+#include <linux/tracepoint.h>
+
+TRACE_EVENT(tcp_retransmit_skb,
+
+	TP_PROTO(struct sock *sk, struct sk_buff *skb, int err),
+
+	TP_ARGS(sk, skb, err),
+
+	TP_STRUCT__entry(
+		__field(void *, skaddr)
+		__field(void *, skbaddr)
+		__field(__u16, lport)
+		__field(int, err)
+	),
+
+	TP_fast_assign(
+		__entry->skaddr = sk;
+		__entry->skbaddr = skb;
+		__entry->lport = inet_sk(sk)->inet_num;
+		__entry->err = err;
+	),
+
+	TP_printk("sk=%p skb=%p port=%hu err=%d",
+		__entry->skaddr, __entry->skbaddr,
+		__entry->lport, __entry->err)
+);
+
+#endif /* _TRACE_TCP_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index ba3c012..63f966b 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -31,6 +31,7 @@
 #include <trace/events/napi.h>
 #include <trace/events/sock.h>
 #include <trace/events/udp.h>
+#include <trace/events/tcp.h>
 
 EXPORT_TRACEPOINT_SYMBOL_GPL(kfree_skb);
 
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 7bd23a8..483cc17 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -40,6 +40,8 @@
 #include <linux/gfp.h>
 #include <linux/module.h>
 
+#include <trace/events/tcp.h>
+
 /* People can turn this off for buggy TCP's found in printers etc. */
 int sysctl_tcp_retrans_collapse __read_mostly = 1;
 
@@ -2199,6 +2201,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
 		TCP_SKB_CB(skb)->ack_seq = tp->snd_nxt;
 	}
 out:
+	trace_tcp_retransmit_skb(sk, skb, err);
 	return err;
 }
 
-- 
1.7.6.4

  parent reply	other threads:[~2012-01-20 18:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 18:07 [PATCH v2 0/2] Tracepoint for tcp retransmission Satoru Moriya
2012-01-20 18:08 ` [PATCH v2 1/2] tcp: refactor tcp_retransmit_skb() for a single return point Satoru Moriya
2012-01-20 18:09 ` Satoru Moriya [this message]
2012-01-20 18:50 ` [PATCH v2 0/2] Tracepoint for tcp retransmission David Miller
2012-02-03 21:47   ` Satoru Moriya
2012-02-04  4:40     ` Yuchung Cheng
2012-02-06 18:32       ` Satoru Moriya
2012-02-04 14:28     ` Neil Horman
2012-02-04 15:58       ` Hagen Paul Pfeifer
2012-02-04 20:09         ` Neil Horman
2012-02-05 12:53           ` Frank Ch. Eigler
2012-02-05 19:17             ` Neil Horman
2012-02-05 20:04               ` Hagen Paul Pfeifer
2012-02-05 21:48                 ` David Miller
2012-02-06  1:32                 ` Neil Horman
2012-02-06 15:20                   ` Frank Ch. Eigler
2012-02-06 15:24                     ` Eric Dumazet
2012-02-06 15:38                       ` Neil Horman
2012-02-06 15:53                     ` Neil Horman
2012-02-06 16:18                       ` Steven Rostedt
2012-02-06 17:02                         ` Eric Dumazet
2012-02-06 17:18                           ` Steven Rostedt
2012-02-06 16:21                       ` Frank Ch. Eigler
2012-02-06 18:21                       ` Satoru Moriya
2012-01-25 13:27 ` Hagen Paul Pfeifer
2012-01-25 14:44   ` Eric Dumazet
2012-01-26 18:51     ` David Miller
2012-02-03 20:31     ` Satoru Moriya
2012-02-03 20:43   ` Satoru Moriya
2012-02-03 20:55     ` Hagen Paul Pfeifer

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=65795E11DBF1E645A09CEC7EAEE94B9CB728DD6C@USINDEVS02.corp.hds.com \
    --to=satoru.moriya@hds.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hagen@jauu.net \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=seiji.aguchi@hds.com \
    --cc=stephen.hemminger@vyatta.com \
    --cc=tgraf@infradead.org \
    /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).