DPDK  17.05.2
rte_flow_driver.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright 2016 6WIND S.A.
5  * Copyright 2016 Mellanox.
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 6WIND S.A. 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_DRIVER_H_
35 #define RTE_FLOW_DRIVER_H_
36 
46 #include <stdint.h>
47 
48 #include <rte_errno.h>
49 #include "rte_ethdev.h"
50 #include "rte_flow.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
92 struct rte_flow_ops {
94  int (*validate)
95  (struct rte_eth_dev *,
96  const struct rte_flow_attr *,
97  const struct rte_flow_item [],
98  const struct rte_flow_action [],
99  struct rte_flow_error *);
101  struct rte_flow *(*create)
102  (struct rte_eth_dev *,
103  const struct rte_flow_attr *,
104  const struct rte_flow_item [],
105  const struct rte_flow_action [],
106  struct rte_flow_error *);
108  int (*destroy)
109  (struct rte_eth_dev *,
110  struct rte_flow *,
111  struct rte_flow_error *);
113  int (*flush)
114  (struct rte_eth_dev *,
115  struct rte_flow_error *);
117  int (*query)
118  (struct rte_eth_dev *,
119  struct rte_flow *,
121  void *,
122  struct rte_flow_error *);
123 };
124 
144 static inline int
146  int code,
148  const void *cause,
149  const char *message)
150 {
151  if (error) {
152  *error = (struct rte_flow_error){
153  .type = type,
154  .cause = cause,
155  .message = message,
156  };
157  }
158  rte_errno = code;
159  return code;
160 }
161 
175 const struct rte_flow_ops *
176 rte_flow_ops_get(uint8_t port_id, struct rte_flow_error *error);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* RTE_FLOW_DRIVER_H_ */