* [dpdk-dev] [PATCH] netvsc: update link info when getting device info
@ 2020-02-06 10:55 Mohammed Gamal
2020-02-06 23:45 ` Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Mohammed Gamal @ 2020-02-06 10:55 UTC (permalink / raw)
To: dev, sthemmin; +Cc: kys, haiyangz, Mohammed Gamal
testpmd 'show summary' command always shows interface status as down
with 0 Mbps speed regardless of the underlying VF's status.
This happens as hn_dev_link_update() is never called, even on the initial
RNDIS_STATUS_MEDIA_CONNECT message as LSC interrupts are not yet enabled
at this point.
Let's call it and update link info when calling hn_dev_info_get().
Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
---
drivers/net/netvsc/hn_ethdev.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index c79f92437..1120fc688 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -265,6 +265,11 @@ static int hn_dev_info_get(struct rte_eth_dev *dev,
if (rc != 0)
return rc;
+ /* fill in link status and link speed */
+ rc = hn_dev_link_update(dev, 0);
+ if (rc != 0)
+ return rc;
+
/* merges the offload and queues of vf */
return hn_vf_info_get(hv, dev_info);
}
--
2.21.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH] netvsc: update link info when getting device info
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 18:08 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2 siblings, 0 replies; 8+ messages in thread
From: Stephen Hemminger @ 2020-02-06 23:45 UTC (permalink / raw)
To: Mohammed Gamal; +Cc: dev, sthemmin, kys, haiyangz
On Thu, 6 Feb 2020 12:55:41 +0200
Mohammed Gamal <mgamal@redhat.com> wrote:
> testpmd 'show summary' command always shows interface status as down
> with 0 Mbps speed regardless of the underlying VF's status.
> This happens as hn_dev_link_update() is never called, even on the initial
> RNDIS_STATUS_MEDIA_CONNECT message as LSC interrupts are not yet enabled
> at this point.
>
> Let's call it and update link info when calling hn_dev_info_get().
>
> Signed-off-by: Mohammed Gamal <mgamal@redhat.com>
This is not the right way to address this.
There is nothing in rte_eth_dev_info about link status.
That is in rte_eth_link_get. I think the issue is that testpmd
calls with "nowait" and the definition of nowait is poorly designed in original
DPDK. The Intel version of wait/nowait is to have rte_eth_link_get wait until
the link comes up (in a spin loop). And nowait just polls state.
The current netvsc driver implements no wait, as "I will ask the host what
the link state is but not wait for a response". This is probably not
what testpmd wants.
I can easily fix netvsc to block even in nowait case, but first we need
to see what other drivers do.
Also link state is undefined if driver has never started.
Is testpmd using Link State Interrupt?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [RFT] net/netvsc: initialize link state
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 ` Stephen Hemminger
2020-02-07 13:22 ` Mohammed Gamal
2020-02-07 18:08 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2020-02-07 0:10 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Mohammed Gamal, Stephen Hemminger
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;
}
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [RFT] net/netvsc: initialize link state
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
0 siblings, 1 reply; 8+ messages in thread
From: Mohammed Gamal @ 2020-02-07 13:22 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: Stephen Hemminger
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?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [RFT] net/netvsc: initialize link state
2020-02-07 13:22 ` Mohammed Gamal
@ 2020-02-07 16:12 ` Stephen Hemminger
2020-02-07 16:26 ` Mohammed Gamal
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2020-02-07 16:12 UTC (permalink / raw)
To: Mohammed Gamal; +Cc: dev, Stephen Hemminger
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [RFT] net/netvsc: initialize link state
2020-02-07 16:12 ` Stephen Hemminger
@ 2020-02-07 16:26 ` Mohammed Gamal
0 siblings, 0 replies; 8+ messages in thread
From: Mohammed Gamal @ 2020-02-07 16:26 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Stephen Hemminger
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>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH v2] net/netvsc: initialize link state
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 18:08 ` Stephen Hemminger
2020-02-10 13:10 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2 siblings, 1 reply; 8+ messages in thread
From: Stephen Hemminger @ 2020-02-07 18:08 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, stable, Mohammed Gamal
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.
Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
Cc: stable@dpdk.org
Reported-by: Mohammed Gamal <mgamal@redhat.com>
Tested-by: Mohammed Gamal <mgamal@redhat.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
Putting on same email thread as original submission
v2 - new patch that does initialization at start
added tested-by and fixes tag
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;
}
--
2.20.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] net/netvsc: initialize link state
2020-02-07 18:08 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
@ 2020-02-10 13:10 ` Ferruh Yigit
0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2020-02-10 13:10 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: stable, Mohammed Gamal
On 2/7/2020 6:08 PM, 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.
>
> Fixes: 4e9c73e96e83 ("net/netvsc: add Hyper-V network device")
> Cc: stable@dpdk.org
> Reported-by: Mohammed Gamal <mgamal@redhat.com>
> Tested-by: Mohammed Gamal <mgamal@redhat.com>
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Applied to dpdk-next-net/master, thanks.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2020-02-10 13:10 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2020-02-07 18:08 ` [dpdk-dev] [PATCH v2] " Stephen Hemminger
2020-02-10 13:10 ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
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).