Re: [Linuxptp-devel] [PATCH RFC 4/6] clock: set sample weight.
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Miroslav L. <mli...@re...> - 2015-03-10 10:58:34
|
On Mon, Feb 16, 2015 at 08:48:15PM +0100, Richard Cochran wrote: > On Fri, Feb 13, 2015 at 01:56:16PM +0100, Miroslav Lichvar wrote: > > + if (sample_delay > 0 && c->path_delay > 0) { > > + weight = (double)c->path_delay / sample_delay; > > + if (weight > 1.0) > > + weight = 1.0; > > + pr_debug("delay sample %9" PRId64 " filtered %9" PRId64 > > + " weight %f", > > + sample_delay, c->path_delay, weight); > > + c->path_delay = sample_delay; > > So now, c->path_delay is set once in clock_path_delay() using > averaging, and here the averaged value is used for the ratio, but then > you clobber c->path_delay with the new value? > > Your intention would be more clear if you would not set c->path_delay > here, but rather use a local variable. Setting c->path_delay here is actually a bug breaking the weight calculation if there is no delay measurement before next sync message, the new weight will be 1.0 as the filtered delay will actually be the raw delay. -- Miroslav Lichvar |