Discussion:
[Linuxptp-devel] [PATCH] Log changes to asCapable
Delio Brignoli
2013-03-17 04:29:57 UTC
Permalink
Signed-off-by: Delio Brignoli <***@audioscience.com>
---
port.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)

diff --git a/port.c b/port.c
index ea9a440..5a906ba 100644
--- a/port.c
+++ b/port.c
@@ -75,6 +75,7 @@ struct port {
struct port_defaults pod;
struct PortIdentity portIdentity;
enum port_state state; /*portState*/
+ int asCapable;
Integer8 logMinDelayReqInterval;
TimeInterval peerMeanPathDelay;
Integer8 logAnnounceInterval;
@@ -379,17 +380,34 @@ static int port_capable(struct port *p)
{
if (!port_is_ieee8021as(p)) {
/* Normal 1588 ports are always capable. */
- return 1;
+ goto capable;
}

if (tmv_to_nanoseconds(p->peer_delay) > p->neighborPropDelayThresh) {
- return 0;
+ if (p->asCapable)
+ pr_debug("port %hu: peer_delay (%lld) > neighborPropDelayThresh "
+ "(%lld), resetting asCapable", portnum(p),
+ tmv_to_nanoseconds(p->peer_delay),
+ p->neighborPropDelayThresh);
+ goto not_capable;
}

if (p->pdr_missing > ALLOWED_LOST_RESPONSES) {
- return 0;
+ if (p->asCapable)
+ pr_debug("port %hu: missed %d peer delay resp, "
+ "resetting asCapable", portnum(p), p->pdr_missing);
+ goto not_capable;
}
+
+capable:
+ if (!p->asCapable)
+ pr_debug("port %hu: setting asCapable", portnum(p));
+ p->asCapable = 1;
return 1;
+
+not_capable:
+ p->asCapable = 0;
+ return 0;
}

static int port_clr_tmo(int fd)
@@ -638,6 +656,7 @@ static void port_nrate_initialize(struct port *p)

/* We start in the 'incapable' state. */
p->pdr_missing = ALLOWED_LOST_RESPONSES + 1;
+ p->asCapable = 0;

p->nrate.origin1 = tmv_zero();
p->nrate.ingress1 = tmv_zero();
--
1.7.0.4
Richard Cochran
2013-03-17 17:55:04 UTC
Permalink
Post by Delio Brignoli
---
port.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
Applied.

BTW, since you are going to remember the peer port ID in the 'struct
port', I think it would be also useful to log changes of peer.

Thanks,
Richard
Keller, Jacob E
2013-03-18 17:22:29 UTC
Permalink
-----Original Message-----
Sent: Sunday, March 17, 2013 10:55 AM
To: Delio Brignoli
Subject: Re: [Linuxptp-devel] [PATCH] Log changes to asCapable
Post by Delio Brignoli
---
port.c | 25 ++++++++++++++++++++++---
1 files changed, 22 insertions(+), 3 deletions(-)
Applied.
BTW, since you are going to remember the peer port ID in the 'struct
port', I think it would be also useful to log changes of peer.
Thanks,
Richard
Agreed.

- Jake
Delio Brignoli
2013-03-18 19:35:11 UTC
Permalink
Post by Keller, Jacob E
-----Original Message-----
Sent: Sunday, March 17, 2013 10:55 AM
To: Delio Brignoli
Subject: Re: [Linuxptp-devel] [PATCH] Log changes to asCapable
[...]
Post by Keller, Jacob E
Applied.
BTW, since you are going to remember the peer port ID in the 'struct
port', I think it would be also useful to log changes of peer.
Thanks,
Richard
Agreed.
- Jake
Logging peer port ID changes is implemented as part of "[PATCH v2]
Explicitly detect and handle changes of the peer's port id by resetting
asCapable and the port's nrate" (which was submitted to this mailing
list earlier today).

--
Delio

Loading...