lib/vhost: make packed_ring_recovery per controller

Previously g_packed_ring_recovery was set globally.
Setting that during controller creation, would affect
all previously created controllers.

This is now set on per-controller basis and only
enabled if packed ring feature is used.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Idcc7231471446c805154648ab835a6af78f6543c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12040
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Tomasz Zawadzki 2022-03-25 11:31:06 +01:00
parent fd53562a87
commit c010a71f27
3 changed files with 7 additions and 7 deletions

View File

@ -46,8 +46,6 @@
#include "spdk_internal/vhost_user.h"
bool g_packed_ring_recovery = false;
/* Path to folder where character device will be created. Can be set by user. */
static char g_vhost_user_dev_dirname[PATH_MAX] = "";
@ -1003,7 +1001,7 @@ start_device(int vid)
* supports split ring inflight because it doesn't send negotiated features
* before get inflight fd. Users can use RPC to enable this function.
*/
if (spdk_unlikely(g_packed_ring_recovery)) {
if (spdk_unlikely(vdev->packed_ring_recovery)) {
rte_vhost_get_vring_base_from_inflight(vsession->vid, i,
&q->last_avail_idx,
&q->last_used_idx);

View File

@ -1563,7 +1563,6 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_
ret = -EINVAL;
goto out;
}
g_packed_ring_recovery = req.packed_ring_recovery;
bvdev = calloc(1, sizeof(*bvdev));
if (bvdev == NULL) {
@ -1583,8 +1582,12 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_
vdev->virtio_features = SPDK_VHOST_BLK_FEATURES_BASE;
vdev->disabled_features = SPDK_VHOST_BLK_DISABLED_FEATURES;
vdev->protocol_features = SPDK_VHOST_BLK_PROTOCOL_FEATURES;
vdev->packed_ring_recovery = false;
vdev->virtio_features |= (uint64_t)req.packed_ring << VIRTIO_F_RING_PACKED;
if (req.packed_ring) {
vdev->virtio_features |= (uint64_t)req.packed_ring << VIRTIO_F_RING_PACKED;
vdev->packed_ring_recovery = req.packed_ring_recovery;
}
if (spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
vdev->virtio_features |= (1ULL << VIRTIO_BLK_F_DISCARD);

View File

@ -45,8 +45,6 @@
#include "spdk/rpc.h"
#include "spdk/config.h"
extern bool g_packed_ring_recovery;
#define SPDK_VHOST_MAX_VQUEUES 256
#define SPDK_VHOST_MAX_VQ_SIZE 1024
@ -184,6 +182,7 @@ struct spdk_vhost_dev {
uint64_t virtio_features;
uint64_t disabled_features;
uint64_t protocol_features;
bool packed_ring_recovery;
const struct spdk_vhost_dev_backend *backend;