MCPcopy Create free account
hub / github.com/F-Stack/f-stack / flow_dv_validate_attributes

Function flow_dv_validate_attributes

dpdk/drivers/net/mlx5/mlx5_flow_dv.c:7030–7076  ·  view source on GitHub ↗

* Verify the @p attributes will be correctly understood by the NIC and store * them in the @p flow if everything is correct. * * @param[in] dev * Pointer to dev struct. * @param[in] attributes * Pointer to flow attributes * @param[in] external * This flow rule is created by request external to PMD. * @param[out] error * Pointer to error structure. * * @return * - 0 on succes

Source from the content-addressed store, hash-verified

7028 * - a negative errno value otherwise and rte_errno is set.
7029 */
7030static int
7031flow_dv_validate_attributes(struct rte_eth_dev *dev,
7032 const struct mlx5_flow_tunnel *tunnel,
7033 const struct rte_flow_attr *attributes,
7034 const struct flow_grp_info *grp_info,
7035 struct rte_flow_error *error)
7036{
7037 struct mlx5_priv *priv = dev->data->dev_private;
7038 uint32_t lowest_priority = mlx5_get_lowest_priority(dev, attributes);
7039 int ret = 0;
7040
7041#ifndef HAVE_MLX5DV_DR
7042 RTE_SET_USED(tunnel);
7043 RTE_SET_USED(grp_info);
7044 if (attributes->group)
7045 return rte_flow_error_set(error, ENOTSUP,
7046 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
7047 NULL,
7048 "groups are not supported");
7049#else
7050 uint32_t table = 0;
7051
7052 ret = mlx5_flow_group_to_table(dev, tunnel, attributes->group, &table,
7053 grp_info, error);
7054 if (ret)
7055 return ret;
7056 if (!table)
7057 ret = MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL;
7058#endif
7059 if (attributes->priority != MLX5_FLOW_LOWEST_PRIO_INDICATOR &&
7060 attributes->priority > lowest_priority)
7061 return rte_flow_error_set(error, ENOTSUP,
7062 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
7063 NULL,
7064 "priority out of range");
7065 if (attributes->transfer && !priv->sh->config.dv_esw_en)
7066 return rte_flow_error_set(error, ENOTSUP,
7067 RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
7068 "E-Switch dr is not supported");
7069 if (attributes->ingress + attributes->egress + attributes->transfer != 1) {
7070 return rte_flow_error_set(error, EINVAL,
7071 RTE_FLOW_ERROR_TYPE_ATTR, NULL,
7072 "must specify exactly one of "
7073 "ingress, egress or transfer");
7074 }
7075 return ret;
7076}
7077
7078static int
7079validate_integrity_bits(const void *arg,

Callers 1

flow_dv_validateFunction · 0.85

Calls 3

mlx5_get_lowest_priorityFunction · 0.85
rte_flow_error_setFunction · 0.85
mlx5_flow_group_to_tableFunction · 0.85

Tested by

no test coverage detected