Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright 2020 Mellanox Technologies, Ltd
3 : : */
4 : :
5 : : #include <rte_errno.h>
6 : : #include <rte_log.h>
7 : :
8 : : #include <mlx5_glue.h>
9 : : #include <mlx5_devx_cmds.h>
10 : : #include <mlx5_prm.h>
11 : :
12 : : #include "mlx5_regex.h"
13 : : #include "mlx5_regex_utils.h"
14 : :
15 : : int
16 : 0 : mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
17 : : uint32_t rof_size, uint64_t rof_mkey_va)
18 : : {
19 : 0 : uint32_t out[MLX5_ST_SZ_DW(set_regexp_params_out)] = {0};
20 : 0 : uint32_t in[MLX5_ST_SZ_DW(set_regexp_params_in)] = {0};
21 : : int ret;
22 : :
23 : 0 : MLX5_SET(set_regexp_params_in, in, opcode, MLX5_CMD_SET_REGEX_PARAMS);
24 : 0 : MLX5_SET(set_regexp_params_in, in, engine_id, engine);
25 : 0 : MLX5_SET(set_regexp_params_in, in, regexp_params.rof_mkey, rof_mkey);
26 : 0 : MLX5_SET(set_regexp_params_in, in, regexp_params.rof_size, rof_size);
27 [ # # ]: 0 : MLX5_SET64(set_regexp_params_in, in, regexp_params.rof_mkey_va,
28 : : rof_mkey_va);
29 : 0 : MLX5_SET(set_regexp_params_in, in, field_select.rof_mkey, 1);
30 : 0 : ret = mlx5_glue->devx_general_cmd(ctx, in, sizeof(in), out,
31 : : sizeof(out));
32 [ # # ]: 0 : if (ret) {
33 : 0 : DRV_LOG(ERR, "Rules program failed %d", ret);
34 : 0 : rte_errno = errno;
35 : 0 : return -errno;
36 : : }
37 : : return 0;
38 : : }
|