DPDK  17.11.0
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_ethdev.h>
74 #include <rte_ether.h>
75 #include <rte_flow.h>
76 #include <rte_acl.h>
77 #include <rte_table_acl.h>
78 
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 extern int librte_flow_classify_logtype;
84 
85 #define RTE_FLOW_CLASSIFY_LOG(level, fmt, args...) \
86 rte_log(RTE_LOG_ ## level, librte_flow_classify_logtype, "%s(): " fmt, \
87  __func__, ## args)
88 
90 struct rte_flow_classifier;
91 
93 struct rte_flow_classify_rule;
94 
101 };
102 
109 };
110 
115 #define RTE_FLOW_CLASSIFY_TABLE_MAX 64
116 
120  const char *name;
121 
125 
128 };
129 
134 
136  void *arg_create;
137 };
138 
141  uint32_t dst_ip;
142  uint32_t dst_ip_mask;
143  uint32_t src_ip;
144  uint32_t src_ip_mask;
145  uint16_t dst_port;
146  uint16_t dst_port_mask;
147  uint16_t src_port;
148  uint16_t src_port_mask;
149  uint8_t proto;
150  uint8_t proto_mask;
151 };
152 
161  void *stats;
162 };
163 
164 struct rte_flow_classify_ipv4_5tuple_stats {
166  uint64_t counter1;
168  struct rte_flow_classify_ipv4_5tuple ipv4_5tuple;
169 };
170 
179 struct rte_flow_classifier *
181 
190 int
191 rte_flow_classifier_free(struct rte_flow_classifier *cls);
192 
206 int
207 rte_flow_classify_table_create(struct rte_flow_classifier *cls,
208  struct rte_flow_classify_table_params *params,
209  uint32_t *table_id);
210 
232 struct rte_flow_classify_rule *
233 rte_flow_classify_table_entry_add(struct rte_flow_classifier *cls,
234  uint32_t table_id,
235  int *key_found,
236  const struct rte_flow_attr *attr,
237  const struct rte_flow_item pattern[],
238  const struct rte_flow_action actions[],
239  struct rte_flow_error *error);
240 
253 int
254 rte_flow_classify_table_entry_delete(struct rte_flow_classifier *cls,
255  uint32_t table_id,
256  struct rte_flow_classify_rule *rule);
257 
277 int
278 rte_flow_classifier_query(struct rte_flow_classifier *cls,
279  uint32_t table_id,
280  struct rte_mbuf **pkts,
281  const uint16_t nb_pkts,
282  struct rte_flow_classify_rule *rule,
283  struct rte_flow_classify_stats *stats);
284 
285 #ifdef __cplusplus
286 }
287 #endif
288 
289 #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)