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.c116
1 files changed, 61 insertions, 55 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index f6bf4830ddfe..e543b9f91ee0 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -41,6 +41,12 @@
41#include "discover.h" 41#include "discover.h"
42#include "config.h" 42#include "config.h"
43 43
44/*
45 * Error message prefixes
46 */
47static const char *link_co_err = "Link changeover error, ";
48static const char *link_rst_msg = "Resetting link ";
49static const char *link_unk_evt = "Unknown link event ";
44 50
45/* 51/*
46 * Out-of-range value for link session numbers 52 * Out-of-range value for link session numbers
@@ -300,20 +306,20 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
300 306
301 if (n_ptr->link_cnt >= 2) { 307 if (n_ptr->link_cnt >= 2) {
302 tipc_addr_string_fill(addr_string, n_ptr->addr); 308 tipc_addr_string_fill(addr_string, n_ptr->addr);
303 err("Attempt to establish third link to %s\n", addr_string); 309 pr_err("Attempt to establish third link to %s\n", addr_string);
304 return NULL; 310 return NULL;
305 } 311 }
306 312
307 if (n_ptr->links[b_ptr->identity]) { 313 if (n_ptr->links[b_ptr->identity]) {
308 tipc_addr_string_fill(addr_string, n_ptr->addr); 314 tipc_addr_string_fill(addr_string, n_ptr->addr);
309 err("Attempt to establish second link on <%s> to %s\n", 315 pr_err("Attempt to establish second link on <%s> to %s\n",
310 b_ptr->name, addr_string); 316 b_ptr->name, addr_string);
311 return NULL; 317 return NULL;
312 } 318 }
313 319
314 l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC); 320 l_ptr = kzalloc(sizeof(*l_ptr), GFP_ATOMIC);
315 if (!l_ptr) { 321 if (!l_ptr) {
316 warn("Link creation failed, no memory\n"); 322 pr_warn("Link creation failed, no memory\n");
317 return NULL; 323 return NULL;
318 } 324 }
319 325
@@ -371,7 +377,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
371void tipc_link_delete(struct tipc_link *l_ptr) 377void tipc_link_delete(struct tipc_link *l_ptr)
372{ 378{
373 if (!l_ptr) { 379 if (!l_ptr) {
374 err("Attempt to delete non-existent link\n"); 380 pr_err("Attempt to delete non-existent link\n");
375 return; 381 return;
376 } 382 }
377 383
@@ -632,8 +638,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
632 link_set_timer(l_ptr, cont_intv / 4); 638 link_set_timer(l_ptr, cont_intv / 4);
633 break; 639 break;
634 case RESET_MSG: 640 case RESET_MSG:
635 info("Resetting link <%s>, requested by peer\n", 641 pr_info("%s<%s>, requested by peer\n", link_rst_msg,
636 l_ptr->name); 642 l_ptr->name);
637 tipc_link_reset(l_ptr); 643 tipc_link_reset(l_ptr);
638 l_ptr->state = RESET_RESET; 644 l_ptr->state = RESET_RESET;
639 l_ptr->fsm_msg_cnt = 0; 645 l_ptr->fsm_msg_cnt = 0;
@@ -642,7 +648,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
642 link_set_timer(l_ptr, cont_intv); 648 link_set_timer(l_ptr, cont_intv);
643 break; 649 break;
644 default: 650 default:
645 err("Unknown link event %u in WW state\n", event); 651 pr_err("%s%u in WW state\n", link_unk_evt, event);
646 } 652 }
647 break; 653 break;
648 case WORKING_UNKNOWN: 654 case WORKING_UNKNOWN:
@@ -654,8 +660,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
654 link_set_timer(l_ptr, cont_intv); 660 link_set_timer(l_ptr, cont_intv);
655 break; 661 break;
656 case RESET_MSG: 662 case RESET_MSG:
657 info("Resetting link <%s>, requested by peer " 663 pr_info("%s<%s>, requested by peer while probing\n",
658 "while probing\n", l_ptr->name); 664 link_rst_msg, l_ptr->name);
659 tipc_link_reset(l_ptr); 665 tipc_link_reset(l_ptr);
660 l_ptr->state = RESET_RESET; 666 l_ptr->state = RESET_RESET;
661 l_ptr->fsm_msg_cnt = 0; 667 l_ptr->fsm_msg_cnt = 0;
@@ -680,8 +686,8 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
680 l_ptr->fsm_msg_cnt++; 686 l_ptr->fsm_msg_cnt++;
681 link_set_timer(l_ptr, cont_intv / 4); 687 link_set_timer(l_ptr, cont_intv / 4);
682 } else { /* Link has failed */ 688 } else { /* Link has failed */
683 warn("Resetting link <%s>, peer not responding\n", 689 pr_warn("%s<%s>, peer not responding\n",
684 l_ptr->name); 690 link_rst_msg, l_ptr->name);
685 tipc_link_reset(l_ptr); 691 tipc_link_reset(l_ptr);
686 l_ptr->state = RESET_UNKNOWN; 692 l_ptr->state = RESET_UNKNOWN;
687 l_ptr->fsm_msg_cnt = 0; 693 l_ptr->fsm_msg_cnt = 0;
@@ -692,7 +698,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
692 } 698 }
693 break; 699 break;
694 default: 700 default:
695 err("Unknown link event %u in WU state\n", event); 701 pr_err("%s%u in WU state\n", link_unk_evt, event);
696 } 702 }
697 break; 703 break;
698 case RESET_UNKNOWN: 704 case RESET_UNKNOWN:
@@ -726,7 +732,7 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
726 link_set_timer(l_ptr, cont_intv); 732 link_set_timer(l_ptr, cont_intv);
727 break; 733 break;
728 default: 734 default:
729 err("Unknown link event %u in RU state\n", event); 735 pr_err("%s%u in RU state\n", link_unk_evt, event);
730 } 736 }
731 break; 737 break;
732 case RESET_RESET: 738 case RESET_RESET:
@@ -751,11 +757,11 @@ static void link_state_event(struct tipc_link *l_ptr, unsigned int event)
751 link_set_timer(l_ptr, cont_intv); 757 link_set_timer(l_ptr, cont_intv);
752 break; 758 break;
753 default: 759 default:
754 err("Unknown link event %u in RR state\n", event); 760 pr_err("%s%u in RR state\n", link_unk_evt, event);
755 } 761 }
756 break; 762 break;
757 default: 763 default:
758 err("Unknown link state %u/%u\n", l_ptr->state, event); 764 pr_err("Unknown link state %u/%u\n", l_ptr->state, event);
759 } 765 }
760} 766}
761 767
@@ -856,7 +862,8 @@ int tipc_link_send_buf(struct tipc_link *l_ptr, struct sk_buff *buf)
856 } 862 }
857 kfree_skb(buf); 863 kfree_skb(buf);
858 if (imp > CONN_MANAGER) { 864 if (imp > CONN_MANAGER) {
859 warn("Resetting link <%s>, send queue full", l_ptr->name); 865 pr_warn("%s<%s>, send queue full", link_rst_msg,
866 l_ptr->name);
860 tipc_link_reset(l_ptr); 867 tipc_link_reset(l_ptr);
861 } 868 }
862 return dsz; 869 return dsz;
@@ -1409,8 +1416,8 @@ static void link_reset_all(unsigned long addr)
1409 1416
1410 tipc_node_lock(n_ptr); 1417 tipc_node_lock(n_ptr);
1411 1418
1412 warn("Resetting all links to %s\n", 1419 pr_warn("Resetting all links to %s\n",
1413 tipc_addr_string_fill(addr_string, n_ptr->addr)); 1420 tipc_addr_string_fill(addr_string, n_ptr->addr));
1414 1421
1415 for (i = 0; i < MAX_BEARERS; i++) { 1422 for (i = 0; i < MAX_BEARERS; i++) {
1416 if (n_ptr->links[i]) { 1423 if (n_ptr->links[i]) {
@@ -1428,7 +1435,7 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
1428{ 1435{
1429 struct tipc_msg *msg = buf_msg(buf); 1436 struct tipc_msg *msg = buf_msg(buf);
1430 1437
1431 warn("Retransmission failure on link <%s>\n", l_ptr->name); 1438 pr_warn("Retransmission failure on link <%s>\n", l_ptr->name);
1432 1439
1433 if (l_ptr->addr) { 1440 if (l_ptr->addr) {
1434 /* Handle failure on standard link */ 1441 /* Handle failure on standard link */
@@ -1440,21 +1447,23 @@ static void link_retransmit_failure(struct tipc_link *l_ptr,
1440 struct tipc_node *n_ptr; 1447 struct tipc_node *n_ptr;
1441 char addr_string[16]; 1448 char addr_string[16];
1442 1449
1443 info("Msg seq number: %u, ", msg_seqno(msg)); 1450 pr_info("Msg seq number: %u, ", msg_seqno(msg));
1444 info("Outstanding acks: %lu\n", 1451 pr_cont("Outstanding acks: %lu\n",
1445 (unsigned long) TIPC_SKB_CB(buf)->handle); 1452 (unsigned long) TIPC_SKB_CB(buf)->handle);
1446 1453
1447 n_ptr = tipc_bclink_retransmit_to(); 1454 n_ptr = tipc_bclink_retransmit_to();
1448 tipc_node_lock(n_ptr); 1455 tipc_node_lock(n_ptr);
1449 1456
1450 tipc_addr_string_fill(addr_string, n_ptr->addr); 1457 tipc_addr_string_fill(addr_string, n_ptr->addr);
1451 info("Broadcast link info for %s\n", addr_string); 1458 pr_info("Broadcast link info for %s\n", addr_string);
1452 info("Supportable: %d, ", n_ptr->bclink.supportable); 1459 pr_info("Supportable: %d, Supported: %d, Acked: %u\n",
1453 info("Supported: %d, ", n_ptr->bclink.supported); 1460 n_ptr->bclink.supportable,
1454 info("Acked: %u\n", n_ptr->bclink.acked); 1461 n_ptr->bclink.supported,
1455 info("Last in: %u, ", n_ptr->bclink.last_in); 1462 n_ptr->bclink.acked);
1456 info("Oos state: %u, ", n_ptr->bclink.oos_state); 1463 pr_info("Last in: %u, Oos state: %u, Last sent: %u\n",
1457 info("Last sent: %u\n", n_ptr->bclink.last_sent); 1464 n_ptr->bclink.last_in,
1465 n_ptr->bclink.oos_state,
1466 n_ptr->bclink.last_sent);
1458 1467
1459 tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr); 1468 tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr);
1460 1469
@@ -1479,8 +1488,8 @@ void tipc_link_retransmit(struct tipc_link *l_ptr, struct sk_buff *buf,
1479 l_ptr->retransm_queue_head = msg_seqno(msg); 1488 l_ptr->retransm_queue_head = msg_seqno(msg);
1480 l_ptr->retransm_queue_size = retransmits; 1489 l_ptr->retransm_queue_size = retransmits;
1481 } else { 1490 } else {
1482 err("Unexpected retransmit on link %s (qsize=%d)\n", 1491 pr_err("Unexpected retransmit on link %s (qsize=%d)\n",
1483 l_ptr->name, l_ptr->retransm_queue_size); 1492 l_ptr->name, l_ptr->retransm_queue_size);
1484 } 1493 }
1485 return; 1494 return;
1486 } else { 1495 } else {
@@ -2074,8 +2083,9 @@ static void link_recv_proto_msg(struct tipc_link *l_ptr, struct sk_buff *buf)
2074 2083
2075 if (msg_linkprio(msg) && 2084 if (msg_linkprio(msg) &&
2076 (msg_linkprio(msg) != l_ptr->priority)) { 2085 (msg_linkprio(msg) != l_ptr->priority)) {
2077 warn("Resetting link <%s>, priority change %u->%u\n", 2086 pr_warn("%s<%s>, priority change %u->%u\n",
2078 l_ptr->name, l_ptr->priority, msg_linkprio(msg)); 2087 link_rst_msg, l_ptr->name, l_ptr->priority,
2088 msg_linkprio(msg));
2079 l_ptr->priority = msg_linkprio(msg); 2089 l_ptr->priority = msg_linkprio(msg);
2080 tipc_link_reset(l_ptr); /* Enforce change to take effect */ 2090 tipc_link_reset(l_ptr); /* Enforce change to take effect */
2081 break; 2091 break;
@@ -2139,15 +2149,13 @@ static void tipc_link_tunnel(struct tipc_link *l_ptr,
2139 2149
2140 tunnel = l_ptr->owner->active_links[selector & 1]; 2150 tunnel = l_ptr->owner->active_links[selector & 1];
2141 if (!tipc_link_is_up(tunnel)) { 2151 if (!tipc_link_is_up(tunnel)) {
2142 warn("Link changeover error, " 2152 pr_warn("%stunnel link no longer available\n", link_co_err);
2143 "tunnel link no longer available\n");
2144 return; 2153 return;
2145 } 2154 }
2146 msg_set_size(tunnel_hdr, length + INT_H_SIZE); 2155 msg_set_size(tunnel_hdr, length + INT_H_SIZE);
2147 buf = tipc_buf_acquire(length + INT_H_SIZE); 2156 buf = tipc_buf_acquire(length + INT_H_SIZE);
2148 if (!buf) { 2157 if (!buf) {
2149 warn("Link changeover error, " 2158 pr_warn("%sunable to send tunnel msg\n", link_co_err);
2150 "unable to send tunnel msg\n");
2151 return; 2159 return;
2152 } 2160 }
2153 skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE); 2161 skb_copy_to_linear_data(buf, tunnel_hdr, INT_H_SIZE);
@@ -2173,8 +2181,7 @@ void tipc_link_changeover(struct tipc_link *l_ptr)
2173 return; 2181 return;
2174 2182
2175 if (!l_ptr->owner->permit_changeover) { 2183 if (!l_ptr->owner->permit_changeover) {
2176 warn("Link changeover error, " 2184 pr_warn("%speer did not permit changeover\n", link_co_err);
2177 "peer did not permit changeover\n");
2178 return; 2185 return;
2179 } 2186 }
2180 2187
@@ -2192,8 +2199,8 @@ void tipc_link_changeover(struct tipc_link *l_ptr)
2192 msg_set_size(&tunnel_hdr, INT_H_SIZE); 2199 msg_set_size(&tunnel_hdr, INT_H_SIZE);
2193 tipc_link_send_buf(tunnel, buf); 2200 tipc_link_send_buf(tunnel, buf);
2194 } else { 2201 } else {
2195 warn("Link changeover error, " 2202 pr_warn("%sunable to send changeover msg\n",
2196 "unable to send changeover msg\n"); 2203 link_co_err);
2197 } 2204 }
2198 return; 2205 return;
2199 } 2206 }
@@ -2246,8 +2253,8 @@ void tipc_link_send_duplicate(struct tipc_link *l_ptr, struct tipc_link *tunnel)
2246 msg_set_size(&tunnel_hdr, length + INT_H_SIZE); 2253 msg_set_size(&tunnel_hdr, length + INT_H_SIZE);
2247 outbuf = tipc_buf_acquire(length + INT_H_SIZE); 2254 outbuf = tipc_buf_acquire(length + INT_H_SIZE);
2248 if (outbuf == NULL) { 2255 if (outbuf == NULL) {
2249 warn("Link changeover error, " 2256 pr_warn("%sunable to send duplicate msg\n",
2250 "unable to send duplicate msg\n"); 2257 link_co_err);
2251 return; 2258 return;
2252 } 2259 }
2253 skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE); 2260 skb_copy_to_linear_data(outbuf, &tunnel_hdr, INT_H_SIZE);
@@ -2298,8 +2305,8 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2298 if (!dest_link) 2305 if (!dest_link)
2299 goto exit; 2306 goto exit;
2300 if (dest_link == *l_ptr) { 2307 if (dest_link == *l_ptr) {
2301 err("Unexpected changeover message on link <%s>\n", 2308 pr_err("Unexpected changeover message on link <%s>\n",
2302 (*l_ptr)->name); 2309 (*l_ptr)->name);
2303 goto exit; 2310 goto exit;
2304 } 2311 }
2305 *l_ptr = dest_link; 2312 *l_ptr = dest_link;
@@ -2310,7 +2317,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2310 goto exit; 2317 goto exit;
2311 *buf = buf_extract(tunnel_buf, INT_H_SIZE); 2318 *buf = buf_extract(tunnel_buf, INT_H_SIZE);
2312 if (*buf == NULL) { 2319 if (*buf == NULL) {
2313 warn("Link changeover error, duplicate msg dropped\n"); 2320 pr_warn("%sduplicate msg dropped\n", link_co_err);
2314 goto exit; 2321 goto exit;
2315 } 2322 }
2316 kfree_skb(tunnel_buf); 2323 kfree_skb(tunnel_buf);
@@ -2319,8 +2326,8 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2319 2326
2320 /* First original message ?: */ 2327 /* First original message ?: */
2321 if (tipc_link_is_up(dest_link)) { 2328 if (tipc_link_is_up(dest_link)) {
2322 info("Resetting link <%s>, changeover initiated by peer\n", 2329 pr_info("%s<%s>, changeover initiated by peer\n", link_rst_msg,
2323 dest_link->name); 2330 dest_link->name);
2324 tipc_link_reset(dest_link); 2331 tipc_link_reset(dest_link);
2325 dest_link->exp_msg_count = msg_count; 2332 dest_link->exp_msg_count = msg_count;
2326 if (!msg_count) 2333 if (!msg_count)
@@ -2333,8 +2340,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2333 2340
2334 /* Receive original message */ 2341 /* Receive original message */
2335 if (dest_link->exp_msg_count == 0) { 2342 if (dest_link->exp_msg_count == 0) {
2336 warn("Link switchover error, " 2343 pr_warn("%sgot too many tunnelled messages\n", link_co_err);
2337 "got too many tunnelled messages\n");
2338 goto exit; 2344 goto exit;
2339 } 2345 }
2340 dest_link->exp_msg_count--; 2346 dest_link->exp_msg_count--;
@@ -2346,7 +2352,7 @@ static int link_recv_changeover_msg(struct tipc_link **l_ptr,
2346 kfree_skb(tunnel_buf); 2352 kfree_skb(tunnel_buf);
2347 return 1; 2353 return 1;
2348 } else { 2354 } else {
2349 warn("Link changeover error, original msg dropped\n"); 2355 pr_warn("%soriginal msg dropped\n", link_co_err);
2350 } 2356 }
2351 } 2357 }
2352exit: 2358exit:
@@ -2367,7 +2373,7 @@ void tipc_link_recv_bundle(struct sk_buff *buf)
2367 while (msgcount--) { 2373 while (msgcount--) {
2368 obuf = buf_extract(buf, pos); 2374 obuf = buf_extract(buf, pos);
2369 if (obuf == NULL) { 2375 if (obuf == NULL) {
2370 warn("Link unable to unbundle message(s)\n"); 2376 pr_warn("Link unable to unbundle message(s)\n");
2371 break; 2377 break;
2372 } 2378 }
2373 pos += align(msg_size(buf_msg(obuf))); 2379 pos += align(msg_size(buf_msg(obuf)));
@@ -2538,7 +2544,7 @@ int tipc_link_recv_fragment(struct sk_buff **pending, struct sk_buff **fb,
2538 set_fragm_size(pbuf, fragm_sz); 2544 set_fragm_size(pbuf, fragm_sz);
2539 set_expected_frags(pbuf, exp_fragm_cnt - 1); 2545 set_expected_frags(pbuf, exp_fragm_cnt - 1);
2540 } else { 2546 } else {
2541 dbg("Link unable to reassemble fragmented message\n"); 2547 pr_debug("Link unable to reassemble fragmented message\n");
2542 kfree_skb(fbuf); 2548 kfree_skb(fbuf);
2543 return -1; 2549 return -1;
2544 } 2550 }
@@ -3060,5 +3066,5 @@ print_state:
3060 tipc_printf(buf, "\n"); 3066 tipc_printf(buf, "\n");
3061 3067
3062 tipc_printbuf_validate(buf); 3068 tipc_printbuf_validate(buf);
3063 info("%s", print_area); 3069 pr_info("%s", print_area);
3064} 3070}