Lines Matching +full:wakeup +full:- +full:method
4 * Copyright (c) 2004-2006, 2014-2017, Ericsson AB
6 * Copyright (c) 2005, 2010-2011, Wind River Systems
48 const char tipc_bclink_name[] = "broadcast-link";
52 * struct tipc_bc_base - base structure for keeping broadcast send state
61 * @rc_ratio: dest count as percentage of cluster size where send method changes
79 return tipc_net(net)->bcbase; in tipc_bc_base()
82 /* tipc_bcast_get_mtu(): -get the MTU currently used by broadcast link
93 tipc_bc_base(net)->rcast_support = supp; in tipc_bcast_toggle_rcast()
101 bb->bc_threshold = 1 + (cluster_size * bb->rc_ratio / 100); in tipc_bcbase_calc_bc_threshold()
110 int all_dests = tipc_link_bc_peers(bb->link); in tipc_bcbase_select_primary()
111 int max_win = tipc_link_max_win(bb->link); in tipc_bcbase_select_primary()
112 int min_win = tipc_link_min_win(bb->link); in tipc_bcbase_select_primary()
115 bb->primary_bearer = INVALID_BEARER_ID; in tipc_bcbase_select_primary()
116 bb->bcast_support = true; in tipc_bcbase_select_primary()
122 if (!bb->dests[i]) in tipc_bcbase_select_primary()
126 if (mtu < tipc_link_mtu(bb->link)) { in tipc_bcbase_select_primary()
127 tipc_link_set_mtu(bb->link, mtu); in tipc_bcbase_select_primary()
128 tipc_link_set_queue_limits(bb->link, in tipc_bcbase_select_primary()
132 bb->bcast_support &= tipc_bearer_bcast_support(net, i); in tipc_bcbase_select_primary()
133 if (bb->dests[i] < all_dests) in tipc_bcbase_select_primary()
136 bb->primary_bearer = i; in tipc_bcbase_select_primary()
142 prim = bb->primary_bearer; in tipc_bcbase_select_primary()
144 bb->bcast_support = tipc_bearer_bcast_support(net, prim); in tipc_bcbase_select_primary()
152 bb->dests[bearer_id]++; in tipc_bcast_inc_bearer_dst_cnt()
162 bb->dests[bearer_id]--; in tipc_bcast_dec_bearer_dst_cnt()
167 /* tipc_bcbase_xmit - broadcast a packet queue across one or more bearers
188 bearer_id = bb->primary_bearer; in tipc_bcbase_xmit()
197 if (!bb->dests[bearer_id]) in tipc_bcbase_xmit()
213 struct tipc_mc_method *method) in tipc_bcast_select_xmit_method() argument
216 unsigned long exp = method->expires; in tipc_bcast_select_xmit_method()
219 if (!bb->bcast_support) { in tipc_bcast_select_xmit_method()
220 method->rcast = true; in tipc_bcast_select_xmit_method()
224 if (!bb->rcast_support) { in tipc_bcast_select_xmit_method()
225 method->rcast = false; in tipc_bcast_select_xmit_method()
228 /* Can current method be changed ? */ in tipc_bcast_select_xmit_method()
229 method->expires = jiffies + TIPC_METHOD_EXPIRE; in tipc_bcast_select_xmit_method()
230 if (method->mandatory) in tipc_bcast_select_xmit_method()
233 if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL) && in tipc_bcast_select_xmit_method()
237 /* Configuration as force 'broadcast' method */ in tipc_bcast_select_xmit_method()
238 if (bb->force_bcast) { in tipc_bcast_select_xmit_method()
239 method->rcast = false; in tipc_bcast_select_xmit_method()
242 /* Configuration as force 'replicast' method */ in tipc_bcast_select_xmit_method()
243 if (bb->force_rcast) { in tipc_bcast_select_xmit_method()
244 method->rcast = true; in tipc_bcast_select_xmit_method()
247 /* Configuration as 'autoselect' or default method */ in tipc_bcast_select_xmit_method()
248 /* Determine method to use now */ in tipc_bcast_select_xmit_method()
249 method->rcast = dests <= bb->bc_threshold; in tipc_bcast_select_xmit_method()
252 /* tipc_bcast_xmit - broadcast the buffer chain to all external nodes
257 * Returns 0 if success, otherwise errno: -EHOSTUNREACH,-EMSGSIZE
273 if (rc == -ELINKCONG) { in tipc_bcast_xmit()
280 /* tipc_rcast_xmit - replicate and send a message to given destination nodes
298 list_for_each_entry_safe(dst, tmp, &dests->list, list) { in tipc_rcast_xmit()
299 dnode = dst->node; in tipc_rcast_xmit()
301 return -ENOMEM; in tipc_rcast_xmit()
303 /* Any other return value than -ELINKCONG is ignored */ in tipc_rcast_xmit()
304 if (tipc_node_xmit(net, &_pkts, dnode, selector) == -ELINKCONG) in tipc_rcast_xmit()
310 /* tipc_mcast_send_sync - deliver a dummy message with SYN bit
313 * @method: send method to be used
318 struct tipc_mc_method *method, in tipc_mcast_send_sync() argument
328 if (!(tipc_net(net)->capabilities & TIPC_MCAST_RBCTL)) in tipc_mcast_send_sync()
340 return -ENOMEM; in tipc_mcast_send_sync()
349 /* Reverse method for dummy message */ in tipc_mcast_send_sync()
357 if (method->rcast) in tipc_mcast_send_sync()
368 /* tipc_mcast_xmit - deliver message to indicated destination nodes
372 * @method: send method to be used
379 struct tipc_mc_method *method, struct tipc_nlist *dests, in tipc_mcast_xmit() argument
383 bool rcast = method->rcast; in tipc_mcast_xmit()
392 if (dests->local && !tipc_msg_reassemble(pkts, &localq)) { in tipc_mcast_xmit()
393 rc = -ENOMEM; in tipc_mcast_xmit()
396 /* Send according to determined transmit method */ in tipc_mcast_xmit()
397 if (dests->remote) { in tipc_mcast_xmit()
398 tipc_bcast_select_xmit_method(net, dests->remote, method); in tipc_mcast_xmit()
404 msg_set_is_rcast(hdr, method->rcast); in tipc_mcast_xmit()
406 /* Switch method ? */ in tipc_mcast_xmit()
407 if (rcast != method->rcast) { in tipc_mcast_xmit()
408 rc = tipc_mcast_send_sync(net, skb, method, dests); in tipc_mcast_xmit()
410 pr_err("Unable to send SYN: method %d, rc %d\n", in tipc_mcast_xmit()
416 if (method->rcast) in tipc_mcast_xmit()
422 if (dests->local) { in tipc_mcast_xmit()
432 /* tipc_bcast_rcv - receive a broadcast packet, and deliver to rcv link
439 struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq; in tipc_bcast_rcv()
459 /* Any socket wakeup messages ? */ in tipc_bcast_rcv()
466 /* tipc_bcast_ack_rcv - receive and handle a broadcast acknowledge
473 struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq; in tipc_bcast_ack_rcv()
489 /* Any socket wakeup messages ? */ in tipc_bcast_ack_rcv()
494 /* tipc_bcast_synch_rcv - check and update rcv link with peer's send state
502 struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq; in tipc_bcast_sync_rcv()
525 /* Any socket wakeup messages ? */ in tipc_bcast_sync_rcv()
531 /* tipc_bcast_add_peer - add a peer node to broadcast link and bearer
547 /* tipc_bcast_remove_peer - remove a peer node from broadcast link and bearer
554 struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq; in tipc_bcast_remove_peer()
567 /* Any socket wakeup messages ? */ in tipc_bcast_remove_peer()
575 return -ENOPROTOOPT; in tipc_bclink_reset_stats()
588 return -ENOPROTOOPT; in tipc_bc_link_set_queue_limits()
592 return -EINVAL; in tipc_bc_link_set_queue_limits()
605 if (!bb->bcast_support) in tipc_bc_link_set_broadcast_mode()
606 return -ENOPROTOOPT; in tipc_bc_link_set_broadcast_mode()
608 bb->force_bcast = true; in tipc_bc_link_set_broadcast_mode()
609 bb->force_rcast = false; in tipc_bc_link_set_broadcast_mode()
612 if (!bb->rcast_support) in tipc_bc_link_set_broadcast_mode()
613 return -ENOPROTOOPT; in tipc_bc_link_set_broadcast_mode()
615 bb->force_bcast = false; in tipc_bc_link_set_broadcast_mode()
616 bb->force_rcast = true; in tipc_bc_link_set_broadcast_mode()
619 if (!bb->bcast_support || !bb->rcast_support) in tipc_bc_link_set_broadcast_mode()
620 return -ENOPROTOOPT; in tipc_bc_link_set_broadcast_mode()
622 bb->force_bcast = false; in tipc_bc_link_set_broadcast_mode()
623 bb->force_rcast = false; in tipc_bc_link_set_broadcast_mode()
626 return -EINVAL; in tipc_bc_link_set_broadcast_mode()
636 if (!bb->bcast_support || !bb->rcast_support) in tipc_bc_link_set_broadcast_ratio()
637 return -ENOPROTOOPT; in tipc_bc_link_set_broadcast_ratio()
640 return -EINVAL; in tipc_bc_link_set_broadcast_ratio()
642 bb->rc_ratio = bc_ratio; in tipc_bc_link_set_broadcast_ratio()
659 return -EINVAL; in tipc_nl_bc_link_set()
668 return -EOPNOTSUPP; in tipc_nl_bc_link_set()
698 tn->bcbase = bb; in tipc_bcast_init()
699 spin_lock_init(&tipc_net(net)->bclock); in tipc_bcast_init()
706 &bb->inputq, in tipc_bcast_init()
711 bb->link = l; in tipc_bcast_init()
712 tn->bcl = l; in tipc_bcast_init()
713 bb->rc_ratio = 10; in tipc_bcast_init()
714 bb->rcast_support = true; in tipc_bcast_init()
719 return -ENOMEM; in tipc_bcast_init()
727 kfree(tn->bcbase); in tipc_bcast_stop()
728 kfree(tn->bcl); in tipc_bcast_stop()
734 INIT_LIST_HEAD(&nl->list); in tipc_nlist_init()
735 nl->self = self; in tipc_nlist_init()
740 if (node == nl->self) in tipc_nlist_add()
741 nl->local = true; in tipc_nlist_add()
742 else if (tipc_dest_push(&nl->list, node, 0)) in tipc_nlist_add()
743 nl->remote++; in tipc_nlist_add()
748 if (node == nl->self) in tipc_nlist_del()
749 nl->local = false; in tipc_nlist_del()
750 else if (tipc_dest_del(&nl->list, node, 0)) in tipc_nlist_del()
751 nl->remote--; in tipc_nlist_del()
756 tipc_dest_list_purge(&nl->list); in tipc_nlist_purge()
757 nl->remote = 0; in tipc_nlist_purge()
758 nl->local = false; in tipc_nlist_purge()
765 if (bb->force_bcast) in tipc_bcast_get_mode()
768 if (bb->force_rcast) in tipc_bcast_get_mode()
771 if (bb->bcast_support && bb->rcast_support) in tipc_bcast_get_mode()
781 return bb->rc_ratio; in tipc_bcast_get_broadcast_ratio()
826 /* Deliver non-SYN message from other link, otherwise queue it */ in tipc_mcast_filter_msg()
835 /* Queue non-SYN/SYN message from same link */ in tipc_mcast_filter_msg()
852 /* Deliver subsequent non-SYN messages from same peer */ in tipc_mcast_filter_msg()