aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/socket.c
diff options
context:
space:
mode:
authorHoang Le <hoang.h.le@dektech.com.au>2019-03-19 07:49:50 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-19 16:56:17 -0400
commitc55c8edafa91139419ed011f7d036274ce96be0b (patch)
tree7feab866d748bdb576236c73efa81e7aae9cdb39 /net/tipc/socket.c
parentff2ebbfba6186adf3964eb816f8f255c6e664dc4 (diff)
tipc: smooth change between replicast and broadcast
Currently, a multicast stream may start out using replicast, because there are few destinations, and then it should ideally switch to L2/broadcast IGMP/multicast when the number of destinations grows beyond a certain limit. The opposite should happen when the number decreases below the limit. To eliminate the risk of message reordering caused by method change, a sending socket must stick to a previously selected method until it enters an idle period of 5 seconds. Means there is a 5 seconds pause in the traffic from the sender socket. If the sender never makes such a pause, the method will never change, and transmission may become very inefficient as the cluster grows. With this commit, we allow such a switch between replicast and broadcast without any need for a traffic pause. Solution is to send a dummy message with only the header, also with the SYN bit set, via broadcast or replicast. For the data message, the SYN bit is set and sending via replicast or broadcast (inverse method with dummy). Then, at receiving side any messages follow first SYN bit message (data or dummy message), they will be held in deferred queue until another pair (dummy or data message) arrived in other link. v2: reverse christmas tree declaration Acked-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: Hoang Le <hoang.h.le@dektech.com.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/socket.c')
-rw-r--r--net/tipc/socket.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index b542f14ed444..922b75ff56d3 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -485,6 +485,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
485 tsk_set_unreturnable(tsk, true); 485 tsk_set_unreturnable(tsk, true);
486 if (sock->type == SOCK_DGRAM) 486 if (sock->type == SOCK_DGRAM)
487 tsk_set_unreliable(tsk, true); 487 tsk_set_unreliable(tsk, true);
488 __skb_queue_head_init(&tsk->mc_method.deferredq);
488 } 489 }
489 490
490 trace_tipc_sk_create(sk, NULL, TIPC_DUMP_NONE, " "); 491 trace_tipc_sk_create(sk, NULL, TIPC_DUMP_NONE, " ");
@@ -582,6 +583,7 @@ static int tipc_release(struct socket *sock)
582 sk->sk_shutdown = SHUTDOWN_MASK; 583 sk->sk_shutdown = SHUTDOWN_MASK;
583 tipc_sk_leave(tsk); 584 tipc_sk_leave(tsk);
584 tipc_sk_withdraw(tsk, 0, NULL); 585 tipc_sk_withdraw(tsk, 0, NULL);
586 __skb_queue_purge(&tsk->mc_method.deferredq);
585 sk_stop_timer(sk, &sk->sk_timer); 587 sk_stop_timer(sk, &sk->sk_timer);
586 tipc_sk_remove(tsk); 588 tipc_sk_remove(tsk);
587 589
@@ -2162,6 +2164,9 @@ static void tipc_sk_filter_rcv(struct sock *sk, struct sk_buff *skb,
2162 if (unlikely(grp)) 2164 if (unlikely(grp))
2163 tipc_group_filter_msg(grp, &inputq, xmitq); 2165 tipc_group_filter_msg(grp, &inputq, xmitq);
2164 2166
2167 if (msg_type(hdr) == TIPC_MCAST_MSG)
2168 tipc_mcast_filter_msg(&tsk->mc_method.deferredq, &inputq);
2169
2165 /* Validate and add to receive buffer if there is space */ 2170 /* Validate and add to receive buffer if there is space */
2166 while ((skb = __skb_dequeue(&inputq))) { 2171 while ((skb = __skb_dequeue(&inputq))) {
2167 hdr = buf_msg(skb); 2172 hdr = buf_msg(skb);