1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
3 
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM mlx5
6 
7 #if !defined(_MLX5_EN_REP_TP_) || defined(TRACE_HEADER_MULTI_READ)
8 #define _MLX5_EN_REP_TP_
9 
10 #include <linux/tracepoint.h>
11 #include <linux/trace_seq.h>
12 #include "en_rep.h"
13 
14 TRACE_EVENT(mlx5e_rep_neigh_update,
15 	    TP_PROTO(const struct mlx5e_neigh_hash_entry *nhe, const u8 *ha,
16 		     bool neigh_connected),
17 	    TP_ARGS(nhe, ha, neigh_connected),
18 	    TP_STRUCT__entry(__string(devname, nhe->neigh_dev->name)
19 			     __array(u8, ha, ETH_ALEN)
20 			     __array(u8, v4, 4)
21 			     __array(u8, v6, 16)
22 			     __field(bool, neigh_connected)
23 			     ),
24 	    TP_fast_assign(const struct mlx5e_neigh *mn = &nhe->m_neigh;
25 			struct in6_addr *pin6;
26 			__be32 *p32;
27 
28 			__assign_str(devname, nhe->neigh_dev->name);
29 			__entry->neigh_connected = neigh_connected;
30 			memcpy(__entry->ha, ha, ETH_ALEN);
31 
32 			p32 = (__be32 *)__entry->v4;
33 			pin6 = (struct in6_addr *)__entry->v6;
34 			if (mn->family == AF_INET) {
35 				*p32 = mn->dst_ip.v4;
36 				ipv6_addr_set_v4mapped(*p32, pin6);
37 			} else if (mn->family == AF_INET6) {
38 				*pin6 = mn->dst_ip.v6;
39 			}
40 			),
41 	    TP_printk("netdev: %s MAC: %pM IPv4: %pI4 IPv6: %pI6c neigh_connected=%d\n",
42 		      __get_str(devname), __entry->ha,
43 		      __entry->v4, __entry->v6, __entry->neigh_connected
44 		      )
45 );
46 
47 #endif /* _MLX5_EN_REP_TP_ */
48 
49 /* This part must be outside protection */
50 #undef TRACE_INCLUDE_PATH
51 #define TRACE_INCLUDE_PATH ./diag
52 #undef TRACE_INCLUDE_FILE
53 #define TRACE_INCLUDE_FILE en_rep_tracepoint
54 #include <trace/define_trace.h>
55