Lines Matching refs:n_ptr

43 static void node_lost_contact(struct tipc_node *n_ptr);
44 static void node_established_contact(struct tipc_node *n_ptr);
115 struct tipc_node *n_ptr, *temp_node; in tipc_node_create() local
118 n_ptr = tipc_node_find(net, addr); in tipc_node_create()
119 if (n_ptr) in tipc_node_create()
121 n_ptr = kzalloc(sizeof(*n_ptr), GFP_ATOMIC); in tipc_node_create()
122 if (!n_ptr) { in tipc_node_create()
126 n_ptr->addr = addr; in tipc_node_create()
127 n_ptr->net = net; in tipc_node_create()
128 kref_init(&n_ptr->kref); in tipc_node_create()
129 spin_lock_init(&n_ptr->lock); in tipc_node_create()
130 INIT_HLIST_NODE(&n_ptr->hash); in tipc_node_create()
131 INIT_LIST_HEAD(&n_ptr->list); in tipc_node_create()
132 INIT_LIST_HEAD(&n_ptr->publ_list); in tipc_node_create()
133 INIT_LIST_HEAD(&n_ptr->conn_sks); in tipc_node_create()
134 __skb_queue_head_init(&n_ptr->bclink.deferdq); in tipc_node_create()
135 hlist_add_head_rcu(&n_ptr->hash, &tn->node_htable[tipc_hashfn(addr)]); in tipc_node_create()
137 if (n_ptr->addr < temp_node->addr) in tipc_node_create()
140 list_add_tail_rcu(&n_ptr->list, &temp_node->list); in tipc_node_create()
141 n_ptr->action_flags = TIPC_WAIT_PEER_LINKS_DOWN; in tipc_node_create()
142 n_ptr->signature = INVALID_NODE_SIG; in tipc_node_create()
143 tipc_node_get(n_ptr); in tipc_node_create()
146 return n_ptr; in tipc_node_create()
226 void tipc_node_link_up(struct tipc_node *n_ptr, struct tipc_link *l_ptr) in tipc_node_link_up() argument
228 struct tipc_link **active = &n_ptr->active_links[0]; in tipc_node_link_up()
230 n_ptr->working_links++; in tipc_node_link_up()
231 n_ptr->action_flags |= TIPC_NOTIFY_LINK_UP; in tipc_node_link_up()
232 n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; in tipc_node_link_up()
239 node_established_contact(n_ptr); in tipc_node_link_up()
257 n_ptr->act_mtus[0] = active[0]->mtu - INT_H_SIZE; in tipc_node_link_up()
258 n_ptr->act_mtus[1] = active[1]->mtu - INT_H_SIZE; in tipc_node_link_up()
264 static void node_select_active_links(struct tipc_node *n_ptr) in node_select_active_links() argument
266 struct tipc_link **active = &n_ptr->active_links[0]; in node_select_active_links()
273 struct tipc_link *l_ptr = n_ptr->links[i]; in node_select_active_links()
291 void tipc_node_link_down(struct tipc_node *n_ptr, struct tipc_link *l_ptr) in tipc_node_link_down() argument
293 struct tipc_net *tn = net_generic(n_ptr->net, tipc_net_id); in tipc_node_link_down()
296 n_ptr->working_links--; in tipc_node_link_down()
297 n_ptr->action_flags |= TIPC_NOTIFY_LINK_DOWN; in tipc_node_link_down()
298 n_ptr->link_id = l_ptr->peer_bearer_id << 16 | l_ptr->bearer_id; in tipc_node_link_down()
308 active = &n_ptr->active_links[0]; in tipc_node_link_down()
314 node_select_active_links(n_ptr); in tipc_node_link_down()
315 if (tipc_node_is_up(n_ptr)) in tipc_node_link_down()
318 node_lost_contact(n_ptr); in tipc_node_link_down()
322 n_ptr->act_mtus[0] = active[0]->mtu - INT_H_SIZE; in tipc_node_link_down()
323 n_ptr->act_mtus[1] = active[1]->mtu - INT_H_SIZE; in tipc_node_link_down()
327 if (n_ptr->addr == tn->own_addr) { in tipc_node_link_down()
328 n_ptr->act_mtus[0] = MAX_MSG_SIZE; in tipc_node_link_down()
329 n_ptr->act_mtus[1] = MAX_MSG_SIZE; in tipc_node_link_down()
333 int tipc_node_active_links(struct tipc_node *n_ptr) in tipc_node_active_links() argument
335 return n_ptr->active_links[0] != NULL; in tipc_node_active_links()
338 int tipc_node_is_up(struct tipc_node *n_ptr) in tipc_node_is_up() argument
340 return tipc_node_active_links(n_ptr); in tipc_node_is_up()
343 void tipc_node_attach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) in tipc_node_attach_link() argument
345 n_ptr->links[l_ptr->bearer_id] = l_ptr; in tipc_node_attach_link()
346 n_ptr->link_cnt++; in tipc_node_attach_link()
349 void tipc_node_detach_link(struct tipc_node *n_ptr, struct tipc_link *l_ptr) in tipc_node_detach_link() argument
354 if (l_ptr != n_ptr->links[i]) in tipc_node_detach_link()
356 n_ptr->links[i] = NULL; in tipc_node_detach_link()
357 n_ptr->link_cnt--; in tipc_node_detach_link()
361 static void node_established_contact(struct tipc_node *n_ptr) in node_established_contact() argument
363 n_ptr->action_flags |= TIPC_NOTIFY_NODE_UP; in node_established_contact()
364 n_ptr->bclink.oos_state = 0; in node_established_contact()
365 n_ptr->bclink.acked = tipc_bclink_get_last_sent(n_ptr->net); in node_established_contact()
366 tipc_bclink_add_node(n_ptr->net, n_ptr->addr); in node_established_contact()
369 static void node_lost_contact(struct tipc_node *n_ptr) in node_lost_contact() argument
373 struct list_head *conns = &n_ptr->conn_sks; in node_lost_contact()
375 struct tipc_net *tn = net_generic(n_ptr->net, tipc_net_id); in node_lost_contact()
379 tipc_addr_string_fill(addr_string, n_ptr->addr)); in node_lost_contact()
382 if (n_ptr->bclink.recv_permitted) { in node_lost_contact()
383 __skb_queue_purge(&n_ptr->bclink.deferdq); in node_lost_contact()
385 if (n_ptr->bclink.reasm_buf) { in node_lost_contact()
386 kfree_skb(n_ptr->bclink.reasm_buf); in node_lost_contact()
387 n_ptr->bclink.reasm_buf = NULL; in node_lost_contact()
390 tipc_bclink_remove_node(n_ptr->net, n_ptr->addr); in node_lost_contact()
391 tipc_bclink_acknowledge(n_ptr, INVALID_LINK_SEQ); in node_lost_contact()
393 n_ptr->bclink.recv_permitted = false; in node_lost_contact()
398 struct tipc_link *l_ptr = n_ptr->links[i]; in node_lost_contact()
409 n_ptr->action_flags &= ~TIPC_WAIT_OWN_LINKS_DOWN; in node_lost_contact()
412 n_ptr->action_flags |= TIPC_WAIT_PEER_LINKS_DOWN; in node_lost_contact()
415 n_ptr->action_flags |= TIPC_NOTIFY_NODE_DOWN; in node_lost_contact()
424 skb_queue_tail(n_ptr->inputq, skb); in node_lost_contact()
425 n_ptr->action_flags |= TIPC_MSG_EVT; in node_lost_contact()