[dpdk-dev] [PATCH v3 2/2] ethdev: add hierarchical scheduler API

Stephen Hemminger stephen at networkplumber.org
Mon Mar 6 17:15:13 CET 2017


On Sat,  4 Mar 2017 01:10:20 +0000
Cristian Dumitrescu <cristian.dumitrescu at intel.com> wrote:

> +/* Get generic traffic manager operations structure from a port. */
> +const struct rte_tm_ops *
> +rte_tm_ops_get(uint8_t port_id, struct rte_tm_error *error)
> +{
> +	struct rte_eth_dev *dev = &rte_eth_devices[port_id];
> +	const struct rte_tm_ops *ops;
> +
> +	if (!rte_eth_dev_is_valid_port(port_id)) {
> +		rte_tm_error_set(error,
> +			ENODEV,
> +			RTE_TM_ERROR_TYPE_UNSPECIFIED,
> +			NULL,
> +			rte_strerror(ENODEV));
> +		return NULL;
> +	}
> +
> +	if ((dev->dev_ops->cap_ops_get == NULL) ||
> +		(dev->dev_ops->cap_ops_get(dev, RTE_ETH_CAPABILITY_TM,
> +		&ops) != 0) || (ops == NULL)) {
> +		rte_tm_error_set(error,
> +			ENOSYS,
> +			RTE_TM_ERROR_TYPE_UNSPECIFIED,
> +			NULL,
> +			rte_strerror(ENOSYS));
> +		return NULL;
> +	}
> +
> +	return ops;
> +}

Why are you introducing yet another version of errno? There already is
rte_errno for RTE specific errors.


More information about the dev mailing list