1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2016 6WIND S.A.
3 * Copyright 2016 Mellanox Technologies, Ltd
6 #ifndef RTE_FLOW_DRIVER_H_
7 #define RTE_FLOW_DRIVER_H_
11 * RTE generic flow API (driver side)
13 * This file provides implementation helpers for internal use by PMDs, they
14 * are not intended to be exposed to applications and are not subject to ABI
20 #include "rte_ethdev.h"
21 #include "rte_ethdev_driver.h"
29 * Generic flow operations structure implemented and returned by PMDs.
31 * To implement this API, PMDs must handle the RTE_ETH_FILTER_GENERIC filter
32 * type in their .filter_ctrl callback function (struct eth_dev_ops) as well
33 * as the RTE_ETH_FILTER_GET filter operation.
35 * If successful, this operation must result in a pointer to a PMD-specific
36 * struct rte_flow_ops written to the argument address as described below:
40 * // PMD filter_ctrl callback
42 * static const struct rte_flow_ops pmd_flow_ops = { ... };
44 * switch (filter_type) {
45 * case RTE_ETH_FILTER_GENERIC:
46 * if (filter_op != RTE_ETH_FILTER_GET)
48 * *(const void **)arg = &pmd_flow_ops;
54 * See also rte_flow_ops_get().
56 * These callback functions are not supposed to be used by applications
57 * directly, which must rely on the API defined in rte_flow.h.
59 * Public-facing wrapper functions perform a few consistency checks so that
60 * unimplemented (i.e. NULL) callbacks simply return -ENOTSUP. These
61 * callbacks otherwise only differ by their first argument (with port ID
62 * already resolved to a pointer to struct rte_eth_dev).
65 /** See rte_flow_validate(). */
67 (struct rte_eth_dev *,
68 const struct rte_flow_attr *,
69 const struct rte_flow_item [],
70 const struct rte_flow_action [],
71 struct rte_flow_error *);
72 /** See rte_flow_create(). */
73 struct rte_flow *(*create)
74 (struct rte_eth_dev *,
75 const struct rte_flow_attr *,
76 const struct rte_flow_item [],
77 const struct rte_flow_action [],
78 struct rte_flow_error *);
79 /** See rte_flow_destroy(). */
81 (struct rte_eth_dev *,
83 struct rte_flow_error *);
84 /** See rte_flow_flush(). */
86 (struct rte_eth_dev *,
87 struct rte_flow_error *);
88 /** See rte_flow_query(). */
90 (struct rte_eth_dev *,
92 const struct rte_flow_action *,
94 struct rte_flow_error *);
95 /** See rte_flow_isolate(). */
97 (struct rte_eth_dev *,
99 struct rte_flow_error *);
100 /** See rte_flow_dev_dump(). */
102 (struct rte_eth_dev *dev,
104 struct rte_flow_error *error);
105 /** See rte_flow_get_aged_flows() */
106 int (*get_aged_flows)
107 (struct rte_eth_dev *dev,
109 uint32_t nb_contexts,
110 struct rte_flow_error *err);
111 /** See rte_flow_shared_action_create() */
112 struct rte_flow_shared_action *(*shared_action_create)
113 (struct rte_eth_dev *dev,
114 const struct rte_flow_shared_action_conf *conf,
115 const struct rte_flow_action *action,
116 struct rte_flow_error *error);
117 /** See rte_flow_shared_action_destroy() */
118 int (*shared_action_destroy)
119 (struct rte_eth_dev *dev,
120 struct rte_flow_shared_action *shared_action,
121 struct rte_flow_error *error);
122 /** See rte_flow_shared_action_update() */
123 int (*shared_action_update)
124 (struct rte_eth_dev *dev,
125 struct rte_flow_shared_action *shared_action,
126 const struct rte_flow_action *update,
127 struct rte_flow_error *error);
128 /** See rte_flow_shared_action_query() */
129 int (*shared_action_query)
130 (struct rte_eth_dev *dev,
131 const struct rte_flow_shared_action *shared_action,
133 struct rte_flow_error *error);
137 * Get generic flow operations structure from a port.
140 * Port identifier to query.
142 * Pointer to flow error structure.
145 * The flow operations structure associated with port_id, NULL in case of
146 * error, in which case rte_errno is set and the error structure contains
147 * additional details.
149 const struct rte_flow_ops *
150 rte_flow_ops_get(uint16_t port_id, struct rte_flow_error *error);
156 #endif /* RTE_FLOW_DRIVER_H_ */