On Thu, 2020-02-06 at 16:10 -0800, Stephen Hemminger wrote:
> If application is using link state interrupt, the correct link state
> needs to be filled in when device is started. This is similar to
> how virtio updates link information.
> 
> Reported-by: Mohammed Gamal <mga...@redhat.com>
> Signed-off-by: Stephen Hemminger <step...@networkplumber.org>
> ---
> This version marked RFT because am in airport without access to a
> machine to test it.
> 
>  drivers/net/netvsc/hn_ethdev.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/netvsc/hn_ethdev.c
> b/drivers/net/netvsc/hn_ethdev.c
> index c79f924379fe..564620748daf 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -823,6 +823,10 @@ hn_dev_start(struct rte_eth_dev *dev)
>       if (error)
>               hn_rndis_set_rxfilter(hv, 0);
>  
> +     /* Initialize Link state */
> +     if (error == 0)
> +             hn_dev_link_update(dev, 0);
> +
>       return error;
>  }
>  

I tested this and I always get the link status as UP, regardless of
whether I start the interface on the guest in UP or DOWN state. Looking
at hn_dev_link_update() code, I see that the link status depends on the
NDIS status that the driver gets from the host if my understanding is
correct.
The question is whether if I use 'ip li set dev $IF_NAME down' on the
guest affects the status the host sees, or would the host set the state
to NDIS_MEDIA_STATE_CONNECTED of the device is physcially connected
regardless of what the guest tries to do?

Reply via email to