PORT_PROPERTIES_NP PMC Command will now display the phcIndex along with
other interface details. A typical use case will be Users can fetch the
phcIndex to use the clock APIs of the kernel (clock_gettime and clock_settime)
to get the PHC time from user applications.

Signed-off-by: Karthikkumar V <kval...@altiostar.com>
Signed-off-by: Ramana Reddy <rre...@altiostar.com>
---
 pmc.c  | 6 ++++--
 port.c | 1 +
 tlv.h  | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/pmc.c b/pmc.c
index a1ee787..67e33a3 100644
--- a/pmc.c
+++ b/pmc.c
@@ -443,11 +443,13 @@ static void pmc_show(struct ptp_message *msg, FILE *fp)
                        IFMT "portIdentity            %s"
                        IFMT "portState               %s"
                        IFMT "timestamping            %s"
-                       IFMT "interface               %s",
+                       IFMT "interface               %s"
+                       IFMT "phcIndex                %d",
                        pid2str(&ppn->portIdentity),
                        ps_str[ppn->port_state],
                        ts_str(ppn->timestamping),
-                       text2str(&ppn->interface));
+                       text2str(&ppn->interface),
+                       ppn->phc_index);
                break;
        case MID_PORT_STATS_NP:
                pcp = (struct port_stats_np *) mgt->data;
diff --git a/port.c b/port.c
index 7e51e77..743b7c7 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.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;
 
-- 
1.8.3.1



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

Reply via email to