Subject: Re: [PATCH] virtio_net: add link status handling

From: Rusty Russell <[email-masked]>
Date: Wed, 10 Dec 2008 10:26:36 +1030

On Tuesday 09 December 2008 20:49:33 Mark McLoughlin wrote:
> Allow the host to inform us that the link is down by adding
> a VIRTIO_NET_F_STATUS which indicates that device status is
> available in virtio_net config.

This has been a TODO for a while, thanks!

> +	if (vi->status == v)
> +		return;
> +
> +	vi->status = v;
> +
> +	if (vi->status & VIRTIO_NET_S_LINK_UP) {
> +		netif_carrier_on(vi->dev);
> +		netif_wake_queue(vi->dev);
> +	} else {
> +		netif_carrier_off(vi->dev);
> +		netif_stop_queue(vi->dev);
> +	}

New status bits will screw this logic unless we count
on the host not to set them.  I suggest:

	/* Ignore unknown (future) status bits */
	v &= VIRTIO_NET_S_LINK_UP;

Cheers,
Rusty.