DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/virtio: wait device ready in device reset
@ 2021-08-23  6:39 Xueming Li
  2021-08-23  9:56 ` Andrew Rybchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Xueming Li @ 2021-08-23  6:39 UTC (permalink / raw)
  Cc: dev, xuemingl, Maxime Coquelin, Chenbo Xia

According to virtio spec, the device MUST reset when 0 is written to
device_status, and present a 0 in device_status once that is done.

This patch adds the missing part of waiting status 0 in reset function.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 drivers/net/virtio/virtio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/virtio/virtio.c b/drivers/net/virtio/virtio.c
index 7e1e77797f..f003f612d6 100644
--- a/drivers/net/virtio/virtio.c
+++ b/drivers/net/virtio/virtio.c
@@ -3,6 +3,8 @@
  * Copyright(c) 2020 Red Hat, Inc.
  */
 
+#include <unistd.h>
+
 #include "virtio.h"
 
 uint64_t
@@ -39,8 +41,9 @@ void
 virtio_reset(struct virtio_hw *hw)
 {
 	VIRTIO_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
-	/* flush status write */
-	VIRTIO_OPS(hw)->get_status(hw);
+	/* Flush status write and wait device ready. */
+	while (VIRTIO_OPS(hw)->get_status(hw) != VIRTIO_CONFIG_STATUS_RESET)
+		usleep(1000L);
 }
 
 void
-- 
2.25.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-09-28 15:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  6:39 [dpdk-dev] [PATCH] net/virtio: wait device ready in device reset Xueming Li
2021-08-23  9:56 ` Andrew Rybchenko
2021-08-23 13:54   ` Xueming(Steven) Li
2021-08-24 15:40     ` Andrew Rybchenko
2021-08-26  7:15       ` Xia, Chenbo
2021-09-15  9:23         ` Xueming(Steven) Li
2021-09-15  9:21 ` [dpdk-dev] [PATCH v1] net/virtio: wait device ready during reset Xueming Li
2021-09-15  9:27   ` Andrew Rybchenko
2021-09-15 10:14     ` Xueming(Steven) Li
2021-09-15 10:12 ` [dpdk-dev] [PATCH v2] " Xueming Li
2021-09-15 10:30   ` Andrew Rybchenko
2021-09-15 11:44   ` Xia, Chenbo
2021-09-28 15:31   ` Maxime Coquelin

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).