4 * Copyright 2016 6WIND S.A.
5 * Copyright 2016 Mellanox.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
34 #ifndef RTE_FLOW_DRIVER_H_
35 #define RTE_FLOW_DRIVER_H_
39 * RTE generic flow API (driver side)
41 * This file provides implementation helpers for internal use by PMDs, they
42 * are not intended to be exposed to applications and are not subject to ABI
48 #include "rte_ethdev.h"
56 * Generic flow operations structure implemented and returned by PMDs.
58 * To implement this API, PMDs must handle the RTE_ETH_FILTER_GENERIC filter
59 * type in their .filter_ctrl callback function (struct eth_dev_ops) as well
60 * as the RTE_ETH_FILTER_GET filter operation.
62 * If successful, this operation must result in a pointer to a PMD-specific
63 * struct rte_flow_ops written to the argument address as described below:
67 * // PMD filter_ctrl callback
69 * static const struct rte_flow_ops pmd_flow_ops = { ... };
71 * switch (filter_type) {
72 * case RTE_ETH_FILTER_GENERIC:
73 * if (filter_op != RTE_ETH_FILTER_GET)
75 * *(const void **)arg = &pmd_flow_ops;
81 * See also rte_flow_ops_get().
83 * These callback functions are not supposed to be used by applications
84 * directly, which must rely on the API defined in rte_flow.h.
86 * Public-facing wrapper functions perform a few consistency checks so that
87 * unimplemented (i.e. NULL) callbacks simply return -ENOTSUP. These
88 * callbacks otherwise only differ by their first argument (with port ID
89 * already resolved to a pointer to struct rte_eth_dev).
92 /** See rte_flow_validate(). */
94 (struct rte_eth_dev *,
95 const struct rte_flow_attr *,
96 const struct rte_flow_item [],
97 const struct rte_flow_action [],
98 struct rte_flow_error *);
99 /** See rte_flow_create(). */
100 struct rte_flow *(*create)
101 (struct rte_eth_dev *,
102 const struct rte_flow_attr *,
103 const struct rte_flow_item [],
104 const struct rte_flow_action [],
105 struct rte_flow_error *);
106 /** See rte_flow_destroy(). */
108 (struct rte_eth_dev *,
110 struct rte_flow_error *);
111 /** See rte_flow_flush(). */
113 (struct rte_eth_dev *,
114 struct rte_flow_error *);
115 /** See rte_flow_query(). */
117 (struct rte_eth_dev *,
119 enum rte_flow_action_type,
121 struct rte_flow_error *);
122 /** See rte_flow_isolate(). */
124 (struct rte_eth_dev *,
126 struct rte_flow_error *);
130 * Get generic flow operations structure from a port.
133 * Port identifier to query.
135 * Pointer to flow error structure.
138 * The flow operations structure associated with port_id, NULL in case of
139 * error, in which case rte_errno is set and the error structure contains
140 * additional details.
142 const struct rte_flow_ops *
143 rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error);
149 #endif /* RTE_FLOW_DRIVER_H_ */