lib/vhost: Fix compilation with dpdk 21.11

Structure vhost_device_ops was renamed to
rte_vhost_device_ops

Cherry-picked-from: f72cab94dd
Signed-off-by: Michal Berger <michalx.berger@intel.com>

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ie9601099d47465536500aa37fc113aeae03a8254
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10223
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10713
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Alexey Marchuk 2021-11-15 11:01:14 +03:00 committed by Tomasz Zawadzki
parent f343f73d57
commit 7f10a88c11
2 changed files with 12 additions and 0 deletions

View File

@ -3,6 +3,7 @@
*
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) 2021 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -134,7 +135,11 @@ destroy_connection(int vid)
vhost_destroy_connection_cb(vid);
}
#if RTE_VERSION >= RTE_VERSION_NUM(21, 11, 0, 0)
static const struct rte_vhost_device_ops g_spdk_vhost_ops = {
#else
static const struct vhost_device_ops g_spdk_vhost_ops = {
#endif
.new_device = start_device,
.destroy_device = stop_device,
.new_connection = new_connection,

View File

@ -3,6 +3,7 @@
*
* Copyright (c) Intel Corporation.
* All rights reserved.
* Copyright (c) 2021 Mellanox Technologies LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -41,6 +42,7 @@
#include "unit/lib/json_mock.c"
#include "vhost/vhost.c"
#include <rte_version.h>
DEFINE_STUB(rte_vhost_set_vring_base, int, (int vid, uint16_t queue_id,
uint16_t last_avail_idx, uint16_t last_used_idx), 0);
@ -65,8 +67,13 @@ DEFINE_STUB(rte_vhost_enable_guest_notification, int,
(int vid, uint16_t queue_id, int enable), 0);
DEFINE_STUB(rte_vhost_get_ifname, int, (int vid, char *buf, size_t len), 0);
DEFINE_STUB(rte_vhost_driver_start, int, (const char *name), 0);
#if RTE_VERSION >= RTE_VERSION_NUM(21, 11, 0, 0)
DEFINE_STUB(rte_vhost_driver_callback_register, int,
(const char *path, struct rte_vhost_device_ops const *const ops), 0);
#else
DEFINE_STUB(rte_vhost_driver_callback_register, int,
(const char *path, struct vhost_device_ops const *const ops), 0);
#endif
DEFINE_STUB(rte_vhost_driver_disable_features, int, (const char *path, uint64_t features), 0);
DEFINE_STUB(rte_vhost_driver_set_features, int, (const char *path, uint64_t features), 0);
DEFINE_STUB(rte_vhost_driver_register, int, (const char *path, uint64_t flags), 0);