On Sun, 2016-07-31 at 23:48 +0200, Richard Cochran wrote:
> Poll for link up/down events.  When a link goes down, the port
> becomes
> faulty until the link goes up again.  Because the netlink
> notifications
> race with our existing fault detection, we keep the fault timer from
> before, but a downed link prevents clear the fault.
> 
> Signed-off-by: Richard Cochran <[email protected]>
> ---
<snip>
> +static void clock_link_status(void *ctx, int index, int linkup)
> +{
> +     struct clock *c = ctx;
> +     struct port *p;
> +     char key[16];
> +
> +     snprintf(key, sizeof(key), "%d", index);
> +     p = hash_lookup(c->index2port, key);
> +     if (!p) {
> +             return;
> +     }
> +     port_link_status_set(p, linkup);
> +     if (linkup) {
> +             port_dispatch(p, EV_FAULT_CLEARED, 0);
> +     } else {
> +             port_dispatch(p, EV_FAULT_DETECTED, 0);
> +     }

Wouldn't these port dispatch messages interfer with the current ones?
Shouldn't we only set the link status here and not actually send the
message? I thought that was from the patch description. Or am I missing
something?

> 
> -             /* Check the fault timer. */
> +             /*
> +              * When the fault timer expires we clear the fault,
> +              * but only if the link is up.
> +              */
>               if (cur[N_POLLFD].revents & (POLLIN|POLLPRI)) {
>                       clock_fault_timeout(p, 0);
> -                     port_dispatch(p, EV_FAULT_CLEARED, 0);
> +                     if (port_link_status_get(p)) {
> +                             port_dispatch(p, EV_FAULT_CLEARED,
> 0);
> +                     }
>  

Here? Wouldn't these two port dispatch things be racing with the ones
above?

Thanks,
Jake
------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to