Skip to content

Commit d408bef

Browse files
Hoang Ledavem330
authored andcommitted
tipc: eliminate checking netns if node established
Currently, we scan over all network namespaces at each received discovery message in order to check if the sending peer might be present in a host local namespaces. This is unnecessary since we can assume that a peer will not change its location during an established session. We now improve the condition for this testing so that we don't perform any redundant scans. Fixes: f73b128 ("tipc: improve throughput between nodes in netns") 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>
1 parent f8cc62c commit d408bef

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

‎net/tipc/node.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,6 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr,
472472
tipc_bc_sndlink(net),
473473
&n->bc_entry.link)) {
474474
pr_warn("Broadcast rcv link creation failed, no memory\n");
475-
if (n->peer_net) {
476-
n->peer_net = NULL;
477-
n->peer_hash_mix = 0;
478-
}
479475
kfree(n);
480476
n = NULL;
481477
goto exit;
@@ -1073,6 +1069,9 @@ void tipc_node_check_dest(struct net *net, u32 addr,
10731069
if (sign_match && addr_match && link_up) {
10741070
/* All is fine. Do nothing. */
10751071
reset = false;
1072+
/* Peer node is not a container/local namespace */
1073+
if (!n->peer_hash_mix)
1074+
n->peer_hash_mix = hash_mixes;
10761075
} else if (sign_match && addr_match && !link_up) {
10771076
/* Respond. The link will come up in due time */
10781077
*respond = true;
@@ -1398,11 +1397,8 @@ static void node_lost_contact(struct tipc_node *n,
13981397

13991398
/* Notify publications from this node */
14001399
n->action_flags |= TIPC_NOTIFY_NODE_DOWN;
1401-
1402-
if (n->peer_net) {
1403-
n->peer_net = NULL;
1404-
n->peer_hash_mix = 0;
1405-
}
1400+
n->peer_net = NULL;
1401+
n->peer_hash_mix = 0;
14061402
/* Notify sockets connected to node */
14071403
list_for_each_entry_safe(conn, safe, conns, list) {
14081404
skb = tipc_msg_create(TIPC_CRITICAL_IMPORTANCE, TIPC_CONN_MSG,

0 commit comments

Comments
 (0)