mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-30 14:34:51 +08:00
07dc22e729
This patch adds tracepoint to consume_skb and add trace_kfree_skb before __kfree_skb in skb_free_datagram_locked and net_tx_action. Combinating with tracepoint on dev_hard_start_xmit, we can check how long it takes to free transmitted packets. And using it, we can calculate how many packets driver had at that time. It is useful when a drop of transmitted packet is a problem. sshd-6828 [000] 112689.258154: consume_skb: skbaddr=f2d99bb8 Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com> Acked-by: David S. Miller <davem@davemloft.net> Acked-by: Neil Horman <nhorman@tuxdriver.com> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Kaneshige Kenji <kaneshige.kenji@jp.fujitsu.com> Cc: Izumo Taku <izumi.taku@jp.fujitsu.com> Cc: Kosaki Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Scott Mcmillan <scott.a.mcmillan@intel.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Eric Dumazet <eric.dumazet@gmail.com> LKML-Reference: <4C724364.50903@jp.fujitsu.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
78 lines
1.4 KiB
C
78 lines
1.4 KiB
C
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM skb
|
|
|
|
#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_SKB_H
|
|
|
|
#include <linux/skbuff.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/tracepoint.h>
|
|
|
|
/*
|
|
* Tracepoint for free an sk_buff:
|
|
*/
|
|
TRACE_EVENT(kfree_skb,
|
|
|
|
TP_PROTO(struct sk_buff *skb, void *location),
|
|
|
|
TP_ARGS(skb, location),
|
|
|
|
TP_STRUCT__entry(
|
|
__field( void *, skbaddr )
|
|
__field( unsigned short, protocol )
|
|
__field( void *, location )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->skbaddr = skb;
|
|
if (skb) {
|
|
__entry->protocol = ntohs(skb->protocol);
|
|
}
|
|
__entry->location = location;
|
|
),
|
|
|
|
TP_printk("skbaddr=%p protocol=%u location=%p",
|
|
__entry->skbaddr, __entry->protocol, __entry->location)
|
|
);
|
|
|
|
TRACE_EVENT(consume_skb,
|
|
|
|
TP_PROTO(struct sk_buff *skb),
|
|
|
|
TP_ARGS(skb),
|
|
|
|
TP_STRUCT__entry(
|
|
__field( void *, skbaddr )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->skbaddr = skb;
|
|
),
|
|
|
|
TP_printk("skbaddr=%p", __entry->skbaddr)
|
|
);
|
|
|
|
TRACE_EVENT(skb_copy_datagram_iovec,
|
|
|
|
TP_PROTO(const struct sk_buff *skb, int len),
|
|
|
|
TP_ARGS(skb, len),
|
|
|
|
TP_STRUCT__entry(
|
|
__field( const void *, skbaddr )
|
|
__field( int, len )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->skbaddr = skb;
|
|
__entry->len = len;
|
|
),
|
|
|
|
TP_printk("skbaddr=%p len=%d", __entry->skbaddr, __entry->len)
|
|
);
|
|
|
|
#endif /* _TRACE_SKB_H */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|