All of lore.kernel.org
 help / color / mirror / Atom feed
From: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
To: netdev@vger.kernel.org, davem@davemloft.net, nhorman@tuxdriver.com
Cc: izumi.taku@jp.fujitsu.com, kaneshige.kenji@jp.fujitsu.com
Subject: [PATCH 3/5] tracing/events: add tracepoint to RAW protocol
Date: Mon, 18 Jan 2010 17:28:27 +0900	[thread overview]
Message-ID: <4B541BAB.600@jp.fujitsu.com> (raw)

This patch adds tracepoints at RAW protocol.

raw_sendmsg             entry of RAW layer(transmit).
raw_rcv                 entry of RAW layer(receive).

Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
---
 include/trace/events/skb.h |   40 ++++++++++++++++++++++++++++++++++++++++
 net/ipv4/raw.c             |    4 ++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index a33893f..fbc25e8 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -154,6 +154,46 @@ TRACE_EVENT(ip_frag_reasm,
 		__entry->skbaddr, __entry->len)
 );
 
+TRACE_EVENT(raw_sendmsg,
+
+	TP_PROTO(struct sock *sk, size_t len),
+
+	TP_ARGS(sk, len),
+
+	TP_STRUCT__entry(
+		__field(	const void *,	skaddr	)
+		__field(	size_t,		len	)
+       ),
+
+	TP_fast_assign(
+		__entry->skaddr = sk;
+		__entry->len = len;
+	),
+
+	TP_printk("sk=%p len=%u",
+		__entry->skaddr, __entry->len)
+);
+
+TRACE_EVENT(raw_rcv,
+
+	TP_PROTO(struct sk_buff *skb),
+
+	TP_ARGS(skb),
+
+	TP_STRUCT__entry(
+		__field(	const void *,	skbaddr	)
+		__field(	unsigned int,	len	)
+       ),
+
+	TP_fast_assign(
+		__entry->skbaddr = skb;
+		__entry->len = skb->len;
+	),
+
+	TP_printk("skbaddr=%p len=%u",
+		__entry->skbaddr, __entry->len)
+);
+
 TRACE_EVENT(dev_queue_xmit,
 
 	TP_PROTO(struct sk_buff *skb,
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index ce154b4..1b2425a 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -77,6 +77,7 @@
 #include <linux/seq_file.h>
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
+#include <trace/events/skb.h>
 
 static struct raw_hashinfo raw_v4_hashinfo = {
 	.lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
@@ -301,6 +302,7 @@ static int raw_rcv_skb(struct sock * sk, struct sk_buff * skb)
 
 int raw_rcv(struct sock *sk, struct sk_buff *skb)
 {
+	trace_raw_rcv(skb);
 	if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb)) {
 		atomic_inc(&sk->sk_drops);
 		kfree_skb(skb);
@@ -354,6 +356,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length,
 	err = -EFAULT;
 	if (memcpy_fromiovecend((void *)iph, from, 0, length))
 		goto error_free;
+	trace_senddata_copy_skb(sk, skb, length);
 
 	iphlen = iph->ihl * 4;
 
@@ -459,6 +462,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	u8  tos;
 	int err;
 
+	trace_raw_sendmsg(sk, len);
 	err = -EMSGSIZE;
 	if (len > 0xFFFF)
 		goto out;


                 reply	other threads:[~2010-01-18  8:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=4B541BAB.600@jp.fujitsu.com \
    --to=sanagi.koki@jp.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=izumi.taku@jp.fujitsu.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.