DPDK patches and discussions
 help / color / mirror / Atom feed
From: <skoteshwar@marvell.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbox@nvidia.com>
Cc: <dev@dpdk.org>, Satha Rao <skoteshwar@marvell.com>
Subject: [PATCH 4/5] net/virtio: implement update link state API
Date: Mon, 7 Oct 2024 20:34:02 +0530	[thread overview]
Message-ID: <20241007150403.1680983-4-skoteshwar@marvell.com> (raw)
In-Reply-To: <20241007150403.1680983-1-skoteshwar@marvell.com>

From: Satha Rao <skoteshwar@marvell.com>

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

Signed-off-by: Satha Rao <skoteshwar@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


  parent reply	other threads:[~2024-10-07 15:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-07 15:03 [PATCH 1/5] interrupts: fix number of bytes read for vdev skoteshwar
2024-10-07 15:04 ` [PATCH 2/5] net/virtio-user: get link duplex and speed skoteshwar
2024-10-07 15:04 ` [PATCH 3/5] net/virtio: add set config callback skoteshwar
2024-10-07 15:04 ` skoteshwar [this message]
2024-10-07 15:04 ` [PATCH 5/5] net/virtio-user: support vDPA configuration callback skoteshwar
2024-10-09  4:01 ` [PATCH 1/5] interrupts: fix number of bytes read for vdev Stephen Hemminger

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=20241007150403.1680983-4-skoteshwar@marvell.com \
    --to=skoteshwar@marvell.com \
    --cc=chenbox@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.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).