aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/mellanox/mlx5/core/diag/en_tc_tracepoint.h
blob: a362100fe6d330b5dfe18e53bdc993315c6e9be0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2019 Mellanox Technologies. */

#undef TRACE_SYSTEM
#define TRACE_SYSTEM mlx5

#if !defined(_MLX5_TC_TP_) || defined(TRACE_HEADER_MULTI_READ)
#define _MLX5_TC_TP_

#include <linux/tracepoint.h>
#include <linux/trace_seq.h>
#include <net/flow_offload.h>

#define __parse_action(ids, num) parse_action(p, ids, num)

void put_ids_to_array(int *ids,
		      const struct flow_action_entry *entries,
		      unsigned int num);

const char *parse_action(struct trace_seq *p,
			 int *ids,
			 unsigned int num);

DECLARE_EVENT_CLASS(mlx5e_flower_template,
		    TP_PROTO(const struct flow_cls_offload *f),
		    TP_ARGS(f),
		    TP_STRUCT__entry(__field(void *, cookie)
				     __field(unsigned int, num)
				     __dynamic_array(int, ids, f->rule ?
					     f->rule->action.num_entries : 0)
				     ),
		    TP_fast_assign(__entry->cookie = (void *)f->cookie;
			__entry->num = (f->rule ?
				f->rule->action.num_entries : 0);
			if (__entry->num)
				put_ids_to_array(__get_dynamic_array(ids),
						 f->rule->action.entries,
						 f->rule->action.num_entries);
			),
		    TP_printk("cookie=%p actions= %s\n",
			      __entry->cookie, __entry->num ?
				      __parse_action(__get_dynamic_array(ids),
						     __entry->num) : "NULL"
			      )
);

DEFINE_EVENT(mlx5e_flower_template, mlx5e_configure_flower,
	     TP_PROTO(const struct flow_cls_offload *f),
	     TP_ARGS(f)
	     );

DEFINE_EVENT(mlx5e_flower_template, mlx5e_delete_flower,
	     TP_PROTO(const struct flow_cls_offload *f),
	     TP_ARGS(f)
	     );

TRACE_EVENT(mlx5e_stats_flower,
	    TP_PROTO(const struct flow_cls_offload *f),
	    TP_ARGS(f),
	    TP_STRUCT__entry(__field(void *, cookie)
			     __field(u64, bytes)
			     __field(u64, packets)
			     __field(u64, lastused)
			     ),
	    TP_fast_assign(__entry->cookie = (void *)f->cookie;
		__entry->bytes = f->stats.bytes;
		__entry->packets = f->stats.pkts;
		__entry->lastused = f->stats.lastused;
		),
	    TP_printk("cookie=%p bytes=%llu packets=%llu lastused=%llu\n",
		      __entry->cookie, __entry->bytes,
		      __entry->packets, __entry->lastused
		      )
);

#endif /* _MLX5_TC_TP_ */

/* This part must be outside protection */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH ./diag
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE en_tc_tracepoint
#include <trace/define_trace.h>