Now that all the pieces are in place, hook the port logic into the unicast
client code.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 port.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/port.c b/port.c
index 19d4939..68066bc 100644
--- a/port.c
+++ b/port.c
@@ -1608,8 +1608,12 @@ int port_initialize(struct port *p)
                p->fda.fd[FD_FIRST_TIMER + i] = fd[i];
        }
 
-       if (port_set_announce_tmo(p))
+       if (port_set_announce_tmo(p)) {
                goto no_tmo;
+       }
+       if (unicast_client_enabled(p) && unicast_client_set_tmo(p)) {
+               goto no_tmo;
+       }
 
        /* No need to open rtnl socket on UDS port. */
        if (transport_type(p->trp) != TRANS_UDS) {
@@ -2476,7 +2480,7 @@ static enum fsm_event bc_event(struct port *p, int 
fd_index)
 
        case FD_UNICAST_REQ_TIMER:
                pr_debug("port %hu: unicast request timeout", portnum(p));
-               return EV_NONE;
+               return unicast_client_timer(p) ? EV_FAULT_DETECTED : EV_NONE;
 
        case FD_RTNL:
                pr_debug("port %hu: received link status notification", 
portnum(p));
@@ -2561,6 +2565,9 @@ static enum fsm_event bc_event(struct port *p, int 
fd_index)
                        event = EV_STATE_DECISION_EVENT;
                break;
        case SIGNALING:
+               if (process_signaling(p, msg)) {
+                       event = EV_FAULT_DETECTED;
+               }
                break;
        case MANAGEMENT:
                if (clock_manage(p->clock, p, msg))
@@ -2860,7 +2867,6 @@ struct port *port_open(int phc_index,
        p->announce_span = transport == TRANS_UDS ? 0 : ANNOUNCE_SPAN;
        p->follow_up_info = config_get_int(cfg, p->name, "follow_up_info");
        p->freq_est_interval = config_get_int(cfg, p->name, 
"freq_est_interval");
-       p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e");
        p->net_sync_monitor = config_get_int(cfg, p->name, "net_sync_monitor");
        p->path_trace_enabled = config_get_int(cfg, p->name, 
"path_trace_enabled");
        p->tc_spanning_tree = config_get_int(cfg, p->name, "tc_spanning_tree");
@@ -2881,6 +2887,15 @@ struct port *port_open(int phc_index,
        p->delayMechanism = config_get_int(cfg, p->name, "delay_mechanism");
        p->versionNumber = PTP_VERSION;
 
+       if (number && unicast_client_claim_table(p)) {
+               goto err_port;
+       }
+       if (unicast_client_enabled(p) &&
+           config_set_section_int(cfg, p->name, "hybrid_e2e", 1)) {
+               goto err_port;
+       }
+       p->hybrid_e2e = config_get_int(cfg, p->name, "hybrid_e2e");
+
        if (number && type == CLOCK_TYPE_P2P && p->delayMechanism != DM_P2P) {
                pr_err("port %d: P2P TC needs P2P ports", number);
                goto err_port;
@@ -2976,6 +2991,7 @@ int port_state_update(struct port *p, enum fsm_event 
event, int mdiff)
                port_show_transition(p, next, event);
                p->state = next;
                port_notify_event(p, NOTIFY_PORT_STATE);
+               unicast_client_state_changed(p);
                return 1;
        }
 
-- 
2.11.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to