This will allow phc2sys -a to use the correct PHC for synchronization if
ptp4l is using a virtual clock.

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 port.c | 1 +
 tlv.c  | 2 ++
 tlv.h  | 1 +
 3 files changed, 4 insertions(+)

diff --git a/port.c b/port.c
index 5a5741d..83aa452 100644
--- a/port.c
+++ b/port.c
@@ -956,6 +956,7 @@ static int port_management_fill_response(struct port 
*target,
                else
                        ppn->port_state = target->state;
                ppn->timestamping = target->timestamping;
+               ppn->phc_index = target->phc_index;
                ts_label = interface_label(target->iface);
                ptp_text_set(&ppn->interface, ts_label);
                datalen = sizeof(*ppn) + ppn->interface.length;
diff --git a/tlv.c b/tlv.c
index cc8d507..5175694 100644
--- a/tlv.c
+++ b/tlv.c
@@ -316,6 +316,7 @@ static int mgt_post_recv(struct management_tlv *m, uint16_t 
data_len,
                        goto bad_length;
                ppn = (struct port_properties_np *)m->data;
                ppn->portIdentity.portNumber = 
ntohs(ppn->portIdentity.portNumber);
+               ppn->phc_index = ntohl(ppn->phc_index);
                extra_len = sizeof(struct port_properties_np);
                extra_len += ppn->interface.length;
                break;
@@ -438,6 +439,7 @@ static void mgt_pre_send(struct management_tlv *m, struct 
tlv_extra *extra)
        case MID_PORT_PROPERTIES_NP:
                ppn = (struct port_properties_np *)m->data;
                ppn->portIdentity.portNumber = 
htons(ppn->portIdentity.portNumber);
+               ppn->phc_index = htonl(ppn->phc_index);
                break;
        case MID_PORT_STATS_NP:
                psn = (struct port_stats_np *)m->data;
diff --git a/tlv.h b/tlv.h
index 97615fd..0f6cf28 100644
--- a/tlv.h
+++ b/tlv.h
@@ -341,6 +341,7 @@ struct port_properties_np {
        struct PortIdentity portIdentity;
        uint8_t port_state;
        uint8_t timestamping;
+       Integer32 phc_index;
        struct PTPText interface;
 } PACKED;
 
-- 
2.33.1



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

Reply via email to