diff options
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r-- | net/tipc/link.c | 130 |
1 files changed, 70 insertions, 60 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c index 18702f58d111..43639ff1cbec 100644 --- a/net/tipc/link.c +++ b/net/tipc/link.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * net/tipc/link.c: TIPC link code | 2 | * net/tipc/link.c: TIPC link code |
3 | * | 3 | * |
4 | * Copyright (c) 1996-2007, Ericsson AB | 4 | * Copyright (c) 1996-2007, Ericsson AB |
5 | * Copyright (c) 2004-2007, Wind River Systems | 5 | * Copyright (c) 2004-2007, 2010-2011, Wind River Systems |
6 | * All rights reserved. | 6 | * All rights reserved. |
7 | * | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | 8 | * Redistribution and use in source and binary forms, with or without |
@@ -90,7 +90,7 @@ static void link_handle_out_of_seq_msg(struct link *l_ptr, | |||
90 | static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf); | 90 | static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf); |
91 | static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf); | 91 | static int link_recv_changeover_msg(struct link **l_ptr, struct sk_buff **buf); |
92 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance); | 92 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance); |
93 | static int link_send_sections_long(struct port *sender, | 93 | static int link_send_sections_long(struct tipc_port *sender, |
94 | struct iovec const *msg_sect, | 94 | struct iovec const *msg_sect, |
95 | u32 num_sect, u32 destnode); | 95 | u32 num_sect, u32 destnode); |
96 | static void link_check_defragm_bufs(struct link *l_ptr); | 96 | static void link_check_defragm_bufs(struct link *l_ptr); |
@@ -113,7 +113,7 @@ static void link_init_max_pkt(struct link *l_ptr) | |||
113 | { | 113 | { |
114 | u32 max_pkt; | 114 | u32 max_pkt; |
115 | 115 | ||
116 | max_pkt = (l_ptr->b_ptr->publ.mtu & ~3); | 116 | max_pkt = (l_ptr->b_ptr->mtu & ~3); |
117 | if (max_pkt > MAX_MSG_SIZE) | 117 | if (max_pkt > MAX_MSG_SIZE) |
118 | max_pkt = MAX_MSG_SIZE; | 118 | max_pkt = MAX_MSG_SIZE; |
119 | 119 | ||
@@ -246,9 +246,6 @@ static void link_timeout(struct link *l_ptr) | |||
246 | l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size; | 246 | l_ptr->stats.accu_queue_sz += l_ptr->out_queue_size; |
247 | l_ptr->stats.queue_sz_counts++; | 247 | l_ptr->stats.queue_sz_counts++; |
248 | 248 | ||
249 | if (l_ptr->out_queue_size > l_ptr->stats.max_queue_sz) | ||
250 | l_ptr->stats.max_queue_sz = l_ptr->out_queue_size; | ||
251 | |||
252 | if (l_ptr->first_out) { | 249 | if (l_ptr->first_out) { |
253 | struct tipc_msg *msg = buf_msg(l_ptr->first_out); | 250 | struct tipc_msg *msg = buf_msg(l_ptr->first_out); |
254 | u32 length = msg_size(msg); | 251 | u32 length = msg_size(msg); |
@@ -296,19 +293,35 @@ static void link_set_timer(struct link *l_ptr, u32 time) | |||
296 | 293 | ||
297 | /** | 294 | /** |
298 | * tipc_link_create - create a new link | 295 | * tipc_link_create - create a new link |
296 | * @n_ptr: pointer to associated node | ||
299 | * @b_ptr: pointer to associated bearer | 297 | * @b_ptr: pointer to associated bearer |
300 | * @peer: network address of node at other end of link | ||
301 | * @media_addr: media address to use when sending messages over link | 298 | * @media_addr: media address to use when sending messages over link |
302 | * | 299 | * |
303 | * Returns pointer to link. | 300 | * Returns pointer to link. |
304 | */ | 301 | */ |
305 | 302 | ||
306 | struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | 303 | struct link *tipc_link_create(struct tipc_node *n_ptr, |
304 | struct tipc_bearer *b_ptr, | ||
307 | const struct tipc_media_addr *media_addr) | 305 | const struct tipc_media_addr *media_addr) |
308 | { | 306 | { |
309 | struct link *l_ptr; | 307 | struct link *l_ptr; |
310 | struct tipc_msg *msg; | 308 | struct tipc_msg *msg; |
311 | char *if_name; | 309 | char *if_name; |
310 | char addr_string[16]; | ||
311 | u32 peer = n_ptr->addr; | ||
312 | |||
313 | if (n_ptr->link_cnt >= 2) { | ||
314 | tipc_addr_string_fill(addr_string, n_ptr->addr); | ||
315 | err("Attempt to establish third link to %s\n", addr_string); | ||
316 | return NULL; | ||
317 | } | ||
318 | |||
319 | if (n_ptr->links[b_ptr->identity]) { | ||
320 | tipc_addr_string_fill(addr_string, n_ptr->addr); | ||
321 | err("Attempt to establish second link on <%s> to %s\n", | ||
322 | b_ptr->name, addr_string); | ||
323 | return NULL; | ||
324 | } | ||
312 | 325 | ||
313 | l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC); | 326 | l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC); |
314 | if (!l_ptr) { | 327 | if (!l_ptr) { |
@@ -317,7 +330,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
317 | } | 330 | } |
318 | 331 | ||
319 | l_ptr->addr = peer; | 332 | l_ptr->addr = peer; |
320 | if_name = strchr(b_ptr->publ.name, ':') + 1; | 333 | if_name = strchr(b_ptr->name, ':') + 1; |
321 | sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", | 334 | sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", |
322 | tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), | 335 | tipc_zone(tipc_own_addr), tipc_cluster(tipc_own_addr), |
323 | tipc_node(tipc_own_addr), | 336 | tipc_node(tipc_own_addr), |
@@ -325,6 +338,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
325 | tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); | 338 | tipc_zone(peer), tipc_cluster(peer), tipc_node(peer)); |
326 | /* note: peer i/f is appended to link name by reset/activate */ | 339 | /* note: peer i/f is appended to link name by reset/activate */ |
327 | memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr)); | 340 | memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr)); |
341 | l_ptr->owner = n_ptr; | ||
328 | l_ptr->checkpoint = 1; | 342 | l_ptr->checkpoint = 1; |
329 | l_ptr->b_ptr = b_ptr; | 343 | l_ptr->b_ptr = b_ptr; |
330 | link_set_supervision_props(l_ptr, b_ptr->media->tolerance); | 344 | link_set_supervision_props(l_ptr, b_ptr->media->tolerance); |
@@ -348,11 +362,7 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer, | |||
348 | 362 | ||
349 | link_reset_statistics(l_ptr); | 363 | link_reset_statistics(l_ptr); |
350 | 364 | ||
351 | l_ptr->owner = tipc_node_attach_link(l_ptr); | 365 | tipc_node_attach_link(n_ptr, l_ptr); |
352 | if (!l_ptr->owner) { | ||
353 | kfree(l_ptr); | ||
354 | return NULL; | ||
355 | } | ||
356 | 366 | ||
357 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); | 367 | k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr); |
358 | list_add_tail(&l_ptr->link_list, &b_ptr->links); | 368 | list_add_tail(&l_ptr->link_list, &b_ptr->links); |
@@ -391,7 +401,9 @@ void tipc_link_delete(struct link *l_ptr) | |||
391 | 401 | ||
392 | static void link_start(struct link *l_ptr) | 402 | static void link_start(struct link *l_ptr) |
393 | { | 403 | { |
404 | tipc_node_lock(l_ptr->owner); | ||
394 | link_state_event(l_ptr, STARTING_EVT); | 405 | link_state_event(l_ptr, STARTING_EVT); |
406 | tipc_node_unlock(l_ptr->owner); | ||
395 | } | 407 | } |
396 | 408 | ||
397 | /** | 409 | /** |
@@ -406,7 +418,7 @@ static void link_start(struct link *l_ptr) | |||
406 | 418 | ||
407 | static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) | 419 | static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) |
408 | { | 420 | { |
409 | struct port *p_ptr; | 421 | struct tipc_port *p_ptr; |
410 | 422 | ||
411 | spin_lock_bh(&tipc_port_list_lock); | 423 | spin_lock_bh(&tipc_port_list_lock); |
412 | p_ptr = tipc_port_lock(origport); | 424 | p_ptr = tipc_port_lock(origport); |
@@ -415,7 +427,7 @@ static int link_schedule_port(struct link *l_ptr, u32 origport, u32 sz) | |||
415 | goto exit; | 427 | goto exit; |
416 | if (!list_empty(&p_ptr->wait_list)) | 428 | if (!list_empty(&p_ptr->wait_list)) |
417 | goto exit; | 429 | goto exit; |
418 | p_ptr->publ.congested = 1; | 430 | p_ptr->congested = 1; |
419 | p_ptr->waiting_pkts = 1 + ((sz - 1) / l_ptr->max_pkt); | 431 | p_ptr->waiting_pkts = 1 + ((sz - 1) / l_ptr->max_pkt); |
420 | list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); | 432 | list_add_tail(&p_ptr->wait_list, &l_ptr->waiting_ports); |
421 | l_ptr->stats.link_congs++; | 433 | l_ptr->stats.link_congs++; |
@@ -428,8 +440,8 @@ exit: | |||
428 | 440 | ||
429 | void tipc_link_wakeup_ports(struct link *l_ptr, int all) | 441 | void tipc_link_wakeup_ports(struct link *l_ptr, int all) |
430 | { | 442 | { |
431 | struct port *p_ptr; | 443 | struct tipc_port *p_ptr; |
432 | struct port *temp_p_ptr; | 444 | struct tipc_port *temp_p_ptr; |
433 | int win = l_ptr->queue_limit[0] - l_ptr->out_queue_size; | 445 | int win = l_ptr->queue_limit[0] - l_ptr->out_queue_size; |
434 | 446 | ||
435 | if (all) | 447 | if (all) |
@@ -445,11 +457,11 @@ void tipc_link_wakeup_ports(struct link *l_ptr, int all) | |||
445 | if (win <= 0) | 457 | if (win <= 0) |
446 | break; | 458 | break; |
447 | list_del_init(&p_ptr->wait_list); | 459 | list_del_init(&p_ptr->wait_list); |
448 | spin_lock_bh(p_ptr->publ.lock); | 460 | spin_lock_bh(p_ptr->lock); |
449 | p_ptr->publ.congested = 0; | 461 | p_ptr->congested = 0; |
450 | p_ptr->wakeup(&p_ptr->publ); | 462 | p_ptr->wakeup(p_ptr); |
451 | win -= p_ptr->waiting_pkts; | 463 | win -= p_ptr->waiting_pkts; |
452 | spin_unlock_bh(p_ptr->publ.lock); | 464 | spin_unlock_bh(p_ptr->lock); |
453 | } | 465 | } |
454 | 466 | ||
455 | exit: | 467 | exit: |
@@ -549,7 +561,7 @@ void tipc_link_reset(struct link *l_ptr) | |||
549 | tipc_node_link_down(l_ptr->owner, l_ptr); | 561 | tipc_node_link_down(l_ptr->owner, l_ptr); |
550 | tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); | 562 | tipc_bearer_remove_dest(l_ptr->b_ptr, l_ptr->addr); |
551 | 563 | ||
552 | if (was_active_link && tipc_node_has_active_links(l_ptr->owner) && | 564 | if (was_active_link && tipc_node_active_links(l_ptr->owner) && |
553 | l_ptr->owner->permit_changeover) { | 565 | l_ptr->owner->permit_changeover) { |
554 | l_ptr->reset_checkpoint = checkpoint; | 566 | l_ptr->reset_checkpoint = checkpoint; |
555 | l_ptr->exp_msg_count = START_CHANGEOVER; | 567 | l_ptr->exp_msg_count = START_CHANGEOVER; |
@@ -824,7 +836,10 @@ static void link_add_to_outqueue(struct link *l_ptr, | |||
824 | l_ptr->last_out = buf; | 836 | l_ptr->last_out = buf; |
825 | } else | 837 | } else |
826 | l_ptr->first_out = l_ptr->last_out = buf; | 838 | l_ptr->first_out = l_ptr->last_out = buf; |
839 | |||
827 | l_ptr->out_queue_size++; | 840 | l_ptr->out_queue_size++; |
841 | if (l_ptr->out_queue_size > l_ptr->stats.max_queue_sz) | ||
842 | l_ptr->stats.max_queue_sz = l_ptr->out_queue_size; | ||
828 | } | 843 | } |
829 | 844 | ||
830 | /* | 845 | /* |
@@ -867,9 +882,6 @@ int tipc_link_send_buf(struct link *l_ptr, struct sk_buff *buf) | |||
867 | 882 | ||
868 | /* Packet can be queued or sent: */ | 883 | /* Packet can be queued or sent: */ |
869 | 884 | ||
870 | if (queue_size > l_ptr->stats.max_queue_sz) | ||
871 | l_ptr->stats.max_queue_sz = queue_size; | ||
872 | |||
873 | if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && | 885 | if (likely(!tipc_bearer_congested(l_ptr->b_ptr, l_ptr) && |
874 | !link_congested(l_ptr))) { | 886 | !link_congested(l_ptr))) { |
875 | link_add_to_outqueue(l_ptr, buf, msg); | 887 | link_add_to_outqueue(l_ptr, buf, msg); |
@@ -1027,12 +1039,12 @@ int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode) | |||
1027 | * except for total message length. | 1039 | * except for total message length. |
1028 | * Returns user data length or errno. | 1040 | * Returns user data length or errno. |
1029 | */ | 1041 | */ |
1030 | int tipc_link_send_sections_fast(struct port *sender, | 1042 | int tipc_link_send_sections_fast(struct tipc_port *sender, |
1031 | struct iovec const *msg_sect, | 1043 | struct iovec const *msg_sect, |
1032 | const u32 num_sect, | 1044 | const u32 num_sect, |
1033 | u32 destaddr) | 1045 | u32 destaddr) |
1034 | { | 1046 | { |
1035 | struct tipc_msg *hdr = &sender->publ.phdr; | 1047 | struct tipc_msg *hdr = &sender->phdr; |
1036 | struct link *l_ptr; | 1048 | struct link *l_ptr; |
1037 | struct sk_buff *buf; | 1049 | struct sk_buff *buf; |
1038 | struct tipc_node *node; | 1050 | struct tipc_node *node; |
@@ -1045,7 +1057,7 @@ again: | |||
1045 | * (Must not hold any locks while building message.) | 1057 | * (Must not hold any locks while building message.) |
1046 | */ | 1058 | */ |
1047 | 1059 | ||
1048 | res = tipc_msg_build(hdr, msg_sect, num_sect, sender->publ.max_pkt, | 1060 | res = tipc_msg_build(hdr, msg_sect, num_sect, sender->max_pkt, |
1049 | !sender->user_port, &buf); | 1061 | !sender->user_port, &buf); |
1050 | 1062 | ||
1051 | read_lock_bh(&tipc_net_lock); | 1063 | read_lock_bh(&tipc_net_lock); |
@@ -1056,7 +1068,7 @@ again: | |||
1056 | if (likely(l_ptr)) { | 1068 | if (likely(l_ptr)) { |
1057 | if (likely(buf)) { | 1069 | if (likely(buf)) { |
1058 | res = link_send_buf_fast(l_ptr, buf, | 1070 | res = link_send_buf_fast(l_ptr, buf, |
1059 | &sender->publ.max_pkt); | 1071 | &sender->max_pkt); |
1060 | if (unlikely(res < 0)) | 1072 | if (unlikely(res < 0)) |
1061 | buf_discard(buf); | 1073 | buf_discard(buf); |
1062 | exit: | 1074 | exit: |
@@ -1075,7 +1087,7 @@ exit: | |||
1075 | if (link_congested(l_ptr) || | 1087 | if (link_congested(l_ptr) || |
1076 | !list_empty(&l_ptr->b_ptr->cong_links)) { | 1088 | !list_empty(&l_ptr->b_ptr->cong_links)) { |
1077 | res = link_schedule_port(l_ptr, | 1089 | res = link_schedule_port(l_ptr, |
1078 | sender->publ.ref, res); | 1090 | sender->ref, res); |
1079 | goto exit; | 1091 | goto exit; |
1080 | } | 1092 | } |
1081 | 1093 | ||
@@ -1084,12 +1096,12 @@ exit: | |||
1084 | * then re-try fast path or fragment the message | 1096 | * then re-try fast path or fragment the message |
1085 | */ | 1097 | */ |
1086 | 1098 | ||
1087 | sender->publ.max_pkt = l_ptr->max_pkt; | 1099 | sender->max_pkt = l_ptr->max_pkt; |
1088 | tipc_node_unlock(node); | 1100 | tipc_node_unlock(node); |
1089 | read_unlock_bh(&tipc_net_lock); | 1101 | read_unlock_bh(&tipc_net_lock); |
1090 | 1102 | ||
1091 | 1103 | ||
1092 | if ((msg_hdr_sz(hdr) + res) <= sender->publ.max_pkt) | 1104 | if ((msg_hdr_sz(hdr) + res) <= sender->max_pkt) |
1093 | goto again; | 1105 | goto again; |
1094 | 1106 | ||
1095 | return link_send_sections_long(sender, msg_sect, | 1107 | return link_send_sections_long(sender, msg_sect, |
@@ -1123,14 +1135,14 @@ exit: | |||
1123 | * | 1135 | * |
1124 | * Returns user data length or errno. | 1136 | * Returns user data length or errno. |
1125 | */ | 1137 | */ |
1126 | static int link_send_sections_long(struct port *sender, | 1138 | static int link_send_sections_long(struct tipc_port *sender, |
1127 | struct iovec const *msg_sect, | 1139 | struct iovec const *msg_sect, |
1128 | u32 num_sect, | 1140 | u32 num_sect, |
1129 | u32 destaddr) | 1141 | u32 destaddr) |
1130 | { | 1142 | { |
1131 | struct link *l_ptr; | 1143 | struct link *l_ptr; |
1132 | struct tipc_node *node; | 1144 | struct tipc_node *node; |
1133 | struct tipc_msg *hdr = &sender->publ.phdr; | 1145 | struct tipc_msg *hdr = &sender->phdr; |
1134 | u32 dsz = msg_data_sz(hdr); | 1146 | u32 dsz = msg_data_sz(hdr); |
1135 | u32 max_pkt, fragm_sz, rest; | 1147 | u32 max_pkt, fragm_sz, rest; |
1136 | struct tipc_msg fragm_hdr; | 1148 | struct tipc_msg fragm_hdr; |
@@ -1142,7 +1154,7 @@ static int link_send_sections_long(struct port *sender, | |||
1142 | 1154 | ||
1143 | again: | 1155 | again: |
1144 | fragm_no = 1; | 1156 | fragm_no = 1; |
1145 | max_pkt = sender->publ.max_pkt - INT_H_SIZE; | 1157 | max_pkt = sender->max_pkt - INT_H_SIZE; |
1146 | /* leave room for tunnel header in case of link changeover */ | 1158 | /* leave room for tunnel header in case of link changeover */ |
1147 | fragm_sz = max_pkt - INT_H_SIZE; | 1159 | fragm_sz = max_pkt - INT_H_SIZE; |
1148 | /* leave room for fragmentation header in each fragment */ | 1160 | /* leave room for fragmentation header in each fragment */ |
@@ -1157,7 +1169,7 @@ again: | |||
1157 | 1169 | ||
1158 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, | 1170 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, |
1159 | INT_H_SIZE, msg_destnode(hdr)); | 1171 | INT_H_SIZE, msg_destnode(hdr)); |
1160 | msg_set_link_selector(&fragm_hdr, sender->publ.ref); | 1172 | msg_set_link_selector(&fragm_hdr, sender->ref); |
1161 | msg_set_size(&fragm_hdr, max_pkt); | 1173 | msg_set_size(&fragm_hdr, max_pkt); |
1162 | msg_set_fragm_no(&fragm_hdr, 1); | 1174 | msg_set_fragm_no(&fragm_hdr, 1); |
1163 | 1175 | ||
@@ -1238,13 +1250,13 @@ error: | |||
1238 | node = tipc_node_find(destaddr); | 1250 | node = tipc_node_find(destaddr); |
1239 | if (likely(node)) { | 1251 | if (likely(node)) { |
1240 | tipc_node_lock(node); | 1252 | tipc_node_lock(node); |
1241 | l_ptr = node->active_links[sender->publ.ref & 1]; | 1253 | l_ptr = node->active_links[sender->ref & 1]; |
1242 | if (!l_ptr) { | 1254 | if (!l_ptr) { |
1243 | tipc_node_unlock(node); | 1255 | tipc_node_unlock(node); |
1244 | goto reject; | 1256 | goto reject; |
1245 | } | 1257 | } |
1246 | if (l_ptr->max_pkt < max_pkt) { | 1258 | if (l_ptr->max_pkt < max_pkt) { |
1247 | sender->publ.max_pkt = l_ptr->max_pkt; | 1259 | sender->max_pkt = l_ptr->max_pkt; |
1248 | tipc_node_unlock(node); | 1260 | tipc_node_unlock(node); |
1249 | for (; buf_chain; buf_chain = buf) { | 1261 | for (; buf_chain; buf_chain = buf) { |
1250 | buf = buf_chain->next; | 1262 | buf = buf_chain->next; |
@@ -1441,7 +1453,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf) | |||
1441 | info("Outstanding acks: %lu\n", | 1453 | info("Outstanding acks: %lu\n", |
1442 | (unsigned long) TIPC_SKB_CB(buf)->handle); | 1454 | (unsigned long) TIPC_SKB_CB(buf)->handle); |
1443 | 1455 | ||
1444 | n_ptr = l_ptr->owner->next; | 1456 | n_ptr = tipc_bclink_retransmit_to(); |
1445 | tipc_node_lock(n_ptr); | 1457 | tipc_node_lock(n_ptr); |
1446 | 1458 | ||
1447 | tipc_addr_string_fill(addr_string, n_ptr->addr); | 1459 | tipc_addr_string_fill(addr_string, n_ptr->addr); |
@@ -1595,11 +1607,10 @@ static int link_recv_buf_validate(struct sk_buff *buf) | |||
1595 | * structure (i.e. cannot be NULL), but bearer can be inactive. | 1607 | * structure (i.e. cannot be NULL), but bearer can be inactive. |
1596 | */ | 1608 | */ |
1597 | 1609 | ||
1598 | void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *tb_ptr) | 1610 | void tipc_recv_msg(struct sk_buff *head, struct tipc_bearer *b_ptr) |
1599 | { | 1611 | { |
1600 | read_lock_bh(&tipc_net_lock); | 1612 | read_lock_bh(&tipc_net_lock); |
1601 | while (head) { | 1613 | while (head) { |
1602 | struct bearer *b_ptr = (struct bearer *)tb_ptr; | ||
1603 | struct tipc_node *n_ptr; | 1614 | struct tipc_node *n_ptr; |
1604 | struct link *l_ptr; | 1615 | struct link *l_ptr; |
1605 | struct sk_buff *crs; | 1616 | struct sk_buff *crs; |
@@ -1735,10 +1746,6 @@ deliver: | |||
1735 | tipc_node_unlock(n_ptr); | 1746 | tipc_node_unlock(n_ptr); |
1736 | tipc_link_recv_bundle(buf); | 1747 | tipc_link_recv_bundle(buf); |
1737 | continue; | 1748 | continue; |
1738 | case ROUTE_DISTRIBUTOR: | ||
1739 | tipc_node_unlock(n_ptr); | ||
1740 | buf_discard(buf); | ||
1741 | continue; | ||
1742 | case NAME_DISTRIBUTOR: | 1749 | case NAME_DISTRIBUTOR: |
1743 | tipc_node_unlock(n_ptr); | 1750 | tipc_node_unlock(n_ptr); |
1744 | tipc_named_recv(buf); | 1751 | tipc_named_recv(buf); |
@@ -1765,6 +1772,10 @@ deliver: | |||
1765 | goto protocol_check; | 1772 | goto protocol_check; |
1766 | } | 1773 | } |
1767 | break; | 1774 | break; |
1775 | default: | ||
1776 | buf_discard(buf); | ||
1777 | buf = NULL; | ||
1778 | break; | ||
1768 | } | 1779 | } |
1769 | } | 1780 | } |
1770 | tipc_node_unlock(n_ptr); | 1781 | tipc_node_unlock(n_ptr); |
@@ -1900,6 +1911,7 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
1900 | struct sk_buff *buf = NULL; | 1911 | struct sk_buff *buf = NULL; |
1901 | struct tipc_msg *msg = l_ptr->pmsg; | 1912 | struct tipc_msg *msg = l_ptr->pmsg; |
1902 | u32 msg_size = sizeof(l_ptr->proto_msg); | 1913 | u32 msg_size = sizeof(l_ptr->proto_msg); |
1914 | int r_flag; | ||
1903 | 1915 | ||
1904 | if (link_blocked(l_ptr)) | 1916 | if (link_blocked(l_ptr)) |
1905 | return; | 1917 | return; |
@@ -1950,15 +1962,14 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
1950 | msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1)); | 1962 | msg_set_ack(msg, mod(l_ptr->reset_checkpoint - 1)); |
1951 | msg_set_seq_gap(msg, 0); | 1963 | msg_set_seq_gap(msg, 0); |
1952 | msg_set_next_sent(msg, 1); | 1964 | msg_set_next_sent(msg, 1); |
1965 | msg_set_probe(msg, 0); | ||
1953 | msg_set_link_tolerance(msg, l_ptr->tolerance); | 1966 | msg_set_link_tolerance(msg, l_ptr->tolerance); |
1954 | msg_set_linkprio(msg, l_ptr->priority); | 1967 | msg_set_linkprio(msg, l_ptr->priority); |
1955 | msg_set_max_pkt(msg, l_ptr->max_pkt_target); | 1968 | msg_set_max_pkt(msg, l_ptr->max_pkt_target); |
1956 | } | 1969 | } |
1957 | 1970 | ||
1958 | if (tipc_node_has_redundant_links(l_ptr->owner)) | 1971 | r_flag = (l_ptr->owner->working_links > tipc_link_is_up(l_ptr)); |
1959 | msg_set_redundant_link(msg); | 1972 | msg_set_redundant_link(msg, r_flag); |
1960 | else | ||
1961 | msg_clear_redundant_link(msg); | ||
1962 | msg_set_linkprio(msg, l_ptr->priority); | 1973 | msg_set_linkprio(msg, l_ptr->priority); |
1963 | 1974 | ||
1964 | /* Ensure sequence number will not fit : */ | 1975 | /* Ensure sequence number will not fit : */ |
@@ -1978,7 +1989,6 @@ void tipc_link_send_proto_msg(struct link *l_ptr, u32 msg_typ, int probe_msg, | |||
1978 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); | 1989 | skb_copy_to_linear_data(buf, msg, sizeof(l_ptr->proto_msg)); |
1979 | return; | 1990 | return; |
1980 | } | 1991 | } |
1981 | msg_set_timestamp(msg, jiffies_to_msecs(jiffies)); | ||
1982 | 1992 | ||
1983 | /* Message can be sent */ | 1993 | /* Message can be sent */ |
1984 | 1994 | ||
@@ -2066,7 +2076,7 @@ static void link_recv_proto_msg(struct link *l_ptr, struct sk_buff *buf) | |||
2066 | l_ptr->peer_bearer_id = msg_bearer_id(msg); | 2076 | l_ptr->peer_bearer_id = msg_bearer_id(msg); |
2067 | 2077 | ||
2068 | /* Synchronize broadcast sequence numbers */ | 2078 | /* Synchronize broadcast sequence numbers */ |
2069 | if (!tipc_node_has_redundant_links(l_ptr->owner)) | 2079 | if (!tipc_node_redundant_links(l_ptr->owner)) |
2070 | l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); | 2080 | l_ptr->owner->bclink.last_in = mod(msg_last_bcast(msg)); |
2071 | break; | 2081 | break; |
2072 | case STATE_MSG: | 2082 | case STATE_MSG: |
@@ -2413,9 +2423,6 @@ static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf) | |||
2413 | else | 2423 | else |
2414 | destaddr = msg_destnode(inmsg); | 2424 | destaddr = msg_destnode(inmsg); |
2415 | 2425 | ||
2416 | if (msg_routed(inmsg)) | ||
2417 | msg_set_prevnode(inmsg, tipc_own_addr); | ||
2418 | |||
2419 | /* Prepare reusable fragment header: */ | 2426 | /* Prepare reusable fragment header: */ |
2420 | 2427 | ||
2421 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, | 2428 | tipc_msg_init(&fragm_hdr, MSG_FRAGMENTER, FIRST_FRAGMENT, |
@@ -2618,6 +2625,9 @@ static void link_check_defragm_bufs(struct link *l_ptr) | |||
2618 | 2625 | ||
2619 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance) | 2626 | static void link_set_supervision_props(struct link *l_ptr, u32 tolerance) |
2620 | { | 2627 | { |
2628 | if ((tolerance < TIPC_MIN_LINK_TOL) || (tolerance > TIPC_MAX_LINK_TOL)) | ||
2629 | return; | ||
2630 | |||
2621 | l_ptr->tolerance = tolerance; | 2631 | l_ptr->tolerance = tolerance; |
2622 | l_ptr->continuity_interval = | 2632 | l_ptr->continuity_interval = |
2623 | ((tolerance / 4) > 500) ? 500 : tolerance / 4; | 2633 | ((tolerance / 4) > 500) ? 500 : tolerance / 4; |
@@ -2658,7 +2668,7 @@ void tipc_link_set_queue_limits(struct link *l_ptr, u32 window) | |||
2658 | static struct link *link_find_link(const char *name, struct tipc_node **node) | 2668 | static struct link *link_find_link(const char *name, struct tipc_node **node) |
2659 | { | 2669 | { |
2660 | struct link_name link_name_parts; | 2670 | struct link_name link_name_parts; |
2661 | struct bearer *b_ptr; | 2671 | struct tipc_bearer *b_ptr; |
2662 | struct link *l_ptr; | 2672 | struct link *l_ptr; |
2663 | 2673 | ||
2664 | if (!link_name_validate(name, &link_name_parts)) | 2674 | if (!link_name_validate(name, &link_name_parts)) |
@@ -2961,7 +2971,7 @@ static void link_print(struct link *l_ptr, const char *str) | |||
2961 | 2971 | ||
2962 | tipc_printf(buf, str); | 2972 | tipc_printf(buf, str); |
2963 | tipc_printf(buf, "Link %x<%s>:", | 2973 | tipc_printf(buf, "Link %x<%s>:", |
2964 | l_ptr->addr, l_ptr->b_ptr->publ.name); | 2974 | l_ptr->addr, l_ptr->b_ptr->name); |
2965 | 2975 | ||
2966 | #ifdef CONFIG_TIPC_DEBUG | 2976 | #ifdef CONFIG_TIPC_DEBUG |
2967 | if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr)) | 2977 | if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr)) |
@@ -2981,9 +2991,9 @@ static void link_print(struct link *l_ptr, const char *str) | |||
2981 | != (l_ptr->out_queue_size - 1)) || | 2991 | != (l_ptr->out_queue_size - 1)) || |
2982 | (l_ptr->last_out->next != NULL)) { | 2992 | (l_ptr->last_out->next != NULL)) { |
2983 | tipc_printf(buf, "\nSend queue inconsistency\n"); | 2993 | tipc_printf(buf, "\nSend queue inconsistency\n"); |
2984 | tipc_printf(buf, "first_out= %x ", l_ptr->first_out); | 2994 | tipc_printf(buf, "first_out= %p ", l_ptr->first_out); |
2985 | tipc_printf(buf, "next_out= %x ", l_ptr->next_out); | 2995 | tipc_printf(buf, "next_out= %p ", l_ptr->next_out); |
2986 | tipc_printf(buf, "last_out= %x ", l_ptr->last_out); | 2996 | tipc_printf(buf, "last_out= %p ", l_ptr->last_out); |
2987 | } | 2997 | } |
2988 | } else | 2998 | } else |
2989 | tipc_printf(buf, "[]"); | 2999 | tipc_printf(buf, "[]"); |