[dpdk-dev] [PATCH v8 5/9] nfp: adding link functionality

Stephen Hemminger stephen at networkplumber.org
Wed Nov 25 17:29:23 CET 2015


On Wed, 25 Nov 2015 16:19:51 +0000
"Alejandro.Lucero" <alejandro.lucero at netronome.com> wrote:

> +/*
> + * Atomically reads link status information from global structure rte_eth_dev.
> + *
> + * @param dev
> + *   - Pointer to the structure rte_eth_dev to read from.
> + *   - Pointer to the buffer to be saved with the link status.
> + *
> + * @return
> + *   - On success, zero.
> + *   - On failure, negative value.
> + */
> +static inline int
> +nfp_net_dev_atomic_read_link_status(struct rte_eth_dev *dev,
> +				    struct rte_eth_link *link)
> +{
> +	struct rte_eth_link *dst = link;
> +	struct rte_eth_link *src = &dev->data->dev_link;
> +
> +	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
> +				*(uint64_t *)src) == 0)
> +		return -1;
> +
> +	return 0;
> +}
> +
> +/

Sigh, this code has been copied and pasted to every driver.
Why is it not part of standard rte_ethdev code.


More information about the dev mailing list