net/virtio-user: fix device init in legacy-mem mode
authorXiao Wang <xiao.w.wang@intel.com>
Thu, 17 May 2018 07:35:25 +0000 (15:35 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 17 May 2018 10:29:05 +0000 (12:29 +0200)
In legacy-mem mode, memory event callback registering is not supported,
we should not return error in dev_init on this case.

Fixes: 12ecb2f63b12 ("net/virtio-user: support memory hotplug")

Suggested-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/net/virtio/virtio_user/virtio_user_dev.c

index aff01f5..4322527 100644 (file)
@@ -447,8 +447,11 @@ virtio_user_dev_init(struct virtio_user_dev *dev, char *path, int queues,
 
        if (rte_mem_event_callback_register(VIRTIO_USER_MEM_EVENT_CLB_NAME,
                                virtio_user_mem_event_cb, dev)) {
-               PMD_INIT_LOG(ERR, "Failed to register mem event callback\n");
-               return -1;
+               if (rte_errno != ENOTSUP) {
+                       PMD_INIT_LOG(ERR, "Failed to register mem event"
+                                       " callback\n");
+                       return -1;
+               }
        }
 
        return 0;