Subject: Re: [PATCH net-next] net: FIB tracepoints

From: David Ahern <[email-masked]>
Date: Thu, 27 Aug 2015 22:12:01 -0700

On 8/27/15 10:07 PM, David Ahern wrote:
> On 8/27/15 10:05 PM, David Miller wrote:
>> From: David Ahern <[email-masked]>
>> Date: Thu, 27 Aug 2015 21:59:32 -0700
>>
>>> +        __array(    __u8,    src,    4    )
>>> +        __array(    __u8,    dst,    4    )
>>   ...
>>> +        __array(    __u8,    src,    4    )
>>
>> Maybe there is something I don't understand about tracing, but why not
>> use __u32?  If endianness types are the issue, just force cast it as
>> needed.
>>
>> Using a memcpy() on a 4-byte array is kinda excessive.
>>
>
> Silly trick need to use %pI4. ie., printing the addresses as strings vs.
> hex.

perhaps an example helps:

swapper     0 [000]   406.447548: fib:fib_table_lookup: table 255 oif 0 
iif 0 src 0.0.0.0 dst 2.1.1.2 tos 0 scope 0 flags 0

If src and dst are u32's then they print as either 0x%x or %d which is 
not intuitive. I added support to perf for the following printk formats 
with 3d199b5be53:

       %pi4 print an IPv4 address with leading zeros
       %pI4 print an IPv4 address without leading zeros
       %pi6 print an IPv6 address without colons
       %pI6 print an IPv6 address with colons
       %pI6c print an IPv6 address in compressed form with colons
       %pISpc print an IP address from a sockaddr