2006-01-03 01:04:38 +07:00
|
|
|
/*
|
|
|
|
* net/tipc/bcast.c: TIPC broadcast code
|
2007-02-09 21:25:21 +07:00
|
|
|
*
|
2015-02-05 20:36:43 +07:00
|
|
|
* Copyright (c) 2004-2006, 2014-2015, Ericsson AB
|
2006-01-03 01:04:38 +07:00
|
|
|
* Copyright (c) 2004, Intel Corporation.
|
2011-01-08 01:00:11 +07:00
|
|
|
* Copyright (c) 2005, 2010-2011, Wind River Systems
|
2006-01-03 01:04:38 +07:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
2006-01-11 19:30:43 +07:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
2006-01-03 01:04:38 +07:00
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
2006-01-11 19:30:43 +07:00
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Neither the names of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
2006-01-03 01:04:38 +07:00
|
|
|
*
|
2006-01-11 19:30:43 +07:00
|
|
|
* Alternatively, this software may be distributed under the terms of the
|
|
|
|
* GNU General Public License ("GPL") version 2 as published by the Free
|
|
|
|
* Software Foundation.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
2006-01-03 01:04:38 +07:00
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2015-10-22 19:51:33 +07:00
|
|
|
#include <linux/tipc_config.h>
|
2014-07-17 07:41:00 +07:00
|
|
|
#include "socket.h"
|
|
|
|
#include "msg.h"
|
2006-01-03 01:04:38 +07:00
|
|
|
#include "bcast.h"
|
2011-04-08 01:57:53 +07:00
|
|
|
#include "name_distr.h"
|
2015-10-22 19:51:33 +07:00
|
|
|
#include "link.h"
|
|
|
|
#include "node.h"
|
2006-01-03 01:04:38 +07:00
|
|
|
|
tipc: extend broadcast link window size
The default fix broadcast window size is currently set to 20 packets.
This is a very low value, set at a time when we were still testing on
10 Mb/s hubs, and a change to it is long overdue.
Commit 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
revealed a problem with this low value. For messages of importance LOW,
the backlog queue limit will be calculated to 30 packets, while a
single, maximum sized message of 66000 bytes, carried across a 1500 MTU
network consists of 46 packets.
This leads to the following scenario (among others leading to the same
situation):
1: Msg 1 of 46 packets is sent. 20 packets go to the transmit queue, 26
packets to the backlog queue.
2: Msg 2 of 46 packets is attempted sent, but rejected because there is
no more space in the backlog queue at this level. The sender is added
to the wakeup queue with a "pending packets chain size" number of 46.
3: Some packets in the transmit queue are acked and released. We try to
wake up the sender, but the pending size of 46 is bigger than the LOW
wakeup limit of 30, so this doesn't happen.
5: Subsequent acks releases all the remaining buffers. Each time we test
for the wakeup criteria and find that 46 still is larger than 30,
even after both the transmit and the backlog queues are empty.
6: The sender is never woken up and given a chance to send its message.
He is stuck.
We could now loosen the wakeup criteria (used by link_prepare_wakeup())
to become equal to the send criteria (used by tipc_link_xmit()), i.e.,
by ignoring the "pending packets chain size" value altogether, or we can
just increase the queue limits so that the criteria can be satisfied
anyway. There are good reasons (potentially multiple waiting senders) to
not opt for the former solution, so we choose the latter one.
This commit fixes the problem by giving the broadcast link window a
default value of 50 packets. We also introduce a new minimum link
window size BCLINK_MIN_WIN of 32, which is enough to always avoid the
described situation. Finally, in order to not break any existing users
which may set the window explicitly, we enforce that the window is set
to the new minimum value in case the user is trying to set it to
anything lower.
Fixes: 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-19 20:21:37 +07:00
|
|
|
#define BCLINK_WIN_DEFAULT 50 /* bcast link window size (default) */
|
|
|
|
#define BCLINK_WIN_MIN 32 /* bcast minimum link window size */
|
2006-01-03 01:04:38 +07:00
|
|
|
|
2010-05-11 21:30:07 +07:00
|
|
|
const char tipc_bclink_name[] = "broadcast-link";
|
2006-01-03 01:04:38 +07:00
|
|
|
|
2015-10-22 19:51:33 +07:00
|
|
|
/**
|
2015-10-22 19:51:48 +07:00
|
|
|
* struct tipc_bc_base - base structure for keeping broadcast send state
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
* @link: broadcast send link structure
|
2015-10-22 19:51:48 +07:00
|
|
|
* @inputq: data input queue; will only carry SOCK_WAKEUP messages
|
|
|
|
* @dest: array keeping number of reachable destinations per bearer
|
|
|
|
* @primary_bearer: a bearer having links to all broadcast destinations, if any
|
2015-10-22 19:51:33 +07:00
|
|
|
*/
|
|
|
|
struct tipc_bc_base {
|
2015-10-22 19:51:37 +07:00
|
|
|
struct tipc_link *link;
|
2015-10-22 19:51:33 +07:00
|
|
|
struct sk_buff_head inputq;
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
int dests[MAX_BEARERS];
|
|
|
|
int primary_bearer;
|
2015-10-22 19:51:33 +07:00
|
|
|
};
|
|
|
|
|
2015-10-22 19:51:35 +07:00
|
|
|
static struct tipc_bc_base *tipc_bc_base(struct net *net)
|
|
|
|
{
|
|
|
|
return tipc_net(net)->bcbase;
|
|
|
|
}
|
|
|
|
|
2015-10-22 19:51:43 +07:00
|
|
|
int tipc_bcast_get_mtu(struct net *net)
|
2014-07-17 07:41:00 +07:00
|
|
|
{
|
2015-10-22 19:51:43 +07:00
|
|
|
return tipc_link_mtu(tipc_bc_sndlink(net));
|
2014-07-17 07:41:00 +07:00
|
|
|
}
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
/* tipc_bcbase_select_primary(): find a bearer with links to all destinations,
|
|
|
|
* if any, and make it primary bearer
|
|
|
|
*/
|
|
|
|
static void tipc_bcbase_select_primary(struct net *net)
|
|
|
|
{
|
|
|
|
struct tipc_bc_base *bb = tipc_bc_base(net);
|
|
|
|
int all_dests = tipc_link_bc_peers(bb->link);
|
2015-10-22 19:51:43 +07:00
|
|
|
int i, mtu;
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
|
|
|
|
bb->primary_bearer = INVALID_BEARER_ID;
|
|
|
|
|
|
|
|
if (!all_dests)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_BEARERS; i++) {
|
2015-10-22 19:51:43 +07:00
|
|
|
if (!bb->dests[i])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
mtu = tipc_bearer_mtu(net, i);
|
|
|
|
if (mtu < tipc_link_mtu(bb->link))
|
|
|
|
tipc_link_set_mtu(bb->link, mtu);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
if (bb->dests[i] < all_dests)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
bb->primary_bearer = i;
|
|
|
|
|
|
|
|
/* Reduce risk that all nodes select same primary */
|
|
|
|
if ((i ^ tipc_own_addr(net)) & 1)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void tipc_bcast_inc_bearer_dst_cnt(struct net *net, int bearer_id)
|
|
|
|
{
|
|
|
|
struct tipc_bc_base *bb = tipc_bc_base(net);
|
|
|
|
|
|
|
|
tipc_bcast_lock(net);
|
|
|
|
bb->dests[bearer_id]++;
|
|
|
|
tipc_bcbase_select_primary(net);
|
|
|
|
tipc_bcast_unlock(net);
|
|
|
|
}
|
|
|
|
|
|
|
|
void tipc_bcast_dec_bearer_dst_cnt(struct net *net, int bearer_id)
|
|
|
|
{
|
|
|
|
struct tipc_bc_base *bb = tipc_bc_base(net);
|
|
|
|
|
|
|
|
tipc_bcast_lock(net);
|
|
|
|
bb->dests[bearer_id]--;
|
|
|
|
tipc_bcbase_select_primary(net);
|
|
|
|
tipc_bcast_unlock(net);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tipc_bcbase_xmit - broadcast a packet queue across one or more bearers
|
|
|
|
*
|
|
|
|
* Note that number of reachable destinations, as indicated in the dests[]
|
|
|
|
* array, may transitionally differ from the number of destinations indicated
|
|
|
|
* in each sent buffer. We can sustain this. Excess destination nodes will
|
|
|
|
* drop and never acknowledge the unexpected packets, and missing destinations
|
|
|
|
* will either require retransmission (if they are just about to be added to
|
|
|
|
* the bearer), or be removed from the buffer's 'ackers' counter (if they
|
|
|
|
* just went down)
|
|
|
|
*/
|
|
|
|
static void tipc_bcbase_xmit(struct net *net, struct sk_buff_head *xmitq)
|
|
|
|
{
|
|
|
|
int bearer_id;
|
|
|
|
struct tipc_bc_base *bb = tipc_bc_base(net);
|
|
|
|
struct sk_buff *skb, *_skb;
|
|
|
|
struct sk_buff_head _xmitq;
|
|
|
|
|
|
|
|
if (skb_queue_empty(xmitq))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* The typical case: at least one bearer has links to all nodes */
|
|
|
|
bearer_id = bb->primary_bearer;
|
|
|
|
if (bearer_id >= 0) {
|
|
|
|
tipc_bearer_bc_xmit(net, bearer_id, xmitq);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We have to transmit across all bearers */
|
|
|
|
skb_queue_head_init(&_xmitq);
|
|
|
|
for (bearer_id = 0; bearer_id < MAX_BEARERS; bearer_id++) {
|
|
|
|
if (!bb->dests[bearer_id])
|
|
|
|
continue;
|
|
|
|
|
|
|
|
skb_queue_walk(xmitq, skb) {
|
|
|
|
_skb = pskb_copy_for_clone(skb, GFP_ATOMIC);
|
|
|
|
if (!_skb)
|
|
|
|
break;
|
|
|
|
__skb_queue_tail(&_xmitq, _skb);
|
|
|
|
}
|
|
|
|
tipc_bearer_bc_xmit(net, bearer_id, &_xmitq);
|
|
|
|
}
|
|
|
|
__skb_queue_purge(xmitq);
|
|
|
|
__skb_queue_purge(&_xmitq);
|
|
|
|
}
|
|
|
|
|
2015-10-22 19:51:33 +07:00
|
|
|
/* tipc_bcast_xmit - deliver buffer chain to all nodes in cluster
|
2014-07-17 07:41:03 +07:00
|
|
|
* and to identified node local sockets
|
2015-01-09 14:27:05 +07:00
|
|
|
* @net: the applicable net namespace
|
2014-11-26 10:41:55 +07:00
|
|
|
* @list: chain of buffers containing message
|
2014-07-17 07:41:00 +07:00
|
|
|
* Consumes the buffer chain, except when returning -ELINKCONG
|
|
|
|
* Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE
|
|
|
|
*/
|
2015-10-22 19:51:33 +07:00
|
|
|
int tipc_bcast_xmit(struct net *net, struct sk_buff_head *list)
|
2014-07-17 07:41:00 +07:00
|
|
|
{
|
2015-10-22 19:51:39 +07:00
|
|
|
struct tipc_link *l = tipc_bc_sndlink(net);
|
|
|
|
struct sk_buff_head xmitq, inputq, rcvq;
|
2014-07-17 07:41:00 +07:00
|
|
|
int rc = 0;
|
|
|
|
|
2015-10-22 19:51:39 +07:00
|
|
|
__skb_queue_head_init(&rcvq);
|
|
|
|
__skb_queue_head_init(&xmitq);
|
|
|
|
skb_queue_head_init(&inputq);
|
2015-07-17 03:54:23 +07:00
|
|
|
|
2015-10-22 19:51:39 +07:00
|
|
|
/* Prepare message clone for local node */
|
|
|
|
if (unlikely(!tipc_msg_reassemble(list, &rcvq)))
|
|
|
|
return -EHOSTUNREACH;
|
2014-07-17 07:41:00 +07:00
|
|
|
|
2015-10-22 19:51:39 +07:00
|
|
|
tipc_bcast_lock(net);
|
|
|
|
if (tipc_link_bc_peers(l))
|
|
|
|
rc = tipc_link_xmit(l, list, &xmitq);
|
|
|
|
tipc_bcast_unlock(net);
|
2014-07-17 07:41:00 +07:00
|
|
|
|
2015-10-22 19:51:39 +07:00
|
|
|
/* Don't send to local node if adding to link failed */
|
2015-02-05 20:36:44 +07:00
|
|
|
if (unlikely(rc)) {
|
2015-10-22 19:51:39 +07:00
|
|
|
__skb_queue_purge(&rcvq);
|
2015-02-05 20:36:44 +07:00
|
|
|
return rc;
|
|
|
|
}
|
2015-10-22 19:51:41 +07:00
|
|
|
|
2015-10-22 19:51:39 +07:00
|
|
|
/* Broadcast to all nodes, inluding local node */
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_xmit(net, &xmitq);
|
2015-10-22 19:51:39 +07:00
|
|
|
tipc_sk_mcast_rcv(net, &rcvq, &inputq);
|
|
|
|
__skb_queue_purge(list);
|
|
|
|
return 0;
|
2014-07-17 07:41:00 +07:00
|
|
|
}
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
/* tipc_bcast_rcv - receive a broadcast packet, and deliver to rcv link
|
|
|
|
*
|
|
|
|
* RCU is locked, no other locks set
|
|
|
|
*/
|
|
|
|
int tipc_bcast_rcv(struct net *net, struct tipc_link *l, struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
struct tipc_msg *hdr = buf_msg(skb);
|
|
|
|
struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
|
|
|
|
struct sk_buff_head xmitq;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
__skb_queue_head_init(&xmitq);
|
|
|
|
|
|
|
|
if (msg_mc_netid(hdr) != tipc_netid(net) || !tipc_link_is_up(l)) {
|
|
|
|
kfree_skb(skb);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
tipc_bcast_lock(net);
|
|
|
|
if (msg_user(hdr) == BCAST_PROTOCOL)
|
|
|
|
rc = tipc_link_bc_nack_rcv(l, skb, &xmitq);
|
|
|
|
else
|
|
|
|
rc = tipc_link_rcv(l, skb, NULL);
|
|
|
|
tipc_bcast_unlock(net);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_xmit(net, &xmitq);
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
/* Any socket wakeup messages ? */
|
|
|
|
if (!skb_queue_empty(inputq))
|
|
|
|
tipc_sk_rcv(net, inputq);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tipc_bcast_ack_rcv - receive and handle a broadcast acknowledge
|
|
|
|
*
|
|
|
|
* RCU is locked, no other locks set
|
|
|
|
*/
|
|
|
|
void tipc_bcast_ack_rcv(struct net *net, struct tipc_link *l, u32 acked)
|
|
|
|
{
|
|
|
|
struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
|
|
|
|
struct sk_buff_head xmitq;
|
|
|
|
|
|
|
|
__skb_queue_head_init(&xmitq);
|
|
|
|
|
|
|
|
tipc_bcast_lock(net);
|
|
|
|
tipc_link_bc_ack_rcv(l, acked, &xmitq);
|
|
|
|
tipc_bcast_unlock(net);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_xmit(net, &xmitq);
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
/* Any socket wakeup messages ? */
|
|
|
|
if (!skb_queue_empty(inputq))
|
|
|
|
tipc_sk_rcv(net, inputq);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* tipc_bcast_synch_rcv - check and update rcv link with peer's send state
|
|
|
|
*
|
|
|
|
* RCU is locked, no other locks set
|
|
|
|
*/
|
2016-09-02 00:52:49 +07:00
|
|
|
int tipc_bcast_sync_rcv(struct net *net, struct tipc_link *l,
|
|
|
|
struct tipc_msg *hdr)
|
2015-10-22 19:51:41 +07:00
|
|
|
{
|
|
|
|
struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
|
|
|
|
struct sk_buff_head xmitq;
|
2016-09-02 00:52:49 +07:00
|
|
|
int rc = 0;
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
__skb_queue_head_init(&xmitq);
|
|
|
|
|
|
|
|
tipc_bcast_lock(net);
|
|
|
|
if (msg_type(hdr) == STATE_MSG) {
|
|
|
|
tipc_link_bc_ack_rcv(l, msg_bcast_ack(hdr), &xmitq);
|
2016-09-02 00:52:49 +07:00
|
|
|
rc = tipc_link_bc_sync_rcv(l, hdr, &xmitq);
|
2015-10-22 19:51:41 +07:00
|
|
|
} else {
|
|
|
|
tipc_link_bc_init_rcv(l, hdr);
|
|
|
|
}
|
|
|
|
tipc_bcast_unlock(net);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_xmit(net, &xmitq);
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
/* Any socket wakeup messages ? */
|
|
|
|
if (!skb_queue_empty(inputq))
|
|
|
|
tipc_sk_rcv(net, inputq);
|
2016-09-02 00:52:49 +07:00
|
|
|
return rc;
|
2015-10-22 19:51:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tipc_bcast_add_peer - add a peer node to broadcast link and bearer
|
|
|
|
*
|
|
|
|
* RCU is locked, node lock is set
|
|
|
|
*/
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
void tipc_bcast_add_peer(struct net *net, struct tipc_link *uc_l,
|
2015-10-22 19:51:41 +07:00
|
|
|
struct sk_buff_head *xmitq)
|
|
|
|
{
|
|
|
|
struct tipc_link *snd_l = tipc_bc_sndlink(net);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcast_lock(net);
|
2015-10-22 19:51:41 +07:00
|
|
|
tipc_link_add_bc_peer(snd_l, uc_l, xmitq);
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_select_primary(net);
|
|
|
|
tipc_bcast_unlock(net);
|
2015-10-22 19:51:41 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* tipc_bcast_remove_peer - remove a peer node from broadcast link and bearer
|
|
|
|
*
|
|
|
|
* RCU is locked, node lock is set
|
|
|
|
*/
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
void tipc_bcast_remove_peer(struct net *net, struct tipc_link *rcv_l)
|
2015-10-22 19:51:41 +07:00
|
|
|
{
|
|
|
|
struct tipc_link *snd_l = tipc_bc_sndlink(net);
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
struct sk_buff_head *inputq = &tipc_bc_base(net)->inputq;
|
2015-10-22 19:51:41 +07:00
|
|
|
struct sk_buff_head xmitq;
|
|
|
|
|
|
|
|
__skb_queue_head_init(&xmitq);
|
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcast_lock(net);
|
2015-10-22 19:51:41 +07:00
|
|
|
tipc_link_remove_bc_peer(snd_l, rcv_l, &xmitq);
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_select_primary(net);
|
|
|
|
tipc_bcast_unlock(net);
|
2015-10-22 19:51:41 +07:00
|
|
|
|
tipc: simplify bearer level broadcast
Until now, we have been keeping track of the exact set of broadcast
destinations though the help structure tipc_node_map. This leads us to
have to maintain a whole infrastructure for supporting this, including
a pseudo-bearer and a number of functions to manipulate both the bearers
and the node map correctly. Apart from the complexity, this approach is
also limiting, as struct tipc_node_map only can support cluster local
broadcast if we want to avoid it becoming excessively large. We want to
eliminate this limitation, in order to enable introduction of scoped
multicast in the future.
A closer analysis reveals that it is unnecessary maintaining this "full
set" overview; it is sufficient to keep a counter per bearer, indicating
how many nodes can be reached via this bearer at the moment. The protocol
is now robust enough to handle transitional discrepancies between the
nominal number of reachable destinations, as expected by the broadcast
protocol itself, and the number which is actually reachable at the
moment. The initial broadcast synchronization, in conjunction with the
retransmission mechanism, ensures that all packets will eventually be
acknowledged by the correct set of destinations.
This commit introduces these changes.
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-22 19:51:42 +07:00
|
|
|
tipc_bcbase_xmit(net, &xmitq);
|
2015-10-22 19:51:41 +07:00
|
|
|
|
|
|
|
/* Any socket wakeup messages ? */
|
|
|
|
if (!skb_queue_empty(inputq))
|
|
|
|
tipc_sk_rcv(net, inputq);
|
|
|
|
}
|
|
|
|
|
2015-01-09 14:27:07 +07:00
|
|
|
int tipc_bclink_reset_stats(struct net *net)
|
2006-01-03 01:04:38 +07:00
|
|
|
{
|
2015-11-20 02:30:46 +07:00
|
|
|
struct tipc_link *l = tipc_bc_sndlink(net);
|
2015-01-09 14:27:07 +07:00
|
|
|
|
2015-11-20 02:30:46 +07:00
|
|
|
if (!l)
|
2006-01-03 01:04:38 +07:00
|
|
|
return -ENOPROTOOPT;
|
|
|
|
|
2015-10-22 19:51:48 +07:00
|
|
|
tipc_bcast_lock(net);
|
2015-11-20 02:30:46 +07:00
|
|
|
tipc_link_reset_stats(l);
|
2015-10-22 19:51:48 +07:00
|
|
|
tipc_bcast_unlock(net);
|
2008-07-15 12:44:01 +07:00
|
|
|
return 0;
|
2006-01-03 01:04:38 +07:00
|
|
|
}
|
|
|
|
|
2015-10-22 19:51:48 +07:00
|
|
|
static int tipc_bc_link_set_queue_limits(struct net *net, u32 limit)
|
2006-01-03 01:04:38 +07:00
|
|
|
{
|
2015-10-22 19:51:48 +07:00
|
|
|
struct tipc_link *l = tipc_bc_sndlink(net);
|
2015-01-09 14:27:07 +07:00
|
|
|
|
2015-10-22 19:51:48 +07:00
|
|
|
if (!l)
|
2006-01-03 01:04:38 +07:00
|
|
|
return -ENOPROTOOPT;
|
tipc: extend broadcast link window size
The default fix broadcast window size is currently set to 20 packets.
This is a very low value, set at a time when we were still testing on
10 Mb/s hubs, and a change to it is long overdue.
Commit 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
revealed a problem with this low value. For messages of importance LOW,
the backlog queue limit will be calculated to 30 packets, while a
single, maximum sized message of 66000 bytes, carried across a 1500 MTU
network consists of 46 packets.
This leads to the following scenario (among others leading to the same
situation):
1: Msg 1 of 46 packets is sent. 20 packets go to the transmit queue, 26
packets to the backlog queue.
2: Msg 2 of 46 packets is attempted sent, but rejected because there is
no more space in the backlog queue at this level. The sender is added
to the wakeup queue with a "pending packets chain size" number of 46.
3: Some packets in the transmit queue are acked and released. We try to
wake up the sender, but the pending size of 46 is bigger than the LOW
wakeup limit of 30, so this doesn't happen.
5: Subsequent acks releases all the remaining buffers. Each time we test
for the wakeup criteria and find that 46 still is larger than 30,
even after both the transmit and the backlog queues are empty.
6: The sender is never woken up and given a chance to send its message.
He is stuck.
We could now loosen the wakeup criteria (used by link_prepare_wakeup())
to become equal to the send criteria (used by tipc_link_xmit()), i.e.,
by ignoring the "pending packets chain size" value altogether, or we can
just increase the queue limits so that the criteria can be satisfied
anyway. There are good reasons (potentially multiple waiting senders) to
not opt for the former solution, so we choose the latter one.
This commit fixes the problem by giving the broadcast link window a
default value of 50 packets. We also introduce a new minimum link
window size BCLINK_MIN_WIN of 32, which is enough to always avoid the
described situation. Finally, in order to not break any existing users
which may set the window explicitly, we enforce that the window is set
to the new minimum value in case the user is trying to set it to
anything lower.
Fixes: 7845989cb4b3da1db ("net: tipc: fix stall during bclink wakeup procedure")
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Reviewed-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-10-19 20:21:37 +07:00
|
|
|
if (limit < BCLINK_WIN_MIN)
|
|
|
|
limit = BCLINK_WIN_MIN;
|
|
|
|
if (limit > TIPC_MAX_LINK_WIN)
|
2006-01-03 01:04:38 +07:00
|
|
|
return -EINVAL;
|
2015-10-22 19:51:48 +07:00
|
|
|
tipc_bcast_lock(net);
|
|
|
|
tipc_link_set_queue_limits(l, limit);
|
|
|
|
tipc_bcast_unlock(net);
|
2008-07-15 12:44:01 +07:00
|
|
|
return 0;
|
2006-01-03 01:04:38 +07:00
|
|
|
}
|
|
|
|
|
2015-05-06 18:58:55 +07:00
|
|
|
int tipc_nl_bc_link_set(struct net *net, struct nlattr *attrs[])
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
u32 win;
|
|
|
|
struct nlattr *props[TIPC_NLA_PROP_MAX + 1];
|
|
|
|
|
|
|
|
if (!attrs[TIPC_NLA_LINK_PROP])
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
err = tipc_nl_parse_link_prop(attrs[TIPC_NLA_LINK_PROP], props);
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
if (!props[TIPC_NLA_PROP_WIN])
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
win = nla_get_u32(props[TIPC_NLA_PROP_WIN]);
|
|
|
|
|
2015-10-22 19:51:48 +07:00
|
|
|
return tipc_bc_link_set_queue_limits(net, win);
|
2015-05-06 18:58:55 +07:00
|
|
|
}
|
|
|
|
|
2015-10-22 19:51:33 +07:00
|
|
|
int tipc_bcast_init(struct net *net)
|
2006-01-03 01:04:38 +07:00
|
|
|
{
|
2015-10-22 19:51:37 +07:00
|
|
|
struct tipc_net *tn = tipc_net(net);
|
|
|
|
struct tipc_bc_base *bb = NULL;
|
|
|
|
struct tipc_link *l = NULL;
|
|
|
|
|
|
|
|
bb = kzalloc(sizeof(*bb), GFP_ATOMIC);
|
|
|
|
if (!bb)
|
|
|
|
goto enomem;
|
|
|
|
tn->bcbase = bb;
|
2015-10-22 19:51:34 +07:00
|
|
|
spin_lock_init(&tipc_net(net)->bclock);
|
2015-10-22 19:51:37 +07:00
|
|
|
|
2015-10-22 19:51:46 +07:00
|
|
|
if (!tipc_link_bc_create(net, 0, 0,
|
2015-10-22 19:51:43 +07:00
|
|
|
U16_MAX,
|
2015-10-22 19:51:37 +07:00
|
|
|
BCLINK_WIN_DEFAULT,
|
2015-10-22 19:51:40 +07:00
|
|
|
0,
|
2015-10-22 19:51:37 +07:00
|
|
|
&bb->inputq,
|
2015-10-22 19:51:48 +07:00
|
|
|
NULL,
|
2015-10-22 19:51:41 +07:00
|
|
|
NULL,
|
2015-10-22 19:51:37 +07:00
|
|
|
&l))
|
|
|
|
goto enomem;
|
|
|
|
bb->link = l;
|
|
|
|
tn->bcl = l;
|
2014-05-05 07:56:16 +07:00
|
|
|
return 0;
|
2015-10-22 19:51:37 +07:00
|
|
|
enomem:
|
|
|
|
kfree(bb);
|
|
|
|
kfree(l);
|
|
|
|
return -ENOMEM;
|
2006-01-03 01:04:38 +07:00
|
|
|
}
|
|
|
|
|
2015-10-22 19:51:33 +07:00
|
|
|
void tipc_bcast_stop(struct net *net)
|
2006-01-03 01:04:38 +07:00
|
|
|
{
|
2015-01-09 14:27:06 +07:00
|
|
|
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
|
|
|
|
2014-05-05 07:56:16 +07:00
|
|
|
synchronize_net();
|
2015-10-22 19:51:33 +07:00
|
|
|
kfree(tn->bcbase);
|
2015-10-22 19:51:37 +07:00
|
|
|
kfree(tn->bcl);
|
2006-01-03 01:04:38 +07:00
|
|
|
}
|