Commit c010a71f authored by Tomasz Zawadzki's avatar Tomasz Zawadzki
Browse files

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: default avatarTomasz 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent fd53562a
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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);
+5 −2
Original line number Diff line number Diff line
@@ -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;

	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);
+1 −2
Original line number Diff line number Diff line
@@ -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;