On Wed, 2022-12-07 at 17:34 +0530, SyncMonk Technologies wrote:
> 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 <[email protected]>
> Signed-off-by: Leon Goldin <[email protected]>
> Signed-off-by: Devasish Dey <[email protected]>
> Signed-off-by: Vipin Sharma <[email protected]>
> ---
> 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..1ad23d4 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;
IEEE 1588-2019 only define Integer64, but not UInteger64.
Not sure why, but probably there is no UInteger64 in IEEE standard.
Are you using UInteger64 for a standard parameter/variables?
> typedef uint8_t Octet;
>
> #endif
> diff --git a/port.c b/port.c
> index 7fd50dd..85cfa4a 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;
Again, using bool in structure is unwise.
Better use uint8_t and not UInteger8, so we now it is not standard type
and with a comment saying it holds a boolean value.
> 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.
Erez
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel