On Mon, May 30, 2022 at 09:34:17PM +0200, Arkadiusz Kubalewski wrote:
> Interface used for:
> - creation, building and storing new SyncE PDU's for later transmission
> - obtain Quality Level TLV and Extended Quality Level TLV from existing
> SyncE PDU's
>
> synce_msg_private.h has constants and structs as defined by Synchronous
> Ethernet standard - Recommendation ITU-T G.8264//Y.1364.
> +int synce_msg_attach_extended_ql_tlv(struct synce_pdu *pdu,
> + struct synce_msg_ext_ql *ext_ql)
> +{
> + struct esmc_tlv *tlv;
> +
> + if (!pdu || !ext_ql) {
> + pr_err("either pdu or ext_ql not provided");
> + return -ENXIO;
> + }
> +
> + tlv = malloc(sizeof(struct esmc_tlv));
> + if (!tlv) {
> + pr_err("malloc failed for TLV: %m");
> + return -ENOMEM;
> + }
> +
> + tlv->extended_ql_tlv.type = EXT_QL_TLV_TYPE;
> + tlv->extended_ql_tlv.length = htons(EXT_QL_TLV_LEN);
> + tlv->extended_ql_tlv.enhancedSsmCode = ext_ql->enhancedSsmCode;
> + memcpy(&tlv->extended_ql_tlv.clockIdentity, &ext_ql->clockIdentity,
> + sizeof(tlv->extended_ql_tlv.clockIdentity));
> + tlv->extended_ql_tlv.flag = ext_ql->flag;
> + tlv->extended_ql_tlv.cascaded_eEEcs = ext_ql->cascaded_eEEcs;
> + tlv->extended_ql_tlv.cascaded_EEcs = ext_ql->cascaded_EEcs;
> +
> + attach_esmc_tlv(pdu, tlv);
The reserved field of the TLV is left uninitialized here and send to
the network later.
> +
> + generate_tlvs(pdu);
> +
> + return 0;
> +}
--
Miroslav Lichvar
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel