All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: aconole@redhat.com, sodey@sonusnet.com,
	yuanhan.liu@linux.intel.com, jianfeng.tan@intel.com,
	dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [PATCH 3/7] vhost: Add new ready status flag
Date: Mon, 13 Feb 2017 15:28:16 +0100	[thread overview]
Message-ID: <20170213142820.8964-4-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <20170213142820.8964-1-maxime.coquelin@redhat.com>

This patch adds a new status flag indicating the Virtio device
is ready to operate.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
 lib/librte_vhost/vhost.h      |  2 ++
 lib/librte_vhost/vhost_user.c | 20 +++++++++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/lib/librte_vhost/vhost.h b/lib/librte_vhost/vhost.h
index 549296f..e8b7e44 100644
--- a/lib/librte_vhost/vhost.h
+++ b/lib/librte_vhost/vhost.h
@@ -46,6 +46,8 @@
 
 /* Used to indicate that the device is running on a data core */
 #define VIRTIO_DEV_RUNNING 1
+/* Used to indicate that the device is ready to operate */
+#define VIRTIO_DEV_READY 2
 
 /* Backend value set by guest. */
 #define VIRTIO_DEV_STOPPED -1
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 69877a4..4726aaf 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -691,14 +691,18 @@ vhost_user_set_vring_kick(struct virtio_net *dev, struct VhostUserMsg *pmsg)
 		close(vq->kickfd);
 	vq->kickfd = file.fd;
 
-	if (virtio_is_ready(dev) && !(dev->flags & VIRTIO_DEV_RUNNING)) {
-		if (dev->dequeue_zero_copy) {
-			RTE_LOG(INFO, VHOST_CONFIG,
-				"dequeue zero copy is enabled\n");
-		}
+	if (virtio_is_ready(dev)) {
+		dev->flags |= VIRTIO_DEV_READY;
+
+		if (!(dev->flags & VIRTIO_DEV_RUNNING)) {
+			if (dev->dequeue_zero_copy) {
+				RTE_LOG(INFO, VHOST_CONFIG,
+						"dequeue zero copy is enabled\n");
+			}
 
-		if (notify_ops->new_device(dev->vid) == 0)
-			dev->flags |= VIRTIO_DEV_RUNNING;
+			if (notify_ops->new_device(dev->vid) == 0)
+				dev->flags |= VIRTIO_DEV_RUNNING;
+		}
 	}
 }
 
@@ -733,6 +737,8 @@ vhost_user_get_vring_base(struct virtio_net *dev,
 		notify_ops->destroy_device(dev->vid);
 	}
 
+	dev->flags &= ~VIRTIO_DEV_READY;
+
 	/* Here we are safe to get the last used index */
 	state->num = vq->last_used_idx;
 
-- 
2.9.3

  parent reply	other threads:[~2017-02-13 14:28 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-13 14:28 [PATCH 0/7] virtio/vhost: Add MTU feature support Maxime Coquelin
2017-02-13 14:28 ` [PATCH 1/7] vhost: Enable VIRTIO_NET_F_MTU feature Maxime Coquelin
2017-02-13 14:28 ` [PATCH 2/7] vhost: vhost-user: Add MTU protocol feature support Maxime Coquelin
2017-02-13 14:28 ` Maxime Coquelin [this message]
2017-02-13 14:28 ` [PATCH 4/7] vhost: Add API to get/set MTU value Maxime Coquelin
2017-02-13 14:28 ` [PATCH 5/7] net/vhost: Implement mtu_set callback Maxime Coquelin
2017-02-13 14:28 ` [PATCH 6/7] net/virtio: Add MTU feature support Maxime Coquelin
2017-02-16 19:31   ` Aaron Conole
2017-02-16 21:17     ` Maxime Coquelin
2017-02-13 14:28 ` [PATCH 7/7] app/testpmd: print MTU value in show port info Maxime Coquelin
2017-02-23  7:10 ` [PATCH 0/7] virtio/vhost: Add MTU feature support Yuanhan Liu
2017-03-01  7:44   ` Maxime Coquelin
2017-03-06  8:27 ` [PATCH v2 " Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 1/7] vhost: Enable VIRTIO_NET_F_MTU feature Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 2/7] vhost: vhost-user: Add MTU protocol feature support Maxime Coquelin
2017-03-08  2:31     ` Yuanhan Liu
2017-03-12 10:24       ` Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 3/7] vhost: Add new ready status flag Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 4/7] vhost: Add API to get MTU value Maxime Coquelin
2017-03-08  2:45     ` Yuanhan Liu
2017-03-12 10:23       ` Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 5/7] net/vhost: Fill rte_eth_dev's MTU property Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 6/7] net/virtio: Add MTU feature support Maxime Coquelin
2017-03-06  8:27   ` [PATCH v2 7/7] app/testpmd: print MTU value in show port info Maxime Coquelin
2017-03-07 21:57   ` [PATCH v2 0/7] virtio/vhost: Add MTU feature support Thomas Monjalon
2017-03-12 10:00     ` Maxime Coquelin
2017-03-12 16:33 ` [PATCH v3 0/9] " Maxime Coquelin
2017-03-12 16:33   ` [PATCH v3 1/9] vhost: Enable VIRTIO_NET_F_MTU feature Maxime Coquelin
2017-03-12 16:33   ` [PATCH v3 2/9] vhost: vhost-user: Add MTU protocol feature support Maxime Coquelin
2017-03-12 16:34   ` [PATCH v3 3/9] vhost: Add new ready status flag Maxime Coquelin
2017-03-12 16:34   ` [PATCH v3 4/9] vhost: Add API to get MTU value Maxime Coquelin
2017-03-16  8:00     ` Yuanhan Liu
2017-03-16 11:37       ` Maxime Coquelin
2017-03-17  5:32         ` Yuanhan Liu
2017-03-17  9:59           ` Maxime Coquelin
2017-03-20  8:42             ` Yuanhan Liu
2017-03-12 16:34   ` [PATCH v3 5/9] vhost: export " Maxime Coquelin
2017-03-12 16:34   ` [PATCH v3 6/9] net/vhost: Fill rte_eth_dev's MTU property Maxime Coquelin
2017-03-12 16:34   ` [PATCH v3 7/9] net/virtio: Add MTU feature support Maxime Coquelin
2017-04-05  4:52     ` Tan, Jianfeng
2017-04-05  7:11       ` Maxime Coquelin
2017-04-05  9:42         ` Tan, Jianfeng
2017-04-05 13:54           ` Maxime Coquelin
2017-04-05 14:50             ` Tan, Jianfeng
2017-04-07 16:40               ` Maxime Coquelin
2017-04-10  6:48                 ` Tan, Jianfeng
2017-03-12 16:34   ` [PATCH v3 8/9] doc: announce Virtio and Vhost MTU support Maxime Coquelin
2017-03-12 16:34   ` [PATCH v3 9/9] app/testpmd: print MTU value in show port info Maxime Coquelin
2017-03-22  8:58   ` [PATCH v3 0/9] virtio/vhost: Add MTU feature support Yuanhan Liu
2017-03-22  9:03     ` Maxime Coquelin
2017-03-28  5:39   ` Yao, Lei A
2017-03-30 11:34     ` Maxime Coquelin

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=20170213142820.8964-4-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=aconole@redhat.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=sodey@sonusnet.com \
    --cc=yuanhan.liu@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.