[dpdk-dev] [PATCH 2/6] Subjet: ethdev: add common code to atomicly access link

Ivan Boule ivan.boule at 6wind.com
Thu May 15 10:43:42 CEST 2014


Hi Stephen,

The new function rte_eth_dev_set_link() below is declared as void.
Thus, the comments about its return value are wrong, and should be removed,
unless they still refer to a desired behaviour, in which case it is the
function itself that should be reworked to invoke rte_atomic64_cmpset and
to return its result.

Regards,
Ivan

2014-05-14 20:55 GMT+02:00 Stephen Hemminger <stephen at networkplumber.org>:

> Many drivers copy/paste same code to atomicly access link information.
> Add functions to do this instead.
>
> Signed-off-by: Stephen Hemminger <shemming at brocade.com>
>
> --- a/lib/librte_ether/rte_ethdev.h     2014-05-14 11:27:07.409461720 -0700
> +++ b/lib/librte_ether/rte_ethdev.h     2014-05-14 11:27:07.409461720 -0700
> @@ -1704,6 +1704,45 @@ extern void rte_eth_link_get_nowait(uint
>                                 struct rte_eth_link *link);
>
> +
> +/**
> + * @internal
> + * Set the link status from device in atomic fashion.
> + * Returns non-zero on success; 0 on failure
> + * Callers should retry on failure
> + */
> +static inline void rte_eth_dev_set_link(struct rte_eth_dev *dev,
> +                                       struct rte_eth_link *link)
> +{
> +       rte_atomic64_t *dst = (rte_atomic64_t *)&dev->data->dev_link;
> +
> +       rte_atomic64_set(dst, *(int64_t *)link);
> +}
> +
>
>

-- 
Ivan BOULE
6WIND
Software Engineer


More information about the dev mailing list