Commit d4a605e9 authored by Yevgeny Kliteynik's avatar Yevgeny Kliteynik Committed by Saeed Mahameed

net/mlx5: HWS, added debug dump and internal headers

Added debug dump of the existing HWS state,
and all the required internal definitions.

To dump the HWS state, cat the following debugfs node:

  cat /sys/kernel/debug/mlx5/<PCI>/steering/fdb/ctx_<ctx_id>
Reviewed-by: default avatarHamdan Agbariya <hamdani@nvidia.com>
Signed-off-by: default avatarYevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent 2111bb97
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */
#ifndef MLX5HWS_DEBUG_H_
#define MLX5HWS_DEBUG_H_
#define HWS_DEBUG_FORMAT_VERSION "1.0"
#define HWS_PTR_TO_ID(p) ((u64)(uintptr_t)(p) & 0xFFFFFFFFULL)
enum mlx5hws_debug_res_type {
MLX5HWS_DEBUG_RES_TYPE_CONTEXT = 4000,
MLX5HWS_DEBUG_RES_TYPE_CONTEXT_ATTR = 4001,
MLX5HWS_DEBUG_RES_TYPE_CONTEXT_CAPS = 4002,
MLX5HWS_DEBUG_RES_TYPE_CONTEXT_SEND_ENGINE = 4003,
MLX5HWS_DEBUG_RES_TYPE_CONTEXT_SEND_RING = 4004,
MLX5HWS_DEBUG_RES_TYPE_CONTEXT_STC = 4005,
MLX5HWS_DEBUG_RES_TYPE_TABLE = 4100,
MLX5HWS_DEBUG_RES_TYPE_MATCHER = 4200,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_ATTR = 4201,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_MATCH_TEMPLATE = 4202,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_MATCH_DEFINER = 4203,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_ACTION_TEMPLATE = 4204,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_HASH_DEFINER = 4205,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_RANGE_DEFINER = 4206,
MLX5HWS_DEBUG_RES_TYPE_MATCHER_TEMPLATE_COMPARE_MATCH_DEFINER = 4207,
};
static inline u64
mlx5hws_debug_icm_to_idx(u64 icm_addr)
{
return (icm_addr >> 6) & 0xffffffff;
}
void mlx5hws_debug_init_dump(struct mlx5hws_context *ctx);
void mlx5hws_debug_uninit_dump(struct mlx5hws_context *ctx);
#endif /* MLX5HWS_DEBUG_H_ */
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
/* Copyright (c) 2024 NVIDIA Corporation & Affiliates */
#ifndef MLX5HWS_INTERNAL_H_
#define MLX5HWS_INTERNAL_H_
#include <linux/mlx5/transobj.h>
#include "../dr_types.h"
#include "mlx5hws_prm.h"
#include "mlx5hws.h"
#include "mlx5hws_pool.h"
#include "mlx5hws_vport.h"
#include "mlx5hws_context.h"
#include "mlx5hws_table.h"
#include "mlx5hws_send.h"
#include "mlx5hws_rule.h"
#include "mlx5hws_cmd.h"
#include "mlx5hws_action.h"
#include "mlx5hws_definer.h"
#include "mlx5hws_matcher.h"
#include "mlx5hws_debug.h"
#include "mlx5hws_pat_arg.h"
#include "mlx5hws_bwc.h"
#include "mlx5hws_bwc_complex.h"
#define W_SIZE 2
#define DW_SIZE 4
#define BITS_IN_BYTE 8
#define BITS_IN_DW (BITS_IN_BYTE * DW_SIZE)
#define IS_BIT_SET(_value, _bit) ((_value) & (1ULL << (_bit)))
#define mlx5hws_err(ctx, arg...) mlx5_core_err((ctx)->mdev, ##arg)
#define mlx5hws_info(ctx, arg...) mlx5_core_info((ctx)->mdev, ##arg)
#define mlx5hws_dbg(ctx, arg...) mlx5_core_dbg((ctx)->mdev, ##arg)
#define MLX5HWS_TABLE_TYPE_BASE 2
#define MLX5HWS_ACTION_STE_IDX_ANY 0
static inline bool is_mem_zero(const u8 *mem, size_t size)
{
if (unlikely(!size)) {
pr_warn("HWS: invalid buffer of size 0 in %s\n", __func__);
return true;
}
return (*mem == 0) && memcmp(mem, mem + 1, size - 1) == 0;
}
static inline unsigned long align(unsigned long val, unsigned long align)
{
return (val + align - 1) & ~(align - 1);
}
#endif /* MLX5HWS_INTERNAL_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment