Set the timer only when an event causes the port to transition to the
FAULTY state. Previously this was done based only on the port's current
state, and events on that port (such as RTNL messages) cause it to
repeatedly re-arm itself, potentially never clearing.

Signed-off-by: davidjm <davi...@arista.com>
---
 clock.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/clock.c b/clock.c
index d37bb87..2d57a33 100644
--- a/clock.c
+++ b/clock.c
@@ -1595,6 +1595,7 @@ void clock_set_sde(struct clock *c, int sde)
 int clock_poll(struct clock *c)
 {
        int cnt, i;
+       enum port_state prior_state;
        enum fsm_event event;
        struct pollfd *cur;
        struct port *p;
@@ -1618,6 +1619,7 @@ int clock_poll(struct clock *c)
                /* Let the ports handle their events. */
                for (i = 0; i < N_POLLFD; i++) {
                        if (cur[i].revents & (POLLIN|POLLPRI|POLLERR)) {
+                               prior_state = port_state(p);
                                if (cur[i].revents & POLLERR) {
                                        pr_err("%s: unexpected socket error",
                                               port_log_name(p));
@@ -1633,7 +1635,7 @@ int clock_poll(struct clock *c)
                                }
                                port_dispatch(p, event, 0);
                                /* Clear any fault after a little while. */
-                               if (PS_FAULTY == port_state(p)) {
+                               if ((PS_FAULTY == port_state(p)) && 
(prior_state != PS_FAULTY)) {
                                        clock_fault_timeout(p, 1);
                                        break;
                                }
-- 
2.38.0



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to