netvsc: update link info when getting device info

Message ID 20200206105541.1186-1-mgamal@redhat.com (mailing list archive)
State Rejected, archived
Delegated to: Ferruh Yigit
Headers
Series netvsc: update link info when getting device info |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-testing success Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK

Commit Message

Mohammed Gamal Feb. 6, 2020, 10:55 a.m. UTC
  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(+)
  

Comments

Stephen Hemminger Feb. 6, 2020, 11:45 p.m. UTC | #1
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?
  

Patch

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);
 }