adding interface rate TLV as defined by ITU-T G.8275.2 Annex D to
enable master to communicate PTP port interface rate to slave.

Signed-off-by: Greg Armstrong <greg.armstrong...@renesas.com>
Signed-off-by: Leon Goldin <leon.goldin...@renesas.com>
Signed-off-by: Devasish Dey <devasish....@syncmonk.net>
Signed-off-by: Vipin Sharma <vipin.sha...@syncmonk.net>

v4: Updating comments for UInteger64 introduced in pdt.h as per ITU-T G.8275.2
---
 config.c       |  1 +
 pdt.h          |  1 +
 port.c         |  1 +
 port_private.h |  1 +
 tlv.c          |  1 +
 tlv.h          | 14 ++++++++++++++
 6 files changed, 19 insertions(+)

diff --git a/config.c b/config.c
index 08e3346..2fa95fc 100644
--- a/config.c
+++ b/config.c
@@ -267,6 +267,7 @@ struct config_item config_tab[] = {
        PORT_ITEM_INT("inhibit_delay_req", 0, 0, 1),
        PORT_ITEM_INT("inhibit_multicast_service", 0, 0, 1),
        GLOB_ITEM_INT("initial_delay", 0, 0, INT_MAX),
+       PORT_ITEM_INT("interface_rate_tlv", 0, 0, 1),
        GLOB_ITEM_INT("kernel_leap", 1, 0, 1),
        GLOB_ITEM_STR("leapfile", NULL),
        PORT_ITEM_INT("logAnnounceInterval", 1, INT8_MIN, INT8_MAX),
diff --git a/pdt.h b/pdt.h
index e46b218..eaad58b 100644
--- a/pdt.h
+++ b/pdt.h
@@ -39,6 +39,7 @@ typedef uint16_t  UInteger16;
 typedef int32_t   Integer32;
 typedef uint32_t  UInteger32;
 typedef int64_t   Integer64;
+typedef uint64_t  UInteger64; /* ITU-T G.8275.2 */
 typedef uint8_t   Octet;
 
 #endif
diff --git a/port.c b/port.c
index 2a96c40..8a1c42a 100644
--- a/port.c
+++ b/port.c
@@ -1854,6 +1854,7 @@ int port_initialize(struct port *p)
        p->neighborPropDelayThresh = config_get_int(cfg, p->name, 
"neighborPropDelayThresh");
        p->min_neighbor_prop_delay = config_get_int(cfg, p->name, 
"min_neighbor_prop_delay");
        p->delay_response_timeout  = config_get_int(cfg, p->name, 
"delay_response_timeout");
+       p->iface_rate_tlv          = config_get_int(cfg, p->name, 
"interface_rate_tlv");
 
        if (config_get_int(cfg, p->name, "asCapable") == AS_CAPABLE_TRUE) {
                p->asCapable = ALWAYS_CAPABLE;
diff --git a/port_private.h b/port_private.h
index d27dceb..d6487eb 100644
--- a/port_private.h
+++ b/port_private.h
@@ -145,6 +145,7 @@ struct port {
        UInteger8           versionNumber; /* UInteger4 */
        UInteger8           delay_response_counter;
        UInteger8           delay_response_timeout;
+       bool                iface_rate_tlv;
        struct PortStats    stats;
        struct PortServiceStats    service_stats;
        /* foreignMasterDS */
diff --git a/tlv.c b/tlv.c
index 1c13460..35bee4f 100644
--- a/tlv.c
+++ b/tlv.c
@@ -35,6 +35,7 @@
        (tlv->length < sizeof(struct type) - sizeof(struct TLV))
 
 uint8_t ieee8021_id[3] = { IEEE_802_1_COMMITTEE };
+uint8_t itu_t_id[3] = { ITU_T_COMMITTEE };
 
 static TAILQ_HEAD(tlv_pool, tlv_extra) tlv_pool =
        TAILQ_HEAD_INITIALIZER(tlv_pool);
diff --git a/tlv.h b/tlv.h
index 8966696..ec22e2f 100644
--- a/tlv.h
+++ b/tlv.h
@@ -395,6 +395,20 @@ struct tlv_extra {
        };
 };
 
+/* Organizationally Unique Identifiers */
+#define ITU_T_COMMITTEE 0x00, 0x19, 0xA7
+extern uint8_t itu_t_id[3];
+
+struct msg_interface_rate_tlv {
+       Enumeration16 type;
+       UInteger16    length;
+       Octet         id[3];
+       Octet         subtype[3];
+       UInteger64    interfaceBitPeriod;
+       UInteger16    numberOfBitsBeforeTimestamp;
+       UInteger16    numberOfBitsAfterTimestamp;
+} PACKED;
+
 /**
  * Allocates a new tlv_extra structure.
  * @return  Pointer to a new structure on success or NULL otherwise.
-- 
2.34.1



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

Reply via email to