DPDK  21.02.0
rte_flow_classify.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Intel Corporation
3  */
4 
5 #ifndef _RTE_FLOW_CLASSIFY_H_
6 #define _RTE_FLOW_CLASSIFY_H_
7 
46 #include <rte_compat.h>
47 #include <rte_common.h>
48 #include <rte_ethdev.h>
49 #include <rte_ether.h>
50 #include <rte_flow.h>
51 #include <rte_acl.h>
52 #include <rte_table_acl.h>
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 extern int librte_flow_classify_logtype;
59 
60 #define RTE_FLOW_CLASSIFY_LOG(level, ...) \
61  rte_log(RTE_LOG_ ## level, \
62  librte_flow_classify_logtype, \
63  RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,), \
64  __func__, \
65  RTE_FMT_TAIL(__VA_ARGS__,)))
66 
67 #ifndef RTE_FLOW_CLASSIFY_TABLE_MAX
68 #define RTE_FLOW_CLASSIFY_TABLE_MAX 32
69 #endif
70 
72 struct rte_flow_classifier;
73 
75 struct rte_flow_classify_rule;
76 
83 };
84 
95 
96 };
97 
101  const char *name;
102 
106 };
107 
112 
114  void *arg_create;
115 
118 };
119 
122  uint32_t dst_ip;
123  uint32_t dst_ip_mask;
124  uint32_t src_ip;
125  uint32_t src_ip_mask;
126  uint16_t dst_port;
127  uint16_t dst_port_mask;
128  uint16_t src_port;
129  uint16_t src_port_mask;
130  uint8_t proto;
131  uint8_t proto_mask;
132 };
133 
142  void *stats;
143 };
144 
145 struct rte_flow_classify_ipv4_5tuple_stats {
147  uint64_t counter1;
149  struct rte_flow_classify_ipv4_5tuple ipv4_5tuple;
150 };
151 
160 __rte_experimental
161 struct rte_flow_classifier *
163 
172 __rte_experimental
173 int
174 rte_flow_classifier_free(struct rte_flow_classifier *cls);
175 
186 __rte_experimental
187 int
188 rte_flow_classify_table_create(struct rte_flow_classifier *cls,
189  struct rte_flow_classify_table_params *params);
190 
208 __rte_experimental
209 int
210 rte_flow_classify_validate(struct rte_flow_classifier *cls,
211  const struct rte_flow_attr *attr,
212  const struct rte_flow_item pattern[],
213  const struct rte_flow_action actions[],
214  struct rte_flow_error *error);
215 
235 __rte_experimental
236 struct rte_flow_classify_rule *
237 rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls,
238  const struct rte_flow_attr *attr,
239  const struct rte_flow_item pattern[],
240  const struct rte_flow_action actions[],
241  int *key_found,
242  struct rte_flow_error *error);
243 
254 __rte_experimental
255 int
256 rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls,
257  struct rte_flow_classify_rule *rule);
258 
276 __rte_experimental
277 int
278 rte_flow_classifier_query(struct rte_flow_classifier *cls,
279  struct rte_mbuf **pkts,
280  const uint16_t nb_pkts,
281  struct rte_flow_classify_rule *rule,
282  struct rte_flow_classify_stats *stats);
283 
284 #ifdef __cplusplus
285 }
286 #endif
287 
288 #endif /* _RTE_FLOW_CLASSIFY_H_ */
__rte_experimental int rte_flow_classify_validate(struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
__rte_experimental struct rte_flow_classify_rule * rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], int *key_found, struct rte_flow_error *error)
__rte_experimental int rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls, struct rte_flow_classify_rule *rule)
rte_flow_classify_table_type
__rte_experimental int rte_flow_classify_table_create(struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params)
enum rte_flow_classify_table_type type
__rte_experimental struct rte_flow_classifier * rte_flow_classifier_create(struct rte_flow_classifier_params *params)
__rte_experimental int rte_flow_classifier_free(struct rte_flow_classifier *cls)
rte_flow_classify_rule_type
__rte_experimental int rte_flow_classifier_query(struct rte_flow_classifier *cls, struct rte_mbuf **pkts, const uint16_t nb_pkts, struct rte_flow_classify_rule *rule, struct rte_flow_classify_stats *stats)