[dpdk-dev] [PATCH v2 2/3] net/ice: add generic flow API

Xing, Beilei beilei.xing at intel.com
Mon Jun 17 08:02:08 CEST 2019


...

> +
> +static int
> +ice_flow_validate(__rte_unused struct rte_eth_dev *dev,
> +		   const struct rte_flow_attr *attr,
> +		   const struct rte_flow_item pattern[],
> +		   const struct rte_flow_action actions[],
> +		   struct rte_flow_error *error)
> +{
> +	uint64_t inset = 0;
> +	int ret = ICE_ERR_NOT_SUPPORTED;
> +
> +	if (!pattern) {
> +		rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ITEM_NUM,
> +				   NULL, "NULL pattern.");
> +		return -rte_errno;
> +	}
> +
> +	if (!actions) {
> +		rte_flow_error_set(error, EINVAL,
> +				   RTE_FLOW_ERROR_TYPE_ACTION_NUM,
> +				   NULL, "NULL action.");
> +		return -rte_errno;
> +	}
> +
> +	if (!attr) {
> +		rte_flow_error_set(error, EINVAL,
> +				   RTE_FLOW_ERROR_TYPE_ATTR,
> +				   NULL, "NULL attribute.");
> +		return -rte_errno;
> +	}
> +
> +	ret = ice_flow_valid_attr(attr, error);
> +	if (!ret)
> +		return ret;
> +
> +	inset = ice_flow_valid_pattern(pattern, error);
> +	if (!inset)
> +		return -rte_errno;
> +
> +	ret = ice_flow_valid_inset(pattern, inset, error);
> +	if (ret)
> +		return ret;
> +
> +	ret = ice_flow_valid_action(actions, error);
> +	if (ret)
> +		return ret;

There're some duplicate work (such as valid action) with patch 1, it's better to optimize it.

> +
> +	return 0;
> +}
> +
> 



More information about the dev mailing list