On Tue, 11 Jul 2023 at 17:28, Vladimir Yakovlev via Linuxptp-devel < linuxptp-devel@lists.sourceforge.net> wrote:
> In current version, when port fault occurs, unicast service in G.8275.2 > mode will lock up. > > When i disconnect cable between master and slave, and reconnect it back, > master stops sending messages. > > Series of events occurs: > 1. unicast_service_rearm_timer rearms timer, but it can skip execution if > port fault occurs. > 2. next time ptp client connects, unicast_service_add will check client > list and find it in itmp->clients list, so it does not arm timer. > 3. unicast_service_timer will not fire > > Master will receive and process unicast_service_extend messages, but does > not send announce and sync. > That looks like an ugly workaround. 1. The clear seems to apply to slaves as well. Is that necessary? 2. Why is that a problem at all, what is the root problem? Do you have other traffic? Are you using any link detection protocols like LLDP? https://en.wikipedia.org/wiki/Link_Layer_Discovery_Protocol 3. PS_FAULTY, is a detection for several errors. If you wish to detect disconnected cable, you should add a new handler that captures the *RTMGRP_LINK *events and issues a link down event. https://man7.org/linux/man-pages/man7/netlink.7.html The netlink link up/down events are a bit problematic as there might be false events that require a more delicate handling to filter them. You might need a link detection protocol like LLDP. Erez > I used this patch to solve a problem. It clears the client list, if port > goes to faulty state. > That sounds like a daemon restart. > > Index: linuxptp-2.0/port.c > =================================================================== > --- linuxptp-2.0.orig/port.c > +++ linuxptp-2.0/port.c > @@ -2976,6 +2976,7 @@ int port_state_update(struct port *p, en > if (PS_FAULTY == next) { > struct fault_interval i; > fault_interval(p, last_fault_type(p), &i); > + unicast_service_clear_clients(p); > if (clear_fault_asap(&i)) { > pr_notice("port %hu: clearing fault immediately", portnum(p)); > next = p->state_machine(next, EV_FAULT_CLEARED, 0); > Index: linuxptp-2.0/unicast_service.c > =================================================================== > --- linuxptp-2.0.orig/unicast_service.c > +++ linuxptp-2.0/unicast_service.c > @@ -378,6 +378,23 @@ void unicast_service_cleanup(struct port > free(p->unicast_service); > } > > +void unicast_service_clear_clients(struct port *p) > +{ > + struct unicast_service_interval *itmp, *inext; > + struct unicast_client_address *ctmp, *cnext; > + > + if (!p->unicast_service) { > + return; > + } > + LIST_FOREACH_SAFE(itmp, &p->unicast_service->intervals, list, inext) { > + LIST_FOREACH_SAFE(ctmp, &itmp->clients, list, cnext) { > + LIST_REMOVE(ctmp, list); > + free(ctmp); > + } > + LIST_REMOVE(itmp, list); > + } > +} > + > int unicast_service_deny(struct port *p, struct ptp_message *m, > struct tlv_extra *extra) > { > Index: linuxptp-2.0/unicast_service.h > =================================================================== > --- linuxptp-2.0.orig/unicast_service.h > +++ linuxptp-2.0/unicast_service.h > @@ -87,4 +87,6 @@ void unicast_service_remove(struct port > */ > int unicast_service_timer(struct port *p); > > +void unicast_service_clear_clients(struct port *p); > + > #endif > _______________________________________________ > Linuxptp-devel mailing list > Linuxptp-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/linuxptp-devel >
_______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel