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:
parent
fd53562a87
commit
c010a71f27
@ -46,8 +46,6 @@
|
|||||||
|
|
||||||
#include "spdk_internal/vhost_user.h"
|
#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. */
|
/* Path to folder where character device will be created. Can be set by user. */
|
||||||
static char g_vhost_user_dev_dirname[PATH_MAX] = "";
|
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
|
* supports split ring inflight because it doesn't send negotiated features
|
||||||
* before get inflight fd. Users can use RPC to enable this function.
|
* 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,
|
rte_vhost_get_vring_base_from_inflight(vsession->vid, i,
|
||||||
&q->last_avail_idx,
|
&q->last_avail_idx,
|
||||||
&q->last_used_idx);
|
&q->last_used_idx);
|
||||||
|
@ -1563,7 +1563,6 @@ spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_
|
|||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
g_packed_ring_recovery = req.packed_ring_recovery;
|
|
||||||
|
|
||||||
bvdev = calloc(1, sizeof(*bvdev));
|
bvdev = calloc(1, sizeof(*bvdev));
|
||||||
if (bvdev == NULL) {
|
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->virtio_features = SPDK_VHOST_BLK_FEATURES_BASE;
|
||||||
vdev->disabled_features = SPDK_VHOST_BLK_DISABLED_FEATURES;
|
vdev->disabled_features = SPDK_VHOST_BLK_DISABLED_FEATURES;
|
||||||
vdev->protocol_features = SPDK_VHOST_BLK_PROTOCOL_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->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)) {
|
if (spdk_bdev_io_type_supported(bdev, SPDK_BDEV_IO_TYPE_UNMAP)) {
|
||||||
vdev->virtio_features |= (1ULL << VIRTIO_BLK_F_DISCARD);
|
vdev->virtio_features |= (1ULL << VIRTIO_BLK_F_DISCARD);
|
||||||
|
@ -45,8 +45,6 @@
|
|||||||
#include "spdk/rpc.h"
|
#include "spdk/rpc.h"
|
||||||
#include "spdk/config.h"
|
#include "spdk/config.h"
|
||||||
|
|
||||||
extern bool g_packed_ring_recovery;
|
|
||||||
|
|
||||||
#define SPDK_VHOST_MAX_VQUEUES 256
|
#define SPDK_VHOST_MAX_VQUEUES 256
|
||||||
#define SPDK_VHOST_MAX_VQ_SIZE 1024
|
#define SPDK_VHOST_MAX_VQ_SIZE 1024
|
||||||
|
|
||||||
@ -184,6 +182,7 @@ struct spdk_vhost_dev {
|
|||||||
uint64_t virtio_features;
|
uint64_t virtio_features;
|
||||||
uint64_t disabled_features;
|
uint64_t disabled_features;
|
||||||
uint64_t protocol_features;
|
uint64_t protocol_features;
|
||||||
|
bool packed_ring_recovery;
|
||||||
|
|
||||||
const struct spdk_vhost_dev_backend *backend;
|
const struct spdk_vhost_dev_backend *backend;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user