[v9,4/5] net/virtio-user: adding link speed devarg

Message ID 20200406085855.25773-5-i.dyukov@samsung.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series net/virtio: add link speed devarg |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Ivan Dyukov April 6, 2020, 8:58 a.m. UTC
  virtio driver already parses speed devarg. virtio-user should add
it to list of valid devargs and call eth_virtio_dev_init function
which init speed value.

eth_virtio_dev_init already is called from virtio_user_pmd_probe
function. The only change is required to enable speed devargs:
adding speed to list of valid devargs.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 doc/guides/nics/virtio.rst              | 8 ++++++++
 drivers/net/virtio/virtio_user_ethdev.c | 5 ++++-
 2 files changed, 12 insertions(+), 1 deletion(-)
  

Comments

Maxime Coquelin April 15, 2020, 3:10 p.m. UTC | #1
On 4/6/20 10:58 AM, Ivan Dyukov wrote:
> virtio driver already parses speed devarg. virtio-user should add
> it to list of valid devargs and call eth_virtio_dev_init function
> which init speed value.
> 
> eth_virtio_dev_init already is called from virtio_user_pmd_probe
> function. The only change is required to enable speed devargs:
> adding speed to list of valid devargs.
> 
> Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
> ---
>  doc/guides/nics/virtio.rst              | 8 ++++++++
>  drivers/net/virtio/virtio_user_ethdev.c | 5 ++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
> 

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/doc/guides/nics/virtio.rst b/doc/guides/nics/virtio.rst
index e579c6aa9..e70b6653b 100644
--- a/doc/guides/nics/virtio.rst
+++ b/doc/guides/nics/virtio.rst
@@ -410,6 +410,14 @@  Below devargs are supported by the virtio-user vdev:
     It is used to enable virtio device packed virtqueue feature.
     (Default: 0 (disabled))
 
+#.  ``speed``:
+
+    It is used to specify link speed of virtio device, in units of 1Mb.
+    Link speed is a part of link status structure. It could be requested
+    by application using rte_eth_link_get_nowait function.
+    (Default: 10000 (10G))
+
+
 Virtio paths Selection and Usage
 --------------------------------
 
diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index a79f68a36..5b32d30fa 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -450,6 +450,8 @@  static const char *valid_args[] = {
 	VIRTIO_USER_ARG_IN_ORDER,
 #define VIRTIO_USER_ARG_PACKED_VQ      "packed_vq"
 	VIRTIO_USER_ARG_PACKED_VQ,
+#define VIRTIO_USER_ARG_SPEED          "speed"
+	VIRTIO_USER_ARG_SPEED,
 	NULL
 };
 
@@ -782,4 +784,5 @@  RTE_PMD_REGISTER_PARAM_STRING(net_virtio_user,
 	"server=<0|1> "
 	"mrg_rxbuf=<0|1> "
 	"in_order=<0|1> "
-	"packed_vq=<0|1>");
+	"packed_vq=<0|1> "
+	"speed=<int>");