diff options
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index c5190ab75290..229d478494b9 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -101,9 +101,18 @@ static unsigned int align(unsigned int i) | |||
101 | 101 | ||
102 | static void link_init_max_pkt(struct tipc_link *l_ptr) | 102 | static void link_init_max_pkt(struct tipc_link *l_ptr) |
103 | { | 103 | { |
104 | struct tipc_bearer *b_ptr; | ||
104 | u32 max_pkt; | 105 | u32 max_pkt; |
105 | 106 | ||
106 | max_pkt = (l_ptr->b_ptr->mtu & ~3); | 107 | rcu_read_lock(); |
108 | b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); | ||
109 | if (!b_ptr) { | ||
110 | rcu_read_unlock(); | ||
111 | return; | ||
112 | } | ||
113 | max_pkt = (b_ptr->mtu & ~3); | ||
114 | rcu_read_unlock(); | ||
115 | |||
107 | if (max_pkt > MAX_MSG_SIZE) | 116 | if (max_pkt > MAX_MSG_SIZE) |
108 | max_pkt = MAX_MSG_SIZE; | 117 | max_pkt = MAX_MSG_SIZE; |
109 | 118 | ||
@@ -248,7 +257,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | |||
248 | l_ptr->owner = n_ptr; | 257 | l_ptr->owner = n_ptr; |
249 | l_ptr->checkpoint = 1; | 258 | l_ptr->checkpoint = 1; |
250 | l_ptr->peer_session = INVALID_SESSION; | 259 | l_ptr->peer_session = INVALID_SESSION; |
251 | l_ptr->b_ptr = b_ptr; | 260 | l_ptr->bearer_id = b_ptr->identity; |
252 | link_set_supervision_props(l_ptr, b_ptr->tolerance); | 261 | link_set_supervision_props(l_ptr, b_ptr->tolerance); |
253 | l_ptr->state = RESET_UNKNOWN; | 262 | l_ptr->state = RESET_UNKNOWN; |
254 | 263 | ||
@@ -263,6 +272,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr, | |||
263 | l_ptr->priority = b_ptr->priority; | 272 | l_ptr->priority = b_ptr->priority; |
264 | tipc_link_set_queue_limits(l_ptr, b_ptr->window); | 273 | tipc_link_set_queue_limits(l_ptr, b_ptr->window); |
265 | 274 | ||
275 | l_ptr->net_plane = b_ptr->net_plane; | ||
266 | link_init_max_pkt(l_ptr); | 276 | link_init_max_pkt(l_ptr); |
267 | 277 | ||
268 | l_ptr->next_out_no = 1; | 278 | l_ptr->next_out_no = 1; |
@@ -426,7 +436,7 @@ void tipc_link_reset(struct tipc_link *l_ptr) | |||
426 | return; | 436 | return; |
427 | 437 | ||
428 | tipc_node_link_down(l_ptr->owner, l_ptr); | 438 | tipc_node_link_down(l_ptr->owner, l_ptr); |
429 | tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); | 439 | tipc_bearer_remove_dest(l_ptr->bearer_id, l_ptr->addr); |
430 | 440 | ||
431 | if (was_active_link && tipc_node_active_links(l_ptr->owner)) { | 441 | if (was_active_link && tipc_node_active_links(l_ptr->owner)) { |
432 | l_ptr->reset_checkpoint = checkpoint; | 442 | l_ptr->reset_checkpoint = checkpoint; |
@@ -477,7 +487,7 @@ static void link_activate(struct tipc_link *l_ptr) | |||
477 | { | 487 | { |
478 | l_ptr->next_in_no = l_ptr->stats.recv_info = 1; | 488 | l_ptr->next_in_no = l_ptr->stats.recv_info = 1; |
479 | tipc_node_link_up(l_ptr->owner, l_ptr); | 489 | tipc_node_link_up(l_ptr->owner, l_ptr); |
480 | tipc_bearer_add_dest(l_ptr->b_ptr, l_ptr->addr); | 490 | tipc_bearer_add_dest(l_ptr->bearer_id, l_ptr->addr); |
481 | } | 491 | } |
482 | 492 | ||
483 | /** | 493 | /** |
@@ -777,7 +787,7 @@ int __tipc_link_xmit(struct tipc_link *l_ptr, struct sk_buff *buf) | |||
777 | if (likely(!link_congested(l_ptr))) { | 787 | if (likely(!link_congested(l_ptr))) { |
778 | link_add_to_outqueue(l_ptr, buf, msg); | 788 | link_add_to_outqueue(l_ptr, buf, msg); |
779 | 789 | ||
780 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 790 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); |
781 | l_ptr->unacked_window = 0; | 791 | l_ptr->unacked_window = 0; |
782 | return dsz; | 792 | return dsz; |
783 | } | 793 | } |
@@ -941,7 +951,7 @@ static int tipc_link_xmit_fast(struct tipc_link *l_ptr, struct sk_buff *buf, | |||
941 | if (likely(!link_congested(l_ptr))) { | 951 | if (likely(!link_congested(l_ptr))) { |
942 | if (likely(msg_size(msg) <= l_ptr->max_pkt)) { | 952 | if (likely(msg_size(msg) <= l_ptr->max_pkt)) { |
943 | link_add_to_outqueue(l_ptr, buf, msg); | 953 | link_add_to_outqueue(l_ptr, buf, msg); |
944 | tipc_bearer_send(l_ptr->b_ptr, buf, | 954 | tipc_bearer_send(l_ptr->bearer_id, buf, |
945 | &l_ptr->media_addr); | 955 | &l_ptr->media_addr); |
946 | l_ptr->unacked_window = 0; | 956 | l_ptr->unacked_window = 0; |
947 | return res; | 957 | return res; |
@@ -1204,7 +1214,7 @@ static u32 tipc_link_push_packet(struct tipc_link *l_ptr) | |||
1204 | if (r_q_size && buf) { | 1214 | if (r_q_size && buf) { |
1205 | msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); | 1215 | msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); |
1206 | msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); | 1216 | msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); |
1207 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 1217 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); |
1208 | l_ptr->retransm_queue_head = mod(++r_q_head); | 1218 | l_ptr->retransm_queue_head = mod(++r_q_head); |
1209 | l_ptr->retransm_queue_size = --r_q_size; | 1219 | l_ptr->retransm_queue_size = --r_q_size; |
1210 | l_ptr->stats.retransmitted++; | 1220 | l_ptr->stats.retransmitted++; |
@@ -1216,7 +1226,7 @@ static u32 tipc_link_push_packet(struct tipc_link *l_ptr) | |||
1216 | if (buf) { | 1226 | if (buf) { |
1217 | msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); | 1227 | msg_set_ack(buf_msg(buf), mod(l_ptr->next_in_no - 1)); |
1218 | msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); | 1228 | msg_set_bcast_ack(buf_msg(buf), l_ptr->owner->bclink.last_in); |
1219 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 1229 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); |
1220 | l_ptr->unacked_window = 0; | 1230 | l_ptr->unacked_window = 0; |
1221 | kfree_skb(buf); | 1231 | kfree_skb(buf); |
1222 | l_ptr->proto_msg_queue = NULL; | 1232 | l_ptr->proto_msg_queue = NULL; |
@@ -1233,7 +1243,8 @@ static u32 tipc_link_push_packet(struct tipc_link *l_ptr) | |||
1233 | if (mod(next - first) < l_ptr->queue_limit[0]) { | 1243 | if (mod(next - first) < l_ptr->queue_limit[0]) { |
1234 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); | 1244 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); |
1235 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 1245 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
1236 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 1246 | tipc_bearer_send(l_ptr->bearer_id, buf, |
1247 | &l_ptr->media_addr); | ||
1237 | if (msg_user(msg) == MSG_BUNDLER) | 1248 | if (msg_user(msg) == MSG_BUNDLER) |
1238 | msg_set_type(msg, CLOSED_MSG); | 1249 | msg_set_type(msg, CLOSED_MSG); |
1239 | l_ptr->next_out = buf->next; | 1250 | l_ptr->next_out = buf->next; |
@@ -1352,7 +1363,7 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf, | |||
1352 | msg = buf_msg(buf); | 1363 | msg = buf_msg(buf); |
1353 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); | 1364 | msg_set_ack(msg, mod(l_ptr->next_in_no - 1)); |
1354 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 1365 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
1355 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 1366 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); |
1356 | buf = buf->next; | 1367 | buf = buf->next; |
1357 | retransmits--; | 1368 | retransmits--; |
1358 | l_ptr->stats.retransmitted++; | 1369 | l_ptr->stats.retransmitted++; |
@@ -1440,7 +1451,7 @@ static int link_recv_buf_validate(struct sk_buff *buf) | |||
1440 | /** | 1451 | /** |
1441 | * tipc_rcv - process TIPC packets/messages arriving from off-node | 1452 | * tipc_rcv - process TIPC packets/messages arriving from off-node |
1442 | * @head: pointer to message buffer chain | 1453 | * @head: pointer to message buffer chain |
1443 | * @tb_ptr: pointer to bearer message arrived on | 1454 | * @b_ptr: pointer to bearer message arrived on |
1444 | * | 1455 | * |
1445 | * Invoked with no locks held. Bearer pointer must point to a valid bearer | 1456 | * Invoked with no locks held. Bearer pointer must point to a valid bearer |
1446 | * structure (i.e. cannot be NULL), but bearer can be inactive. | 1457 | * structure (i.e. cannot be NULL), but bearer can be inactive. |
@@ -1752,7 +1763,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg, | |||
1752 | 1763 | ||
1753 | /* Create protocol message with "out-of-sequence" sequence number */ | 1764 | /* Create protocol message with "out-of-sequence" sequence number */ |
1754 | msg_set_type(msg, msg_typ); | 1765 | msg_set_type(msg, msg_typ); |
1755 | msg_set_net_plane(msg, l_ptr->b_ptr->net_plane); | 1766 | msg_set_net_plane(msg, l_ptr->net_plane); |
1756 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); | 1767 | msg_set_bcast_ack(msg, l_ptr->owner->bclink.last_in); |
1757 | msg_set_last_bcast(msg, tipc_bclink_get_last_sent()); | 1768 | msg_set_last_bcast(msg, tipc_bclink_get_last_sent()); |
1758 | 1769 | ||
@@ -1818,7 +1829,7 @@ void tipc_link_proto_xmit(struct tipc_link *l_ptr, u32 msg_typ, int probe_msg, | |||
1818 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); | 1829 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); |
1819 | buf->priority = TC_PRIO_CONTROL; | 1830 | buf->priority = TC_PRIO_CONTROL; |
1820 | 1831 | ||
1821 | tipc_bearer_send(l_ptr->b_ptr, buf, &l_ptr->media_addr); | 1832 | tipc_bearer_send(l_ptr->bearer_id, buf, &l_ptr->media_addr); |
1822 | l_ptr->unacked_window = 0; | 1833 | l_ptr->unacked_window = 0; |
1823 | kfree_skb(buf); | 1834 | kfree_skb(buf); |
1824 | } | 1835 | } |
@@ -1843,9 +1854,9 @@ static void tipc_link_proto_rcv(struct tipc_link *l_ptr, struct sk_buff *buf) | |||
1843 | /* record unnumbered packet arrival (force mismatch on next timeout) */ | 1854 | /* record unnumbered packet arrival (force mismatch on next timeout) */ |
1844 | l_ptr->checkpoint--; | 1855 | l_ptr->checkpoint--; |
1845 | 1856 | ||
1846 | if (l_ptr->b_ptr->net_plane != msg_net_plane(msg)) | 1857 | if (l_ptr->net_plane != msg_net_plane(msg)) |
1847 | if (tipc_own_addr > msg_prevnode(msg)) | 1858 | if (tipc_own_addr > msg_prevnode(msg)) |
1848 | l_ptr->b_ptr->net_plane = msg_net_plane(msg); | 1859 | l_ptr->net_plane = msg_net_plane(msg); |
1849 | 1860 | ||
1850 | switch (msg_type(msg)) { | 1861 | switch (msg_type(msg)) { |
1851 | 1862 | ||
@@ -2793,7 +2804,13 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector) | |||
2793 | 2804 | ||
2794 | static void link_print(struct tipc_link *l_ptr, const char *str) | 2805 | static void link_print(struct tipc_link *l_ptr, const char *str) |
2795 | { | 2806 | { |
2796 | pr_info("%s Link %x<%s>:", str, l_ptr->addr, l_ptr->b_ptr->name); | 2807 | struct tipc_bearer *b_ptr; |
2808 | |||
2809 | rcu_read_lock(); | ||
2810 | b_ptr = rcu_dereference_rtnl(bearer_list[l_ptr->bearer_id]); | ||
2811 | if (b_ptr) | ||
2812 | pr_info("%s Link %x<%s>:", str, l_ptr->addr, b_ptr->name); | ||
2813 | rcu_read_unlock(); | ||
2797 | 2814 | ||
2798 | if (link_working_unknown(l_ptr)) | 2815 | if (link_working_unknown(l_ptr)) |
2799 | pr_cont(":WU\n"); | 2816 | pr_cont(":WU\n"); |