On Tue, Feb 12, 2019 at 10:22:37AM -0800, Vedang Patel wrote:
> - operLogSyncInterval: slave will ask the master to switch to this
> interval for sending sync messages when the timer expires.
> - operLogPdelayReqInterval: the slave will set this interval for pdelay
> request messages when the timer expires.
There is no timer anymore.
> diff --git a/config.c b/config.c
> index 232131082b2e..eaa083306d75 100644
> --- a/config.c
> +++ b/config.c
> @@ -263,6 +263,8 @@ struct config_item config_tab[] = {
> PORT_ITEM_ENU("network_transport", TRANS_UDP_IPV4, nw_trans_enu),
> GLOB_ITEM_INT("ntpshm_segment", 0, INT_MIN, INT_MAX),
> GLOB_ITEM_INT("offsetScaledLogVariance", 0xffff, 0, UINT16_MAX),
> + PORT_ITEM_INT("operLogSyncInterval", 0, INT8_MIN, INT8_MAX),
> + PORT_ITEM_INT("operLogPdelayReqInterval", 0, INT8_MIN, INT8_MAX),
Alphabetical order please.
> @@ -88,6 +91,16 @@ void servo_destroy(struct servo *servo)
> servo->destroy(servo);
> }
>
> +int check_offset_threshold(struct servo *s, int64_t offset)
static
> +{
> + if (s->offset_threshold && offset) {
Why test offset != 0 here?
> + if (abs(offset) < s->offset_threshold && s->curr_offset_values)
Since you are Using abs(), don't you need a special case test for
offset > INT_MAX ?
> + s->curr_offset_values--;
> + return s->curr_offset_values ? 0 : 1;
> + }
> + return 0;
> +}
> +
> double servo_sample(struct servo *servo,
> int64_t offset,
> uint64_t local_ts,
> @@ -100,6 +113,12 @@ double servo_sample(struct servo *servo,
>
> if (*state != SERVO_UNLOCKED)
> servo->first_update = 0;
> + else
> + servo->curr_offset_values = servo->num_offset_values;
> +
> + if (*state == SERVO_LOCKED && check_offset_threshold(servo, offset)) {
> + *state = SERVO_LOCKED_STABLE;
> + }
This is getting hard to follow. Time for switch/case(*state) with all the
cases listed explicitly.
Thanks,
Richard
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel