diff options
author | Tuong Lien <tuong.t.lien@dektech.com.au> | 2018-12-18 21:17:59 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-12-19 14:49:24 -0500 |
commit | eb18a510b5cd4daeb9736ad8db57a9fc49db185b (patch) | |
tree | c534592346da560bb9005638d3f485cf262ad4e1 /net/tipc | |
parent | 01e661ebfbad40e6280fb8ec25f2861d39ba4387 (diff) |
tipc: add trace_events for tipc node
The commit adds the new trace_events for TIPC node object:
trace_tipc_node_create()
trace_tipc_node_delete()
trace_tipc_node_lost_contact()
trace_tipc_node_timeout()
trace_tipc_node_link_up()
trace_tipc_node_link_down()
trace_tipc_node_reset_links()
trace_tipc_node_fsm_evt()
trace_tipc_node_check_state()
Also, enables the traces for the following cases:
- When a node is created/deleted;
- When a node contact is lost;
- When a node timer is timed out;
- When a node link is up/down;
- When all node links are reset;
- When node state is changed;
- When a skb comes and node state needs to be checked/updated.
Acked-by: Ying Xue <ying.xue@windriver.com>
Tested-by: Ying Xue <ying.xue@windriver.com>
Acked-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Tuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/node.c | 15 | ||||
-rw-r--r-- | net/tipc/trace.h | 9 |
2 files changed, 24 insertions, 0 deletions
diff --git a/net/tipc/node.c b/net/tipc/node.c index 1e13ea98b96c..db2a6c3e0be9 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c | |||
@@ -433,6 +433,7 @@ static struct tipc_node *tipc_node_create(struct net *net, u32 addr, | |||
433 | break; | 433 | break; |
434 | } | 434 | } |
435 | list_add_tail_rcu(&n->list, &temp_node->list); | 435 | list_add_tail_rcu(&n->list, &temp_node->list); |
436 | trace_tipc_node_create(n, true, " "); | ||
436 | exit: | 437 | exit: |
437 | spin_unlock_bh(&tn->node_list_lock); | 438 | spin_unlock_bh(&tn->node_list_lock); |
438 | return n; | 439 | return n; |
@@ -460,6 +461,7 @@ static void tipc_node_delete_from_list(struct tipc_node *node) | |||
460 | 461 | ||
461 | static void tipc_node_delete(struct tipc_node *node) | 462 | static void tipc_node_delete(struct tipc_node *node) |
462 | { | 463 | { |
464 | trace_tipc_node_delete(node, true, " "); | ||
463 | tipc_node_delete_from_list(node); | 465 | tipc_node_delete_from_list(node); |
464 | 466 | ||
465 | del_timer_sync(&node->timer); | 467 | del_timer_sync(&node->timer); |
@@ -617,6 +619,7 @@ static void tipc_node_timeout(struct timer_list *t) | |||
617 | int bearer_id; | 619 | int bearer_id; |
618 | int rc = 0; | 620 | int rc = 0; |
619 | 621 | ||
622 | trace_tipc_node_timeout(n, false, " "); | ||
620 | if (!node_is_up(n) && tipc_node_cleanup(n)) { | 623 | if (!node_is_up(n) && tipc_node_cleanup(n)) { |
621 | /*Removing the reference of Timer*/ | 624 | /*Removing the reference of Timer*/ |
622 | tipc_node_put(n); | 625 | tipc_node_put(n); |
@@ -682,6 +685,7 @@ static void __tipc_node_link_up(struct tipc_node *n, int bearer_id, | |||
682 | 685 | ||
683 | pr_debug("Established link <%s> on network plane %c\n", | 686 | pr_debug("Established link <%s> on network plane %c\n", |
684 | tipc_link_name(nl), tipc_link_plane(nl)); | 687 | tipc_link_name(nl), tipc_link_plane(nl)); |
688 | trace_tipc_node_link_up(n, true, " "); | ||
685 | 689 | ||
686 | /* Ensure that a STATE message goes first */ | 690 | /* Ensure that a STATE message goes first */ |
687 | tipc_link_build_state_msg(nl, xmitq); | 691 | tipc_link_build_state_msg(nl, xmitq); |
@@ -835,6 +839,7 @@ static void tipc_node_link_down(struct tipc_node *n, int bearer_id, bool delete) | |||
835 | /* Defuse pending tipc_node_link_up() */ | 839 | /* Defuse pending tipc_node_link_up() */ |
836 | tipc_link_fsm_evt(l, LINK_RESET_EVT); | 840 | tipc_link_fsm_evt(l, LINK_RESET_EVT); |
837 | } | 841 | } |
842 | trace_tipc_node_link_down(n, true, "node link down or deleted!"); | ||
838 | tipc_node_write_unlock(n); | 843 | tipc_node_write_unlock(n); |
839 | if (delete) | 844 | if (delete) |
840 | tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); | 845 | tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); |
@@ -1064,6 +1069,7 @@ static void tipc_node_reset_links(struct tipc_node *n) | |||
1064 | 1069 | ||
1065 | pr_warn("Resetting all links to %x\n", n->addr); | 1070 | pr_warn("Resetting all links to %x\n", n->addr); |
1066 | 1071 | ||
1072 | trace_tipc_node_reset_links(n, true, " "); | ||
1067 | for (i = 0; i < MAX_BEARERS; i++) { | 1073 | for (i = 0; i < MAX_BEARERS; i++) { |
1068 | tipc_node_link_down(n, i, false); | 1074 | tipc_node_link_down(n, i, false); |
1069 | } | 1075 | } |
@@ -1239,11 +1245,13 @@ static void tipc_node_fsm_evt(struct tipc_node *n, int evt) | |||
1239 | pr_err("Unknown node fsm state %x\n", state); | 1245 | pr_err("Unknown node fsm state %x\n", state); |
1240 | break; | 1246 | break; |
1241 | } | 1247 | } |
1248 | trace_tipc_node_fsm(n->peer_id, n->state, state, evt); | ||
1242 | n->state = state; | 1249 | n->state = state; |
1243 | return; | 1250 | return; |
1244 | 1251 | ||
1245 | illegal_evt: | 1252 | illegal_evt: |
1246 | pr_err("Illegal node fsm evt %x in state %x\n", evt, state); | 1253 | pr_err("Illegal node fsm evt %x in state %x\n", evt, state); |
1254 | trace_tipc_node_fsm(n->peer_id, n->state, state, evt); | ||
1247 | } | 1255 | } |
1248 | 1256 | ||
1249 | static void node_lost_contact(struct tipc_node *n, | 1257 | static void node_lost_contact(struct tipc_node *n, |
@@ -1257,6 +1265,7 @@ static void node_lost_contact(struct tipc_node *n, | |||
1257 | 1265 | ||
1258 | pr_debug("Lost contact with %x\n", n->addr); | 1266 | pr_debug("Lost contact with %x\n", n->addr); |
1259 | n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); | 1267 | n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); |
1268 | trace_tipc_node_lost_contact(n, true, " "); | ||
1260 | 1269 | ||
1261 | /* Clean up broadcast state */ | 1270 | /* Clean up broadcast state */ |
1262 | tipc_bcast_remove_peer(n->net, n->bc_entry.link); | 1271 | tipc_bcast_remove_peer(n->net, n->bc_entry.link); |
@@ -1585,6 +1594,10 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb, | |||
1585 | struct tipc_media_addr *maddr; | 1594 | struct tipc_media_addr *maddr; |
1586 | int pb_id; | 1595 | int pb_id; |
1587 | 1596 | ||
1597 | if (trace_tipc_node_check_state_enabled()) { | ||
1598 | trace_tipc_skb_dump(skb, false, "skb for node state check"); | ||
1599 | trace_tipc_node_check_state(n, true, " "); | ||
1600 | } | ||
1588 | l = n->links[bearer_id].link; | 1601 | l = n->links[bearer_id].link; |
1589 | if (!l) | 1602 | if (!l) |
1590 | return false; | 1603 | return false; |
@@ -1636,6 +1649,8 @@ static bool tipc_node_check_state(struct tipc_node *n, struct sk_buff *skb, | |||
1636 | syncpt = oseqno + exp_pkts - 1; | 1649 | syncpt = oseqno + exp_pkts - 1; |
1637 | if (pl && tipc_link_is_up(pl)) { | 1650 | if (pl && tipc_link_is_up(pl)) { |
1638 | __tipc_node_link_down(n, &pb_id, xmitq, &maddr); | 1651 | __tipc_node_link_down(n, &pb_id, xmitq, &maddr); |
1652 | trace_tipc_node_link_down(n, true, | ||
1653 | "node link down <- failover!"); | ||
1639 | tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl), | 1654 | tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl), |
1640 | tipc_link_inputq(l)); | 1655 | tipc_link_inputq(l)); |
1641 | } | 1656 | } |
diff --git a/net/tipc/trace.h b/net/tipc/trace.h index ebbfcd14627e..4d05141866aa 100644 --- a/net/tipc/trace.h +++ b/net/tipc/trace.h | |||
@@ -337,6 +337,14 @@ DEFINE_EVENT(tipc_node_class, name, \ | |||
337 | TP_PROTO(struct tipc_node *n, bool more, const char *header), \ | 337 | TP_PROTO(struct tipc_node *n, bool more, const char *header), \ |
338 | TP_ARGS(n, more, header)) | 338 | TP_ARGS(n, more, header)) |
339 | DEFINE_NODE_EVENT(tipc_node_dump); | 339 | DEFINE_NODE_EVENT(tipc_node_dump); |
340 | DEFINE_NODE_EVENT(tipc_node_create); | ||
341 | DEFINE_NODE_EVENT(tipc_node_delete); | ||
342 | DEFINE_NODE_EVENT(tipc_node_lost_contact); | ||
343 | DEFINE_NODE_EVENT(tipc_node_timeout); | ||
344 | DEFINE_NODE_EVENT(tipc_node_link_up); | ||
345 | DEFINE_NODE_EVENT(tipc_node_link_down); | ||
346 | DEFINE_NODE_EVENT(tipc_node_reset_links); | ||
347 | DEFINE_NODE_EVENT(tipc_node_check_state); | ||
340 | 348 | ||
341 | DECLARE_EVENT_CLASS(tipc_fsm_class, | 349 | DECLARE_EVENT_CLASS(tipc_fsm_class, |
342 | 350 | ||
@@ -368,6 +376,7 @@ DEFINE_EVENT(tipc_fsm_class, fsm_name, \ | |||
368 | TP_PROTO(const char *name, u32 os, u32 ns, int evt), \ | 376 | TP_PROTO(const char *name, u32 os, u32 ns, int evt), \ |
369 | TP_ARGS(name, os, ns, evt)) | 377 | TP_ARGS(name, os, ns, evt)) |
370 | DEFINE_FSM_EVENT(tipc_link_fsm); | 378 | DEFINE_FSM_EVENT(tipc_link_fsm); |
379 | DEFINE_FSM_EVENT(tipc_node_fsm); | ||
371 | 380 | ||
372 | #endif /* _TIPC_TRACE_H */ | 381 | #endif /* _TIPC_TRACE_H */ |
373 | 382 | ||