From: Andrew Morton <akpm@linux-foundation.org>
To: Patrick Ohly <patrick.ohly@intel.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
davem@davemloft.net, patrick.ohly@intel.com
Subject: Re: [RFC PATCH 10/11] time sync: generic infrastructure to map between time stamps generated by a clock source and system time
Date: Wed, 19 Nov 2008 17:14:45 -0800 [thread overview]
Message-ID: <20081119171445.bd02498e.akpm@linux-foundation.org> (raw)
In-Reply-To: <1227096528-24150-11-git-send-email-patrick.ohly@intel.com>
These patcehs add a lot of quite large inlined functions.
On Wed, 19 Nov 2008 13:08:47 +0100
Patrick Ohly <patrick.ohly@intel.com> wrote:
> +static inline void clocksync_update(struct clocksync *sync,
> + u64 hwtstamp)
> +{
> + s64 offset;
> + u64 average_time;
> +
> + if (hwtstamp &&
> + (s64)(hwtstamp - sync->last_update) < NSEC_PER_SEC)
> + return;
> +
> + if (!clocksync_offset(sync, &offset, &average_time))
> + return;
> +
> + printk(KERN_DEBUG
> + "average offset: %lld\n", offset);
> +
> + if (!sync->last_update) {
> + sync->last_update = average_time;
> + sync->offset = offset;
> + sync->skew = 0;
> + } else {
> + s64 delta_nsec = average_time - sync->last_update;
> +
> + /* avoid division by negative or small deltas */
> + if (delta_nsec >= 10000) {
> + s64 delta_offset_nsec = offset - sync->offset;
> + s64 skew = delta_offset_nsec *
> + CLOCKSYNC_SKEW_RESOLUTION /
> + delta_nsec;
> +
> + /**
> + * Calculate new overall skew as 4/16 the
> + * old value and 12/16 the new one. This is
> + * a rather arbitrary tradeoff between
> + * only using the latest measurement (0/16 and
> + * 16/16) and even more weight on past measurements.
> + */
> +#define CLOCKSYNC_NEW_SKEW_PER_16 12
> + sync->skew =
> + ((16 - CLOCKSYNC_NEW_SKEW_PER_16) * sync->skew +
> + CLOCKSYNC_NEW_SKEW_PER_16 * skew) /
> + 16;
> + sync->last_update = average_time;
> + sync->offset = offset;
> + }
> + }
> +}
This one is a champ.
The token '/**' is used exclusively to introduce kerneldoc-formatted
comments. Please check the patches for comments which are incorrectly
thus-tagged.
Please cc linux-api@vger.kernel.org on patches which affect the
kernel's userspace interfaces.
next prev parent reply other threads:[~2008-11-20 1:15 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-19 12:08 hardware time stamping with extra skb->hwtstamp Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 01/11] put_cmsg_compat + SO_TIMESTAMP[NS]: use same name for value as caller Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 02/11] net: new user space API for time stamping of incoming and outgoing packets Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 03/11] net: infrastructure for hardware time stamping Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 04/11] net: socket infrastructure for SO_TIMESTAMPING Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 05/11] ip: support for TX timestamps on UDP and RAW sockets Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 06/11] net: pass new SIOCSHWTSTAMP through to device drivers Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 07/11] igb: stub support for SIOCSHWTSTAMP Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 08/11] clocksource: allow usage independent of timekeeping.c Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 09/11] igb: infrastructure for hardware time stamping Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 10/11] time sync: generic infrastructure to map between time stamps generated by a clock source and system time Patrick Ohly
2008-11-19 12:08 ` [RFC PATCH 11/11] igb: use clocksync to implement hardware time stamping Patrick Ohly
2008-11-20 1:14 ` Andrew Morton [this message]
2008-11-20 7:08 ` [RFC PATCH 10/11] time sync: generic infrastructure to map between time stamps generated by a clock source and system time Ohly, Patrick
2008-12-05 21:05 ` [RFC PATCH 08/11] clocksource: allow usage independent of timekeeping.c john stultz
2008-12-11 12:11 ` Patrick Ohly
2008-12-11 22:23 ` john stultz
2008-12-12 8:50 ` Patrick Ohly
2008-11-19 15:21 ` [RFC PATCH 03/11] net: infrastructure for hardware time stamping Patrick Ohly
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=20081119171445.bd02498e.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=patrick.ohly@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.