Re: [Linuxptp-devel] [PATCH V3 6/7] port: Provide methods to set and get the link status.

2016-10-19 Thread Richard Cochran
On Tue, Oct 18, 2016 at 08:59:17AM +0200, Miroslav Lichvar wrote: > Would it make sense to print the message only when the status has > changed? I'd rather leave them in. These are the events that the kernel is giving us, and I want to see what rtnl is doing, especially since I don't completely t

[Linuxptp-devel] [PATCH V4 2/7] sk: Add a method to obtain a socket for utility purposes.

2016-10-19 Thread Richard Cochran
The clock module will want to know the interface indexes, in order to implement link monitoring. However, the clock does not open any sockets directly. This helper function lets us keep the clock module free of socket level code. Signed-off-by: Richard Cochran --- sk.c | 10 ++ sk.h |

[Linuxptp-devel] [PATCH V4 0/7] Link state tracking

2016-10-19 Thread Richard Cochran
Changes in V4: ~~ - Tolerate failure when opening the rtnl socket. This is especially important in order to run the test suite in the clknetsim environment. Changes in V3: ~~ - Free rtnl's malloc'ed buffer on the exit path. Changes in V2: ~~ - Add more exp

[Linuxptp-devel] [PATCH V4 3/7] clock: Remove stray semicolon.

2016-10-19 Thread Richard Cochran
Signed-off-by: Richard Cochran --- clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clock.c b/clock.c index 8ca749e..55532b8 100644 --- a/clock.c +++ b/clock.c @@ -314,7 +314,7 @@ static void clock_freq_est_reset(struct clock *c) c->fest.origin1 = tmv_zero();

[Linuxptp-devel] [PATCH V4 1/7] rtnl: Introduce RT netlink sockets.

2016-10-19 Thread Richard Cochran
This patch adds a source module that implements RT netlink sockets for the purpose of link monitoring. Unfortunately the netlink API offers no possibility for per-port notification. Instead it forces us to use a de-multiplexing pattern. Signed-off-by: Richard Cochran --- makefile | 2 +- rtn

[Linuxptp-devel] [PATCH V4 4/7] clock: Fix coding style within a helper function.

2016-10-19 Thread Richard Cochran
No functional changes. Signed-off-by: Richard Cochran --- clock.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/clock.c b/clock.c index 55532b8..3b42109 100644 --- a/clock.c +++ b/clock.c @@ -768,20 +768,22 @@ static int clock_add_port(struct clock *c, int ph

[Linuxptp-devel] [PATCH V4 6/7] port: Provide methods to set and get the link status.

2016-10-19 Thread Richard Cochran
Signed-off-by: Richard Cochran --- port.c | 13 + port.h | 14 ++ 2 files changed, 27 insertions(+) diff --git a/port.c b/port.c index 5868983..a1ad6f6 100644 --- a/port.c +++ b/port.c @@ -117,6 +117,7 @@ struct port { int path_trace_enabled;

[Linuxptp-devel] [PATCH V4 5/7] clock: Remember each port's interface index.

2016-10-19 Thread Richard Cochran
We use a hash table to remember the mapping. Since our existing hash table is a simply string hash, we convert the integer index into a decimal string. Although hashing integers in this way is sub-optimal, the table will not be used in a performance critical path. Signed-off-by: Richard Cochran

[Linuxptp-devel] [PATCH V4 7/7] clock: Monitor the link status using a RT netlink socket.

2016-10-19 Thread Richard Cochran
Poll for link up/down events. When a link goes down, the port becomes faulty until the link goes up again. We keep the fault timer from the existing fault detection, but a downed link prevents clear the fault. The new state machine is depicted in this ascii art diagram: ++