aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorAllan Stephens <Allan.Stephens@windriver.com>2010-12-31 13:59:27 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-01 16:57:53 -0500
commit8d64a5ba58157dedc61f3f1f51e1c5d66f32a484 (patch)
tree2bfd8a02b5da343cd24eafb95197a426aa94dd45 /net/tipc
parent7ced6890bf81d311ab2ea846f92d5f3d0951c08c (diff)
tipc: Prune down link-specific debugging code
Eliminates most link-specific debugging code in TIPC, which is now largely unnecessary. All calls to the link-specific debugging macros have been removed, as are the macros themselves; in addition, the optional allocation of print buffers to hold debugging information for each link endpoint has been removed. The ability for TIPC to print out helpful diagnostic information when link retransmit failures occur has been retained for the time being, as an aid in tracking down the cause of such failures. Signed-off-by: Allan Stephens <Allan.Stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c13
-rw-r--r--net/tipc/link.c167
-rw-r--r--net/tipc/link.h3
3 files changed, 36 insertions, 147 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index cb817d503c14..22a10fadc8c6 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -45,8 +45,6 @@
45 45
46#define BCLINK_WIN_DEFAULT 20 /* bcast link window size (default) */ 46#define BCLINK_WIN_DEFAULT 20 /* bcast link window size (default) */
47 47
48#define BCLINK_LOG_BUF_SIZE 0
49
50/* 48/*
51 * Loss rate for incoming broadcast frames; used to test retransmission code. 49 * Loss rate for incoming broadcast frames; used to test retransmission code.
52 * Set to N to cause every N'th frame to be discarded; 0 => don't discard any. 50 * Set to N to cause every N'th frame to be discarded; 0 => don't discard any.
@@ -774,7 +772,6 @@ int tipc_bclink_init(void)
774 bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC); 772 bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC);
775 bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC); 773 bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
776 if (!bcbearer || !bclink) { 774 if (!bcbearer || !bclink) {
777 nomem:
778 warn("Multicast link creation failed, no memory\n"); 775 warn("Multicast link creation failed, no memory\n");
779 kfree(bcbearer); 776 kfree(bcbearer);
780 bcbearer = NULL; 777 bcbearer = NULL;
@@ -799,14 +796,6 @@ int tipc_bclink_init(void)
799 bcl->state = WORKING_WORKING; 796 bcl->state = WORKING_WORKING;
800 strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME); 797 strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
801 798
802 if (BCLINK_LOG_BUF_SIZE) {
803 char *pb = kmalloc(BCLINK_LOG_BUF_SIZE, GFP_ATOMIC);
804
805 if (!pb)
806 goto nomem;
807 tipc_printbuf_init(&bcl->print_buf, pb, BCLINK_LOG_BUF_SIZE);
808 }
809
810 return 0; 799 return 0;
811} 800}
812 801
@@ -815,8 +804,6 @@ void tipc_bclink_stop(void)
815 spin_lock_bh(&bc_lock); 804 spin_lock_bh(&bc_lock);
816 if (bcbearer) { 805 if (bcbearer) {
817 tipc_link_stop(bcl); 806 tipc_link_stop(bcl);
818 if (BCLINK_LOG_BUF_SIZE)
819 kfree(bcl->print_buf.buf);
820 bcl = NULL; 807 bcl = NULL;
821 kfree(bclink); 808 kfree(bclink);
822 bclink = NULL; 809 bclink = NULL;
diff --git a/net/tipc/link.c b/net/tipc/link.c
index cb10d20caef3..647f2ecfde50 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -96,63 +96,10 @@ static int link_send_sections_long(struct port *sender,
96static void link_check_defragm_bufs(struct link *l_ptr); 96static void link_check_defragm_bufs(struct link *l_ptr);
97static void link_state_event(struct link *l_ptr, u32 event); 97static void link_state_event(struct link *l_ptr, u32 event);
98static void link_reset_statistics(struct link *l_ptr); 98static void link_reset_statistics(struct link *l_ptr);
99static void link_print(struct link *l_ptr, struct print_buf *buf, 99static void link_print(struct link *l_ptr, const char *str);
100 const char *str);
101static void link_start(struct link *l_ptr); 100static void link_start(struct link *l_ptr);
102static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf); 101static int link_send_long_buf(struct link *l_ptr, struct sk_buff *buf);
103 102
104
105/*
106 * Debugging code used by link routines only
107 *
108 * When debugging link problems on a system that has multiple links,
109 * the standard TIPC debugging routines may not be useful since they
110 * allow the output from multiple links to be intermixed. For this reason
111 * routines of the form "dbg_link_XXX()" have been created that will capture
112 * debug info into a link's personal print buffer, which can then be dumped
113 * into the TIPC system log (TIPC_LOG) upon request.
114 *
115 * To enable per-link debugging, use LINK_LOG_BUF_SIZE to specify the size
116 * of the print buffer used by each link. If LINK_LOG_BUF_SIZE is set to 0,
117 * the dbg_link_XXX() routines simply send their output to the standard
118 * debug print buffer (DBG_OUTPUT), if it has been defined; this can be useful
119 * when there is only a single link in the system being debugged.
120 *
121 * Notes:
122 * - When enabled, LINK_LOG_BUF_SIZE should be set to at least TIPC_PB_MIN_SIZE
123 * - "l_ptr" must be valid when using dbg_link_XXX() macros
124 */
125
126#define LINK_LOG_BUF_SIZE 0
127
128#define dbg_link(fmt, arg...) \
129 do { \
130 if (LINK_LOG_BUF_SIZE) \
131 tipc_printf(&l_ptr->print_buf, fmt, ## arg); \
132 } while (0)
133#define dbg_link_msg(msg, txt) \
134 do { \
135 if (LINK_LOG_BUF_SIZE) \
136 tipc_msg_dbg(&l_ptr->print_buf, msg, txt); \
137 } while (0)
138#define dbg_link_state(txt) \
139 do { \
140 if (LINK_LOG_BUF_SIZE) \
141 link_print(l_ptr, &l_ptr->print_buf, txt); \
142 } while (0)
143#define dbg_link_dump() do { \
144 if (LINK_LOG_BUF_SIZE) { \
145 tipc_printf(LOG, "\n\nDumping link <%s>:\n", l_ptr->name); \
146 tipc_printbuf_move(LOG, &l_ptr->print_buf); \
147 } \
148} while (0)
149
150static void dbg_print_link(struct link *l_ptr, const char *str)
151{
152 if (DBG_OUTPUT != TIPC_NULL)
153 link_print(l_ptr, DBG_OUTPUT, str);
154}
155
156/* 103/*
157 * Simple link routines 104 * Simple link routines
158 */ 105 */
@@ -366,17 +313,6 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
366 return NULL; 313 return NULL;
367 } 314 }
368 315
369 if (LINK_LOG_BUF_SIZE) {
370 char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC);
371
372 if (!pb) {
373 kfree(l_ptr);
374 warn("Link creation failed, no memory for print buffer\n");
375 return NULL;
376 }
377 tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
378 }
379
380 l_ptr->addr = peer; 316 l_ptr->addr = peer;
381 if_name = strchr(b_ptr->publ.name, ':') + 1; 317 if_name = strchr(b_ptr->publ.name, ':') + 1;
382 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:", 318 sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:",
@@ -411,8 +347,6 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
411 347
412 l_ptr->owner = tipc_node_attach_link(l_ptr); 348 l_ptr->owner = tipc_node_attach_link(l_ptr);
413 if (!l_ptr->owner) { 349 if (!l_ptr->owner) {
414 if (LINK_LOG_BUF_SIZE)
415 kfree(l_ptr->print_buf.buf);
416 kfree(l_ptr); 350 kfree(l_ptr);
417 return NULL; 351 return NULL;
418 } 352 }
@@ -447,8 +381,6 @@ void tipc_link_delete(struct link *l_ptr)
447 tipc_node_detach_link(l_ptr->owner, l_ptr); 381 tipc_node_detach_link(l_ptr->owner, l_ptr);
448 tipc_link_stop(l_ptr); 382 tipc_link_stop(l_ptr);
449 list_del_init(&l_ptr->link_list); 383 list_del_init(&l_ptr->link_list);
450 if (LINK_LOG_BUF_SIZE)
451 kfree(l_ptr->print_buf.buf);
452 tipc_node_unlock(l_ptr->owner); 384 tipc_node_unlock(l_ptr->owner);
453 k_term_timer(&l_ptr->timer); 385 k_term_timer(&l_ptr->timer);
454 kfree(l_ptr); 386 kfree(l_ptr);
@@ -607,7 +539,6 @@ void tipc_link_reset(struct link *l_ptr)
607 link_init_max_pkt(l_ptr); 539 link_init_max_pkt(l_ptr);
608 540
609 l_ptr->state = RESET_UNKNOWN; 541 l_ptr->state = RESET_UNKNOWN;
610 dbg_link_state("Resetting Link\n");
611 542
612 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET)) 543 if ((prev_state == RESET_UNKNOWN) || (prev_state == RESET_RESET))
613 return; 544 return;
@@ -686,20 +617,14 @@ static void link_state_event(struct link *l_ptr, unsigned event)
686 } 617 }
687 return; /* Changeover going on */ 618 return; /* Changeover going on */
688 } 619 }
689 dbg_link("STATE_EV: <%s> ", l_ptr->name);
690 620
691 switch (l_ptr->state) { 621 switch (l_ptr->state) {
692 case WORKING_WORKING: 622 case WORKING_WORKING:
693 dbg_link("WW/");
694 switch (event) { 623 switch (event) {
695 case TRAFFIC_MSG_EVT: 624 case TRAFFIC_MSG_EVT:
696 dbg_link("TRF-");
697 /* fall through */
698 case ACTIVATE_MSG: 625 case ACTIVATE_MSG:
699 dbg_link("ACT\n");
700 break; 626 break;
701 case TIMEOUT_EVT: 627 case TIMEOUT_EVT:
702 dbg_link("TIM ");
703 if (l_ptr->next_in_no != l_ptr->checkpoint) { 628 if (l_ptr->next_in_no != l_ptr->checkpoint) {
704 l_ptr->checkpoint = l_ptr->next_in_no; 629 l_ptr->checkpoint = l_ptr->next_in_no;
705 if (tipc_bclink_acks_missing(l_ptr->owner)) { 630 if (tipc_bclink_acks_missing(l_ptr->owner)) {
@@ -714,7 +639,6 @@ static void link_state_event(struct link *l_ptr, unsigned event)
714 link_set_timer(l_ptr, cont_intv); 639 link_set_timer(l_ptr, cont_intv);
715 break; 640 break;
716 } 641 }
717 dbg_link(" -> WU\n");
718 l_ptr->state = WORKING_UNKNOWN; 642 l_ptr->state = WORKING_UNKNOWN;
719 l_ptr->fsm_msg_cnt = 0; 643 l_ptr->fsm_msg_cnt = 0;
720 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0); 644 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 1, 0, 0, 0, 0);
@@ -722,7 +646,6 @@ static void link_state_event(struct link *l_ptr, unsigned event)
722 link_set_timer(l_ptr, cont_intv / 4); 646 link_set_timer(l_ptr, cont_intv / 4);
723 break; 647 break;
724 case RESET_MSG: 648 case RESET_MSG:
725 dbg_link("RES -> RR\n");
726 info("Resetting link <%s>, requested by peer\n", 649 info("Resetting link <%s>, requested by peer\n",
727 l_ptr->name); 650 l_ptr->name);
728 tipc_link_reset(l_ptr); 651 tipc_link_reset(l_ptr);
@@ -737,18 +660,14 @@ static void link_state_event(struct link *l_ptr, unsigned event)
737 } 660 }
738 break; 661 break;
739 case WORKING_UNKNOWN: 662 case WORKING_UNKNOWN:
740 dbg_link("WU/");
741 switch (event) { 663 switch (event) {
742 case TRAFFIC_MSG_EVT: 664 case TRAFFIC_MSG_EVT:
743 dbg_link("TRF-");
744 case ACTIVATE_MSG: 665 case ACTIVATE_MSG:
745 dbg_link("ACT -> WW\n");
746 l_ptr->state = WORKING_WORKING; 666 l_ptr->state = WORKING_WORKING;
747 l_ptr->fsm_msg_cnt = 0; 667 l_ptr->fsm_msg_cnt = 0;
748 link_set_timer(l_ptr, cont_intv); 668 link_set_timer(l_ptr, cont_intv);
749 break; 669 break;
750 case RESET_MSG: 670 case RESET_MSG:
751 dbg_link("RES -> RR\n");
752 info("Resetting link <%s>, requested by peer " 671 info("Resetting link <%s>, requested by peer "
753 "while probing\n", l_ptr->name); 672 "while probing\n", l_ptr->name);
754 tipc_link_reset(l_ptr); 673 tipc_link_reset(l_ptr);
@@ -759,9 +678,7 @@ static void link_state_event(struct link *l_ptr, unsigned event)
759 link_set_timer(l_ptr, cont_intv); 678 link_set_timer(l_ptr, cont_intv);
760 break; 679 break;
761 case TIMEOUT_EVT: 680 case TIMEOUT_EVT:
762 dbg_link("TIM ");
763 if (l_ptr->next_in_no != l_ptr->checkpoint) { 681 if (l_ptr->next_in_no != l_ptr->checkpoint) {
764 dbg_link("-> WW\n");
765 l_ptr->state = WORKING_WORKING; 682 l_ptr->state = WORKING_WORKING;
766 l_ptr->fsm_msg_cnt = 0; 683 l_ptr->fsm_msg_cnt = 0;
767 l_ptr->checkpoint = l_ptr->next_in_no; 684 l_ptr->checkpoint = l_ptr->next_in_no;
@@ -772,16 +689,11 @@ static void link_state_event(struct link *l_ptr, unsigned event)
772 } 689 }
773 link_set_timer(l_ptr, cont_intv); 690 link_set_timer(l_ptr, cont_intv);
774 } else if (l_ptr->fsm_msg_cnt < l_ptr->abort_limit) { 691 } else if (l_ptr->fsm_msg_cnt < l_ptr->abort_limit) {
775 dbg_link("Probing %u/%u,timer = %u ms)\n",
776 l_ptr->fsm_msg_cnt, l_ptr->abort_limit,
777 cont_intv / 4);
778 tipc_link_send_proto_msg(l_ptr, STATE_MSG, 692 tipc_link_send_proto_msg(l_ptr, STATE_MSG,
779 1, 0, 0, 0, 0); 693 1, 0, 0, 0, 0);
780 l_ptr->fsm_msg_cnt++; 694 l_ptr->fsm_msg_cnt++;
781 link_set_timer(l_ptr, cont_intv / 4); 695 link_set_timer(l_ptr, cont_intv / 4);
782 } else { /* Link has failed */ 696 } else { /* Link has failed */
783 dbg_link("-> RU (%u probes unanswered)\n",
784 l_ptr->fsm_msg_cnt);
785 warn("Resetting link <%s>, peer not responding\n", 697 warn("Resetting link <%s>, peer not responding\n",
786 l_ptr->name); 698 l_ptr->name);
787 tipc_link_reset(l_ptr); 699 tipc_link_reset(l_ptr);
@@ -798,18 +710,13 @@ static void link_state_event(struct link *l_ptr, unsigned event)
798 } 710 }
799 break; 711 break;
800 case RESET_UNKNOWN: 712 case RESET_UNKNOWN:
801 dbg_link("RU/");
802 switch (event) { 713 switch (event) {
803 case TRAFFIC_MSG_EVT: 714 case TRAFFIC_MSG_EVT:
804 dbg_link("TRF-\n");
805 break; 715 break;
806 case ACTIVATE_MSG: 716 case ACTIVATE_MSG:
807 other = l_ptr->owner->active_links[0]; 717 other = l_ptr->owner->active_links[0];
808 if (other && link_working_unknown(other)) { 718 if (other && link_working_unknown(other))
809 dbg_link("ACT\n");
810 break; 719 break;
811 }
812 dbg_link("ACT -> WW\n");
813 l_ptr->state = WORKING_WORKING; 720 l_ptr->state = WORKING_WORKING;
814 l_ptr->fsm_msg_cnt = 0; 721 l_ptr->fsm_msg_cnt = 0;
815 link_activate(l_ptr); 722 link_activate(l_ptr);
@@ -818,8 +725,6 @@ static void link_state_event(struct link *l_ptr, unsigned event)
818 link_set_timer(l_ptr, cont_intv); 725 link_set_timer(l_ptr, cont_intv);
819 break; 726 break;
820 case RESET_MSG: 727 case RESET_MSG:
821 dbg_link("RES\n");
822 dbg_link(" -> RR\n");
823 l_ptr->state = RESET_RESET; 728 l_ptr->state = RESET_RESET;
824 l_ptr->fsm_msg_cnt = 0; 729 l_ptr->fsm_msg_cnt = 0;
825 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0); 730 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 1, 0, 0, 0, 0);
@@ -827,11 +732,9 @@ static void link_state_event(struct link *l_ptr, unsigned event)
827 link_set_timer(l_ptr, cont_intv); 732 link_set_timer(l_ptr, cont_intv);
828 break; 733 break;
829 case STARTING_EVT: 734 case STARTING_EVT:
830 dbg_link("START-");
831 l_ptr->started = 1; 735 l_ptr->started = 1;
832 /* fall through */ 736 /* fall through */
833 case TIMEOUT_EVT: 737 case TIMEOUT_EVT:
834 dbg_link("TIM\n");
835 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0); 738 tipc_link_send_proto_msg(l_ptr, RESET_MSG, 0, 0, 0, 0, 0);
836 l_ptr->fsm_msg_cnt++; 739 l_ptr->fsm_msg_cnt++;
837 link_set_timer(l_ptr, cont_intv); 740 link_set_timer(l_ptr, cont_intv);
@@ -841,18 +744,12 @@ static void link_state_event(struct link *l_ptr, unsigned event)
841 } 744 }
842 break; 745 break;
843 case RESET_RESET: 746 case RESET_RESET:
844 dbg_link("RR/ ");
845 switch (event) { 747 switch (event) {
846 case TRAFFIC_MSG_EVT: 748 case TRAFFIC_MSG_EVT:
847 dbg_link("TRF-");
848 /* fall through */
849 case ACTIVATE_MSG: 749 case ACTIVATE_MSG:
850 other = l_ptr->owner->active_links[0]; 750 other = l_ptr->owner->active_links[0];
851 if (other && link_working_unknown(other)) { 751 if (other && link_working_unknown(other))
852 dbg_link("ACT\n");
853 break; 752 break;
854 }
855 dbg_link("ACT -> WW\n");
856 l_ptr->state = WORKING_WORKING; 753 l_ptr->state = WORKING_WORKING;
857 l_ptr->fsm_msg_cnt = 0; 754 l_ptr->fsm_msg_cnt = 0;
858 link_activate(l_ptr); 755 link_activate(l_ptr);
@@ -861,14 +758,11 @@ static void link_state_event(struct link *l_ptr, unsigned event)
861 link_set_timer(l_ptr, cont_intv); 758 link_set_timer(l_ptr, cont_intv);
862 break; 759 break;
863 case RESET_MSG: 760 case RESET_MSG:
864 dbg_link("RES\n");
865 break; 761 break;
866 case TIMEOUT_EVT: 762 case TIMEOUT_EVT:
867 dbg_link("TIM\n");
868 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0); 763 tipc_link_send_proto_msg(l_ptr, ACTIVATE_MSG, 0, 0, 0, 0, 0);
869 l_ptr->fsm_msg_cnt++; 764 l_ptr->fsm_msg_cnt++;
870 link_set_timer(l_ptr, cont_intv); 765 link_set_timer(l_ptr, cont_intv);
871 dbg_link("fsm_msg_cnt %u\n", l_ptr->fsm_msg_cnt);
872 break; 766 break;
873 default: 767 default:
874 err("Unknown link event %u in RR state\n", event); 768 err("Unknown link event %u in RR state\n", event);
@@ -1515,8 +1409,7 @@ static void link_reset_all(unsigned long addr)
1515 1409
1516 for (i = 0; i < MAX_BEARERS; i++) { 1410 for (i = 0; i < MAX_BEARERS; i++) {
1517 if (n_ptr->links[i]) { 1411 if (n_ptr->links[i]) {
1518 link_print(n_ptr->links[i], TIPC_OUTPUT, 1412 link_print(n_ptr->links[i], "Resetting link\n");
1519 "Resetting link\n");
1520 tipc_link_reset(n_ptr->links[i]); 1413 tipc_link_reset(n_ptr->links[i]);
1521 } 1414 }
1522 } 1415 }
@@ -1535,7 +1428,7 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
1535 1428
1536 /* Handle failure on standard link */ 1429 /* Handle failure on standard link */
1537 1430
1538 link_print(l_ptr, TIPC_OUTPUT, "Resetting link\n"); 1431 link_print(l_ptr, "Resetting link\n");
1539 tipc_link_reset(l_ptr); 1432 tipc_link_reset(l_ptr);
1540 1433
1541 } else { 1434 } else {
@@ -1545,21 +1438,21 @@ static void link_retransmit_failure(struct link *l_ptr, struct sk_buff *buf)
1545 struct tipc_node *n_ptr; 1438 struct tipc_node *n_ptr;
1546 char addr_string[16]; 1439 char addr_string[16];
1547 1440
1548 tipc_printf(TIPC_OUTPUT, "Msg seq number: %u, ", msg_seqno(msg)); 1441 info("Msg seq number: %u, ", msg_seqno(msg));
1549 tipc_printf(TIPC_OUTPUT, "Outstanding acks: %lu\n", 1442 info("Outstanding acks: %lu\n",
1550 (unsigned long) TIPC_SKB_CB(buf)->handle); 1443 (unsigned long) TIPC_SKB_CB(buf)->handle);
1551 1444
1552 n_ptr = l_ptr->owner->next; 1445 n_ptr = l_ptr->owner->next;
1553 tipc_node_lock(n_ptr); 1446 tipc_node_lock(n_ptr);
1554 1447
1555 tipc_addr_string_fill(addr_string, n_ptr->addr); 1448 tipc_addr_string_fill(addr_string, n_ptr->addr);
1556 tipc_printf(TIPC_OUTPUT, "Multicast link info for %s\n", addr_string); 1449 info("Multicast link info for %s\n", addr_string);
1557 tipc_printf(TIPC_OUTPUT, "Supported: %d, ", n_ptr->bclink.supported); 1450 info("Supported: %d, ", n_ptr->bclink.supported);
1558 tipc_printf(TIPC_OUTPUT, "Acked: %u\n", n_ptr->bclink.acked); 1451 info("Acked: %u\n", n_ptr->bclink.acked);
1559 tipc_printf(TIPC_OUTPUT, "Last in: %u, ", n_ptr->bclink.last_in); 1452 info("Last in: %u, ", n_ptr->bclink.last_in);
1560 tipc_printf(TIPC_OUTPUT, "Gap after: %u, ", n_ptr->bclink.gap_after); 1453 info("Gap after: %u, ", n_ptr->bclink.gap_after);
1561 tipc_printf(TIPC_OUTPUT, "Gap to: %u\n", n_ptr->bclink.gap_to); 1454 info("Gap to: %u\n", n_ptr->bclink.gap_to);
1562 tipc_printf(TIPC_OUTPUT, "Nack sync: %u\n\n", n_ptr->bclink.nack_sync); 1455 info("Nack sync: %u\n\n", n_ptr->bclink.nack_sync);
1563 1456
1564 tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr); 1457 tipc_k_signal((Handler)link_reset_all, (unsigned long)n_ptr->addr);
1565 1458
@@ -1581,7 +1474,6 @@ void tipc_link_retransmit(struct link *l_ptr, struct sk_buff *buf,
1581 1474
1582 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) { 1475 if (tipc_bearer_congested(l_ptr->b_ptr, l_ptr)) {
1583 if (l_ptr->retransm_queue_size == 0) { 1476 if (l_ptr->retransm_queue_size == 0) {
1584 dbg_print_link(l_ptr, " ");
1585 l_ptr->retransm_queue_head = msg_seqno(msg); 1477 l_ptr->retransm_queue_head = msg_seqno(msg);
1586 l_ptr->retransm_queue_size = retransmits; 1478 l_ptr->retransm_queue_size = retransmits;
1587 } else { 1479 } else {
@@ -2458,7 +2350,6 @@ static int link_recv_changeover_msg(struct link **l_ptr,
2458 if (dest_link->exp_msg_count == 0) { 2350 if (dest_link->exp_msg_count == 0) {
2459 warn("Link switchover error, " 2351 warn("Link switchover error, "
2460 "got too many tunnelled messages\n"); 2352 "got too many tunnelled messages\n");
2461 dbg_print_link(dest_link, "LINK:");
2462 goto exit; 2353 goto exit;
2463 } 2354 }
2464 dest_link->exp_msg_count--; 2355 dest_link->exp_msg_count--;
@@ -3066,14 +2957,22 @@ u32 tipc_link_get_max_pkt(u32 dest, u32 selector)
3066 return res; 2957 return res;
3067} 2958}
3068 2959
3069static void link_print(struct link *l_ptr, struct print_buf *buf, 2960static void link_print(struct link *l_ptr, const char *str)
3070 const char *str)
3071{ 2961{
2962 char print_area[256];
2963 struct print_buf pb;
2964 struct print_buf *buf = &pb;
2965
2966 tipc_printbuf_init(buf, print_area, sizeof(print_area));
2967
3072 tipc_printf(buf, str); 2968 tipc_printf(buf, str);
3073 if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr))
3074 return;
3075 tipc_printf(buf, "Link %x<%s>:", 2969 tipc_printf(buf, "Link %x<%s>:",
3076 l_ptr->addr, l_ptr->b_ptr->publ.name); 2970 l_ptr->addr, l_ptr->b_ptr->publ.name);
2971
2972#ifdef CONFIG_TIPC_DEBUG
2973 if (link_reset_reset(l_ptr) || link_reset_unknown(l_ptr))
2974 goto print_state;
2975
3077 tipc_printf(buf, ": NXO(%u):", mod(l_ptr->next_out_no)); 2976 tipc_printf(buf, ": NXO(%u):", mod(l_ptr->next_out_no));
3078 tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no)); 2977 tipc_printf(buf, "NXI(%u):", mod(l_ptr->next_in_no));
3079 tipc_printf(buf, "SQUE"); 2978 tipc_printf(buf, "SQUE");
@@ -3104,14 +3003,20 @@ static void link_print(struct link *l_ptr, struct print_buf *buf,
3104 l_ptr->deferred_inqueue_sz); 3003 l_ptr->deferred_inqueue_sz);
3105 } 3004 }
3106 } 3005 }
3006print_state:
3007#endif
3008
3107 if (link_working_unknown(l_ptr)) 3009 if (link_working_unknown(l_ptr))
3108 tipc_printf(buf, ":WU"); 3010 tipc_printf(buf, ":WU");
3109 if (link_reset_reset(l_ptr)) 3011 else if (link_reset_reset(l_ptr))
3110 tipc_printf(buf, ":RR"); 3012 tipc_printf(buf, ":RR");
3111 if (link_reset_unknown(l_ptr)) 3013 else if (link_reset_unknown(l_ptr))
3112 tipc_printf(buf, ":RU"); 3014 tipc_printf(buf, ":RU");
3113 if (link_working_working(l_ptr)) 3015 else if (link_working_working(l_ptr))
3114 tipc_printf(buf, ":WW"); 3016 tipc_printf(buf, ":WW");
3115 tipc_printf(buf, "\n"); 3017 tipc_printf(buf, "\n");
3018
3019 tipc_printbuf_validate(buf);
3020 info("%s", print_area);
3116} 3021}
3117 3022
diff --git a/net/tipc/link.h b/net/tipc/link.h
index eeb0c015dba9..eca19c247b79 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -107,7 +107,6 @@
107 * @long_msg_seq_no: next identifier to use for outbound fragmented messages 107 * @long_msg_seq_no: next identifier to use for outbound fragmented messages
108 * @defragm_buf: list of partially reassembled inbound message fragments 108 * @defragm_buf: list of partially reassembled inbound message fragments
109 * @stats: collects statistics regarding link activity 109 * @stats: collects statistics regarding link activity
110 * @print_buf: print buffer used to log link activity
111 */ 110 */
112 111
113struct link { 112struct link {
@@ -210,8 +209,6 @@ struct link {
210 u32 msg_lengths_total; 209 u32 msg_lengths_total;
211 u32 msg_length_profile[7]; 210 u32 msg_length_profile[7];
212 } stats; 211 } stats;
213
214 struct print_buf print_buf;
215}; 212};
216 213
217struct port; 214struct port;