lib:vhost Add version check when use RTE_VHOST_USER_ASYNC_COPY in 21.01

In dpdk 19.11 version, RTE_VHOST_USER_ASYNC_COPY is not define.
After dpdk 20.08, we can use RTE_VHOST_USER_ASYNC_COPY.
Use version check to avoid this problem.

Signed-off-by: sunshihao <sunshihao@huawei.com>
Change-Id: Iaf9914e8380f3d54cded1e2f16af6a7dc3504f95
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6274
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Community-CI: Mellanox Build Bot
This commit is contained in:
sunshihao520 2021-02-09 15:17:24 +08:00 committed by Tomasz Zawadzki
parent 240fdd7dd1
commit 9529803fe0

View File

@ -46,6 +46,7 @@
#include "spdk/barrier.h"
#include "spdk/vhost.h"
#include "vhost_internal.h"
#include <rte_version.h>
#include "spdk_internal/vhost_user.h"
@ -331,7 +332,11 @@ vhost_register_unix_socket(const char *path, const char *ctrl_name,
}
}
#if RTE_VERSION < RTE_VERSION_NUM(20, 8, 0, 0)
if (rte_vhost_driver_register(path, 0) != 0) {
#else
if (rte_vhost_driver_register(path, RTE_VHOST_USER_ASYNC_COPY) != 0) {
#endif
SPDK_ERRLOG("Could not register controller %s with vhost library\n", ctrl_name);
SPDK_ERRLOG("Check if domain socket %s already exists\n", path);
return -EIO;