DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mohammed Gamal <mgamal@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [dpdk-dev] [RFT] net/netvsc: initialize link state
Date: Fri, 07 Feb 2020 18:26:33 +0200	[thread overview]
Message-ID: <1b4726452e8537ce7cbb7a60a821be6f04bb465f.camel@redhat.com> (raw)
In-Reply-To: <20200207081204.56e36149@hermes.lan>

On Fri, 2020-02-07 at 08:12 -0800, Stephen Hemminger wrote:
> On Fri, 07 Feb 2020 15:22:23 +0200
> Mohammed Gamal <mgamal@redhat.com> wrote:
> 
> > 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 <mgamal@redhat.com>
> > > Signed-off-by: Stephen Hemminger <stephen@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?
> > 
> 
> Are you confused about admin state vs link state?  Admin state is the
> up/down state in software, and link state is the (virtual) hardware
> link
> status.  In traditional Linux, admin state is controlled by ip link
> set up/down; in DPDK the admin state is implied by whether the DPDK
> device is started or stopped.  The link state for hardware devices is
> determined by whether the hardware link has synchronized with the
> switch.
> In virtual environments this is synchronized. In Linux link state
> is reported as NOCARRIER (IFF_RUNNING). In DPDK it is reported in
> via the link info get.
> 
> The device visible to the kernel is the accelerated networking
> (Mellanox)
> device and is not related directly to the netvsc device.
> 
> To test link up/down is not easy on Azure. You would have to use
> Azure CLI
> to disconnect the NIC from VM.  On native Hyper-V you can test by
> setting up a virtual switch with an external network device; then
> unplug the network device.
> 
> 

I see. Thanks for the explanation. In this case this does work as
expected.

Tested-by: Mohammed Gamal <mgamal@redhat.com>


  reply	other threads:[~2020-02-07 16:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 10:55 [dpdk-dev] [PATCH] netvsc: update link info when getting device info Mohammed Gamal
2020-02-06 23:45 ` Stephen Hemminger
2020-02-07  0:10 ` [dpdk-dev] [RFT] net/netvsc: initialize link state Stephen Hemminger
2020-02-07 13:22   ` Mohammed Gamal
2020-02-07 16:12     ` Stephen Hemminger
2020-02-07 16:26       ` Mohammed Gamal [this message]
2020-02-07 18:08 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2020-02-10 13:10   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b4726452e8537ce7cbb7a60a821be6f04bb465f.camel@redhat.com \
    --to=mgamal@redhat.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).