2 #define TRACE_SYSTEM neigh
4 #if !defined(_TRACE_NEIGH_H) || defined(TRACE_HEADER_MULTI_READ)
7 #include <linux/skbuff.h>
8 #include <linux/netdevice.h>
9 #include <linux/tracepoint.h>
10 #include <net/neighbour.h>
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"})
23 TRACE_EVENT(neigh_create,
25 TP_PROTO(struct neigh_table *tbl, struct net_device *dev,
26 const void *pkey, const struct neighbour *n,
29 TP_ARGS(tbl, dev, pkey, n, exempt_from_gc),
33 __dynamic_array(char, dev, IFNAMSIZ )
36 __field(u8, gc_exempt)
37 __array(u8, primary_key4, 4)
38 __array(u8, primary_key6, 16)
44 __entry->family = tbl->family;
45 __assign_str(dev, (dev ? dev->name : "NULL"));
46 __entry->entries = atomic_read(&tbl->gc_entries);
47 __entry->created = n != NULL;
48 __entry->gc_exempt = exempt_from_gc;
49 p32 = (__be32 *)__entry->primary_key4;
51 if (tbl->family == AF_INET)
52 *p32 = *(__be32 *)pkey;
56 #if IS_ENABLED(CONFIG_IPV6)
57 if (tbl->family == AF_INET6) {
58 struct in6_addr *pin6;
60 pin6 = (struct in6_addr *)__entry->primary_key6;
61 *pin6 = *(struct in6_addr *)pkey;
66 TP_printk("family %d dev %s entries %d primary_key4 %pI4 primary_key6 %pI6c created %d gc_exempt %d",
67 __entry->family, __get_str(dev), __entry->entries,
68 __entry->primary_key4, __entry->primary_key6,
69 __entry->created, __entry->gc_exempt)
72 TRACE_EVENT(neigh_update,
74 TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new,
75 u32 flags, u32 nlmsg_pid),
77 TP_ARGS(n, lladdr, new, flags, nlmsg_pid),
81 __string(dev, (n->dev ? n->dev->name : "NULL"))
82 __array(u8, lladdr, MAX_ADDR_LEN)
83 __field(u8, lladdr_len)
85 __field(u8, nud_state)
89 __array(__u8, primary_key4, 4)
90 __array(__u8, primary_key6, 16)
91 __field(unsigned long, confirmed)
92 __field(unsigned long, updated)
93 __field(unsigned long, used)
94 __array(u8, new_lladdr, MAX_ADDR_LEN)
95 __field(u8, new_state)
96 __field(u32, update_flags)
101 int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN);
102 struct in6_addr *pin6;
105 __entry->family = n->tbl->family;
106 __assign_str(dev, (n->dev ? n->dev->name : "NULL"));
107 __entry->lladdr_len = lladdr_len;
108 memcpy(__entry->lladdr, n->ha, lladdr_len);
109 __entry->flags = n->flags;
110 __entry->nud_state = n->nud_state;
111 __entry->type = n->type;
112 __entry->dead = n->dead;
113 __entry->refcnt = refcount_read(&n->refcnt);
114 pin6 = (struct in6_addr *)__entry->primary_key6;
115 p32 = (__be32 *)__entry->primary_key4;
117 if (n->tbl->family == AF_INET)
118 *p32 = *(__be32 *)n->primary_key;
122 #if IS_ENABLED(CONFIG_IPV6)
123 if (n->tbl->family == AF_INET6) {
124 pin6 = (struct in6_addr *)__entry->primary_key6;
125 *pin6 = *(struct in6_addr *)n->primary_key;
129 ipv6_addr_set_v4mapped(*p32, pin6);
131 __entry->confirmed = n->confirmed;
132 __entry->updated = n->updated;
133 __entry->used = n->used;
135 memcpy(__entry->new_lladdr, lladdr, lladdr_len);
136 __entry->new_state = new;
137 __entry->update_flags = flags;
138 __entry->pid = nlmsg_pid;
141 TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x "
142 "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c "
143 "confirmed %lu updated %lu used %lu new_lladdr %s "
144 "new_state %s update_flags %02x pid %d",
145 __entry->family, __get_str(dev),
146 __print_hex_str(__entry->lladdr, __entry->lladdr_len),
147 __entry->flags, neigh_state_str(__entry->nud_state),
148 __entry->type, __entry->dead, __entry->refcnt,
149 __entry->primary_key4, __entry->primary_key6,
150 __entry->confirmed, __entry->updated, __entry->used,
151 __print_hex_str(__entry->new_lladdr, __entry->lladdr_len),
152 neigh_state_str(__entry->new_state),
153 __entry->update_flags, __entry->pid)
156 DECLARE_EVENT_CLASS(neigh__update,
157 TP_PROTO(struct neighbour *n, int err),
161 __string(dev, (n->dev ? n->dev->name : "NULL"))
162 __array(u8, lladdr, MAX_ADDR_LEN)
163 __field(u8, lladdr_len)
165 __field(u8, nud_state)
169 __array(__u8, primary_key4, 4)
170 __array(__u8, primary_key6, 16)
171 __field(unsigned long, confirmed)
172 __field(unsigned long, updated)
173 __field(unsigned long, used)
178 int lladdr_len = (n->dev ? n->dev->addr_len : MAX_ADDR_LEN);
179 struct in6_addr *pin6;
182 __entry->family = n->tbl->family;
183 __assign_str(dev, (n->dev ? n->dev->name : "NULL"));
184 __entry->lladdr_len = lladdr_len;
185 memcpy(__entry->lladdr, n->ha, lladdr_len);
186 __entry->flags = n->flags;
187 __entry->nud_state = n->nud_state;
188 __entry->type = n->type;
189 __entry->dead = n->dead;
190 __entry->refcnt = refcount_read(&n->refcnt);
191 pin6 = (struct in6_addr *)__entry->primary_key6;
192 p32 = (__be32 *)__entry->primary_key4;
194 if (n->tbl->family == AF_INET)
195 *p32 = *(__be32 *)n->primary_key;
199 #if IS_ENABLED(CONFIG_IPV6)
200 if (n->tbl->family == AF_INET6) {
201 pin6 = (struct in6_addr *)__entry->primary_key6;
202 *pin6 = *(struct in6_addr *)n->primary_key;
206 ipv6_addr_set_v4mapped(*p32, pin6);
209 __entry->confirmed = n->confirmed;
210 __entry->updated = n->updated;
211 __entry->used = n->used;
215 TP_printk("family %d dev %s lladdr %s flags %02x nud_state %s type %02x "
216 "dead %d refcnt %d primary_key4 %pI4 primary_key6 %pI6c "
217 "confirmed %lu updated %lu used %lu err %d",
218 __entry->family, __get_str(dev),
219 __print_hex_str(__entry->lladdr, __entry->lladdr_len),
220 __entry->flags, neigh_state_str(__entry->nud_state),
221 __entry->type, __entry->dead, __entry->refcnt,
222 __entry->primary_key4, __entry->primary_key6,
223 __entry->confirmed, __entry->updated, __entry->used,
227 DEFINE_EVENT(neigh__update, neigh_update_done,
228 TP_PROTO(struct neighbour *neigh, int err),
232 DEFINE_EVENT(neigh__update, neigh_timer_handler,
233 TP_PROTO(struct neighbour *neigh, int err),
237 DEFINE_EVENT(neigh__update, neigh_event_send_done,
238 TP_PROTO(struct neighbour *neigh, int err),
242 DEFINE_EVENT(neigh__update, neigh_event_send_dead,
243 TP_PROTO(struct neighbour *neigh, int err),
247 DEFINE_EVENT(neigh__update, neigh_cleanup_and_release,
248 TP_PROTO(struct neighbour *neigh, int rc),
252 #endif /* _TRACE_NEIGH_H */
254 /* This part must be outside protection */
255 #include <trace/define_trace.h>