tipc: make broadcast bearer store in bearer_list array
[firefly-linux-kernel-4.4.55.git] / net / tipc / node.c
index efe4d41bf11bacb258e3096dc4619e97828c2904..7c9b6673e2ab9161757dd31f647314b887241410 100644 (file)
@@ -95,12 +95,6 @@ struct tipc_node *tipc_node_create(u32 addr)
 
        spin_lock_bh(&node_create_lock);
 
-       n_ptr = tipc_node_find(addr);
-       if (n_ptr) {
-               spin_unlock_bh(&node_create_lock);
-               return n_ptr;
-       }
-
        n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC);
        if (!n_ptr) {
                spin_unlock_bh(&node_create_lock);
@@ -162,7 +156,7 @@ void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
                pr_info("New link <%s> becomes standby\n", l_ptr->name);
                return;
        }
-       tipc_link_dup_send_queue(active[0], l_ptr);
+       tipc_link_dup_queue_xmit(active[0], l_ptr);
        if (l_ptr->priority == active[0]->priority) {
                active[0] = l_ptr;
                return;
@@ -249,9 +243,15 @@ void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
 
 void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr)
 {
-       n_ptr->links[l_ptr->b_ptr->identity] = NULL;
-       atomic_dec(&tipc_num_links);
-       n_ptr->link_cnt--;
+       int i;
+
+       for (i = 0; i < MAX_BEARERS; i++) {
+               if (l_ptr != n_ptr->links[i])
+                       continue;
+               n_ptr->links[i] = NULL;
+               atomic_dec(&tipc_num_links);
+               n_ptr->link_cnt--;
+       }
 }
 
 static void node_established_contact(struct tipc_node *n_ptr)