linux/include/trace/events/neigh.h
<<
>>
Prefs
   1#undef TRACE_SYSTEM
   2#define TRACE_SYSTEM neigh
   3
   4#if !defined(_TRACE_NEIGH_H) || defined(TRACE_HEADER_MULTI_READ)
   5#define _TRACE_NEIGH_H
   6
   7#include <linux/skbuff.h>
   8#include <linux/netdevice.h>
   9#include <linux/tracepoint.h>
  10#include <net/neighbour.h>
  11
  12#define neigh_state_str(state)                          \
  13        __print_symbolic(state,                         \
  14                { NUD_INCOMPLETE, "incomplete" },       \
  15                { NUD_REACHABLE, "reachable" },         \
  16                { NUD_STALE, "stale" },                 \
  17                { NUD_DELAY, "delay" },                 \
  18                { NUD_PROBE, "probe" },                 \
  19                { NUD_FAILED, "failed" },               \
  20                { NUD_NOARP, "noarp" },                 \
  21                { NUD_PERMANENT, "permanent"})
  22
  23TRACE_EVENT(neigh_update,
  24
  25        TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new,
  26                 u32 flags, u32 nlmsg_pid),
  27
  28        TP_ARGS(n, lladdr, new, flags, nlmsg_pid),
  29
  30        TP_STRUCT__entry(
  31                __field(u32, family)
  32                __string(dev, (n->dev ? n->dev->name : "NULL"))
  33                __array(u8, lladdr, MAX_ADDR_LEN)
  34                __field(u8, lladdr_len)
  35                __field(u8, flags)
  36                __field(u8, nud_state)
  37                __field(u8, type)
  38                __field(u8, dead)
  39                __field(int, refcnt)
  40                __array(__u8, primary_key4, 4)
  41                __array(__u8, primary_key6, 16)
  42                __field(unsigned long, confirmed)
  43                __field(unsigned long, updated)
  44                __field(unsigned long, used)
  45                __array(u8, new_lladdr, MAX_ADDR_LEN)
  46                __field(u8, new_state)
  47                __field(u32, update_flags)
  48                __field(u32, pid)
  49        ),
  50
  51        TP_fast_assign(
  52                int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN);
  53                struct in6_addr *pin6;
  54                __be32 *p32;
  55
  56                __entry->family = n->tbl->family;
  57                __assign_str(dev, (n->dev ? n->dev->name : "NULL"));
  58                __entry->lladdr_len = lladdr_len;
  59                memcpy(__entry->lladdr, n->ha, lladdr_len);
  60                __entry->flags = n->flags;
  61                __entry->nud_state = n->nud_state;
  62                __entry->type = n->type;
  63                __entry->dead = n->dead;
  64                __entry->refcnt = refcount_read(&n->refcnt);
  65                pin6 = (struct in6_addr *)__entry->primary_key6;
  66                p32 = (__be32 *)__entry->primary_key4;
  67
  68                if (n->tbl->family == AF_INET)
  69                        *p32 = *(__be32 *)n->primary_key;
  70                else
  71                        *p32 = 0;
  72
  73#if IS_ENABLED(CONFIG_IPV6)
  74                if (n->tbl->family == AF_INET6) {
  75                        pin6 = (struct in6_addr *)__entry->primary_key6;
  76                        *pin6 = *(struct in6_addr *)n->primary_key;
  77                } else
  78#endif
  79                {
  80                        ipv6_addr_set_v4mapped(*p32, pin6);
  81                }
  82                __entry->confirmed = n->confirmed;
  83                __entry->updated = n->updated;
  84                __entry->used = n->used;
  85                if (lladdr)
  86                        memcpy(__entry->new_lladdr, lladdr, lladdr_len);
  87                __entry->new_state = new;
  88                __entry->update_flags = flags;
  89                __entry->pid = nlmsg_pid;
  90        ),
  91
  92        TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x "
  93                  "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c "
  94                  "confirmed %lu updated %lu used %lu new_lladdr %s "
  95                  "new_state %s update_flags %02x pid %d",
  96                  __entry->family, __get_str(dev),
  97                  __print_hex_str(__entry->lladdr, __entry->lladdr_len),
  98                  __entry->flags, neigh_state_str(__entry->nud_state),
  99                  __entry->type, __entry->dead, __entry->refcnt,
 100                  __entry->primary_key4, __entry->primary_key6,
 101                  __entry->confirmed, __entry->updated, __entry->used,
 102                  __print_hex_str(__entry->new_lladdr, __entry->lladdr_len),
 103                  neigh_state_str(__entry->new_state),
 104                  __entry->update_flags, __entry->pid)
 105);
 106
 107DECLARE_EVENT_CLASS(neigh__update,
 108        TP_PROTO(struct neighbour *n, int err),
 109        TP_ARGS(n, err),
 110        TP_STRUCT__entry(
 111                __field(u32, family)
 112                __string(dev, (n->dev ? n->dev->name : "NULL"))
 113                __array(u8, lladdr, MAX_ADDR_LEN)
 114                __field(u8, lladdr_len)
 115                __field(u8, flags)
 116                __field(u8, nud_state)
 117                __field(u8, type)
 118                __field(u8, dead)
 119                __field(int, refcnt)
 120                __array(__u8, primary_key4, 4)
 121                __array(__u8, primary_key6, 16)
 122                __field(unsigned long, confirmed)
 123                __field(unsigned long, updated)
 124                __field(unsigned long, used)
 125                __field(u32, err)
 126        ),
 127
 128        TP_fast_assign(
 129                int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN);
 130                struct in6_addr *pin6;
 131                __be32 *p32;
 132
 133                __entry->family = n->tbl->family;
 134                __assign_str(dev, (n->dev ? n->dev->name : "NULL"));
 135                __entry->lladdr_len = lladdr_len;
 136                memcpy(__entry->lladdr, n->ha, lladdr_len);
 137                __entry->flags = n->flags;
 138                __entry->nud_state = n->nud_state;
 139                __entry->type = n->type;
 140                __entry->dead = n->dead;
 141                __entry->refcnt = refcount_read(&n->refcnt);
 142                pin6 = (struct in6_addr *)__entry->primary_key6;
 143                p32 = (__be32 *)__entry->primary_key4;
 144
 145                if (n->tbl->family == AF_INET)
 146                        *p32 = *(__be32 *)n->primary_key;
 147                else
 148                        *p32 = 0;
 149
 150#if IS_ENABLED(CONFIG_IPV6)
 151                if (n->tbl->family == AF_INET6) {
 152                        pin6 = (struct in6_addr *)__entry->primary_key6;
 153                        *pin6 = *(struct in6_addr *)n->primary_key;
 154                } else
 155#endif
 156                {
 157                        ipv6_addr_set_v4mapped(*p32, pin6);
 158                }
 159
 160                __entry->confirmed = n->confirmed;
 161                __entry->updated = n->updated;
 162                __entry->used = n->used;
 163                __entry->err = err;
 164        ),
 165
 166        TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x "
 167                  "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c "
 168                  "confirmed %lu updated %lu used %lu err %d",
 169                  __entry->family, __get_str(dev),
 170                  __print_hex_str(__entry->lladdr, __entry->lladdr_len),
 171                  __entry->flags, neigh_state_str(__entry->nud_state),
 172                  __entry->type, __entry->dead, __entry->refcnt,
 173                  __entry->primary_key4, __entry->primary_key6,
 174                  __entry->confirmed, __entry->updated, __entry->used,
 175                  __entry->err)
 176);
 177
 178DEFINE_EVENT(neigh__update, neigh_update_done,
 179        TP_PROTO(struct neighbour *neigh, int err),
 180        TP_ARGS(neigh, err)
 181);
 182
 183DEFINE_EVENT(neigh__update, neigh_timer_handler,
 184        TP_PROTO(struct neighbour *neigh, int err),
 185        TP_ARGS(neigh, err)
 186);
 187
 188DEFINE_EVENT(neigh__update, neigh_event_send_done,
 189        TP_PROTO(struct neighbour *neigh, int err),
 190        TP_ARGS(neigh, err)
 191);
 192
 193DEFINE_EVENT(neigh__update, neigh_event_send_dead,
 194        TP_PROTO(struct neighbour *neigh, int err),
 195        TP_ARGS(neigh, err)
 196);
 197
 198DEFINE_EVENT(neigh__update, neigh_cleanup_and_release,
 199        TP_PROTO(struct neighbour *neigh, int rc),
 200        TP_ARGS(neigh, rc)
 201);
 202
 203#endif /* _TRACE_NEIGH_H */
 204
 205/* This part must be outside protection */
 206#include <trace/define_trace.h>
 207