aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/bcast.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2015-01-09 02:27:05 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-12 16:24:32 -0500
commitf2f9800d4955a96d92896841d8ba9b04201deaa1 (patch)
tree3b817800cfd8fcb2de6d5a3d7eb4fff972fba681 /net/tipc/bcast.c
parentc93d3baa24095887005647984cff5de8c63d3611 (diff)
tipc: make tipc node table aware of net namespace
Global variables associated with node table are below: - node table list (node_htable) - node hash table list (tipc_node_list) - node table lock (node_list_lock) - node number counter (tipc_num_nodes) - node link number counter (tipc_num_links) To make node table support namespace, above global variables must be moved to tipc_net structure in order to keep secret for different namespaces. As a consequence, these variables are allocated and initialized when namespace is created, and deallocated when namespace is destroyed. After the change, functions associated with these variables have to utilize a namespace pointer to access them. So adding namespace pointer as a parameter of these functions is the major change made in the commit. 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/bcast.c')
-rw-r--r--net/tipc/bcast.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index f98231138916..816c0e49319f 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -232,13 +232,12 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
232 * 232 *
233 * Called with no locks taken 233 * Called with no locks taken
234 */ 234 */
235void tipc_bclink_wakeup_users(void) 235void tipc_bclink_wakeup_users(struct net *net)
236{ 236{
237 struct sk_buff *skb; 237 struct sk_buff *skb;
238 238
239 while ((skb = skb_dequeue(&bclink->link.waiting_sks))) 239 while ((skb = skb_dequeue(&bclink->link.waiting_sks)))
240 tipc_sk_rcv(skb); 240 tipc_sk_rcv(net, skb);
241
242} 241}
243 242
244/** 243/**
@@ -385,9 +384,9 @@ void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr,
385 * Delay any upcoming NACK by this node if another node has already 384 * Delay any upcoming NACK by this node if another node has already
386 * requested the first message this node is going to ask for. 385 * requested the first message this node is going to ask for.
387 */ 386 */
388static void bclink_peek_nack(struct tipc_msg *msg) 387static void bclink_peek_nack(struct net *net, struct tipc_msg *msg)
389{ 388{
390 struct tipc_node *n_ptr = tipc_node_find(msg_destnode(msg)); 389 struct tipc_node *n_ptr = tipc_node_find(net, msg_destnode(msg));
391 390
392 if (unlikely(!n_ptr)) 391 if (unlikely(!n_ptr))
393 return; 392 return;
@@ -404,11 +403,12 @@ static void bclink_peek_nack(struct tipc_msg *msg)
404 403
405/* tipc_bclink_xmit - broadcast buffer chain to all nodes in cluster 404/* tipc_bclink_xmit - broadcast buffer chain to all nodes in cluster
406 * and to identified node local sockets 405 * and to identified node local sockets
406 * @net: the applicable net namespace
407 * @list: chain of buffers containing message 407 * @list: chain of buffers containing message
408 * Consumes the buffer chain, except when returning -ELINKCONG 408 * Consumes the buffer chain, except when returning -ELINKCONG
409 * Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE 409 * Returns 0 if success, otherwise errno: -ELINKCONG,-EHOSTUNREACH,-EMSGSIZE
410 */ 410 */
411int tipc_bclink_xmit(struct sk_buff_head *list) 411int tipc_bclink_xmit(struct net *net, struct sk_buff_head *list)
412{ 412{
413 int rc = 0; 413 int rc = 0;
414 int bc = 0; 414 int bc = 0;
@@ -443,7 +443,7 @@ int tipc_bclink_xmit(struct sk_buff_head *list)
443 443
444 /* Deliver message clone */ 444 /* Deliver message clone */
445 if (likely(!rc)) 445 if (likely(!rc))
446 tipc_sk_mcast_rcv(skb); 446 tipc_sk_mcast_rcv(net, skb);
447 else 447 else
448 kfree_skb(skb); 448 kfree_skb(skb);
449 449
@@ -491,7 +491,7 @@ void tipc_bclink_rcv(struct net *net, struct sk_buff *buf)
491 if (msg_mc_netid(msg) != tn->net_id) 491 if (msg_mc_netid(msg) != tn->net_id)
492 goto exit; 492 goto exit;
493 493
494 node = tipc_node_find(msg_prevnode(msg)); 494 node = tipc_node_find(net, msg_prevnode(msg));
495 if (unlikely(!node)) 495 if (unlikely(!node))
496 goto exit; 496 goto exit;
497 497
@@ -514,7 +514,7 @@ void tipc_bclink_rcv(struct net *net, struct sk_buff *buf)
514 tipc_bclink_unlock(); 514 tipc_bclink_unlock();
515 } else { 515 } else {
516 tipc_node_unlock(node); 516 tipc_node_unlock(node);
517 bclink_peek_nack(msg); 517 bclink_peek_nack(net, msg);
518 } 518 }
519 goto exit; 519 goto exit;
520 } 520 }
@@ -532,7 +532,7 @@ receive:
532 tipc_bclink_unlock(); 532 tipc_bclink_unlock();
533 tipc_node_unlock(node); 533 tipc_node_unlock(node);
534 if (likely(msg_mcast(msg))) 534 if (likely(msg_mcast(msg)))
535 tipc_sk_mcast_rcv(buf); 535 tipc_sk_mcast_rcv(net, buf);
536 else 536 else
537 kfree_skb(buf); 537 kfree_skb(buf);
538 } else if (msg_user(msg) == MSG_BUNDLER) { 538 } else if (msg_user(msg) == MSG_BUNDLER) {
@@ -542,7 +542,7 @@ receive:
542 bcl->stats.recv_bundled += msg_msgcnt(msg); 542 bcl->stats.recv_bundled += msg_msgcnt(msg);
543 tipc_bclink_unlock(); 543 tipc_bclink_unlock();
544 tipc_node_unlock(node); 544 tipc_node_unlock(node);
545 tipc_link_bundle_rcv(buf); 545 tipc_link_bundle_rcv(net, buf);
546 } else if (msg_user(msg) == MSG_FRAGMENTER) { 546 } else if (msg_user(msg) == MSG_FRAGMENTER) {
547 tipc_buf_append(&node->bclink.reasm_buf, &buf); 547 tipc_buf_append(&node->bclink.reasm_buf, &buf);
548 if (unlikely(!buf && !node->bclink.reasm_buf)) 548 if (unlikely(!buf && !node->bclink.reasm_buf))
@@ -563,7 +563,7 @@ receive:
563 bclink_accept_pkt(node, seqno); 563 bclink_accept_pkt(node, seqno);
564 tipc_bclink_unlock(); 564 tipc_bclink_unlock();
565 tipc_node_unlock(node); 565 tipc_node_unlock(node);
566 tipc_named_rcv(buf); 566 tipc_named_rcv(net, buf);
567 } else { 567 } else {
568 tipc_bclink_lock(); 568 tipc_bclink_lock();
569 bclink_accept_pkt(node, seqno); 569 bclink_accept_pkt(node, seqno);