[dpdk-dev] [PATCH v3 03/15] net/virtio: use eth_linkstatus_set

Ferruh Yigit ferruh.yigit at intel.com
Thu Jan 11 18:02:16 CET 2018


On 1/8/2018 5:45 PM, Stephen Hemminger wrote:
> Use the new comon code in ethdev to handle link status update.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>

<...>

>  static int
>  virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complete)
>  {
> -	struct rte_eth_link link, old;
> -	uint16_t status;
>  	struct virtio_hw *hw = dev->data->dev_private;
> -	memset(&link, 0, sizeof(link));
> -	virtio_dev_atomic_read_link_status(dev, &link);
> -	old = link;
> -	link.link_duplex = ETH_LINK_FULL_DUPLEX;
> -	link.link_speed  = SPEED_10G;
> +	uint16_t status;
> +	struct rte_eth_link link = {
> +		.link_speed = ETH_SPEED_NUM_10G,
> +		.link_duplex = ETH_LINK_FULL_DUPLEX,
> +		.link_autoneg = ETH_LINK_SPEED_FIXED,

With a new cleanup commit [1] ETH_LINK_FIXED used for autoneg value (instead of
ETH_LINK_SPEED_FIXED). And since is ETH_LINK_FIXED is 0, setting autoneg to it
can be omitted.

[1]
93dd7b328a9b ("ethdev: fix link autonegotiation value")

This commit is in next-net.
Unlike Linux "net-next" sub-tree which is for next release development tree,
dpdk next-net is for current release network drivers which this patch seems fits
into.

I already rebased this patchset to next-net, I will share it to continue
discussion from that point.

> +	};
>  
>  	if (hw->started == 0) {
>  		link.link_status = ETH_LINK_DOWN;
> @@ -1957,9 +1916,8 @@ virtio_dev_link_update(struct rte_eth_dev *dev, __rte_unused int wait_to_complet
>  	} else {
>  		link.link_status = ETH_LINK_UP;
>  	}
> -	virtio_dev_atomic_write_link_status(dev, &link);
>  
> -	return (old.link_status == link.link_status) ? -1 : 0;
> +	return _rte_eth_linkstatus_set(dev, &link);
>  }
>  
>  static int
> 



More information about the dev mailing list