All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 1/1] tipc: eliminate unnecessary probing
@ 2017-11-02 14:44 Jon Maloy
  2017-11-03  6:49 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2017-11-02 14:44 UTC (permalink / raw)
  To: davem, netdev; +Cc: parthasarathy.bhuvaragan, ying.xue, tipc-discussion

The neighbor monitor employs a threshold, default set to 32 peer nodes,
where it activates the "Overlapping Neighbor Monitoring" algorithm.
Below that threshold, monitoring is full-mesh, and no "domain records"
are passed between the nodes.

Because of this, a node never received a peer's ack that it has received
the most recent update of the own domain. Hence, the field 'acked_gen'
in struct tipc_monitor_state remains permamently at zero, whereas the
own domain generation is incremented for each added or removed peer.

This has the effect that the function tipc_mon_get_state() always sets
the field 'probing' in struct tipc_monitor_state true, again leading the
tipc_link_timeout() of the link in question to always send out a probe,
even when link->silent_intv_count is zero.

This is functionally harmless, but leads to some unncessary probing,
which can easily be eliminated by setting the 'probing' field of the
said struct correctly in such cases.

At the same time, we explictly invalidate the sent domain records when
the algorithm is not activated. This will eliminate any risk that an
invalid domain record might be inadverently accepted by the peer.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
 net/tipc/monitor.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/tipc/monitor.c b/net/tipc/monitor.c
index b9c3255..8e884ed 100644
--- a/net/tipc/monitor.c
+++ b/net/tipc/monitor.c
@@ -530,8 +530,11 @@ void tipc_mon_prep(struct net *net, void *data, int *dlen,
 	u16 gen = mon->dom_gen;
 	u16 len;
 
-	if (!tipc_mon_is_active(net, mon))
+	/* Send invalid record if not active */
+	if (!tipc_mon_is_active(net, mon)) {
+		dom->len = 0;
 		return;
+	}
 
 	/* Send only a dummy record with ack if peer has acked our last sent */
 	if (likely(state->acked_gen == gen)) {
@@ -559,6 +562,12 @@ void tipc_mon_get_state(struct net *net, u32 addr,
 	struct tipc_monitor *mon = tipc_monitor(net, bearer_id);
 	struct tipc_peer *peer;
 
+	if (!tipc_mon_is_active(net, mon)) {
+		state->probing = false;
+		state->monitoring = true;
+		return;
+	}
+
 	/* Used cached state if table has not changed */
 	if (!state->probing &&
 	    (state->list_gen == mon->list_gen) &&
-- 
2.1.4

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

* Re: [net-next 1/1] tipc: eliminate unnecessary probing
  2017-11-02 14:44 [net-next 1/1] tipc: eliminate unnecessary probing Jon Maloy
@ 2017-11-03  6:49 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-11-03  6:49 UTC (permalink / raw)
  To: jon.maloy; +Cc: netdev, parthasarathy.bhuvaragan, ying.xue, tipc-discussion

From: Jon Maloy <jon.maloy@ericsson.com>
Date: Thu, 2 Nov 2017 15:44:15 +0100

> The neighbor monitor employs a threshold, default set to 32 peer nodes,
> where it activates the "Overlapping Neighbor Monitoring" algorithm.
> Below that threshold, monitoring is full-mesh, and no "domain records"
> are passed between the nodes.
> 
> Because of this, a node never received a peer's ack that it has received
> the most recent update of the own domain. Hence, the field 'acked_gen'
> in struct tipc_monitor_state remains permamently at zero, whereas the
> own domain generation is incremented for each added or removed peer.
> 
> This has the effect that the function tipc_mon_get_state() always sets
> the field 'probing' in struct tipc_monitor_state true, again leading the
> tipc_link_timeout() of the link in question to always send out a probe,
> even when link->silent_intv_count is zero.
> 
> This is functionally harmless, but leads to some unncessary probing,
> which can easily be eliminated by setting the 'probing' field of the
> said struct correctly in such cases.
> 
> At the same time, we explictly invalidate the sent domain records when
> the algorithm is not activated. This will eliminate any risk that an
> invalid domain record might be inadverently accepted by the peer.
> 
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>

Applied.

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

end of thread, other threads:[~2017-11-03  6:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 14:44 [net-next 1/1] tipc: eliminate unnecessary probing Jon Maloy
2017-11-03  6:49 ` 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.