DPDK  22.11.7
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_flow.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 extern int librte_flow_classify_logtype;
55 
56 #define RTE_FLOW_CLASSIFY_LOG(level, ...) \
57  rte_log(RTE_LOG_ ## level, \
58  librte_flow_classify_logtype, \
59  RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,), \
60  __func__, \
61  RTE_FMT_TAIL(__VA_ARGS__,)))
62 
63 #ifndef RTE_FLOW_CLASSIFY_TABLE_MAX
64 #define RTE_FLOW_CLASSIFY_TABLE_MAX 32
65 #endif
66 
68 struct rte_flow_classifier;
69 
71 struct rte_flow_classify_rule;
72 
79 };
80 
91 
92 };
93 
97  const char *name;
98 
102 };
103 
108 
110  void *arg_create;
111 
114 };
115 
118  uint32_t dst_ip;
119  uint32_t dst_ip_mask;
120  uint32_t src_ip;
121  uint32_t src_ip_mask;
122  uint16_t dst_port;
123  uint16_t dst_port_mask;
124  uint16_t src_port;
125  uint16_t src_port_mask;
126  uint8_t proto;
127  uint8_t proto_mask;
128 };
129 
138  void *stats;
139 };
140 
141 struct rte_flow_classify_ipv4_5tuple_stats {
143  uint64_t counter1;
145  struct rte_flow_classify_ipv4_5tuple ipv4_5tuple;
146 };
147 
156 __rte_experimental
157 struct rte_flow_classifier *
159 
168 __rte_experimental
169 int
170 rte_flow_classifier_free(struct rte_flow_classifier *cls);
171 
182 __rte_experimental
183 int
184 rte_flow_classify_table_create(struct rte_flow_classifier *cls,
185  struct rte_flow_classify_table_params *params);
186 
204 __rte_experimental
205 int
206 rte_flow_classify_validate(struct rte_flow_classifier *cls,
207  const struct rte_flow_attr *attr,
208  const struct rte_flow_item pattern[],
209  const struct rte_flow_action actions[],
210  struct rte_flow_error *error);
211 
231 __rte_experimental
232 struct rte_flow_classify_rule *
233 rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls,
234  const struct rte_flow_attr *attr,
235  const struct rte_flow_item pattern[],
236  const struct rte_flow_action actions[],
237  int *key_found,
238  struct rte_flow_error *error);
239 
250 __rte_experimental
251 int
252 rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls,
253  struct rte_flow_classify_rule *rule);
254 
272 __rte_experimental
273 int
274 rte_flow_classifier_query(struct rte_flow_classifier *cls,
275  struct rte_mbuf **pkts,
276  const uint16_t nb_pkts,
277  struct rte_flow_classify_rule *rule,
278  struct rte_flow_classify_stats *stats);
279 
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif /* _RTE_FLOW_CLASSIFY_H_ */
rte_flow_classify_ipv4_5tuple::src_port_mask
uint16_t src_port_mask
Definition: rte_flow_classify.h:125
rte_flow_classify_ipv4_5tuple::src_ip
uint32_t src_ip
Definition: rte_flow_classify.h:120
rte_flow_classifier_params
Definition: rte_flow_classify.h:95
rte_flow_classify_ipv4_5tuple::src_ip_mask
uint32_t src_ip_mask
Definition: rte_flow_classify.h:121
rte_flow_classifier_params::name
const char * name
Definition: rte_flow_classify.h:97
rte_flow_classify_table_params::type
enum rte_flow_classify_table_type type
Definition: rte_flow_classify.h:113
rte_flow_classify_table_entry_add
__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_flow_classify_validate
__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_FLOW_CLASSIFY_TABLE_ACL_QINQ_IP4_5TUPLE
@ RTE_FLOW_CLASSIFY_TABLE_ACL_QINQ_IP4_5TUPLE
Definition: rte_flow_classify.h:90
rte_flow_classify_table_params
Definition: rte_flow_classify.h:105
rte_flow_classify_ipv4_5tuple::dst_port_mask
uint16_t dst_port_mask
Definition: rte_flow_classify.h:123
rte_flow_classify_ipv4_5tuple::dst_port
uint16_t dst_port
Definition: rte_flow_classify.h:122
rte_flow_classify_ipv4_5tuple::proto
uint8_t proto
Definition: rte_flow_classify.h:126
rte_flow_item
Definition: rte_flow.h:1912
rte_flow_classify_table_entry_delete
__rte_experimental int rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls, struct rte_flow_classify_rule *rule)
RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_5TUPLE
@ RTE_FLOW_CLASSIFY_RULE_TYPE_IPV4_5TUPLE
Definition: rte_flow_classify.h:78
rte_flow_classify_ipv4_5tuple::dst_ip_mask
uint32_t dst_ip_mask
Definition: rte_flow_classify.h:119
RTE_FLOW_CLASSIFY_TABLE_TYPE_NONE
@ RTE_FLOW_CLASSIFY_TABLE_TYPE_NONE
Definition: rte_flow_classify.h:84
rte_flow_classify_ipv4_5tuple::dst_ip
uint32_t dst_ip
Definition: rte_flow_classify.h:118
rte_mbuf
Definition: rte_mbuf_core.h:465
rte_flow_classify_table_type
rte_flow_classify_table_type
Definition: rte_flow_classify.h:82
rte_flow_classify_table_create
__rte_experimental int rte_flow_classify_table_create(struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params)
rte_flow_classifier_create
__rte_experimental struct rte_flow_classifier * rte_flow_classifier_create(struct rte_flow_classifier_params *params)
rte_flow.h
rte_flow_classifier_params::socket_id
int socket_id
Definition: rte_flow_classify.h:101
RTE_FLOW_CLASSIFY_RULE_TYPE_NONE
@ RTE_FLOW_CLASSIFY_RULE_TYPE_NONE
Definition: rte_flow_classify.h:76
rte_flow_classify_stats
Definition: rte_flow_classify.h:137
RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE
@ RTE_FLOW_CLASSIFY_TABLE_ACL_IP4_5TUPLE
Definition: rte_flow_classify.h:86
rte_flow_classify_rule_type
rte_flow_classify_rule_type
Definition: rte_flow_classify.h:74
rte_flow_classify_table_params::ops
struct rte_table_ops * ops
Definition: rte_flow_classify.h:107
rte_common.h
rte_table_ops
Definition: rte_table.h:257
rte_flow_classifier_free
__rte_experimental int rte_flow_classifier_free(struct rte_flow_classifier *cls)
rte_flow_attr
Definition: rte_flow.h:88
rte_flow_classify_ipv4_5tuple::proto_mask
uint8_t proto_mask
Definition: rte_flow_classify.h:127
rte_flow_error
Definition: rte_flow.h:3761
rte_flow_classifier_query
__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)
rte_flow_classify_ipv4_5tuple::src_port
uint16_t src_port
Definition: rte_flow_classify.h:124
rte_flow_action
Definition: rte_flow.h:3674
rte_flow_classify_table_params::arg_create
void * arg_create
Definition: rte_flow_classify.h:110
RTE_FLOW_CLASSIFY_TABLE_ACL_VLAN_IP4_5TUPLE
@ RTE_FLOW_CLASSIFY_TABLE_ACL_VLAN_IP4_5TUPLE
Definition: rte_flow_classify.h:88
rte_flow_classify_ipv4_5tuple
Definition: rte_flow_classify.h:117