Re: [PATCH] skb: Augment skb_copy_datagram_iovec TRACE_EVENT to dump more info
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2009-08-31 19:05:44
On Fri, 28 Aug 2009, Neil Horman wrote:
quoted
quoted
/* * Tracepoint for free an sk_buff:@@ -42,16 +43,35 @@ TRACE_EVENT(skb_copy_datagram_iovec, TP_ARGS(skb, len), TP_STRUCT__entry( - __field( const void *, skbaddr ) + __field( const struct sk_buff *, skb ) __field( int, len ) + __field( int, anid ) + __field( int, cnid ) + __field( int, rx_queue ) + __dynamic_array(char, name, IFNAMSIZ )For string fields we have a __string macro: __string( char, name )Yeah, I was going to use that, but I ran into an issue, in that the __string macro expects, as its second of two arguments, a pointer to a string with witch to determine the dynamic arrays size. The problem is that, if I'm to provide that, I need to point it to skb->dev->name, and there is no guarantee that skb->dev isn't NULL, at which point I think the use of string breaks down. Note below that I obtain the dev pointer by other means and check its validity prior to assigning it. If theres a better way to do this, please let me know.
Ah, OK I see the issue. The problem is the code that figures out the offset. It will always be calculated, and that would cause the skb->dev be evaluated and if NULL will cause an OOPS. Yeah, keep the dynamic_array here then. -- Steve