DPDK  17.11.10
rte_flow_classify.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2017 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _RTE_FLOW_CLASSIFY_H_
35 #define _RTE_FLOW_CLASSIFY_H_
36 
73 #include <rte_common.h>
74 #include <rte_ethdev.h>
75 #include <rte_ether.h>
76 #include <rte_flow.h>
77 #include <rte_acl.h>
78 #include <rte_table_acl.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
84 extern int librte_flow_classify_logtype;
85 
86 #define RTE_FLOW_CLASSIFY_LOG(level, ...) \
87  rte_log(RTE_LOG_ ## level, \
88  librte_flow_classify_logtype, \
89  RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,), \
90  __func__, \
91  RTE_FMT_TAIL(__VA_ARGS__,)))
92 
94 struct rte_flow_classifier;
95 
97 struct rte_flow_classify_rule;
98 
105 };
106 
113 };
114 
119 #define RTE_FLOW_CLASSIFY_TABLE_MAX 64
120 
124  const char *name;
125 
129 
132 };
133 
138 
140  void *arg_create;
141 };
142 
145  uint32_t dst_ip;
146  uint32_t dst_ip_mask;
147  uint32_t src_ip;
148  uint32_t src_ip_mask;
149  uint16_t dst_port;
150  uint16_t dst_port_mask;
151  uint16_t src_port;
152  uint16_t src_port_mask;
153  uint8_t proto;
154  uint8_t proto_mask;
155 };
156 
165  void *stats;
166 };
167 
168 struct rte_flow_classify_ipv4_5tuple_stats {
170  uint64_t counter1;
172  struct rte_flow_classify_ipv4_5tuple ipv4_5tuple;
173 };
174 
183 struct rte_flow_classifier *
185 
194 int
195 rte_flow_classifier_free(struct rte_flow_classifier *cls);
196 
210 int
211 rte_flow_classify_table_create(struct rte_flow_classifier *cls,
212  struct rte_flow_classify_table_params *params,
213  uint32_t *table_id);
214 
236 struct rte_flow_classify_rule *
237 rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls,
238  uint32_t table_id,
239  int *key_found,
240  const struct rte_flow_attr *attr,
241  const struct rte_flow_item pattern[],
242  const struct rte_flow_action actions[],
243  struct rte_flow_error *error);
244 
257 int
258 rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls,
259  uint32_t table_id,
260  struct rte_flow_classify_rule *rule);
261 
281 int
282 rte_flow_classifier_query(struct rte_flow_classifier *cls,
283  uint32_t table_id,
284  struct rte_mbuf **pkts,
285  const uint16_t nb_pkts,
286  struct rte_flow_classify_rule *rule,
287  struct rte_flow_classify_stats *stats);
288 
289 #ifdef __cplusplus
290 }
291 #endif
292 
293 #endif /* _RTE_FLOW_CLASSIFY_H_ */
struct rte_flow_classifier * rte_flow_classifier_create(struct rte_flow_classifier_params *params)
int rte_flow_classify_table_create(struct rte_flow_classifier *cls, struct rte_flow_classify_table_params *params, uint32_t *table_id)
rte_flow_classify_table_type
enum rte_flow_classify_table_type type
int rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls, uint32_t table_id, struct rte_flow_classify_rule *rule)
rte_flow_classify_rule_type
struct rte_flow_classify_rule * rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls, uint32_t table_id, int *key_found, const struct rte_flow_attr *attr, const struct rte_flow_item pattern[], const struct rte_flow_action actions[], struct rte_flow_error *error)
int rte_flow_classifier_query(struct rte_flow_classifier *cls, uint32_t table_id, struct rte_mbuf **pkts, const uint16_t nb_pkts, struct rte_flow_classify_rule *rule, struct rte_flow_classify_stats *stats)
int rte_flow_classifier_free(struct rte_flow_classifier *cls)