diff mbox

[16/18] test: vubr check vring enable state

Message ID 1459509388-6185-17-git-send-email-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marc-André Lureau April 1, 2016, 11:16 a.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

The rings shouldn't be processed unless previously enabled.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 tests/vhost-user-bridge.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c
index 0779ba2..42450a6 100644
--- a/tests/vhost-user-bridge.c
+++ b/tests/vhost-user-bridge.c
@@ -710,7 +710,8 @@  vubr_backend_recv_cb(int sock, void *ctx)
     int buflen = sizeof(buf);
     int len;
 
-    if (!dev->ready) {
+    if (!dev->ready || !rx_vq->enable) {
+        DPRINT("\n NOT READY: dev: %d, rx: %d\n", dev->ready, rx_vq->enable);
         return;
     }
 
@@ -747,8 +748,11 @@  vubr_kick_cb(int sock, void *ctx)
     if (rc == -1) {
         vubr_die("eventfd_read()");
     } else {
-        DPRINT("Got kick_data: %016"PRIx64"\n", kick_data);
-        vubr_process_avail(dev, &dev->vq[1]);
+        DPRINT("Got kick_data: %016"PRIx64", vq enabled: %d\n",
+               kick_data, dev->vq[1].enable);
+        if (dev->vq[1].enable) {
+            vubr_process_avail(dev, &dev->vq[1]);
+        }
     }
 }