You may add set action if you wish.
You may combine my get master only patch with it.

You need to verify the ptp4l can dynamically change the master only flag.

As the 'slave only' flag does not allow set, I skip it for now.

Only priorities 1 and  2 can be changed at the moment.

However as the 'master only' is a port action and not clock action as 'slave 
only', it might be easier to implement and verify.

Erez

-----Original Message-----
From: Luigi 'Comio' Mantellini <luigi.mantell...@gmail.com> 
Sent: Thursday, 22 April 2021 15:25
To: Geva, Erez (ext) (DI PA DCP R&D 3) <erez.geva....@siemens.com>
Cc: linuxptp-devel@lists.sourceforge.net
Subject: Re: [Linuxptp-devel] [PATCH 0/1] Add master only management TLV

Why do you also introduce the set action?
This is a snip from port_management_set:

static int port_management_set(struct port *target,
                   struct port *ingress, int id,
                   struct ptp_message *req) { ...
    switch (id) {
    case TLV_MASTERONLY:
        mtd = (struct management_tlv_datum *) tlv->data;
        master_only = !!mtd->val;
        respond = 1;

        if (!!target->master_only != master_only) {
            if (target->bmca == BMCA_NOOP && target->transport != TRANS_UDS) {
                if (master_only) {
                    target->state_machine = designated_master_fsm;
                } else if (clock_slave_only(target->clock)) {
                    target->state_machine = designated_slave_fsm;
                } else {
                    pr_err("Please enable at least one of masterOnly or 
slaveOnly when BMCA == noop.\n");
                    respond = 0;
                }
            } else {
                target->state_machine =
clock_slave_only(target->clock) ? ptp_slave_fsm : ptp_fsm;
            }
            if (respond) {
                target->master_only = master_only;
                port_dispatch(target, EV_INITIALIZE, 0);
            }
        }
        break;
...
}


ciao

luigi

Il giorno gio 22 apr 2021 alle ore 15:06 Erez Geva <erez.geva....@siemens.com> 
ha scritto:
>
> As we support the new master only flag.
> Add the master only TLV to pmc tool.
>
> Erez Geva (1):
>   Add master only management TLV
>
>  pmc.c        | 5 +++++
>  pmc_common.c | 2 ++
>  port.c       | 6 ++++++
>  tlv.h        | 1 +
>  4 files changed, 14 insertions(+)
>
> --
> 2.20.1
>
>
>
> _______________________________________________
> Linuxptp-devel mailing list
> Linuxptp-devel@lists.sourceforge.net
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> s.sourceforge.net%2Flists%2Flistinfo%2Flinuxptp-devel&amp;data=04%7C01
> %7Cerez.geva.ext%40siemens.com%7C2a01d35f5d5442723c6408d90592150e%7C38
> ae3bcd95794fd4addab42e1495d55a%7C1%7C0%7C637546947238491423%7CUnknown%
> 7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJX
> VCI6Mn0%3D%7C1000&amp;sdata=Oj0HTnrQYZ%2Bz7f8ZC8CqdW2hlj%2Frd8gHQuQNeq
> rJKiM%3D&amp;reserved=0



--
Luigi 'Comio' Mantellini
My Professional Profile

"UNIX is very simple, it just needs a genius to understand its simplicity." 
[cit.]


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

Reply via email to