1
2
3
4
5#ifndef _RTE_REGEX_CORE_H_
6#define _RTE_REGEX_CORE_H_
7
8
9
10
11
12
13
14
15
16
17
18
19
20struct rte_regexdev;
21
22typedef int (*regexdev_info_get_t)(struct rte_regexdev *dev,
23 struct rte_regexdev_info *info);
24
25
26typedef int (*regexdev_configure_t)(struct rte_regexdev *dev,
27 const struct rte_regexdev_config *cfg);
28
29
30typedef int (*regexdev_qp_setup_t)(struct rte_regexdev *dev, uint16_t id,
31 const struct rte_regexdev_qp_conf *qp_conf);
32
33
34typedef int (*regexdev_start_t)(struct rte_regexdev *dev);
35
36
37typedef int (*regexdev_stop_t)(struct rte_regexdev *dev);
38
39
40typedef int (*regexdev_close_t)(struct rte_regexdev *dev);
41
42
43typedef int (*regexdev_attr_get_t)(struct rte_regexdev *dev,
44 enum rte_regexdev_attr_id id,
45 void *value);
46
47
48typedef int (*regexdev_attr_set_t)(struct rte_regexdev *dev,
49 enum rte_regexdev_attr_id id,
50 const void *value);
51
52
53typedef int (*regexdev_rule_db_update_t)(struct rte_regexdev *dev,
54 const struct rte_regexdev_rule *rules,
55 uint16_t nb_rules);
56
57
58typedef int (*regexdev_rule_db_compile_activate_t)(struct rte_regexdev *dev);
59
60
61typedef int (*regexdev_rule_db_import_t)(struct rte_regexdev *dev,
62 const char *rule_db,
63 uint32_t rule_db_len);
64
65
66typedef int (*regexdev_rule_db_export_t)(struct rte_regexdev *dev,
67 char *rule_db);
68
69
70typedef int (*regexdev_xstats_names_get_t)(struct rte_regexdev *dev,
71 struct rte_regexdev_xstats_map
72 *xstats_map);
73
74
75typedef int (*regexdev_xstats_get_t)(struct rte_regexdev *dev,
76 const uint16_t *ids, uint64_t *values,
77 uint16_t nb_values);
78
79
80typedef int (*regexdev_xstats_by_name_get_t)(struct rte_regexdev *dev,
81 const char *name, uint16_t *id,
82 uint64_t *value);
83
84
85typedef int (*regexdev_xstats_reset_t)(struct rte_regexdev *dev,
86 const uint16_t *ids,
87 uint16_t nb_ids);
88
89
90typedef int (*regexdev_selftest_t)(struct rte_regexdev *dev);
91
92
93typedef int (*regexdev_dump_t)(struct rte_regexdev *dev, FILE *f);
94
95
96typedef uint16_t (*regexdev_enqueue_t)(struct rte_regexdev *dev, uint16_t qp_id,
97 struct rte_regex_ops **ops,
98 uint16_t nb_ops);
99
100
101typedef uint16_t (*regexdev_dequeue_t)(struct rte_regexdev *dev, uint16_t qp_id,
102 struct rte_regex_ops **ops,
103 uint16_t nb_ops);
104
105
106
107
108
109struct rte_regexdev_ops {
110 regexdev_info_get_t dev_info_get;
111 regexdev_configure_t dev_configure;
112 regexdev_qp_setup_t dev_qp_setup;
113 regexdev_start_t dev_start;
114 regexdev_stop_t dev_stop;
115 regexdev_close_t dev_close;
116 regexdev_attr_get_t dev_attr_get;
117 regexdev_attr_set_t dev_attr_set;
118 regexdev_rule_db_update_t dev_rule_db_update;
119 regexdev_rule_db_compile_activate_t dev_rule_db_compile_activate;
120 regexdev_rule_db_import_t dev_db_import;
121 regexdev_rule_db_export_t dev_db_export;
122 regexdev_xstats_names_get_t dev_xstats_names_get;
123 regexdev_xstats_get_t dev_xstats_get;
124 regexdev_xstats_by_name_get_t dev_xstats_by_name_get;
125 regexdev_xstats_reset_t dev_xstats_reset;
126 regexdev_selftest_t dev_selftest;
127 regexdev_dump_t dev_dump;
128};
129
130
131
132
133enum rte_regexdev_state {
134 RTE_REGEXDEV_UNUSED = 0,
135 RTE_REGEXDEV_REGISTERED,
136
137 RTE_REGEXDEV_READY,
138
139};
140
141
142
143
144
145
146
147
148struct rte_regexdev_data {
149 void *dev_private;
150 char dev_name[RTE_REGEXDEV_NAME_MAX_LEN];
151 uint16_t dev_id;
152 struct rte_regexdev_config dev_conf;
153 uint8_t dev_started : 1;
154} __rte_cache_aligned;
155
156
157
158
159
160
161
162
163
164
165
166struct rte_regexdev {
167 regexdev_enqueue_t enqueue;
168 regexdev_dequeue_t dequeue;
169 const struct rte_regexdev_ops *dev_ops;
170
171 struct rte_device *device;
172 enum rte_regexdev_state state;
173 struct rte_regexdev_data *data;
174} __rte_cache_aligned;
175
176
177
178
179
180
181extern struct rte_regexdev rte_regex_devices[];
182
183#endif
184