net/virtio-user: fix device init in legacy-mem mode

In legacy-mem mode, memory event callback registering is not supported,
we should not return error in dev_init on this case.

Fixes: 12ecb2f63b ("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>
This commit is contained in:
Xiao Wang 2018-05-17 15:35:25 +08:00 committed by Ferruh Yigit
parent 0230e058e9
commit 88e5469ff8

View 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;