1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2020 Mellanox Technologies, Ltd
5 #include "mlx5_flow_os.h"
6 #include "mlx5_win_ext.h"
9 * Verify the @p attributes will be correctly understood by the NIC and store
10 * them in the @p flow if everything is correct.
13 * Pointer to dev struct.
14 * @param[in] attributes
15 * Pointer to flow attributes
17 * This flow rule is created by request external to PMD.
19 * Pointer to error structure.
22 * - 0 on success and non root table (not a valid option for Windows yet).
23 * - 1 on success and root table.
24 * - a negative errno value otherwise and rte_errno is set.
27 mlx5_flow_os_validate_flow_attributes(struct rte_eth_dev *dev,
28 const struct rte_flow_attr *attributes,
30 struct rte_flow_error *error)
35 RTE_SET_USED(external);
36 if (attributes->group)
37 return rte_flow_error_set(error, ENOTSUP,
38 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
40 "groups are not supported");
41 if (attributes->priority)
42 return rte_flow_error_set(error, ENOTSUP,
43 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
45 "priorities are not supported");
46 if (attributes->transfer)
47 return rte_flow_error_set(error, ENOTSUP,
48 RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER,
50 "transfer not supported");
51 if (!(attributes->ingress))
52 return rte_flow_error_set(error, ENOTSUP,
53 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
54 NULL, "must specify ingress only");
59 * Create flow matcher in a flow table.
62 * Pointer to relevant device context.
64 * Pointer to relevant attributes.
66 * Pointer to table object.
68 * Pointer to a valid flow matcher object on success, NULL otherwise.
71 * 0 on success, or errno on failure.
74 mlx5_flow_os_create_flow_matcher(void *ctx,
88 * Destroy flow matcher.
91 * Pointer to matcher object to destroy.
94 * 0 on success, or the value of errno on failure.
97 mlx5_flow_os_destroy_flow_matcher(void *matcher)
99 RTE_SET_USED(matcher);
105 * Create flow action: dest_devx_tir
108 * Pointer to DevX tir object
110 * Pointer to a valid action on success, NULL otherwise.
113 * 0 on success, or errno on failure.
116 mlx5_flow_os_create_flow_action_dest_devx_tir(struct mlx5_devx_obj *tir,
126 * Destroy flow action.
129 * Pointer to action object to destroy.
132 * 0 on success, or the value of errno on failure.
135 mlx5_flow_os_destroy_flow_action(void *action)
137 RTE_SET_USED(action);
146 * Pointer to match mask structure.
147 * @param[in] match_value
148 * Pointer to match value structure.
149 * @param[in] num_actions
150 * Number of actions in flow rule.
152 * Pointer to array of flow rule actions.
154 * Pointer to a valid flow rule object on success, NULL otherwise.
157 * 0 on success, or errno on failure.
160 mlx5_flow_os_create_flow(void *matcher, void *match_value,
162 void *actions[], void **flow)
164 RTE_SET_USED(matcher);
165 RTE_SET_USED(match_value);
166 RTE_SET_USED(num_actions);
167 RTE_SET_USED(actions);
176 * @param[in] drv_flow_ptr
177 * Pointer to flow rule object.
180 * 0 on success, errno on failure.
183 mlx5_flow_os_destroy_flow(void *drv_flow_ptr)
185 RTE_SET_USED(dev_flow_ptr);