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_TC_TP_) || defined(TRACE_HEADER_MULTI_READ) 8 #define _MLX5_TC_TP_ 9 10 #include <linux/tracepoint.h> 11 #include <linux/trace_seq.h> 12 #include <net/flow_offload.h> 13 #include "en_rep.h" 14 15 #define __parse_action(ids, num) parse_action(p, ids, num) 16 17 void put_ids_to_array(int *ids, 18 const struct flow_action_entry *entries, 19 unsigned int num); 20 21 const char *parse_action(struct trace_seq *p, 22 int *ids, 23 unsigned int num); 24 25 DECLARE_EVENT_CLASS(mlx5e_flower_template, 26 TP_PROTO(const struct flow_cls_offload *f), 27 TP_ARGS(f), 28 TP_STRUCT__entry(__field(void *, cookie) 29 __field(unsigned int, num) 30 __dynamic_array(int, ids, f->rule ? 31 f->rule->action.num_entries : 0) 32 ), 33 TP_fast_assign(__entry->cookie = (void *)f->cookie; 34 __entry->num = (f->rule ? 35 f->rule->action.num_entries : 0); 36 if (__entry->num) 37 put_ids_to_array(__get_dynamic_array(ids), 38 f->rule->action.entries, 39 f->rule->action.num_entries); 40 ), 41 TP_printk("cookie=%p actions= %s\n", 42 __entry->cookie, __entry->num ? 43 __parse_action(__get_dynamic_array(ids), 44 __entry->num) : "NULL" 45 ) 46 ); 47 48 DEFINE_EVENT(mlx5e_flower_template, mlx5e_configure_flower, 49 TP_PROTO(const struct flow_cls_offload *f), 50 TP_ARGS(f) 51 ); 52 53 DEFINE_EVENT(mlx5e_flower_template, mlx5e_delete_flower, 54 TP_PROTO(const struct flow_cls_offload *f), 55 TP_ARGS(f) 56 ); 57 58 TRACE_EVENT(mlx5e_stats_flower, 59 TP_PROTO(const struct flow_cls_offload *f), 60 TP_ARGS(f), 61 TP_STRUCT__entry(__field(void *, cookie) 62 __field(u64, bytes) 63 __field(u64, packets) 64 __field(u64, lastused) 65 ), 66 TP_fast_assign(__entry->cookie = (void *)f->cookie; 67 __entry->bytes = f->stats.bytes; 68 __entry->packets = f->stats.pkts; 69 __entry->lastused = f->stats.lastused; 70 ), 71 TP_printk("cookie=%p bytes=%llu packets=%llu lastused=%llu\n", 72 __entry->cookie, __entry->bytes, 73 __entry->packets, __entry->lastused 74 ) 75 ); 76 77 TRACE_EVENT(mlx5e_tc_update_neigh_used_value, 78 TP_PROTO(const struct mlx5e_neigh_hash_entry *nhe, bool neigh_used), 79 TP_ARGS(nhe, neigh_used), 80 TP_STRUCT__entry(__string(devname, nhe->neigh_dev->name) 81 __array(u8, v4, 4) 82 __array(u8, v6, 16) 83 __field(bool, neigh_used) 84 ), 85 TP_fast_assign(const struct mlx5e_neigh *mn = &nhe->m_neigh; 86 struct in6_addr *pin6; 87 __be32 *p32; 88 89 __assign_str(devname); 90 __entry->neigh_used = neigh_used; 91 92 p32 = (__be32 *)__entry->v4; 93 pin6 = (struct in6_addr *)__entry->v6; 94 if (mn->family == AF_INET) { 95 *p32 = mn->dst_ip.v4; 96 ipv6_addr_set_v4mapped(*p32, pin6); 97 } else if (mn->family == AF_INET6) { 98 *pin6 = mn->dst_ip.v6; 99 } 100 ), 101 TP_printk("netdev: %s IPv4: %pI4 IPv6: %pI6c neigh_used=%d\n", 102 __get_str(devname), __entry->v4, __entry->v6, 103 __entry->neigh_used 104 ) 105 ); 106 107 #endif /* _MLX5_TC_TP_ */ 108 109 /* This part must be outside protection */ 110 #undef TRACE_INCLUDE_PATH 111 #define TRACE_INCLUDE_PATH ./diag 112 #undef TRACE_INCLUDE_FILE 113 #define TRACE_INCLUDE_FILE en_tc_tracepoint 114 #include <trace/define_trace.h> 115