Skip to contentSkip to conversation

vhost: fix vring disable fail in async transfer

PATCH In review [email protected] 1 participant 2 messages Jul 23, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: fix vring disable fail in async transfer

From: Patrick Fu <[email protected]>

Async inflight packets is checked when front end virtio requests to disable vring. If inflight packets exists, vring disabling will fail. However, there is no good way for application to get notified before vring is disabled and properly complete inflight packets. This patch moves the inflight packets check from vring disabling time to the vring enabling time, so that applications have chances to drain out pending packets.

Fixes 78639d54563a ("vhost: introduce async enqueue registration API")
---
 lib/librte_vhost/vhost_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/vhost_user.c +2 -2
index 9ddeae362..36da1380a 100644
@@ -2038,9 +2038,9 @@ vhost_user_set_vring_enable(struct virtio_net **pdev,
 		"set queue enable: %d to qp idx: %d\n",
 		enable, index);
 
-	if (!enable && dev->virtqueue[index]->async_registered) {
+	if (enable && dev->virtqueue[index]->async_registered) {
 		if (dev->virtqueue[index]->async_pkts_inflight_n) {
-			VHOST_LOG_CONFIG(ERR, "failed to disable vring. "
+			VHOST_LOG_CONFIG(ERR, "failed to enable vring. "
 			"async inflight packets must be completed first\n");
 			return RTE_VHOST_MSG_RESULT_ERR;
 		}
Signature · 1 line
2.18.4
#1 lore raw

Hi,

Sorry but I'd like to withdraw this patch as the issue could be addressed by applications to register a pre_msg_handler.

Thanks,

Patrick

Quoted 43 lines

-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 23, 2020 1:38 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v1] vhost: fix vring disable fail in async transfer

From: Patrick Fu <[email protected]>

Async inflight packets is checked when front end virtio requests to disable vring. If inflight packets exists, vring disabling will fail. However, there is no good way for application to get notified before vring is disabled and properly complete inflight packets. This patch moves the inflight packets check from vring disabling time to the vring enabling time, so that applications have chances to drain out pending packets.

Fixes 78639d54563a ("vhost: introduce async enqueue registration API")
---
 lib/librte_vhost/vhost_user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/librte_vhost/vhost_user.c +2 -2
index 9ddeae362..36da1380a 100644
@@ -2038,9 +2038,9 @@ vhost_user_set_vring_enable(struct virtio_net
 **pdev,
 		"set queue enable: %d to qp idx: %d\n",
 		enable, index);
 
-	if (!enable && dev->virtqueue[index]->async_registered) {
+	if (enable && dev->virtqueue[index]->async_registered) {
 		if (dev->virtqueue[index]->async_pkts_inflight_n) {
-			VHOST_LOG_CONFIG(ERR, "failed to disable vring. "
+			VHOST_LOG_CONFIG(ERR, "failed to enable vring. "
 			"async inflight packets must be completed first\n");
 			return RTE_VHOST_MSG_RESULT_ERR;

}
--
2.18.4