From: Satha Rao <skotesh...@marvell.com>

This patch introduces the vhost_vdpa_update_link_state API to manage the
link state updates.

Signed-off-by: Satha Rao <skotesh...@marvell.com>
---
 drivers/net/virtio/virtio_user/vhost_vdpa.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c 
b/drivers/net/virtio/virtio_user/vhost_vdpa.c
index 5c610664b6..e8aea54000 100644
--- a/drivers/net/virtio/virtio_user/vhost_vdpa.c
+++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c
@@ -619,9 +619,17 @@ vhost_vdpa_get_backend_features(uint64_t *features)
 }
 
 static int
-vhost_vdpa_update_link_state(struct virtio_user_dev *dev __rte_unused)
+vhost_vdpa_update_link_state(struct virtio_user_dev *dev)
 {
-       /* Nothing to update (for now?) */
+       uint16_t status;
+       int rc, offset;
+
+       offset = offsetof(struct virtio_net_config, status);
+       rc = vhost_vdpa_get_config(dev, (uint8_t *)&status, offset, 
sizeof(status));
+       if (rc)
+               return rc;
+       dev->net_status = status & VIRTIO_NET_S_LINK_UP;
+
        return 0;
 }
 
-- 
2.25.1

Reply via email to