The broadcast transmission link is currently instantiated when the
network subsystem is started, i.e., on order from user space via netlink.
This forces the broadcast transmission code to do unnecessary tests for
the existence of the transmission link, as well in single mode node as
in network mode.
In this commit, we do instead create the link during initialization of
the name space, and remove it when it is stopped. The fact that the
transmission link now has a guaranteed longer life cycle than any of its
potential clients paves the way for further code simplifcations
and optimizations.
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>
struct tipc_node *retransmit_to;
};
struct tipc_node *retransmit_to;
};
+static struct tipc_bc_base *tipc_bc_base(struct net *net)
+{
+ return tipc_net(net)->bcbase;
+}
+
/**
* tipc_nmap_equal - test for equality of node maps
*/
/**
* tipc_nmap_equal - test for equality of node maps
*/
bcl->bearer_id = MAX_BEARERS;
rcu_assign_pointer(tn->bearer_list[MAX_BEARERS], &bcbearer->bearer);
bcl->pmsg = (struct tipc_msg *)&bcl->proto_msg;
bcl->bearer_id = MAX_BEARERS;
rcu_assign_pointer(tn->bearer_list[MAX_BEARERS], &bcbearer->bearer);
bcl->pmsg = (struct tipc_msg *)&bcl->proto_msg;
- msg_set_prevnode(bcl->pmsg, tn->own_addr);
strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
tn->bcbearer = bcbearer;
tn->bcbase = bclink;
strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
tn->bcbearer = bcbearer;
tn->bcbase = bclink;
+void tipc_bcast_reinit(struct net *net)
+{
+ struct tipc_bc_base *b = tipc_bc_base(net);
+
+ msg_set_prevnode(b->link.pmsg, tipc_own_addr(net));
+}
+
void tipc_bcast_stop(struct net *net)
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
void tipc_bcast_stop(struct net *net)
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
tipc_bclink_lock(net);
tipc_link_purge_queues(tn->bcl);
tipc_bclink_unlock(net);
tipc_bclink_lock(net);
tipc_link_purge_queues(tn->bcl);
tipc_bclink_unlock(net);
RCU_INIT_POINTER(tn->bearer_list[BCBEARER], NULL);
synchronize_net();
kfree(tn->bcbearer);
RCU_INIT_POINTER(tn->bearer_list[BCBEARER], NULL);
synchronize_net();
kfree(tn->bcbearer);
extern const char tipc_bclink_name[];
int tipc_bcast_init(struct net *net);
extern const char tipc_bclink_name[];
int tipc_bcast_init(struct net *net);
+void tipc_bcast_reinit(struct net *net);
void tipc_bcast_stop(struct net *net);
void tipc_bclink_add_node(struct net *net, u32 addr);
void tipc_bclink_remove_node(struct net *net, u32 addr);
void tipc_bcast_stop(struct net *net);
void tipc_bclink_add_node(struct net *net, u32 addr);
void tipc_bclink_remove_node(struct net *net, u32 addr);
#include "bearer.h"
#include "net.h"
#include "socket.h"
#include "bearer.h"
#include "net.h"
#include "socket.h"
#include <linux/module.h>
#include <linux/module.h>
err = tipc_topsrv_start(net);
if (err)
goto out_subscr;
err = tipc_topsrv_start(net);
if (err)
goto out_subscr;
+
+ err = tipc_bcast_init(net);
+ if (err)
+ goto out_bclink;
+
+out_bclink:
+ tipc_bcast_stop(net);
out_subscr:
tipc_nametbl_stop(net);
out_nametbl:
out_subscr:
tipc_nametbl_stop(net);
out_nametbl:
{
tipc_topsrv_stop(net);
tipc_net_stop(net);
{
tipc_topsrv_stop(net);
tipc_net_stop(net);
tipc_nametbl_stop(net);
tipc_sk_rht_destroy(net);
}
tipc_nametbl_stop(net);
tipc_sk_rht_destroy(net);
}
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
char addr_string[16];
{
struct tipc_net *tn = net_generic(net, tipc_net_id);
char addr_string[16];
tn->own_addr = addr;
tipc_named_reinit(net);
tipc_sk_reinit(net);
tn->own_addr = addr;
tipc_named_reinit(net);
tipc_sk_reinit(net);
- res = tipc_bcast_init(net);
- if (res)
- return res;
+ tipc_bcast_reinit(net);
tipc_nametbl_publish(net, TIPC_CFG_SRV, tn->own_addr, tn->own_addr,
TIPC_ZONE_SCOPE, 0, tn->own_addr);
tipc_nametbl_publish(net, TIPC_CFG_SRV, tn->own_addr, tn->own_addr,
TIPC_ZONE_SCOPE, 0, tn->own_addr);
tn->own_addr);
rtnl_lock();
tipc_bearer_stop(net);
tn->own_addr);
rtnl_lock();
tipc_bearer_stop(net);
tipc_node_stop(net);
rtnl_unlock();
tipc_node_stop(net);
rtnl_unlock();