Commit cf5f55f7 authored by Tuong Lien's avatar Tuong Lien Committed by David S. Miller

tipc: add trace_events for tipc bearer

The commit adds the new trace_event for TIPC bearer, L2 device event:

trace_tipc_l2_device_event()

Also, it puts the trace at the tipc_l2_device_event() function, then
the device/bearer events and related info can be traced out during
runtime when needed.
Acked-by: default avatarYing Xue <ying.xue@windriver.com>
Tested-by: default avatarYing Xue <ying.xue@windriver.com>
Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent eb18a510
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "bcast.h" #include "bcast.h"
#include "netlink.h" #include "netlink.h"
#include "udp_media.h" #include "udp_media.h"
#include "trace.h"
#define MAX_ADDR_STR 60 #define MAX_ADDR_STR 60
...@@ -608,6 +609,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt, ...@@ -608,6 +609,7 @@ static int tipc_l2_device_event(struct notifier_block *nb, unsigned long evt,
if (!b) if (!b)
return NOTIFY_DONE; return NOTIFY_DONE;
trace_tipc_l2_device_event(dev, b, evt);
switch (evt) { switch (evt) {
case NETDEV_CHANGE: case NETDEV_CHANGE:
if (netif_carrier_ok(dev) && netif_oper_up(dev)) { if (netif_carrier_ok(dev) && netif_oper_up(dev)) {
......
...@@ -113,6 +113,17 @@ enum { ...@@ -113,6 +113,17 @@ enum {
{(0xcbe), "SYNCH_BEGIN_EVT" },\ {(0xcbe), "SYNCH_BEGIN_EVT" },\
{(0xcee), "SYNCH_END_EVT" }) {(0xcee), "SYNCH_END_EVT" })
/* Bearer, net device events: */
#define dev_evt_sym(val) \
__print_symbolic(val, \
{(NETDEV_CHANGE), "NETDEV_CHANGE" },\
{(NETDEV_GOING_DOWN), "NETDEV_GOING_DOWN" },\
{(NETDEV_UP), "NETDEV_UP" },\
{(NETDEV_CHANGEMTU), "NETDEV_CHANGEMTU" },\
{(NETDEV_CHANGEADDR), "NETDEV_CHANGEADDR" },\
{(NETDEV_UNREGISTER), "NETDEV_UNREGISTER" },\
{(NETDEV_CHANGENAME), "NETDEV_CHANGENAME" })
extern unsigned long sysctl_tipc_sk_filter[5] __read_mostly; extern unsigned long sysctl_tipc_sk_filter[5] __read_mostly;
int tipc_skb_dump(struct sk_buff *skb, bool more, char *buf); int tipc_skb_dump(struct sk_buff *skb, bool more, char *buf);
...@@ -378,6 +389,38 @@ DEFINE_EVENT(tipc_fsm_class, fsm_name, \ ...@@ -378,6 +389,38 @@ DEFINE_EVENT(tipc_fsm_class, fsm_name, \
DEFINE_FSM_EVENT(tipc_link_fsm); DEFINE_FSM_EVENT(tipc_link_fsm);
DEFINE_FSM_EVENT(tipc_node_fsm); DEFINE_FSM_EVENT(tipc_node_fsm);
TRACE_EVENT(tipc_l2_device_event,
TP_PROTO(struct net_device *dev, struct tipc_bearer *b,
unsigned long evt),
TP_ARGS(dev, b, evt),
TP_STRUCT__entry(
__string(dev_name, dev->name)
__string(b_name, b->name)
__field(unsigned long, evt)
__field(u8, b_up)
__field(u8, carrier)
__field(u8, oper)
),
TP_fast_assign(
__assign_str(dev_name, dev->name);
__assign_str(b_name, b->name);
__entry->evt = evt;
__entry->b_up = test_bit(0, &b->up);
__entry->carrier = netif_carrier_ok(dev);
__entry->oper = netif_oper_up(dev);
),
TP_printk("%s on: <%s>/<%s> oper: %s carrier: %s bearer: %s\n",
dev_evt_sym(__entry->evt), __get_str(dev_name),
__get_str(b_name), (__entry->oper) ? "up" : "down",
(__entry->carrier) ? "ok" : "notok",
(__entry->b_up) ? "up" : "down")
);
#endif /* _TIPC_TRACE_H */ #endif /* _TIPC_TRACE_H */
/* This part must be outside protection */ /* This part must be outside protection */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment