net.c (8dd06ef34b6e2f41b29fbf5fc1663780f2524285) net.c (d966ddcc38217a6110a6a0ff37ad2dee7d42e23e)
1/*
2 * net/tipc/net.c: TIPC network routing code
3 *
4 * Copyright (c) 1995-2006, 2014, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 91 unchanged lines hidden (view full) ---

100 * - There is one local spin_lock per sub_sequence, which can be seen
101 * as a sub-domain to the tipc_nametbl_lock domain. It is used only
102 * for translation operations, and is needed because a translation
103 * steps the root of the 'publication' linked list between each lookup.
104 * This is always used within the scope of a tipc_nametbl_lock(read).
105 * - A local spin_lock protecting the queue of subscriber events.
106*/
107
1/*
2 * net/tipc/net.c: TIPC network routing code
3 *
4 * Copyright (c) 1995-2006, 2014, Ericsson AB
5 * Copyright (c) 2005, 2010-2011, Wind River Systems
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 91 unchanged lines hidden (view full) ---

100 * - There is one local spin_lock per sub_sequence, which can be seen
101 * as a sub-domain to the tipc_nametbl_lock domain. It is used only
102 * for translation operations, and is needed because a translation
103 * steps the root of the 'publication' linked list between each lookup.
104 * This is always used within the scope of a tipc_nametbl_lock(read).
105 * - A local spin_lock protecting the queue of subscriber events.
106*/
107
108struct tipc_net_work {
109 struct work_struct work;
110 struct net *net;
111 u32 addr;
112};
113
114static void tipc_net_finalize(struct net *net, u32 addr);
115
116int tipc_net_init(struct net *net, u8 *node_id, u32 addr)
117{
118 if (tipc_own_id(net)) {
119 pr_info("Cannot configure node identity twice\n");
120 return -1;
121 }

--- 15 unchanged lines hidden (view full) ---

137 tipc_set_node_addr(net, addr);
138 tipc_named_reinit(net);
139 tipc_sk_reinit(net);
140 tipc_mon_reinit_self(net);
141 tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr,
142 TIPC_CLUSTER_SCOPE, 0, addr);
143}
144
108static void tipc_net_finalize(struct net *net, u32 addr);
109
110int tipc_net_init(struct net *net, u8 *node_id, u32 addr)
111{
112 if (tipc_own_id(net)) {
113 pr_info("Cannot configure node identity twice\n");
114 return -1;
115 }

--- 15 unchanged lines hidden (view full) ---

131 tipc_set_node_addr(net, addr);
132 tipc_named_reinit(net);
133 tipc_sk_reinit(net);
134 tipc_mon_reinit_self(net);
135 tipc_nametbl_publish(net, TIPC_CFG_SRV, addr, addr,
136 TIPC_CLUSTER_SCOPE, 0, addr);
137}
138
145static void tipc_net_finalize_work(struct work_struct *work)
139void tipc_net_finalize_work(struct work_struct *work)
146{
147 struct tipc_net_work *fwork;
148
149 fwork = container_of(work, struct tipc_net_work, work);
150 tipc_net_finalize(fwork->net, fwork->addr);
140{
141 struct tipc_net_work *fwork;
142
143 fwork = container_of(work, struct tipc_net_work, work);
144 tipc_net_finalize(fwork->net, fwork->addr);
151 kfree(fwork);
152}
153
154void tipc_sched_net_finalize(struct net *net, u32 addr)
155{
145}
146
147void tipc_sched_net_finalize(struct net *net, u32 addr)
148{
156 struct tipc_net_work *fwork = kzalloc(sizeof(*fwork), GFP_ATOMIC);
149 struct tipc_net *tn = tipc_net(net);
157
150
158 if (!fwork)
159 return;
160 INIT_WORK(&fwork->work, tipc_net_finalize_work);
161 fwork->net = net;
162 fwork->addr = addr;
163 schedule_work(&fwork->work);
151 tn->final_work.net = net;
152 tn->final_work.addr = addr;
153 schedule_work(&tn->final_work.work);
164}
165
166void tipc_net_stop(struct net *net)
167{
168 if (!tipc_own_id(net))
169 return;
170
171 rtnl_lock();

--- 189 unchanged lines hidden ---
154}
155
156void tipc_net_stop(struct net *net)
157{
158 if (!tipc_own_id(net))
159 return;
160
161 rtnl_lock();

--- 189 unchanged lines hidden ---