linux/drivers/net/ethernet/mellanox/mlx5/core/diag/fs_tracepoint.h
<<
>>
Prefs
   1/*
   2 * Copyright (c) 2017, Mellanox Technologies. All rights reserved.
   3 *
   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:
   9 *
  10 *     Redistribution and use in source and binary forms, with or
  11 *     without modification, are permitted provided that the following
  12 *     conditions are met:
  13 *
  14 *      - Redistributions of source code must retain the above
  15 *        copyright notice, this list of conditions and the following
  16 *        disclaimer.
  17 *
  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.
  22 *
  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
  30 * SOFTWARE.
  31 */
  32
  33#if !defined(_MLX5_FS_TP_) || defined(TRACE_HEADER_MULTI_READ)
  34#define _MLX5_FS_TP_
  35
  36#include <linux/tracepoint.h>
  37#include <linux/trace_seq.h>
  38#include "../fs_core.h"
  39
  40#undef TRACE_SYSTEM
  41#define TRACE_SYSTEM mlx5
  42
  43#define __parse_fs_hdrs(match_criteria_enable, mouter, mmisc, minner, vouter, \
  44                        vinner, vmisc)                                        \
  45        parse_fs_hdrs(p, match_criteria_enable, mouter, mmisc, minner, vouter,\
  46                      vinner, vmisc)
  47
  48const char *parse_fs_hdrs(struct trace_seq *p,
  49                          u8 match_criteria_enable,
  50                          const u32 *mask_outer,
  51                          const u32 *mask_misc,
  52                          const u32 *mask_inner,
  53                          const u32 *value_outer,
  54                          const u32 *value_misc,
  55                          const u32 *value_inner);
  56
  57#define __parse_fs_dst(dst, counter_id) \
  58        parse_fs_dst(p, (const struct mlx5_flow_destination *)dst, counter_id)
  59
  60const char *parse_fs_dst(struct trace_seq *p,
  61                         const struct mlx5_flow_destination *dst,
  62                         u32 counter_id);
  63
  64TRACE_EVENT(mlx5_fs_add_fg,
  65            TP_PROTO(const struct mlx5_flow_group *fg),
  66            TP_ARGS(fg),
  67            TP_STRUCT__entry(
  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)
  72                __field(u32, id)
  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))
  77            ),
  78            TP_fast_assign(
  79                           __entry->fg = fg;
  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;
  83                           __entry->id = fg->id;
  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,
  88                                               outer_headers),
  89                                  sizeof(__entry->mask_outer));
  90                           memcpy(__entry->mask_inner,
  91                                  MLX5_ADDR_OF(fte_match_param,
  92                                               &fg->mask.match_criteria,
  93                                               inner_headers),
  94                                  sizeof(__entry->mask_inner));
  95                           memcpy(__entry->mask_misc,
  96                                  MLX5_ADDR_OF(fte_match_param,
  97                                               &fg->mask.match_criteria,
  98                                               misc_parameters),
  99                                  sizeof(__entry->mask_misc));
 100
 101            ),
 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,
 107                                      __entry->mask_outer,
 108                                      __entry->mask_misc,
 109                                      __entry->mask_inner,
 110                                      __entry->mask_outer,
 111                                      __entry->mask_misc,
 112                                      __entry->mask_inner))
 113            );
 114
 115TRACE_EVENT(mlx5_fs_del_fg,
 116            TP_PROTO(const struct mlx5_flow_group *fg),
 117            TP_ARGS(fg),
 118            TP_STRUCT__entry(
 119                __field(const struct mlx5_flow_group *, fg)
 120                __field(u32, id)
 121            ),
 122            TP_fast_assign(
 123                           __entry->fg = fg;
 124                           __entry->id = fg->id;
 125
 126            ),
 127            TP_printk("fg=%p id=%u\n",
 128                      __entry->fg, __entry->id)
 129            );
 130
 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"}
 140
 141TRACE_EVENT(mlx5_fs_set_fte,
 142            TP_PROTO(const struct fs_fte *fte, int new_fte),
 143            TP_ARGS(fte, new_fte),
 144            TP_STRUCT__entry(
 145                __field(const struct fs_fte *, fte)
 146                __field(const struct mlx5_flow_group *, fg)
 147                __field(u32, group_index)
 148                __field(u32, index)
 149                __field(u32, action)
 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))
 159            ),
 160            TP_fast_assign(
 161                           __entry->fte = fte;
 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;
 167                           __entry->mask_enable = __entry->fg->mask.match_criteria_enable;
 168                           __entry->flow_tag = fte->flow_tag;
 169                           memcpy(__entry->mask_outer,
 170                                  MLX5_ADDR_OF(fte_match_param,
 171                                               &__entry->fg->mask.match_criteria,
 172                                               outer_headers),
 173                                  sizeof(__entry->mask_outer));
 174                           memcpy(__entry->mask_inner,
 175                                  MLX5_ADDR_OF(fte_match_param,
 176                                               &__entry->fg->mask.match_criteria,
 177                                               inner_headers),
 178                                  sizeof(__entry->mask_inner));
 179                           memcpy(__entry->mask_misc,
 180                                  MLX5_ADDR_OF(fte_match_param,
 181                                               &__entry->fg->mask.match_criteria,
 182                                               misc_parameters),
 183                                  sizeof(__entry->mask_misc));
 184                           memcpy(__entry->value_outer,
 185                                  MLX5_ADDR_OF(fte_match_param,
 186                                               &fte->val,
 187                                               outer_headers),
 188                                  sizeof(__entry->value_outer));
 189                           memcpy(__entry->value_inner,
 190                                  MLX5_ADDR_OF(fte_match_param,
 191                                               &fte->val,
 192                                               inner_headers),
 193                                  sizeof(__entry->value_inner));
 194                           memcpy(__entry->value_misc,
 195                                  MLX5_ADDR_OF(fte_match_param,
 196                                               &fte->val,
 197                                               misc_parameters),
 198                                  sizeof(__entry->value_misc));
 199
 200            ),
 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, "|",
 205                                                          ACTION_FLAGS),
 206                      __entry->flow_tag,
 207                      __parse_fs_hdrs(__entry->mask_enable,
 208                                      __entry->mask_outer,
 209                                      __entry->mask_misc,
 210                                      __entry->mask_inner,
 211                                      __entry->value_outer,
 212                                      __entry->value_misc,
 213                                      __entry->value_inner))
 214            );
 215
 216TRACE_EVENT(mlx5_fs_del_fte,
 217            TP_PROTO(const struct fs_fte *fte),
 218            TP_ARGS(fte),
 219            TP_STRUCT__entry(
 220                __field(const struct fs_fte *, fte)
 221                __field(u32, index)
 222            ),
 223            TP_fast_assign(
 224                           __entry->fte = fte;
 225                           __entry->index = fte->index;
 226
 227            ),
 228            TP_printk("fte=%p index=%u\n",
 229                      __entry->fte, __entry->index)
 230            );
 231
 232TRACE_EVENT(mlx5_fs_add_rule,
 233            TP_PROTO(const struct mlx5_flow_rule *rule),
 234            TP_ARGS(rule),
 235            TP_STRUCT__entry(
 236                __field(const struct mlx5_flow_rule *, rule)
 237                __field(const struct fs_fte *, fte)
 238                __field(u32, sw_action)
 239                __field(u32, index)
 240                __field(u32, counter_id)
 241                __array(u8, destination, sizeof(struct mlx5_flow_destination))
 242            ),
 243            TP_fast_assign(
 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,
 249                                  &rule->dest_attr,
 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;
 255            ),
 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))
 260            );
 261
 262TRACE_EVENT(mlx5_fs_del_rule,
 263            TP_PROTO(const struct mlx5_flow_rule *rule),
 264            TP_ARGS(rule),
 265            TP_STRUCT__entry(
 266                __field(const struct mlx5_flow_rule *, rule)
 267                __field(const struct fs_fte *, fte)
 268            ),
 269            TP_fast_assign(
 270                           __entry->rule = rule;
 271                           fs_get_obj(__entry->fte, rule->node.parent);
 272            ),
 273            TP_printk("rule=%p fte=%p\n",
 274                      __entry->rule, __entry->fte)
 275            );
 276#endif
 277
 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>
 283