[dpdk-dev] [PATCH v4 11/22] net/atlantic: link status and interrupt management

Ferruh Yigit ferruh.yigit at intel.com
Wed Oct 10 12:27:06 CEST 2018


On 10/9/2018 10:31 AM, Igor Russkikh wrote:
> From: Pavel Belous <Pavel.Belous at aquantia.com>
> 
> Implement link interrupt, link info, link polling.
> 
> Signed-off-by: Igor Russkikh <igor.russkikh at aquantia.com>
> Signed-off-by: Pavel Belous <Pavel.Belous at aquantia.com>

<...>

> +/**
> + * Atomically reads the 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
> +rte_atl_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;
> +}
> +
> +/**
> + * Atomically writes the link status information into 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
> +rte_atl_dev_atomic_write_link_status(struct rte_eth_dev *dev,
> +				struct rte_eth_link *link)
> +{
> +	struct rte_eth_link *dst = &dev->data->dev_link;
> +	struct rte_eth_link *src = link;
> +
> +	if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
> +					*(uint64_t *)src) == 0)
> +		return -1;
> +
> +	return 0;
> +}


No need to implement atomic link status read/writes in PMDs anymore, new common
functions for it added:
rte_eth_linkstatus_get()
rte_eth_linkstatus_set()


More information about the dev mailing list