aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/discover.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:06 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:32 -0500
commit7f9f95d9d9bcdf253c4149a157b096958013eceb (patch)
tree779858049250f786a0b1b2d89482f3cdccd9617f /net/tipc/discover.c
parentf2f9800d4955a96d92896841d8ba9b04201deaa1 (diff)
tipc: make bearer list support net namespace
Bearer list defined as a global variable is used to store bearer instances. When tipc supports net namespace, bearers created in one namespace must be isolated with others allocated in other namespaces, which requires us that the bearer list(bearer_list) must be moved to tipc_net structure. As a result, a net namespace pointer has to be passed to functions which access the bearer list. Signed-off-by: Ying Xue <ying.xue@windriver.com> Tested-by: Tero Aho <Tero.Aho@coriant.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/discover.c')
-rw-r--r--net/tipc/discover.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/net/tipc/discover.c b/net/tipc/discover.c
index f0fd8b449aef..f93dd3dd621b 100644
--- a/net/tipc/discover.c
+++ b/net/tipc/discover.c
@@ -51,6 +51,7 @@
51/** 51/**
52 * struct tipc_link_req - information about an ongoing link setup request 52 * struct tipc_link_req - information about an ongoing link setup request
53 * @bearer_id: identity of bearer issuing requests 53 * @bearer_id: identity of bearer issuing requests
54 * @net: network namespace instance
54 * @dest: destination address for request messages 55 * @dest: destination address for request messages
55 * @domain: network domain to which links can be established 56 * @domain: network domain to which links can be established
56 * @num_nodes: number of nodes currently discovered (i.e. with an active link) 57 * @num_nodes: number of nodes currently discovered (i.e. with an active link)
@@ -62,6 +63,7 @@
62struct tipc_link_req { 63struct tipc_link_req {
63 u32 bearer_id; 64 u32 bearer_id;
64 struct tipc_media_addr dest; 65 struct tipc_media_addr dest;
66 struct net *net;
65 u32 domain; 67 u32 domain;
66 int num_nodes; 68 int num_nodes;
67 spinlock_t lock; 69 spinlock_t lock;
@@ -254,7 +256,7 @@ void tipc_disc_rcv(struct net *net, struct sk_buff *buf,
254 rbuf = tipc_buf_acquire(INT_H_SIZE); 256 rbuf = tipc_buf_acquire(INT_H_SIZE);
255 if (rbuf) { 257 if (rbuf) {
256 tipc_disc_init_msg(net, rbuf, DSC_RESP_MSG, bearer); 258 tipc_disc_init_msg(net, rbuf, DSC_RESP_MSG, bearer);
257 tipc_bearer_send(bearer->identity, rbuf, &maddr); 259 tipc_bearer_send(net, bearer->identity, rbuf, &maddr);
258 kfree_skb(rbuf); 260 kfree_skb(rbuf);
259 } 261 }
260 } 262 }
@@ -328,7 +330,7 @@ static void disc_timeout(unsigned long data)
328 * hold at fast polling rate if don't have any associated nodes, 330 * hold at fast polling rate if don't have any associated nodes,
329 * otherwise hold at slow polling rate 331 * otherwise hold at slow polling rate
330 */ 332 */
331 tipc_bearer_send(req->bearer_id, req->buf, &req->dest); 333 tipc_bearer_send(req->net, req->bearer_id, req->buf, &req->dest);
332 334
333 335
334 req->timer_intv *= 2; 336 req->timer_intv *= 2;
@@ -370,6 +372,7 @@ int tipc_disc_create(struct net *net, struct tipc_bearer *b_ptr,
370 372
371 tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); 373 tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr);
372 memcpy(&req->dest, dest, sizeof(*dest)); 374 memcpy(&req->dest, dest, sizeof(*dest));
375 req->net = net;
373 req->bearer_id = b_ptr->identity; 376 req->bearer_id = b_ptr->identity;
374 req->domain = b_ptr->domain; 377 req->domain = b_ptr->domain;
375 req->num_nodes = 0; 378 req->num_nodes = 0;
@@ -378,7 +381,7 @@ int tipc_disc_create(struct net *net, struct tipc_bearer *b_ptr,
378 setup_timer(&req->timer, disc_timeout, (unsigned long)req); 381 setup_timer(&req->timer, disc_timeout, (unsigned long)req);
379 mod_timer(&req->timer, jiffies + req->timer_intv); 382 mod_timer(&req->timer, jiffies + req->timer_intv);
380 b_ptr->link_req = req; 383 b_ptr->link_req = req;
381 tipc_bearer_send(req->bearer_id, req->buf, &req->dest); 384 tipc_bearer_send(net, req->bearer_id, req->buf, &req->dest);
382 return 0; 385 return 0;
383} 386}
384 387
@@ -405,11 +408,12 @@ void tipc_disc_reset(struct net *net, struct tipc_bearer *b_ptr)
405 408
406 spin_lock_bh(&req->lock); 409 spin_lock_bh(&req->lock);
407 tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr); 410 tipc_disc_init_msg(net, req->buf, DSC_REQ_MSG, b_ptr);
411 req->net = net;
408 req->bearer_id = b_ptr->identity; 412 req->bearer_id = b_ptr->identity;
409 req->domain = b_ptr->domain; 413 req->domain = b_ptr->domain;
410 req->num_nodes = 0; 414 req->num_nodes = 0;
411 req->timer_intv = TIPC_LINK_REQ_INIT; 415 req->timer_intv = TIPC_LINK_REQ_INIT;
412 mod_timer(&req->timer, jiffies + req->timer_intv); 416 mod_timer(&req->timer, jiffies + req->timer_intv);
413 tipc_bearer_send(req->bearer_id, req->buf, &req->dest); 417 tipc_bearer_send(net, req->bearer_id, req->buf, &req->dest);
414 spin_unlock_bh(&req->lock); 418 spin_unlock_bh(&req->lock);
415} 419}