* Validates @p attributes of the flow rule. * * This function is used if and only if legacy Verbs flow engine is used. * * @param[in] dev * Pointer to the Ethernet device structure. * @param[in] attributes * Pointer to flow attributes * @param[out] error * Pointer to error structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */
| 1247 | * 0 on success, a negative errno value otherwise and rte_errno is set. |
| 1248 | */ |
| 1249 | static int |
| 1250 | flow_verbs_validate_attributes(struct rte_eth_dev *dev, |
| 1251 | const struct rte_flow_attr *attributes, |
| 1252 | struct rte_flow_error *error) |
| 1253 | { |
| 1254 | struct mlx5_priv *priv = dev->data->dev_private; |
| 1255 | uint32_t priority_max = priv->sh->flow_max_priority - 1; |
| 1256 | |
| 1257 | if (attributes->group) |
| 1258 | return rte_flow_error_set(error, ENOTSUP, |
| 1259 | RTE_FLOW_ERROR_TYPE_ATTR_GROUP, |
| 1260 | NULL, "groups is not supported"); |
| 1261 | if (attributes->priority != MLX5_FLOW_LOWEST_PRIO_INDICATOR && |
| 1262 | attributes->priority >= priority_max) |
| 1263 | return rte_flow_error_set(error, ENOTSUP, |
| 1264 | RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY, |
| 1265 | NULL, "priority out of range"); |
| 1266 | if (attributes->egress) |
| 1267 | return rte_flow_error_set(error, ENOTSUP, |
| 1268 | RTE_FLOW_ERROR_TYPE_ATTR_EGRESS, NULL, |
| 1269 | "egress is not supported"); |
| 1270 | if (attributes->transfer) |
| 1271 | return rte_flow_error_set(error, ENOTSUP, |
| 1272 | RTE_FLOW_ERROR_TYPE_ATTR_TRANSFER, |
| 1273 | NULL, "transfer is not supported"); |
| 1274 | if (!attributes->ingress) |
| 1275 | return rte_flow_error_set(error, EINVAL, |
| 1276 | RTE_FLOW_ERROR_TYPE_ATTR_INGRESS, |
| 1277 | NULL, |
| 1278 | "ingress attribute is mandatory"); |
| 1279 | return 0; |
| 1280 | } |
| 1281 | |
| 1282 | /** |
| 1283 | * Internal validation function. For validating both actions and items. |
no test coverage detected