aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/tipc/link.c33
-rw-r--r--net/tipc/link.h1
-rw-r--r--net/tipc/node.c8
-rw-r--r--net/tipc/trace.h124
4 files changed, 164 insertions, 2 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 668dab529021..55c44d867d4b 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -357,9 +357,11 @@ void tipc_link_remove_bc_peer(struct tipc_link *snd_l,
357 rcv_l->bc_peer_is_up = true; 357 rcv_l->bc_peer_is_up = true;
358 rcv_l->state = LINK_ESTABLISHED; 358 rcv_l->state = LINK_ESTABLISHED;
359 tipc_link_bc_ack_rcv(rcv_l, ack, xmitq); 359 tipc_link_bc_ack_rcv(rcv_l, ack, xmitq);
360 trace_tipc_link_reset(rcv_l, TIPC_DUMP_ALL, "bclink removed!");
360 tipc_link_reset(rcv_l); 361 tipc_link_reset(rcv_l);
361 rcv_l->state = LINK_RESET; 362 rcv_l->state = LINK_RESET;
362 if (!snd_l->ackers) { 363 if (!snd_l->ackers) {
364 trace_tipc_link_reset(snd_l, TIPC_DUMP_ALL, "zero ackers!");
363 tipc_link_reset(snd_l); 365 tipc_link_reset(snd_l);
364 snd_l->state = LINK_RESET; 366 snd_l->state = LINK_RESET;
365 __skb_queue_purge(xmitq); 367 __skb_queue_purge(xmitq);
@@ -523,6 +525,7 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
523 525
524 l = *link; 526 l = *link;
525 strcpy(l->name, tipc_bclink_name); 527 strcpy(l->name, tipc_bclink_name);
528 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "bclink created!");
526 tipc_link_reset(l); 529 tipc_link_reset(l);
527 l->state = LINK_RESET; 530 l->state = LINK_RESET;
528 l->ackers = 0; 531 l->ackers = 0;
@@ -547,6 +550,7 @@ bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer,
547int tipc_link_fsm_evt(struct tipc_link *l, int evt) 550int tipc_link_fsm_evt(struct tipc_link *l, int evt)
548{ 551{
549 int rc = 0; 552 int rc = 0;
553 int old_state = l->state;
550 554
551 switch (l->state) { 555 switch (l->state) {
552 case LINK_RESETTING: 556 case LINK_RESETTING:
@@ -693,10 +697,12 @@ int tipc_link_fsm_evt(struct tipc_link *l, int evt)
693 default: 697 default:
694 pr_err("Unknown FSM state %x in %s\n", l->state, l->name); 698 pr_err("Unknown FSM state %x in %s\n", l->state, l->name);
695 } 699 }
700 trace_tipc_link_fsm(l->name, old_state, l->state, evt);
696 return rc; 701 return rc;
697illegal_evt: 702illegal_evt:
698 pr_err("Illegal FSM event %x in state %x on link %s\n", 703 pr_err("Illegal FSM event %x in state %x on link %s\n",
699 evt, l->state, l->name); 704 evt, l->state, l->name);
705 trace_tipc_link_fsm(l->name, old_state, l->state, evt);
700 return rc; 706 return rc;
701} 707}
702 708
@@ -741,6 +747,18 @@ static void link_profile_stats(struct tipc_link *l)
741 l->stats.msg_length_profile[6]++; 747 l->stats.msg_length_profile[6]++;
742} 748}
743 749
750/**
751 * tipc_link_too_silent - check if link is "too silent"
752 * @l: tipc link to be checked
753 *
754 * Returns true if the link 'silent_intv_cnt' is about to reach the
755 * 'abort_limit' value, otherwise false
756 */
757bool tipc_link_too_silent(struct tipc_link *l)
758{
759 return (l->silent_intv_cnt + 2 > l->abort_limit);
760}
761
744/* tipc_link_timeout - perform periodic task as instructed from node timeout 762/* tipc_link_timeout - perform periodic task as instructed from node timeout
745 */ 763 */
746int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq) 764int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq)
@@ -754,6 +772,8 @@ int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq)
754 u16 bc_acked = l->bc_rcvlink->acked; 772 u16 bc_acked = l->bc_rcvlink->acked;
755 struct tipc_mon_state *mstate = &l->mon_state; 773 struct tipc_mon_state *mstate = &l->mon_state;
756 774
775 trace_tipc_link_timeout(l, TIPC_DUMP_NONE, " ");
776 trace_tipc_link_too_silent(l, TIPC_DUMP_ALL, " ");
757 switch (l->state) { 777 switch (l->state) {
758 case LINK_ESTABLISHED: 778 case LINK_ESTABLISHED:
759 case LINK_SYNCHING: 779 case LINK_SYNCHING:
@@ -816,6 +836,7 @@ static int link_schedule_user(struct tipc_link *l, struct tipc_msg *hdr)
816 TIPC_SKB_CB(skb)->chain_imp = msg_importance(hdr); 836 TIPC_SKB_CB(skb)->chain_imp = msg_importance(hdr);
817 skb_queue_tail(&l->wakeupq, skb); 837 skb_queue_tail(&l->wakeupq, skb);
818 l->stats.link_congs++; 838 l->stats.link_congs++;
839 trace_tipc_link_conges(l, TIPC_DUMP_ALL, "wakeup scheduled!");
819 return -ELINKCONG; 840 return -ELINKCONG;
820} 841}
821 842
@@ -1037,6 +1058,7 @@ static int tipc_link_retrans(struct tipc_link *l, struct tipc_link *r,
1037 if (less(to, from)) 1058 if (less(to, from))
1038 return 0; 1059 return 0;
1039 1060
1061 trace_tipc_link_retrans(r, from, to, &l->transmq);
1040 /* Detect repeated retransmit failures on same packet */ 1062 /* Detect repeated retransmit failures on same packet */
1041 if (r->prev_from != from) { 1063 if (r->prev_from != from) {
1042 r->prev_from = from; 1064 r->prev_from = from;
@@ -1044,6 +1066,9 @@ static int tipc_link_retrans(struct tipc_link *l, struct tipc_link *r,
1044 r->stale_cnt = 0; 1066 r->stale_cnt = 0;
1045 } else if (++r->stale_cnt > 99 && time_after(jiffies, r->stale_limit)) { 1067 } else if (++r->stale_cnt > 99 && time_after(jiffies, r->stale_limit)) {
1046 link_retransmit_failure(l, skb); 1068 link_retransmit_failure(l, skb);
1069 trace_tipc_list_dump(&l->transmq, true, "retrans failure!");
1070 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "retrans failure!");
1071 trace_tipc_link_dump(r, TIPC_DUMP_NONE, "retrans failure!");
1047 if (link_is_bc_sndlink(l)) 1072 if (link_is_bc_sndlink(l))
1048 return TIPC_LINK_DOWN_EVT; 1073 return TIPC_LINK_DOWN_EVT;
1049 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT); 1074 return tipc_link_fsm_evt(l, LINK_FAILURE_EVT);
@@ -1403,6 +1428,7 @@ static void tipc_link_build_proto_msg(struct tipc_link *l, int mtyp, bool probe,
1403 l->stats.sent_nacks++; 1428 l->stats.sent_nacks++;
1404 skb->priority = TC_PRIO_CONTROL; 1429 skb->priority = TC_PRIO_CONTROL;
1405 __skb_queue_tail(xmitq, skb); 1430 __skb_queue_tail(xmitq, skb);
1431 trace_tipc_proto_build(skb, false, l->name);
1406} 1432}
1407 1433
1408void tipc_link_create_dummy_tnl_msg(struct tipc_link *l, 1434void tipc_link_create_dummy_tnl_msg(struct tipc_link *l,
@@ -1566,6 +1592,7 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
1566 char *if_name; 1592 char *if_name;
1567 int rc = 0; 1593 int rc = 0;
1568 1594
1595 trace_tipc_proto_rcv(skb, false, l->name);
1569 if (tipc_link_is_blocked(l) || !xmitq) 1596 if (tipc_link_is_blocked(l) || !xmitq)
1570 goto exit; 1597 goto exit;
1571 1598
@@ -1576,8 +1603,11 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb,
1576 hdr = buf_msg(skb); 1603 hdr = buf_msg(skb);
1577 data = msg_data(hdr); 1604 data = msg_data(hdr);
1578 1605
1579 if (!tipc_link_validate_msg(l, hdr)) 1606 if (!tipc_link_validate_msg(l, hdr)) {
1607 trace_tipc_skb_dump(skb, false, "PROTO invalid (1)!");
1608 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "PROTO invalid (1)!");
1580 goto exit; 1609 goto exit;
1610 }
1581 1611
1582 switch (mtyp) { 1612 switch (mtyp) {
1583 case RESET_MSG: 1613 case RESET_MSG:
@@ -1820,6 +1850,7 @@ void tipc_link_bc_ack_rcv(struct tipc_link *l, u16 acked,
1820 if (!more(acked, l->acked)) 1850 if (!more(acked, l->acked))
1821 return; 1851 return;
1822 1852
1853 trace_tipc_link_bc_ack(l, l->acked, acked, &snd_l->transmq);
1823 /* Skip over packets peer has already acked */ 1854 /* Skip over packets peer has already acked */
1824 skb_queue_walk(&snd_l->transmq, skb) { 1855 skb_queue_walk(&snd_l->transmq, skb) {
1825 if (more(buf_seqno(skb), l->acked)) 1856 if (more(buf_seqno(skb), l->acked))
diff --git a/net/tipc/link.h b/net/tipc/link.h
index e8f692598e4d..8439e0ee53a8 100644
--- a/net/tipc/link.h
+++ b/net/tipc/link.h
@@ -148,4 +148,5 @@ int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
148 struct sk_buff_head *xmitq); 148 struct sk_buff_head *xmitq);
149int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb, 149int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,
150 struct sk_buff_head *xmitq); 150 struct sk_buff_head *xmitq);
151bool tipc_link_too_silent(struct tipc_link *l);
151#endif 152#endif
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 4fd6e2887818..1e13ea98b96c 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -784,6 +784,7 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id,
784 if (tipc_link_peer_is_down(l)) 784 if (tipc_link_peer_is_down(l))
785 tipc_node_fsm_evt(n, PEER_LOST_CONTACT_EVT); 785 tipc_node_fsm_evt(n, PEER_LOST_CONTACT_EVT);
786 tipc_node_fsm_evt(n, SELF_LOST_CONTACT_EVT); 786 tipc_node_fsm_evt(n, SELF_LOST_CONTACT_EVT);
787 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "link down!");
787 tipc_link_fsm_evt(l, LINK_RESET_EVT); 788 tipc_link_fsm_evt(l, LINK_RESET_EVT);
788 tipc_link_reset(l); 789 tipc_link_reset(l);
789 tipc_link_build_reset_msg(l, xmitq); 790 tipc_link_build_reset_msg(l, xmitq);
@@ -801,6 +802,7 @@ static void __tipc_node_link_down(struct tipc_node *n, int *bearer_id,
801 tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT); 802 tipc_node_fsm_evt(n, NODE_SYNCH_END_EVT);
802 n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1); 803 n->sync_point = tipc_link_rcv_nxt(tnl) + (U16_MAX / 2 - 1);
803 tipc_link_tnl_prepare(l, tnl, FAILOVER_MSG, xmitq); 804 tipc_link_tnl_prepare(l, tnl, FAILOVER_MSG, xmitq);
805 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "link down -> failover!");
804 tipc_link_reset(l); 806 tipc_link_reset(l);
805 tipc_link_fsm_evt(l, LINK_RESET_EVT); 807 tipc_link_fsm_evt(l, LINK_RESET_EVT);
806 tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT); 808 tipc_link_fsm_evt(l, LINK_FAILOVER_BEGIN_EVT);
@@ -1022,6 +1024,7 @@ void tipc_node_check_dest(struct net *net, u32 addr,
1022 *respond = false; 1024 *respond = false;
1023 goto exit; 1025 goto exit;
1024 } 1026 }
1027 trace_tipc_link_reset(l, TIPC_DUMP_ALL, "link created!");
1025 tipc_link_reset(l); 1028 tipc_link_reset(l);
1026 tipc_link_fsm_evt(l, LINK_RESET_EVT); 1029 tipc_link_fsm_evt(l, LINK_RESET_EVT);
1027 if (n->state == NODE_FAILINGOVER) 1030 if (n->state == NODE_FAILINGOVER)
@@ -1599,8 +1602,11 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb,
1599 } 1602 }
1600 } 1603 }
1601 1604
1602 if (!tipc_link_validate_msg(l, hdr)) 1605 if (!tipc_link_validate_msg(l, hdr)) {
1606 trace_tipc_skb_dump(skb, false, "PROTO invalid (2)!");
1607 trace_tipc_link_dump(l, TIPC_DUMP_NONE, "PROTO invalid (2)!");
1603 return false; 1608 return false;
1609 }
1604 1610
1605 /* Check and update node accesibility if applicable */ 1611 /* Check and update node accesibility if applicable */
1606 if (state == SELF_UP_PEER_COMING) { 1612 if (state == SELF_UP_PEER_COMING) {
diff --git a/net/tipc/trace.h b/net/tipc/trace.h
index 4c74927df685..535c8958651f 100644
--- a/net/tipc/trace.h
+++ b/net/tipc/trace.h
@@ -74,6 +74,45 @@ enum {
74}; 74};
75#endif 75#endif
76 76
77/* Link & Node FSM states: */
78#define state_sym(val) \
79 __print_symbolic(val, \
80 {(0xe), "ESTABLISHED" },\
81 {(0xe << 4), "ESTABLISHING" },\
82 {(0x1 << 8), "RESET" },\
83 {(0x2 << 12), "RESETTING" },\
84 {(0xd << 16), "PEER_RESET" },\
85 {(0xf << 20), "FAILINGOVER" },\
86 {(0xc << 24), "SYNCHING" },\
87 {(0xdd), "SELF_DOWN_PEER_DOWN" },\
88 {(0xaa), "SELF_UP_PEER_UP" },\
89 {(0xd1), "SELF_DOWN_PEER_LEAVING" },\
90 {(0xac), "SELF_UP_PEER_COMING" },\
91 {(0xca), "SELF_COMING_PEER_UP" },\
92 {(0x1d), "SELF_LEAVING_PEER_DOWN" },\
93 {(0xf0), "FAILINGOVER" },\
94 {(0xcc), "SYNCHING" })
95
96/* Link & Node FSM events: */
97#define evt_sym(val) \
98 __print_symbolic(val, \
99 {(0xec1ab1e), "ESTABLISH_EVT" },\
100 {(0x9eed0e), "PEER_RESET_EVT" },\
101 {(0xfa110e), "FAILURE_EVT" },\
102 {(0x10ca1d0e), "RESET_EVT" },\
103 {(0xfa110bee), "FAILOVER_BEGIN_EVT" },\
104 {(0xfa110ede), "FAILOVER_END_EVT" },\
105 {(0xc1ccbee), "SYNCH_BEGIN_EVT" },\
106 {(0xc1ccede), "SYNCH_END_EVT" },\
107 {(0xece), "SELF_ESTABL_CONTACT_EVT" },\
108 {(0x1ce), "SELF_LOST_CONTACT_EVT" },\
109 {(0x9ece), "PEER_ESTABL_CONTACT_EVT" },\
110 {(0x91ce), "PEER_LOST_CONTACT_EVT" },\
111 {(0xfbe), "FAILOVER_BEGIN_EVT" },\
112 {(0xfee), "FAILOVER_END_EVT" },\
113 {(0xcbe), "SYNCH_BEGIN_EVT" },\
114 {(0xcee), "SYNCH_END_EVT" })
115
77int tipc_skb_dump(struct sk_buff *skb, bool more, char *buf); 116int tipc_skb_dump(struct sk_buff *skb, bool more, char *buf);
78int tipc_list_dump(struct sk_buff_head *list, bool more, char *buf); 117int tipc_list_dump(struct sk_buff_head *list, bool more, char *buf);
79int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf); 118int tipc_sk_dump(struct sock *sk, u16 dqueues, char *buf);
@@ -104,6 +143,8 @@ DEFINE_EVENT(tipc_skb_class, name, \
104 TP_PROTO(struct sk_buff *skb, bool more, const char *header), \ 143 TP_PROTO(struct sk_buff *skb, bool more, const char *header), \
105 TP_ARGS(skb, more, header)) 144 TP_ARGS(skb, more, header))
106DEFINE_SKB_EVENT(tipc_skb_dump); 145DEFINE_SKB_EVENT(tipc_skb_dump);
146DEFINE_SKB_EVENT(tipc_proto_build);
147DEFINE_SKB_EVENT(tipc_proto_rcv);
107 148
108DECLARE_EVENT_CLASS(tipc_list_class, 149DECLARE_EVENT_CLASS(tipc_list_class,
109 150
@@ -192,6 +233,58 @@ DEFINE_EVENT(tipc_link_class, name, \
192 TP_PROTO(struct tipc_link *l, u16 dqueues, const char *header), \ 233 TP_PROTO(struct tipc_link *l, u16 dqueues, const char *header), \
193 TP_ARGS(l, dqueues, header)) 234 TP_ARGS(l, dqueues, header))
194DEFINE_LINK_EVENT(tipc_link_dump); 235DEFINE_LINK_EVENT(tipc_link_dump);
236DEFINE_LINK_EVENT(tipc_link_conges);
237DEFINE_LINK_EVENT(tipc_link_timeout);
238DEFINE_LINK_EVENT(tipc_link_reset);
239
240#define DEFINE_LINK_EVENT_COND(name, cond) \
241DEFINE_EVENT_CONDITION(tipc_link_class, name, \
242 TP_PROTO(struct tipc_link *l, u16 dqueues, const char *header), \
243 TP_ARGS(l, dqueues, header), \
244 TP_CONDITION(cond))
245DEFINE_LINK_EVENT_COND(tipc_link_too_silent, tipc_link_too_silent(l));
246
247DECLARE_EVENT_CLASS(tipc_link_transmq_class,
248
249 TP_PROTO(struct tipc_link *r, u16 f, u16 t, struct sk_buff_head *tq),
250
251 TP_ARGS(r, f, t, tq),
252
253 TP_STRUCT__entry(
254 __array(char, name, TIPC_MAX_LINK_NAME)
255 __field(u16, from)
256 __field(u16, to)
257 __field(u32, len)
258 __field(u16, fseqno)
259 __field(u16, lseqno)
260 ),
261
262 TP_fast_assign(
263 tipc_link_name_ext(r, __entry->name);
264 __entry->from = f;
265 __entry->to = t;
266 __entry->len = skb_queue_len(tq);
267 __entry->fseqno = msg_seqno(buf_msg(skb_peek(tq)));
268 __entry->lseqno = msg_seqno(buf_msg(skb_peek_tail(tq)));
269 ),
270
271 TP_printk("<%s> retrans req: [%u-%u] transmq: %u [%u-%u]\n",
272 __entry->name, __entry->from, __entry->to,
273 __entry->len, __entry->fseqno, __entry->lseqno)
274);
275
276DEFINE_EVENT(tipc_link_transmq_class, tipc_link_retrans,
277 TP_PROTO(struct tipc_link *r, u16 f, u16 t, struct sk_buff_head *tq),
278 TP_ARGS(r, f, t, tq)
279);
280
281DEFINE_EVENT_PRINT(tipc_link_transmq_class, tipc_link_bc_ack,
282 TP_PROTO(struct tipc_link *r, u16 f, u16 t, struct sk_buff_head *tq),
283 TP_ARGS(r, f, t, tq),
284 TP_printk("<%s> acked: [%u-%u] transmq: %u [%u-%u]\n",
285 __entry->name, __entry->from, __entry->to,
286 __entry->len, __entry->fseqno, __entry->lseqno)
287);
195 288
196DECLARE_EVENT_CLASS(tipc_node_class, 289DECLARE_EVENT_CLASS(tipc_node_class,
197 290
@@ -221,6 +314,37 @@ DEFINE_EVENT(tipc_node_class, name, \
221 TP_ARGS(n, more, header)) 314 TP_ARGS(n, more, header))
222DEFINE_NODE_EVENT(tipc_node_dump); 315DEFINE_NODE_EVENT(tipc_node_dump);
223 316
317DECLARE_EVENT_CLASS(tipc_fsm_class,
318
319 TP_PROTO(const char *name, u32 os, u32 ns, int evt),
320
321 TP_ARGS(name, os, ns, evt),
322
323 TP_STRUCT__entry(
324 __string(name, name)
325 __field(u32, os)
326 __field(u32, ns)
327 __field(u32, evt)
328 ),
329
330 TP_fast_assign(
331 __assign_str(name, name);
332 __entry->os = os;
333 __entry->ns = ns;
334 __entry->evt = evt;
335 ),
336
337 TP_printk("<%s> %s--(%s)->%s\n", __get_str(name),
338 state_sym(__entry->os), evt_sym(__entry->evt),
339 state_sym(__entry->ns))
340);
341
342#define DEFINE_FSM_EVENT(fsm_name) \
343DEFINE_EVENT(tipc_fsm_class, fsm_name, \
344 TP_PROTO(const char *name, u32 os, u32 ns, int evt), \
345 TP_ARGS(name, os, ns, evt))
346DEFINE_FSM_EVENT(tipc_link_fsm);
347
224#endif /* _TIPC_TRACE_H */ 348#endif /* _TIPC_TRACE_H */
225 349
226/* This part must be outside protection */ 350/* This part must be outside protection */