1
2
3
4
5#ifndef MLX5_REGEX_H
6#define MLX5_REGEX_H
7
8#include <rte_regexdev.h>
9
10#include <infiniband/verbs.h>
11#include <infiniband/mlx5dv.h>
12
13#include <mlx5_common.h>
14#include <mlx5_common_mr.h>
15#include <mlx5_common_devx.h>
16
17#include "mlx5_rxp.h"
18#include "mlx5_regex_utils.h"
19
20struct mlx5_regex_hw_qp {
21 uint16_t log_nb_desc;
22 struct mlx5_devx_qp qp_obj;
23 size_t pi, db_pi;
24 size_t ci;
25 uint32_t qpn;
26};
27
28struct mlx5_regex_cq {
29 uint32_t log_nb_desc;
30 struct mlx5_devx_cq cq_obj;
31 size_t ci;
32};
33
34struct mlx5_regex_qp {
35 uint32_t flags;
36 uint32_t nb_desc;
37 struct mlx5_regex_hw_qp *qps;
38 uint16_t nb_obj;
39 struct mlx5_regex_cq cq;
40 uint32_t free_qps;
41 struct mlx5_regex_job *jobs;
42 struct ibv_mr *metadata;
43 struct ibv_mr *outputs;
44 struct ibv_mr *imkey_addr;
45 size_t ci, pi;
46 struct mlx5_mr_ctrl mr_ctrl;
47};
48
49struct mlx5_regex_priv {
50 TAILQ_ENTRY(mlx5_regex_priv) next;
51 struct mlx5_common_device *cdev;
52 struct rte_regexdev *regexdev;
53 uint16_t nb_queues;
54 struct mlx5_regex_qp *qps;
55 uint16_t nb_max_matches;
56 enum mlx5_rxp_program_mode prog_mode;
57 uint32_t nb_engines;
58 struct mlx5_uar uar;
59 uint8_t is_bf2;
60 uint8_t has_umr;
61 uint32_t mmo_regex_qp_cap:1;
62 uint32_t mmo_regex_sq_cap:1;
63};
64
65
66int mlx5_regex_start(struct rte_regexdev *dev);
67int mlx5_regex_stop(struct rte_regexdev *dev);
68int mlx5_regex_close(struct rte_regexdev *dev);
69
70
71int mlx5_regex_info_get(struct rte_regexdev *dev,
72 struct rte_regexdev_info *info);
73int mlx5_regex_configure(struct rte_regexdev *dev,
74 const struct rte_regexdev_config *cfg);
75int mlx5_regex_rules_db_import(struct rte_regexdev *dev,
76 const char *rule_db, uint32_t rule_db_len);
77
78
79int mlx5_devx_regex_rules_program(void *ctx, uint8_t engine, uint32_t rof_mkey,
80 uint32_t rof_size, uint64_t db_mkey_offset);
81
82
83int mlx5_regex_qp_setup(struct rte_regexdev *dev, uint16_t qp_ind,
84 const struct rte_regexdev_qp_conf *cfg);
85void mlx5_regex_clean_ctrl(struct rte_regexdev *dev);
86
87
88int mlx5_regexdev_setup_fastpath(struct mlx5_regex_priv *priv, uint32_t qp_id);
89void mlx5_regexdev_teardown_fastpath(struct mlx5_regex_priv *priv,
90 uint32_t qp_id);
91uint16_t mlx5_regexdev_enqueue(struct rte_regexdev *dev, uint16_t qp_id,
92 struct rte_regex_ops **ops, uint16_t nb_ops);
93uint16_t mlx5_regexdev_dequeue(struct rte_regexdev *dev, uint16_t qp_id,
94 struct rte_regex_ops **ops, uint16_t nb_ops);
95uint16_t mlx5_regexdev_enqueue_gga(struct rte_regexdev *dev, uint16_t qp_id,
96 struct rte_regex_ops **ops, uint16_t nb_ops);
97#endif
98