[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45E8A936.9050908@cosmosbay.com>
Date: Fri, 02 Mar 2007 23:46:14 +0100
From: Eric Dumazet <dada1@...mosbay.com>
To: Stephen Hemminger <shemminger@...ux-foundation.org>
CC: David Miller <davem@...emloft.net>,
John find <linux.kernel@...e.fr>, netdev@...r.kernel.org
Subject: Re: [PATCH] NET : convert network timestamps to ktime_t
Stephen Hemminger a écrit :
> On Fri, 2 Mar 2007 15:38:41 +0100
> Eric Dumazet <dada1@...mosbay.com> wrote:
>
>> We currently use a special structure (struct skb_timeval) and plain 'struct
>> timeval' to store packet timestamps in sk_buffs and struct sock.
>>
>> This has some drawbacks :
>> - Fixed resolution of micro second.
>> - Waste of space on 64bit platforms where sizeof(struct timeval)=16
>>
>> I suggest using ktime_t that is a nice abstraction of high resolution time
>> services, currently capable of nanosecond resolution.
>>
>> As sizeof(ktime_t) is 8 bytes, using ktime_t in 'struct sock' permits a 8 byte
>> shrink of this structure on 64bit architectures. Some other structures also
>> benefit from this size reduction (struct ipq in ipv4/ip_fragment.c, struct
>> frag_queue in ipv6/reassembly.c, ...)
>>
>>
>
> You missed a couple of spots.
Arg yes...
>
> --- tcp-2.6.orig/net/sunrpc/svcsock.c 2007-03-02 12:50:45.000000000 -0800
> +++ tcp-2.6/net/sunrpc/svcsock.c 2007-03-02 12:58:28.000000000 -0800
> @@ -805,16 +805,9 @@
> /* possibly an icmp error */
> dprintk("svc: recvfrom returned error %d\n", -err);
> }
> - if (skb->tstamp.off_sec == 0) {
> - struct timeval tv;
>
> - tv.tv_sec = xtime.tv_sec;
> - tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC;
> - skb_set_timestamp(skb, &tv);
> - /* Don't enable netstamp, sunrpc doesn't
> - need that much accuracy */
> - }
> - skb_get_timestamp(skb, &svsk->sk_sk->sk_stamp);
> + svsk->sk_sk->sk_stamp = (skb->tstamp.tv64 != 0) ? skb->tstamp
> + : ktime_get_real();
Well, if we want to stay in the spirit of old code, we probably want to use
current_kernel_time() (+ timespec_to_ktime()), because its less expensive.
And also setting the skb tstamp, no ?
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists