netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	netdev@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>,
	David Miller <davem@davemloft.net>,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH v2] ftrace: change the export format of trace_kfree_skb()
Date: Thu, 18 Jun 2009 11:26:28 +0800	[thread overview]
Message-ID: <4A39B3E4.6060004@cn.fujitsu.com> (raw)
In-Reply-To: <20090610072618.GA6016@nowhere>

Use %pf instead of %p to output the function's address and print the
protocol's name.

Before patch:

  <idle>-0     [000] 60144.542521: kfree_skb: skbaddr=de7b8240 protocol=2048 location=c1365429
  <idle>-0     [000] 60164.488153: kfree_skb: skbaddr=da66f900 protocol=2048 location=c1365429
  <idle>-0     [000] 60193.493933: kfree_skb: skbaddr=deaeb480 protocol=4 location=c134ec25
  <idle>-0     [000] 60253.118421: kfree_skb: skbaddr=de7c4900 protocol=4 location=c134ec25
          
After patch:

  <idle>-0     [000]   169.979205: kfree_skb: skbaddr=ceddc240 protocol=ETH_P_802_2 location=netif_receive_skb
  <idle>-0     [000]   172.587000: kfree_skb: skbaddr=ceddc300 protocol=ETH_P_802_2 location=netif_receive_skb
    ping-3391  [000]   192.109803: kfree_skb: skbaddr=ceddc900 protocol=ETH_P_IP location=icmp_rcv
    ping-3391  [000]   192.109902: kfree_skb: skbaddr=ceddc780 protocol=ETH_P_IP location=icmp_rcv

Changelog v1->v2:
Convert protocol from raw numeric to its name as Frederic's suggestion

Signed-off-by: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
---
 include/trace/events/skb.h |   70 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 68 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 1e8fabb..2496060 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -7,6 +7,71 @@
 #undef TRACE_SYSTEM
 #define TRACE_SYSTEM skb
 
+#define protocol_name(protocol) { protocol, #protocol }
+#define show_protocol_name(val)					\
+	__print_symbolic(val,					\
+			 protocol_name(ETH_P_LOOP),		\
+			 protocol_name(ETH_P_PUP),		\
+			 protocol_name(ETH_P_PUPAT),		\
+			 protocol_name(ETH_P_IP),		\
+			 protocol_name(ETH_P_X25),		\
+			 protocol_name(ETH_P_ARP),		\
+			 protocol_name(ETH_P_BPQ),		\
+			 protocol_name(ETH_P_IEEEPUP),		\
+			 protocol_name(ETH_P_IEEEPUPAT),	\
+			 protocol_name(ETH_P_DEC),		\
+			 protocol_name(ETH_P_DNA_DL),		\
+			 protocol_name(ETH_P_DNA_RC),		\
+			 protocol_name(ETH_P_DNA_RT),		\
+			 protocol_name(ETH_P_LAT),		\
+			 protocol_name(ETH_P_DIAG),		\
+			 protocol_name(ETH_P_CUST),		\
+			 protocol_name(ETH_P_SCA),		\
+			 protocol_name(ETH_P_TEB),		\
+			 protocol_name(ETH_P_RARP),		\
+			 protocol_name(ETH_P_ATALK),		\
+			 protocol_name(ETH_P_AARP),		\
+			 protocol_name(ETH_P_8021Q),		\
+			 protocol_name(ETH_P_IPX),		\
+			 protocol_name(ETH_P_IPV6),		\
+			 protocol_name(ETH_P_PAUSE),		\
+			 protocol_name(ETH_P_SLOW),		\
+			 protocol_name(ETH_P_WCCP),		\
+			 protocol_name(ETH_P_PPP_DISC),		\
+			 protocol_name(ETH_P_PPP_SES),		\
+			 protocol_name(ETH_P_MPLS_UC),		\
+			 protocol_name(ETH_P_MPLS_MC),		\
+			 protocol_name(ETH_P_ATMMPOA),		\
+			 protocol_name(ETH_P_ATMFATE),		\
+			 protocol_name(ETH_P_PAE),		\
+			 protocol_name(ETH_P_AOE),		\
+			 protocol_name(ETH_P_TIPC),		\
+			 protocol_name(ETH_P_FCOE),		\
+			 protocol_name(ETH_P_FIP),		\
+			 protocol_name(ETH_P_EDSA),		\
+			 protocol_name(ETH_P_802_3),		\
+			 protocol_name(ETH_P_AX25),		\
+			 protocol_name(ETH_P_ALL),		\
+			 protocol_name(ETH_P_802_2),		\
+			 protocol_name(ETH_P_SNAP),		\
+			 protocol_name(ETH_P_DDCMP),		\
+			 protocol_name(ETH_P_WAN_PPP),		\
+			 protocol_name(ETH_P_PPP_MP),		\
+			 protocol_name(ETH_P_LOCALTALK),	\
+			 protocol_name(ETH_P_CAN),		\
+			 protocol_name(ETH_P_PPPTALK),		\
+			 protocol_name(ETH_P_TR_802_2),		\
+			 protocol_name(ETH_P_MOBITEX),		\
+			 protocol_name(ETH_P_CONTROL),		\
+			 protocol_name(ETH_P_IRDA),		\
+			 protocol_name(ETH_P_ECONET),		\
+			 protocol_name(ETH_P_HDLC),		\
+			 protocol_name(ETH_P_ARCNET),		\
+			 protocol_name(ETH_P_DSA),		\
+			 protocol_name(ETH_P_TRAILER),		\
+			 protocol_name(ETH_P_PHONET),		\
+			 protocol_name(ETH_P_IEEE802154))
+
 /*
  * Tracepoint for free an sk_buff:
  */
@@ -30,8 +95,9 @@ TRACE_EVENT(kfree_skb,
 		__entry->location = location;
 	),
 
-	TP_printk("skbaddr=%p protocol=%u location=%p",
-		__entry->skbaddr, __entry->protocol, __entry->location)
+	TP_printk("skbaddr=%p protocol=%s location=%pf",
+		  __entry->skbaddr, show_protocol_name(__entry->protocol),
+		  __entry->location)
 );
 
 #endif /* _TRACE_SKB_H */
-- 
1.6.1.2



  reply	other threads:[~2009-06-18  3:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09  5:54 [PATCH RESEND] ftrace: change the export format of trace_kfree_skb() Xiao Guangrong
2009-06-09 18:27 ` Frederic Weisbecker
2009-06-10  1:40   ` Xiao Guangrong
2009-06-10  1:56     ` Steven Rostedt
2009-06-10  7:26     ` Frederic Weisbecker
2009-06-18  3:26       ` Xiao Guangrong [this message]
2009-06-18 10:35         ` [PATCH v2] " Neil Horman
2009-06-18 12:51           ` Steven Rostedt
2009-06-18 14:08             ` Neil Horman
2009-06-24  6:58           ` David Miller
2009-06-26  1:24             ` Xiao Guangrong
2009-06-19  0:33         ` Steven Rostedt
2009-06-19  2:05           ` Xiao Guangrong
2009-06-19  2:11             ` Steven Rostedt

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=4A39B3E4.6060004@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=rostedt@goodmis.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).