1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
9 #include <mlx5_devx_cmds.h>
12 #include "mlx5_regex.h"
13 #include "mlx5_regex_utils.h"
16 mlx5_devx_regex_register_write(struct ibv_context *ctx, int engine_id,
17 uint32_t addr, uint32_t data)
19 uint32_t out[MLX5_ST_SZ_DW(set_regexp_register_out)] = {0};
20 uint32_t in[MLX5_ST_SZ_DW(set_regexp_register_in)] = {0};
23 MLX5_SET(set_regexp_register_in, in, opcode,
24 MLX5_CMD_SET_REGEX_REGISTERS);
25 MLX5_SET(set_regexp_register_in, in, engine_id, engine_id);
26 MLX5_SET(set_regexp_register_in, in, register_address, addr);
27 MLX5_SET(set_regexp_register_in, in, register_data, data);
29 ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out,
32 DRV_LOG(ERR, "Set regexp register failed %d", ret);
40 mlx5_devx_regex_register_read(struct ibv_context *ctx, int engine_id,
41 uint32_t addr, uint32_t *data)
43 uint32_t out[MLX5_ST_SZ_DW(query_regexp_register_out)] = {0};
44 uint32_t in[MLX5_ST_SZ_DW(query_regexp_register_in)] = {0};
47 MLX5_SET(query_regexp_register_in, in, opcode,
48 MLX5_CMD_QUERY_REGEX_REGISTERS);
49 MLX5_SET(query_regexp_register_in, in, engine_id, engine_id);
50 MLX5_SET(query_regexp_register_in, in, register_address, addr);
52 ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out,
55 DRV_LOG(ERR, "Query regexp register failed %d", ret);
59 *data = MLX5_GET(query_regexp_register_out, out, register_data);