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. I used this patch to solve a problem. It clears the client list, if port goes to faulty state. 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