2 * Copyright (c) 2017, Mellanox Technologies. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #if !defined(_MLX5_FS_TP_) || defined(TRACE_HEADER_MULTI_READ)
36 #include <linux/tracepoint.h>
37 #include <linux/trace_seq.h>
38 #include "../fs_core.h"
41 #define TRACE_SYSTEM mlx5
43 #define __parse_fs_hdrs(match_criteria_enable, mouter, mmisc, minner, vouter, \
45 parse_fs_hdrs(p, match_criteria_enable, mouter, mmisc, minner, vouter,\
48 const char *parse_fs_hdrs(struct trace_seq *p,
49 u8 match_criteria_enable,
50 const u32 *mask_outer,
52 const u32 *mask_inner,
53 const u32 *value_outer,
54 const u32 *value_misc,
55 const u32 *value_inner);
57 #define __parse_fs_dst(dst, counter_id) \
58 parse_fs_dst(p, (const struct mlx5_flow_destination *)dst, counter_id)
60 const char *parse_fs_dst(struct trace_seq *p,
61 const struct mlx5_flow_destination *dst,
64 TRACE_EVENT(mlx5_fs_add_fg,
65 TP_PROTO(const struct mlx5_flow_group *fg),
68 __field(const struct mlx5_flow_group *, fg)
69 __field(const struct mlx5_flow_table *, ft)
70 __field(u32, start_index)
71 __field(u32, end_index)
73 __field(u8, mask_enable)
74 __array(u32, mask_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
75 __array(u32, mask_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
76 __array(u32, mask_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
80 fs_get_obj(__entry->ft, fg->node.parent);
81 __entry->start_index = fg->start_index;
82 __entry->end_index = fg->start_index + fg->max_ftes;
84 __entry->mask_enable = fg->mask.match_criteria_enable;
85 memcpy(__entry->mask_outer,
86 MLX5_ADDR_OF(fte_match_param,
87 &fg->mask.match_criteria,
89 sizeof(__entry->mask_outer));
90 memcpy(__entry->mask_inner,
91 MLX5_ADDR_OF(fte_match_param,
92 &fg->mask.match_criteria,
94 sizeof(__entry->mask_inner));
95 memcpy(__entry->mask_misc,
96 MLX5_ADDR_OF(fte_match_param,
97 &fg->mask.match_criteria,
99 sizeof(__entry->mask_misc));
102 TP_printk("fg=%p ft=%p id=%u start=%u end=%u bit_mask=%02x %s\n",
103 __entry->fg, __entry->ft, __entry->id,
104 __entry->start_index, __entry->end_index,
105 __entry->mask_enable,
106 __parse_fs_hdrs(__entry->mask_enable,
112 __entry->mask_inner))
115 TRACE_EVENT(mlx5_fs_del_fg,
116 TP_PROTO(const struct mlx5_flow_group *fg),
119 __field(const struct mlx5_flow_group *, fg)
124 __entry->id = fg->id;
127 TP_printk("fg=%p id=%u\n",
128 __entry->fg, __entry->id)
131 #define ACTION_FLAGS \
132 {MLX5_FLOW_CONTEXT_ACTION_ALLOW, "ALLOW"},\
133 {MLX5_FLOW_CONTEXT_ACTION_DROP, "DROP"},\
134 {MLX5_FLOW_CONTEXT_ACTION_FWD_DEST, "FWD"},\
135 {MLX5_FLOW_CONTEXT_ACTION_COUNT, "CNT"},\
136 {MLX5_FLOW_CONTEXT_ACTION_ENCAP, "ENCAP"},\
137 {MLX5_FLOW_CONTEXT_ACTION_DECAP, "DECAP"},\
138 {MLX5_FLOW_CONTEXT_ACTION_MOD_HDR, "MOD_HDR"},\
139 {MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
141 TRACE_EVENT(mlx5_fs_set_fte,
142 TP_PROTO(const struct fs_fte *fte, int new_fte),
143 TP_ARGS(fte, new_fte),
145 __field(const struct fs_fte *, fte)
146 __field(const struct mlx5_flow_group *, fg)
147 __field(u32, group_index)
150 __field(u32, flow_tag)
151 __field(u8, mask_enable)
152 __field(int, new_fte)
153 __array(u32, mask_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
154 __array(u32, mask_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
155 __array(u32, mask_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
156 __array(u32, value_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
157 __array(u32, value_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
158 __array(u32, value_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
162 __entry->new_fte = new_fte;
163 fs_get_obj(__entry->fg, fte->node.parent);
164 __entry->group_index = __entry->fg->id;
165 __entry->index = fte->index;
166 __entry->action = fte->action.action;
167 __entry->mask_enable = __entry->fg->mask.match_criteria_enable;
168 __entry->flow_tag = fte->action.flow_tag;
169 memcpy(__entry->mask_outer,
170 MLX5_ADDR_OF(fte_match_param,
171 &__entry->fg->mask.match_criteria,
173 sizeof(__entry->mask_outer));
174 memcpy(__entry->mask_inner,
175 MLX5_ADDR_OF(fte_match_param,
176 &__entry->fg->mask.match_criteria,
178 sizeof(__entry->mask_inner));
179 memcpy(__entry->mask_misc,
180 MLX5_ADDR_OF(fte_match_param,
181 &__entry->fg->mask.match_criteria,
183 sizeof(__entry->mask_misc));
184 memcpy(__entry->value_outer,
185 MLX5_ADDR_OF(fte_match_param,
188 sizeof(__entry->value_outer));
189 memcpy(__entry->value_inner,
190 MLX5_ADDR_OF(fte_match_param,
193 sizeof(__entry->value_inner));
194 memcpy(__entry->value_misc,
195 MLX5_ADDR_OF(fte_match_param,
198 sizeof(__entry->value_misc));
201 TP_printk("op=%s fte=%p fg=%p index=%u group_index=%u action=<%s> flow_tag=%x %s\n",
202 __entry->new_fte ? "add" : "set",
203 __entry->fte, __entry->fg, __entry->index,
204 __entry->group_index, __print_flags(__entry->action, "|",
207 __parse_fs_hdrs(__entry->mask_enable,
211 __entry->value_outer,
213 __entry->value_inner))
216 TRACE_EVENT(mlx5_fs_del_fte,
217 TP_PROTO(const struct fs_fte *fte),
220 __field(const struct fs_fte *, fte)
225 __entry->index = fte->index;
228 TP_printk("fte=%p index=%u\n",
229 __entry->fte, __entry->index)
232 TRACE_EVENT(mlx5_fs_add_rule,
233 TP_PROTO(const struct mlx5_flow_rule *rule),
236 __field(const struct mlx5_flow_rule *, rule)
237 __field(const struct fs_fte *, fte)
238 __field(u32, sw_action)
240 __field(u32, counter_id)
241 __array(u8, destination, sizeof(struct mlx5_flow_destination))
244 __entry->rule = rule;
245 fs_get_obj(__entry->fte, rule->node.parent);
246 __entry->index = __entry->fte->dests_size - 1;
247 __entry->sw_action = rule->sw_action;
248 memcpy(__entry->destination,
250 sizeof(__entry->destination));
251 if (rule->dest_attr.type & MLX5_FLOW_DESTINATION_TYPE_COUNTER &&
252 rule->dest_attr.counter)
253 __entry->counter_id =
254 rule->dest_attr.counter->id;
256 TP_printk("rule=%p fte=%p index=%u sw_action=<%s> [dst] %s\n",
257 __entry->rule, __entry->fte, __entry->index,
258 __print_flags(__entry->sw_action, "|", ACTION_FLAGS),
259 __parse_fs_dst(__entry->destination, __entry->counter_id))
262 TRACE_EVENT(mlx5_fs_del_rule,
263 TP_PROTO(const struct mlx5_flow_rule *rule),
266 __field(const struct mlx5_flow_rule *, rule)
267 __field(const struct fs_fte *, fte)
270 __entry->rule = rule;
271 fs_get_obj(__entry->fte, rule->node.parent);
273 TP_printk("rule=%p fte=%p\n",
274 __entry->rule, __entry->fte)
278 #undef TRACE_INCLUDE_PATH
279 #define TRACE_INCLUDE_PATH ./diag
280 #undef TRACE_INCLUDE_FILE
281 #define TRACE_INCLUDE_FILE fs_tracepoint
282 #include <trace/define_trace.h>