On Sun, 2013-12-01 at 21:09 +0100, Richard Cochran wrote:
> According to 802.1AS, ports are always expected to transmit announce
> messages, even if they never want to become the grand master. Instead
> of using a slave only BMC state machine as in 1588, 802.1AS offers a
> "grand master capable" flag which allows clocks to not send sync
> messages.
> 
> This patch keeps a port from transmitting sync (but not announce)
> messages when there is no other master.
> 
> Signed-off-by: Richard Cochran <[email protected]>
> ---
>  port.c |   28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/port.c b/port.c
> index 13a34a2..df94e8c 100644
> --- a/port.c
> +++ b/port.c
> @@ -532,6 +532,31 @@ static int port_ignore(struct port *p, struct 
> ptp_message *m)
>       return 0;
>  }
>  
> +/*
> + * Test whether a 802.1AS port may transmit a sync message.
> + */
> +static int port_incapable(struct port *p)
> +{
> +     struct ClockIdentity cid;
> +     struct PortIdentity pid;
> +
> +     if (!port_is_ieee8021as(p)) {
> +             return 0;
> +     }
> +     if (clock_gm_capable(p->clock)) {
> +             return 0;
> +     }
> +     cid = clock_identity(p->clock);
> +     pid = clock_parent_identity(p->clock);
> +     if (!memcmp(&cid, &pid.clockIdentity, sizeof(cid))) {
> +             /*
> +              * We are the GM, but without gmCapable set.
> +              */
> +             return 1;
> +     }
> +     return 0;
> +}
> +
>  static int port_is_ieee8021as(struct port *p)
>  {
>       return p->pod.follow_up_info ? 1 : 0;
> @@ -1148,6 +1173,9 @@ static int port_tx_sync(struct port *p)
>       if (!port_capable(p)) {
>               return 0;
>       }

Is there a specific reason that port_capable and port_incapable are not
the same function?

Regards,
Jake

> +     if (port_incapable(p)) {
> +             return 0;
> +     }
>       msg = msg_allocate();
>       if (!msg)
>               return -1;


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Linuxptp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to