On Tue, Aug 16, 2022 at 01:08:35PM -0400, [email protected] wrote:
> From: Izunna Otiji <[email protected]>
>
> Signed-off-by: Izunna Otiji <[email protected]>
> ---
> port.c | 13 ++++++++++++-
> transport.c | 5 +++++
> transport.h | 5 +++++
> 3 files changed, 22 insertions(+), 1 deletion(-)
>
> diff --git a/port.c b/port.c
> index 871ad68..acdf1e5 100644
> --- a/port.c
> +++ b/port.c
> @@ -831,6 +831,8 @@ static void port_management_send_error(struct port *p,
> struct port *ingress,
>
> static const Octet profile_id_drr[] = {0x00, 0x1B, 0x19, 0x00, 0x01, 0x00};
> static const Octet profile_id_p2p[] = {0x00, 0x1B, 0x19, 0x00, 0x02, 0x00};
> +static const Octet profile_id_8275_1[] = {0x00, 0x19, 0xA7, 0x01, 0x02,
> 0x01};
> +static const Octet profile_id_8275_2[] = {0x00, 0x19, 0xA7, 0x02, 0x01,
> 0x00};
>
> static int port_management_fill_response(struct port *target,
> struct ptp_message *rsp, int id)
> @@ -926,7 +928,16 @@ static int port_management_fill_response(struct port
> *target,
> if (target->delayMechanism == DM_P2P) {
> memcpy(buf, profile_id_p2p, PROFILE_ID_LEN);
> } else {
> - memcpy(buf, profile_id_drr, PROFILE_ID_LEN);
> + if (config_get_int(transport_config(target->trp), NULL,
> "dataset_comparison") ==
Please don't nest function calls in function arguments.
> + DS_CMP_G8275) {
> + if (transport_type(target->trp) ==
> TRANS_IEEE_802_3) {
> + memcpy(buf, profile_id_8275_1,
> PROFILE_ID_LEN);
> + } else {
> + memcpy(buf, profile_id_8275_2,
> PROFILE_ID_LEN);
> + }
> + } else {
> + memcpy(buf, profile_id_drr, PROFILE_ID_LEN);
> + }
> }
> buf += PROFILE_ID_LEN;
> datalen = buf - tlv->data;
> diff --git a/transport.c b/transport.c
> index 9366fbf..41ca999 100644
> --- a/transport.c
> +++ b/transport.c
> @@ -98,6 +98,11 @@ enum transport_type transport_type(struct transport *t)
> return t->type;
> }
>
> +struct config* transport_config(struct transport *t)
> +{
> + return t->cfg;
> +}
> +
This new method is superfluous.
The port instance already has a pointer to the clock instance, and
this, in turn, stores a pointer to the configuration instance.
So, in the case of port_management_fill_response(), you can do:
struct config *cfg = clock_config(target->clock);
See?
Thanks,
Richard
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel