From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: David Miller <davem@davemloft.net>,
John find <linux.kernel@free.fr>,
netdev@vger.kernel.org
Subject: Re: [PATCH] NET : convert network timestamps to ktime_t
Date: Fri, 2 Mar 2007 13:02:10 -0800 [thread overview]
Message-ID: <20070302130210.57883edc@freekitty> (raw)
In-Reply-To: <200703021538.41284.dada1@cosmosbay.com>
On Fri, 2 Mar 2007 15:38:41 +0100
Eric Dumazet <dada1@cosmosbay.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.
--- 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();
set_bit(SK_DATA, &svsk->sk_flags); /* there may be more data... */
/*
--- tcp-2.6.orig/kernel/time.c 2007-03-02 12:59:55.000000000 -0800
+++ tcp-2.6/kernel/time.c 2007-03-02 13:00:08.000000000 -0800
@@ -469,6 +469,8 @@
return tv;
}
+EXPORT_SYMBOL(ns_to_timeval);
+
/*
* Convert jiffies to milliseconds and back.
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-03-02 21:02 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-28 10:18 CLOCK_MONOTONIC datagram timestamps by the kernel John
2007-02-28 13:37 ` John
2007-02-28 13:55 ` Eric Dumazet
2007-02-28 14:23 ` John
2007-02-28 14:55 ` Eric Dumazet
2007-02-28 16:07 ` John
2007-03-01 10:03 ` Evgeniy Polyakov
2007-03-01 11:30 ` Eric Dumazet
2007-03-01 15:54 ` Stephen Hemminger
2007-03-01 16:13 ` Eric Dumazet
2007-03-02 14:38 ` [PATCH] NET : convert network timestamps to ktime_t Eric Dumazet
2007-03-02 16:27 ` Stephen Hemminger
2007-03-02 21:02 ` Stephen Hemminger [this message]
2007-03-02 22:46 ` Eric Dumazet
2007-03-05 0:19 ` David Miller
2007-03-05 6:56 ` Eric Dumazet
2007-03-05 7:40 ` Eric Dumazet
2007-03-05 8:00 ` David Miller
2007-03-05 8:21 ` Eric Dumazet
2007-03-05 8:49 ` David Miller
2007-03-08 14:17 ` [PATCH] NET : Introduce SIOCGSTAMPNS ioctl to get timestamps with nanosec resolution Eric Dumazet
2007-03-08 16:28 ` Patrick McHardy
2007-03-08 16:42 ` Eric Dumazet
2007-03-08 16:45 ` Patrick McHardy
2007-03-09 4:39 ` David Miller
2007-03-09 18:39 ` [PATCH] NET : Adding SO_TIMESTAMPNS / SCM_TIMESTAMPNS support Eric Dumazet
2007-03-09 22:17 ` David Miller
2007-03-01 18:53 ` CLOCK_MONOTONIC datagram timestamps by the kernel Stephen Hemminger
2007-03-01 23:14 ` Eric Dumazet
2007-03-01 23:34 ` Stephen Hemminger
2007-03-02 0:56 ` Eric Dumazet
2007-03-02 9:26 ` John
2007-03-02 10:11 ` Eric Dumazet
2007-02-28 18:22 ` Stephen Hemminger
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=20070302130210.57883edc@freekitty \
--to=shemminger@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=linux.kernel@free.fr \
--cc=netdev@vger.kernel.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).