Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tuong Lien and committed by
David S. Miller
eb18a510 01e661eb

+24
+15
net/tipc/node.c
··· 433 433 break; 434 434 } 435 435 list_add_tail_rcu(&n->list, &temp_node->list); 436 + trace_tipc_node_create(n, true, " "); 436 437 exit: 437 438 spin_unlock_bh(&tn->node_list_lock); 438 439 return n; ··· 461 460 462 461 static void tipc_node_delete(struct tipc_node *node) 463 462 { 463 + trace_tipc_node_delete(node, true, " "); 464 464 tipc_node_delete_from_list(node); 465 465 466 466 del_timer_sync(&node->timer); ··· 619 617 int bearer_id; 620 618 int rc = 0; 621 619 620 + trace_tipc_node_timeout(n, false, " "); 622 621 if (!node_is_up(n) && tipc_node_cleanup(n)) { 623 622 /*Removing the reference of Timer*/ 624 623 tipc_node_put(n); ··· 685 682 686 683 pr_debug("Established link <%s> on network plane %c\n", 687 684 tipc_link_name(nl), tipc_link_plane(nl)); 685 + trace_tipc_node_link_up(n, true, " "); 688 686 689 687 /* Ensure that a STATE message goes first */ 690 688 tipc_link_build_state_msg(nl, xmitq); ··· 839 835 /* Defuse pending tipc_node_link_up() */ 840 836 tipc_link_fsm_evt(l, LINK_RESET_EVT); 841 837 } 838 + trace_tipc_node_link_down(n, true, "node link down or deleted!"); 842 839 tipc_node_write_unlock(n); 843 840 if (delete) 844 841 tipc_mon_remove_peer(n->net, n->addr, old_bearer_id); ··· 1069 1064 1070 1065 pr_warn("Resetting all links to %x\n", n->addr); 1071 1066 1067 + trace_tipc_node_reset_links(n, true, " "); 1072 1068 for (i = 0; i < MAX_BEARERS; i++) { 1073 1069 tipc_node_link_down(n, i, false); 1074 1070 } ··· 1245 1239 pr_err("Unknown node fsm state %x\n", state); 1246 1240 break; 1247 1241 } 1242 + trace_tipc_node_fsm(n->peer_id, n->state, state, evt); 1248 1243 n->state = state; 1249 1244 return; 1250 1245 1251 1246 illegal_evt: 1252 1247 pr_err("Illegal node fsm evt %x in state %x\n", evt, state); 1248 + trace_tipc_node_fsm(n->peer_id, n->state, state, evt); 1253 1249 } 1254 1250 1255 1251 static void node_lost_contact(struct tipc_node *n, ··· 1265 1257 1266 1258 pr_debug("Lost contact with %x\n", n->addr); 1267 1259 n->delete_at = jiffies + msecs_to_jiffies(NODE_CLEANUP_AFTER); 1260 + trace_tipc_node_lost_contact(n, true, " "); 1268 1261 1269 1262 /* Clean up broadcast state */ 1270 1263 tipc_bcast_remove_peer(n->net, n->bc_entry.link); ··· 1594 1585 struct tipc_media_addr *maddr; 1595 1586 int pb_id; 1596 1587 1588 + if (trace_tipc_node_check_state_enabled()) { 1589 + trace_tipc_skb_dump(skb, false, "skb for node state check"); 1590 + trace_tipc_node_check_state(n, true, " "); 1591 + } 1597 1592 l = n->links[bearer_id].link; 1598 1593 if (!l) 1599 1594 return false; ··· 1649 1636 syncpt = oseqno + exp_pkts - 1; 1650 1637 if (pl && tipc_link_is_up(pl)) { 1651 1638 __tipc_node_link_down(n, &pb_id, xmitq, &maddr); 1639 + trace_tipc_node_link_down(n, true, 1640 + "node link down <- failover!"); 1652 1641 tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl), 1653 1642 tipc_link_inputq(l)); 1654 1643 }
+9
net/tipc/trace.h
··· 337 337 TP_PROTO(struct tipc_node *n, bool more, const char *header), \ 338 338 TP_ARGS(n, more, header)) 339 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 349 DECLARE_EVENT_CLASS(tipc_fsm_class, 342 350 ··· 376 368 TP_PROTO(const char *name, u32 os, u32 ns, int evt), \ 377 369 TP_ARGS(name, os, ns, evt)) 378 370 DEFINE_FSM_EVENT(tipc_link_fsm); 371 + DEFINE_FSM_EVENT(tipc_node_fsm); 379 372 380 373 #endif /* _TIPC_TRACE_H */ 381 374