diff options
author | Ying Xue <ying.xue@windriver.com> | 2015-01-09 02:27:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-12 16:24:32 -0500 |
commit | c93d3baa24095887005647984cff5de8c63d3611 (patch) | |
tree | 1c7917d92605991696960243fe97dfef9d14913a /net/tipc/bcast.c | |
parent | 54fef04ad05f15984082c225fe47ce6af8ea1c5c (diff) |
tipc: involve namespace infrastructure
Involve namespace infrastructure, make the "tipc_net_id" global
variable aware of per namespace, and rename it to "net_id". In
order that the conversion can be successfully done, an instance
of networking namespace must be passed to relevant functions,
allowing them to access the "net_id" variable of per namespace.
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.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c index a9e174fc0f91..f98231138916 100644 --- a/net/tipc/bcast.c +++ b/net/tipc/bcast.c | |||
@@ -327,9 +327,11 @@ exit: | |||
327 | * | 327 | * |
328 | * RCU and node lock set | 328 | * RCU and node lock set |
329 | */ | 329 | */ |
330 | void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent) | 330 | void tipc_bclink_update_link_state(struct net *net, struct tipc_node *n_ptr, |
331 | u32 last_sent) | ||
331 | { | 332 | { |
332 | struct sk_buff *buf; | 333 | struct sk_buff *buf; |
334 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
333 | 335 | ||
334 | /* Ignore "stale" link state info */ | 336 | /* Ignore "stale" link state info */ |
335 | if (less_eq(last_sent, n_ptr->bclink.last_in)) | 337 | if (less_eq(last_sent, n_ptr->bclink.last_in)) |
@@ -362,7 +364,7 @@ void tipc_bclink_update_link_state(struct tipc_node *n_ptr, u32 last_sent) | |||
362 | tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, | 364 | tipc_msg_init(msg, BCAST_PROTOCOL, STATE_MSG, |
363 | INT_H_SIZE, n_ptr->addr); | 365 | INT_H_SIZE, n_ptr->addr); |
364 | msg_set_non_seq(msg, 1); | 366 | msg_set_non_seq(msg, 1); |
365 | msg_set_mc_netid(msg, tipc_net_id); | 367 | msg_set_mc_netid(msg, tn->net_id); |
366 | msg_set_bcast_ack(msg, n_ptr->bclink.last_in); | 368 | msg_set_bcast_ack(msg, n_ptr->bclink.last_in); |
367 | msg_set_bcgap_after(msg, n_ptr->bclink.last_in); | 369 | msg_set_bcgap_after(msg, n_ptr->bclink.last_in); |
368 | msg_set_bcgap_to(msg, to); | 370 | msg_set_bcgap_to(msg, to); |
@@ -476,8 +478,9 @@ static void bclink_accept_pkt(struct tipc_node *node, u32 seqno) | |||
476 | * | 478 | * |
477 | * RCU is locked, no other locks set | 479 | * RCU is locked, no other locks set |
478 | */ | 480 | */ |
479 | void tipc_bclink_rcv(struct sk_buff *buf) | 481 | void tipc_bclink_rcv(struct net *net, struct sk_buff *buf) |
480 | { | 482 | { |
483 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
481 | struct tipc_msg *msg = buf_msg(buf); | 484 | struct tipc_msg *msg = buf_msg(buf); |
482 | struct tipc_node *node; | 485 | struct tipc_node *node; |
483 | u32 next_in; | 486 | u32 next_in; |
@@ -485,7 +488,7 @@ void tipc_bclink_rcv(struct sk_buff *buf) | |||
485 | int deferred = 0; | 488 | int deferred = 0; |
486 | 489 | ||
487 | /* Screen out unwanted broadcast messages */ | 490 | /* Screen out unwanted broadcast messages */ |
488 | if (msg_mc_netid(msg) != tipc_net_id) | 491 | if (msg_mc_netid(msg) != tn->net_id) |
489 | goto exit; | 492 | goto exit; |
490 | 493 | ||
491 | node = tipc_node_find(msg_prevnode(msg)); | 494 | node = tipc_node_find(msg_prevnode(msg)); |
@@ -638,6 +641,8 @@ static int tipc_bcbearer_send(struct sk_buff *buf, struct tipc_bearer *unused1, | |||
638 | { | 641 | { |
639 | int bp_index; | 642 | int bp_index; |
640 | struct tipc_msg *msg = buf_msg(buf); | 643 | struct tipc_msg *msg = buf_msg(buf); |
644 | struct net *net = sock_net(buf->sk); | ||
645 | struct tipc_net *tn = net_generic(net, tipc_net_id); | ||
641 | 646 | ||
642 | /* Prepare broadcast link message for reliable transmission, | 647 | /* Prepare broadcast link message for reliable transmission, |
643 | * if first time trying to send it; | 648 | * if first time trying to send it; |
@@ -647,7 +652,7 @@ static int tipc_bcbearer_send(struct sk_buff *buf, struct tipc_bearer *unused1, | |||
647 | if (likely(!msg_non_seq(buf_msg(buf)))) { | 652 | if (likely(!msg_non_seq(buf_msg(buf)))) { |
648 | bcbuf_set_acks(buf, bclink->bcast_nodes.count); | 653 | bcbuf_set_acks(buf, bclink->bcast_nodes.count); |
649 | msg_set_non_seq(msg, 1); | 654 | msg_set_non_seq(msg, 1); |
650 | msg_set_mc_netid(msg, tipc_net_id); | 655 | msg_set_mc_netid(msg, tn->net_id); |
651 | bcl->stats.sent_info++; | 656 | bcl->stats.sent_info++; |
652 | 657 | ||
653 | if (WARN_ON(!bclink->bcast_nodes.count)) { | 658 | if (WARN_ON(!bclink->bcast_nodes.count)) { |