All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next] tipc: fix node keep alive interval calculation
@ 2018-12-06  2:00 Hoang Le
  2018-12-06  4:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Hoang Le @ 2018-12-06  2:00 UTC (permalink / raw)
  To: tipc-discussion, jon.maloy, maloy, ying.xue, netdev

When setting LINK tolerance, node timer interval will be calculated
base on the LINK with lowest tolerance.

But when calculated, the old node timer interval only updated if current
setting value (tolerance/4) less than old ones regardless of number of
links as well as links' lowest tolerance value.

This caused to two cases missing if tolerance changed as following:
Case 1:
1.1/ There is one link (L1) available in the system
1.2/ Set L1's tolerance from 1500ms => lower (i.e 500ms)
1.3/ Then, fallback to default (1500ms) or higher (i.e 2000ms)

Expected:
    node timer interval is 1500/4=375ms after 1.3

Result:
node timer interval will not being updated after changing tolerance at 1.3
since its value 1500/4=375ms is not less than 500/4=125ms at 1.2.

Case 2:
2.1/ There are two links (L1, L2) available in the system
2.2/ L1 and L2 tolerance value are 2000ms as initial
2.3/ Set L2's tolerance from 2000ms => lower 1500ms
2.4/ Disable link L2 (bring down its bearer)

Expected:
    node timer interval is 2000ms/4=500ms after 2.4

Result:
node timer interval will not being updated after disabling L2 since
its value 2000ms/4=500ms is still not less than 1500/4=375ms at 2.3
although L2 is already not available in the system.

To fix this, we start the node interval calculation by initializing it to
a value larger than any conceivable calculated value. This way, the link
with the lowest tolerance will always determine the calculated value.

Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>
---
 net/tipc/node.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/tipc/node.c b/net/tipc/node.c
index 488019766433..32556f480a60 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -624,6 +624,12 @@ static void tipc_node_timeout(struct timer_list *t)
 
 	__skb_queue_head_init(&xmitq);
 
+	/* Initial node interval to value larger (10 seconds), then it will be
+	 * recalculated with link lowest tolerance
+	 */
+	tipc_node_read_lock(n);
+	n->keepalive_intv = 10000;
+	tipc_node_read_unlock(n);
 	for (bearer_id = 0; remains && (bearer_id < MAX_BEARERS); bearer_id++) {
 		tipc_node_read_lock(n);
 		le = &n->links[bearer_id];
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net-next] tipc: fix node keep alive interval calculation
  2018-12-06  2:00 [net-next] tipc: fix node keep alive interval calculation Hoang Le
@ 2018-12-06  4:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-12-06  4:52 UTC (permalink / raw)
  To: hoang.h.le; +Cc: tipc-discussion, jon.maloy, maloy, ying.xue, netdev

From: Hoang Le <hoang.h.le@dektech.com.au>
Date: Thu,  6 Dec 2018 09:00:09 +0700

> When setting LINK tolerance, node timer interval will be calculated
> base on the LINK with lowest tolerance.
> 
> But when calculated, the old node timer interval only updated if current
> setting value (tolerance/4) less than old ones regardless of number of
> links as well as links' lowest tolerance value.
> 
> This caused to two cases missing if tolerance changed as following:
> Case 1:
> 1.1/ There is one link (L1) available in the system
> 1.2/ Set L1's tolerance from 1500ms => lower (i.e 500ms)
> 1.3/ Then, fallback to default (1500ms) or higher (i.e 2000ms)
> 
> Expected:
>     node timer interval is 1500/4=375ms after 1.3
> 
> Result:
> node timer interval will not being updated after changing tolerance at 1.3
> since its value 1500/4=375ms is not less than 500/4=125ms at 1.2.
> 
> Case 2:
> 2.1/ There are two links (L1, L2) available in the system
> 2.2/ L1 and L2 tolerance value are 2000ms as initial
> 2.3/ Set L2's tolerance from 2000ms => lower 1500ms
> 2.4/ Disable link L2 (bring down its bearer)
> 
> Expected:
>     node timer interval is 2000ms/4=500ms after 2.4
> 
> Result:
> node timer interval will not being updated after disabling L2 since
> its value 2000ms/4=500ms is still not less than 1500/4=375ms at 2.3
> although L2 is already not available in the system.
> 
> To fix this, we start the node interval calculation by initializing it to
> a value larger than any conceivable calculated value. This way, the link
> with the lowest tolerance will always determine the calculated value.
> 
> Acked-by: Jon Maloy <jon.maloy@ericsson.com>
> Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au>

Applied, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-06  4:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  2:00 [net-next] tipc: fix node keep alive interval calculation Hoang Le
2018-12-06  4:52 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.