From: Miroslav Lichvar Date: Wed, 11 Dec 2024 10:16:30 +0000 (+0100) Subject: refclock: drop filter length adjustment for polling drivers X-Git-Tag: 4.7-pre1~50 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ee725ff188a8b4be9b060a02d8fcb3f38cf88fa;p=thirdparty%2Fchrony.git refclock: drop filter length adjustment for polling drivers In the refclock initialization, if the driver provides a poll() function and 2^(poll-dpoll) is smaller than the configured length of the median filter (64 by default), the filter is shortened to 2^(poll-dpoll) samples, assuming the driver provides samples only in the poll() function and at most one per call, to avoid wasting memory and before commit 12237bf28393 ("refclock: stop requiring 4 samples in median filter") also simplify configuration (for polling drivers only) But this assumption is not always correct. The PHC driver can read external PPS timestamps independently from the driver polling and the RTC driver can timestamp interrupts. If the dpoll was too large to cover the sample rate, some samples would be lost. Drop the adjustment of the filter length to avoid this unexpected impact on filtering and make it work as documented. --- diff --git a/refclock.c b/refclock.c index a0e716c4..2cc4f621 100644 --- a/refclock.c +++ b/refclock.c @@ -231,17 +231,8 @@ RCL_AddRefclock(RefclockParameters *params) } if (inst->driver->poll) { - int max_samples; - if (inst->driver_poll > inst->poll) inst->driver_poll = inst->poll; - - /* Adjust the filter length to save memory if the expected number - of samples is smaller */ - max_samples = 1 << (inst->poll - inst->driver_poll); - if (max_samples < params->filter_length) { - params->filter_length = max_samples; - } } if (inst->driver->init && !inst->driver->init(inst))