aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index f6505652742e..be21e6ac73fe 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -129,11 +129,13 @@ static unsigned int align(unsigned int i)
129 129
130static void link_init_max_pkt(struct tipc_link *l_ptr) 130static void link_init_max_pkt(struct tipc_link *l_ptr)
131{ 131{
132 struct tipc_node *node = l_ptr->owner;
133 struct tipc_net *tn = net_generic(node->net, tipc_net_id);
132 struct tipc_bearer *b_ptr; 134 struct tipc_bearer *b_ptr;
133 u32 max_pkt; 135 u32 max_pkt;
134 136
135 rcu_read_lock(); 137 rcu_read_lock();
136 b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); 138 b_ptr = rcu_dereference_rtnl(tn->bearer_list[l_ptr->bearer_id]);
137 if (!b_ptr) { 139 if (!b_ptr) {
138 rcu_read_unlock(); 140 rcu_read_unlock();
139 return; 141 return;
@@ -431,7 +433,7 @@ void tipc_link_reset(struct tipc_link *l_ptr)
431 return; 433 return;
432 434
433 tipc_node_link_down(l_ptr->owner, l_ptr); 435 tipc_node_link_down(l_ptr->owner, l_ptr);
434 tipc_bearer_remove_dest(l_ptr->bearer_id, l_ptr->addr); 436 tipc_bearer_remove_dest(owner->net, l_ptr->bearer_id, l_ptr->addr);
435 437
436 if (was_active_link && tipc_node_active_links(l_ptr->owner)) { 438 if (was_active_link && tipc_node_active_links(l_ptr->owner)) {
437 l_ptr->reset_checkpoint = checkpoint; 439 l_ptr->reset_checkpoint = checkpoint;
@@ -471,11 +473,14 @@ void tipc_link_reset_list(struct net *net, unsigned int bearer_id)
471 rcu_read_unlock(); 473 rcu_read_unlock();
472} 474}
473 475
474static void link_activate(struct tipc_link *l_ptr) 476static void link_activate(struct tipc_link *link)
475{ 477{
476 l_ptr->next_in_no = l_ptr->stats.recv_info = 1; 478 struct tipc_node *node = link->owner;
477 tipc_node_link_up(l_ptr->owner, l_ptr); 479
478 tipc_bearer_add_dest(l_ptr->bearer_id, l_ptr->addr); 480 link->next_in_no = 1;
481 link->stats.recv_info = 1;
482 tipc_node_link_up(node, link);
483 tipc_bearer_add_dest(node->net, link->bearer_id, link->addr);
479} 484}
480 485
481/** 486/**
@@ -707,7 +712,8 @@ drop:
707 * Only the socket functions tipc_send_stream() and tipc_send_packet() need 712 * Only the socket functions tipc_send_stream() and tipc_send_packet() need
708 * to act on the return value, since they may need to do more send attempts. 713 * to act on the return value, since they may need to do more send attempts.
709 */ 714 */
710int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list) 715int __tipc_link_xmit(struct net *net, struct tipc_link *link,
716 struct sk_buff_head *list)
711{ 717{
712 struct tipc_msg *msg = buf_msg(skb_peek(list)); 718 struct tipc_msg *msg = buf_msg(skb_peek(list));
713 uint psz = msg_size(msg); 719 uint psz = msg_size(msg);
@@ -740,7 +746,8 @@ int __tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list)
740 746
741 if (skb_queue_len(outqueue) < sndlim) { 747 if (skb_queue_len(outqueue) < sndlim) {
742 __skb_queue_tail(outqueue, skb); 748 __skb_queue_tail(outqueue, skb);
743 tipc_bearer_send(link->bearer_id, skb, addr); 749 tipc_bearer_send(net, link->bearer_id,
750 skb, addr);
744 link->next_out = NULL; 751 link->next_out = NULL;
745 link->unacked_window = 0; 752 link->unacked_window = 0;
746 } else if (tipc_msg_bundle(outqueue, skb, mtu)) { 753 } else if (tipc_msg_bundle(outqueue, skb, mtu)) {
@@ -774,7 +781,7 @@ static int __tipc_link_xmit_skb(struct tipc_link *link, struct sk_buff *skb)
774 struct sk_buff_head head; 781 struct sk_buff_head head;
775 782
776 skb2list(skb, &head); 783 skb2list(skb, &head);
777 return __tipc_link_xmit(link, &head); 784 return __tipc_link_xmit(link->owner->net, link, &head);
778} 785}
779 786
780int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dnode, 787int tipc_link_xmit_skb(struct net *net, struct sk_buff *skb, u32 dnode,
@@ -808,7 +815,7 @@ int tipc_link_xmit(struct net *net, struct sk_buff_head *list, u32 dnode,
808 tipc_node_lock(node); 815 tipc_node_lock(node);
809 link = node->active_links[selector & 1]; 816 link = node->active_links[selector & 1];
810 if (link) 817 if (link)
811 rc = __tipc_link_xmit(link, list); 818 rc = __tipc_link_xmit(net, link, list);
812 tipc_node_unlock(node); 819 tipc_node_unlock(node);
813 } 820 }
814 821
@@ -900,7 +907,8 @@ void tipc_link_push_packets(struct tipc_link *l_ptr)
900 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 907 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
901 if (msg_user(msg) == MSG_BUNDLER) 908 if (msg_user(msg) == MSG_BUNDLER)
902 TIPC_SKB_CB(skb)->bundling = false; 909 TIPC_SKB_CB(skb)->bundling = false;
903 tipc_bearer_send(l_ptr->bearer_id, skb, 910 tipc_bearer_send(l_ptr->owner->net,
911 l_ptr->bearer_id, skb,
904 &l_ptr->media_addr); 912 &l_ptr->media_addr);
905 l_ptr->next_out = tipc_skb_queue_next(outqueue, skb); 913 l_ptr->next_out = tipc_skb_queue_next(outqueue, skb);
906 } else { 914 } else {
@@ -997,7 +1005,8 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *skb,
997 msg = buf_msg(skb); 1005 msg = buf_msg(skb);
998 msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); 1006 msg_set_ack(msg, mod(l_ptr->next_in_no - 1));
999 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); 1007 msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in);
1000 tipc_bearer_send(l_ptr->bearer_id, skb, &l_ptr->media_addr); 1008 tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, skb,
1009 &l_ptr->media_addr);
1001 retransmits--; 1010 retransmits--;
1002 l_ptr->stats.retransmitted++; 1011 l_ptr->stats.retransmitted++;
1003 } 1012 }
@@ -1459,7 +1468,8 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg,
1459 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); 1468 skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg));
1460 buf->priority = TC_PRIO_CONTROL; 1469 buf->priority = TC_PRIO_CONTROL;
1461 1470
1462 tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); 1471 tipc_bearer_send(l_ptr->owner->net, l_ptr->bearer_id, buf,
1472 &l_ptr->media_addr);
1463 l_ptr->unacked_window = 0; 1473 l_ptr->unacked_window = 0;
1464 kfree_skb(buf); 1474 kfree_skb(buf);
1465} 1475}
@@ -2037,7 +2047,7 @@ static int link_cmd_set_value(struct net *net, const char *name, u32 new_value,
2037 return res; 2047 return res;
2038 } 2048 }
2039 2049
2040 b_ptr = tipc_bearer_find(name); 2050 b_ptr = tipc_bearer_find(net, name);
2041 if (b_ptr) { 2051 if (b_ptr) {
2042 switch (cmd) { 2052 switch (cmd) {
2043 case TIPC_CMD_SET_LINK_TOL: 2053 case TIPC_CMD_SET_LINK_TOL:
@@ -2295,10 +2305,11 @@ struct sk_buff *tipc_link_cmd_show_stats(struct net *net,
2295 2305
2296static void link_print(struct tipc_link *l_ptr, const char *str) 2306static void link_print(struct tipc_link *l_ptr, const char *str)
2297{ 2307{
2308 struct tipc_net *tn = net_generic(l_ptr->owner->net, tipc_net_id);
2298 struct tipc_bearer *b_ptr; 2309 struct tipc_bearer *b_ptr;
2299 2310
2300 rcu_read_lock(); 2311 rcu_read_lock();
2301 b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); 2312 b_ptr = rcu_dereference_rtnl(tn->bearer_list[l_ptr->bearer_id]);
2302 if (b_ptr) 2313 if (b_ptr)
2303 pr_info("%s Link %x<%s>:", str, l_ptr->addr, b_ptr->name); 2314 pr_info("%s Link %x<%s>:", str, l_ptr->addr, b_ptr->name);
2304 rcu_read_unlock(); 2315 rcu_read_unlock();