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_VLAN_PUSH, "VLAN_PUSH"},\
140 {MLX5_FLOW_CONTEXT_ACTION_VLAN_POP, "VLAN_POP"},\
141 {MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH_2, "VLAN_PUSH_2"},\
142 {MLX5_FLOW_CONTEXT_ACTION_VLAN_POP_2, "VLAN_POP_2"},\
143 {MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO, "NEXT_PRIO"}
145 TRACE_EVENT(mlx5_fs_set_fte,
146 TP_PROTO(const struct fs_fte *fte, int new_fte),
147 TP_ARGS(fte, new_fte),
149 __field(const struct fs_fte *, fte)
150 __field(const struct mlx5_flow_group *, fg)
151 __field(u32, group_index)
154 __field(u32, flow_tag)
155 __field(u8, mask_enable)
156 __field(int, new_fte)
157 __array(u32, mask_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
158 __array(u32, mask_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
159 __array(u32, mask_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
160 __array(u32, value_outer, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
161 __array(u32, value_inner, MLX5_ST_SZ_DW(fte_match_set_lyr_2_4))
162 __array(u32, value_misc, MLX5_ST_SZ_DW(fte_match_set_misc))
166 __entry->new_fte = new_fte;
167 fs_get_obj(__entry->fg, fte->node.parent);
168 __entry->group_index = __entry->fg->id;
169 __entry->index = fte->index;
170 __entry->action = fte->action.action;
171 __entry->mask_enable = __entry->fg->mask.match_criteria_enable;
172 __entry->flow_tag = fte->action.flow_tag;
173 memcpy(__entry->mask_outer,
174 MLX5_ADDR_OF(fte_match_param,
175 &__entry->fg->mask.match_criteria,
177 sizeof(__entry->mask_outer));
178 memcpy(__entry->mask_inner,
179 MLX5_ADDR_OF(fte_match_param,
180 &__entry->fg->mask.match_criteria,
182 sizeof(__entry->mask_inner));
183 memcpy(__entry->mask_misc,
184 MLX5_ADDR_OF(fte_match_param,
185 &__entry->fg->mask.match_criteria,
187 sizeof(__entry->mask_misc));
188 memcpy(__entry->value_outer,
189 MLX5_ADDR_OF(fte_match_param,
192 sizeof(__entry->value_outer));
193 memcpy(__entry->value_inner,
194 MLX5_ADDR_OF(fte_match_param,
197 sizeof(__entry->value_inner));
198 memcpy(__entry->value_misc,
199 MLX5_ADDR_OF(fte_match_param,
202 sizeof(__entry->value_misc));
205 TP_printk("op=%s fte=%p fg=%p index=%u group_index=%u action=<%s> flow_tag=%x %s\n",
206 __entry->new_fte ? "add" : "set",
207 __entry->fte, __entry->fg, __entry->index,
208 __entry->group_index, __print_flags(__entry->action, "|",
211 __parse_fs_hdrs(__entry->mask_enable,
215 __entry->value_outer,
217 __entry->value_inner))
220 TRACE_EVENT(mlx5_fs_del_fte,
221 TP_PROTO(const struct fs_fte *fte),
224 __field(const struct fs_fte *, fte)
229 __entry->index = fte->index;
232 TP_printk("fte=%p index=%u\n",
233 __entry->fte, __entry->index)
236 TRACE_EVENT(mlx5_fs_add_rule,
237 TP_PROTO(const struct mlx5_flow_rule *rule),
240 __field(const struct mlx5_flow_rule *, rule)
241 __field(const struct fs_fte *, fte)
242 __field(u32, sw_action)
244 __field(u32, counter_id)
245 __array(u8, destination, sizeof(struct mlx5_flow_destination))
248 __entry->rule = rule;
249 fs_get_obj(__entry->fte, rule->node.parent);
250 __entry->index = __entry->fte->dests_size - 1;
251 __entry->sw_action = rule->sw_action;
252 memcpy(__entry->destination,
254 sizeof(__entry->destination));
255 if (rule->dest_attr.type & MLX5_FLOW_DESTINATION_TYPE_COUNTER &&
256 rule->dest_attr.counter)
257 __entry->counter_id =
258 rule->dest_attr.counter->id;
260 TP_printk("rule=%p fte=%p index=%u sw_action=<%s> [dst] %s\n",
261 __entry->rule, __entry->fte, __entry->index,
262 __print_flags(__entry->sw_action, "|", ACTION_FLAGS),
263 __parse_fs_dst(__entry->destination, __entry->counter_id))
266 TRACE_EVENT(mlx5_fs_del_rule,
267 TP_PROTO(const struct mlx5_flow_rule *rule),
270 __field(const struct mlx5_flow_rule *, rule)
271 __field(const struct fs_fte *, fte)
274 __entry->rule = rule;
275 fs_get_obj(__entry->fte, rule->node.parent);
277 TP_printk("rule=%p fte=%p\n",
278 __entry->rule, __entry->fte)
282 #undef TRACE_INCLUDE_PATH
283 #define TRACE_INCLUDE_PATH ./diag
284 #undef TRACE_INCLUDE_FILE
285 #define TRACE_INCLUDE_FILE fs_tracepoint
286 #include <trace/define_trace.h>