Skip to content

Commit fc65100

Browse files
dsaherndavem330
authored andcommitted
neighbor: Add tracepoint to __neigh_create
Add tracepoint to __neigh_create to enable debugging of new entries. Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a92a0a7 commit fc65100

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

include/trace/events/neigh.h

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,55 @@
2020
{ NUD_NOARP, "noarp" }, \
2121
{ NUD_PERMANENT, "permanent"})
2222

23+
TRACE_EVENT(neigh_create,
24+
25+
TP_PROTO(struct neigh_table *tbl, struct net_device *dev,
26+
const void *pkey, const struct neighbour *n,
27+
bool exempt_from_gc),
28+
29+
TP_ARGS(tbl, dev, pkey, n, exempt_from_gc),
30+
31+
TP_STRUCT__entry(
32+
__field(u32, family)
33+
__dynamic_array(char, dev, IFNAMSIZ )
34+
__field(int, entries)
35+
__field(u8, created)
36+
__field(u8, gc_exempt)
37+
__array(u8, primary_key4, 4)
38+
__array(u8, primary_key6, 16)
39+
),
40+
41+
TP_fast_assign(
42+
struct in6_addr *pin6;
43+
__be32 *p32;
44+
45+
__entry->family = tbl->family;
46+
__assign_str(dev, (dev ? dev->name : "NULL"));
47+
__entry->entries = atomic_read(&tbl->gc_entries);
48+
__entry->created = n != NULL;
49+
__entry->gc_exempt = exempt_from_gc;
50+
pin6 = (struct in6_addr *)__entry->primary_key6;
51+
p32 = (__be32 *)__entry->primary_key4;
52+
53+
if (tbl->family == AF_INET)
54+
*p32 = *(__be32 *)pkey;
55+
else
56+
*p32 = 0;
57+
58+
#if IS_ENABLED(CONFIG_IPV6)
59+
if (tbl->family == AF_INET6) {
60+
pin6 = (struct in6_addr *)__entry->primary_key6;
61+
*pin6 = *(struct in6_addr *)pkey;
62+
}
63+
#endif
64+
),
65+
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)
70+
);
71+
2372
TRACE_EVENT(neigh_update,
2473

2574
TP_PROTO(struct neighbour *n, const u8 *lladdr, u8 new,

net/core/neighbour.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,8 @@ static struct neighbour *___neigh_create(struct neigh_table *tbl,
587587
int error;
588588
struct neigh_hash_table *nht;
589589

590+
trace_neigh_create(tbl, dev, pkey, n, exempt_from_gc);
591+
590592
if (!n) {
591593
rc = ERR_PTR(-ENOBUFS);
592594
goto out;

0 commit comments

Comments
 (0)