2017-05-22 12:53:27 +00:00
|
|
|
/*-
|
|
|
|
* BSD LICENSE
|
|
|
|
*
|
|
|
|
* Copyright (c) Intel Corporation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* * Neither the name of Intel Corporation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPDK_VHOST_INTERNAL_H
|
|
|
|
#define SPDK_VHOST_INTERNAL_H
|
|
|
|
|
|
|
|
#include "spdk/stdinc.h"
|
|
|
|
|
|
|
|
#include <rte_vhost.h>
|
|
|
|
|
|
|
|
#include "spdk_internal/log.h"
|
|
|
|
#include "spdk/event.h"
|
2017-07-13 14:37:50 +00:00
|
|
|
#include "spdk/rpc.h"
|
2019-02-25 00:57:46 +00:00
|
|
|
#include "spdk/config.h"
|
2017-05-22 12:53:27 +00:00
|
|
|
|
|
|
|
#define SPDK_CACHE_LINE_SIZE RTE_CACHE_LINE_SIZE
|
|
|
|
|
2017-05-26 13:24:31 +00:00
|
|
|
#ifndef VHOST_USER_F_PROTOCOL_FEATURES
|
|
|
|
#define VHOST_USER_F_PROTOCOL_FEATURES 30
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef VIRTIO_F_VERSION_1
|
|
|
|
#define VIRTIO_F_VERSION_1 32
|
|
|
|
#endif
|
|
|
|
|
2017-08-08 16:52:33 +00:00
|
|
|
#ifndef VIRTIO_BLK_F_MQ
|
|
|
|
#define VIRTIO_BLK_F_MQ 12 /* support more than one vq */
|
|
|
|
#endif
|
|
|
|
|
2017-06-29 21:01:15 +00:00
|
|
|
#ifndef VIRTIO_BLK_F_CONFIG_WCE
|
|
|
|
#define VIRTIO_BLK_F_CONFIG_WCE 11
|
|
|
|
#endif
|
|
|
|
|
2017-07-10 09:42:54 +00:00
|
|
|
#define SPDK_VHOST_MAX_VQUEUES 256
|
2017-10-10 20:19:40 +00:00
|
|
|
#define SPDK_VHOST_MAX_VQ_SIZE 1024
|
2017-05-22 12:53:27 +00:00
|
|
|
|
2017-06-02 16:00:22 +00:00
|
|
|
#define SPDK_VHOST_SCSI_CTRLR_MAX_DEVS 8
|
|
|
|
|
2018-01-22 22:40:00 +00:00
|
|
|
#define SPDK_VHOST_IOVS_MAX 129
|
2017-07-28 16:03:49 +00:00
|
|
|
|
2017-09-11 17:45:56 +00:00
|
|
|
/*
|
|
|
|
* Rate at which stats are checked for interrupt coalescing.
|
|
|
|
*/
|
2018-12-17 02:45:35 +00:00
|
|
|
#define SPDK_VHOST_STATS_CHECK_INTERVAL_MS 10
|
2017-09-11 17:45:56 +00:00
|
|
|
/*
|
|
|
|
* Default threshold at which interrupts start to be coalesced.
|
|
|
|
*/
|
|
|
|
#define SPDK_VHOST_VQ_IOPS_COALESCING_THRESHOLD 60000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Currently coalescing is not used by default.
|
|
|
|
* Setting this to value > 0 here or by RPC will enable coalescing.
|
|
|
|
*/
|
|
|
|
#define SPDK_VHOST_COALESCING_DELAY_BASE_US 0
|
|
|
|
|
|
|
|
|
2017-08-09 16:59:53 +00:00
|
|
|
#define SPDK_VHOST_FEATURES ((1ULL << VHOST_F_LOG_ALL) | \
|
|
|
|
(1ULL << VHOST_USER_F_PROTOCOL_FEATURES) | \
|
|
|
|
(1ULL << VIRTIO_F_VERSION_1) | \
|
|
|
|
(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \
|
|
|
|
(1ULL << VIRTIO_RING_F_EVENT_IDX) | \
|
|
|
|
(1ULL << VIRTIO_RING_F_INDIRECT_DESC))
|
|
|
|
|
2018-01-03 13:24:38 +00:00
|
|
|
#define SPDK_VHOST_DISABLED_FEATURES ((1ULL << VIRTIO_RING_F_EVENT_IDX) | \
|
2018-02-04 12:24:13 +00:00
|
|
|
(1ULL << VIRTIO_F_NOTIFY_ON_EMPTY))
|
2017-08-09 16:59:53 +00:00
|
|
|
|
2017-08-31 14:38:35 +00:00
|
|
|
struct spdk_vhost_virtqueue {
|
|
|
|
struct rte_vhost_vring vring;
|
2019-02-24 23:46:37 +00:00
|
|
|
uint16_t last_avail_idx;
|
|
|
|
uint16_t last_used_idx;
|
|
|
|
|
2017-10-10 20:19:40 +00:00
|
|
|
void *tasks;
|
2017-09-11 17:45:56 +00:00
|
|
|
|
|
|
|
/* Request count from last stats check */
|
|
|
|
uint32_t req_cnt;
|
|
|
|
|
|
|
|
/* Request count from last event */
|
|
|
|
uint16_t used_req_cnt;
|
|
|
|
|
|
|
|
/* How long interrupt is delayed */
|
|
|
|
uint32_t irq_delay_time;
|
|
|
|
|
|
|
|
/* Next time when we need to send event */
|
|
|
|
uint64_t next_event_time;
|
|
|
|
|
2019-05-10 11:37:54 +00:00
|
|
|
/* Associated vhost_virtqueue in the virtio device's virtqueue list */
|
|
|
|
uint32_t vring_idx;
|
2017-08-31 14:38:35 +00:00
|
|
|
} __attribute((aligned(SPDK_CACHE_LINE_SIZE)));
|
|
|
|
|
2018-12-14 13:44:46 +00:00
|
|
|
struct spdk_vhost_session {
|
|
|
|
struct spdk_vhost_dev *vdev;
|
|
|
|
|
|
|
|
/* rte_vhost connection ID. */
|
|
|
|
int vid;
|
|
|
|
|
2018-12-17 15:33:30 +00:00
|
|
|
/* Unique session ID. */
|
|
|
|
unsigned id;
|
|
|
|
|
2019-01-07 23:30:57 +00:00
|
|
|
int32_t lcore;
|
|
|
|
|
2019-03-27 13:59:45 +00:00
|
|
|
bool initialized;
|
2019-04-29 07:26:10 +00:00
|
|
|
bool started;
|
2019-02-23 11:59:34 +00:00
|
|
|
bool needs_restart;
|
2019-03-04 22:44:43 +00:00
|
|
|
bool forced_polling;
|
2019-02-23 11:59:34 +00:00
|
|
|
|
2018-12-14 13:44:46 +00:00
|
|
|
struct rte_vhost_memory *mem;
|
|
|
|
|
|
|
|
int task_cnt;
|
|
|
|
|
|
|
|
uint16_t max_queues;
|
|
|
|
|
|
|
|
uint64_t negotiated_features;
|
|
|
|
|
2018-12-17 02:45:35 +00:00
|
|
|
/* Local copy of device coalescing settings. */
|
|
|
|
uint32_t coalescing_delay_time_base;
|
|
|
|
uint32_t coalescing_io_rate_threshold;
|
|
|
|
|
|
|
|
/* Next time when stats for event coalescing will be checked. */
|
|
|
|
uint64_t next_stats_check_time;
|
|
|
|
|
|
|
|
/* Interval used for event coalescing checking. */
|
|
|
|
uint64_t stats_check_interval;
|
|
|
|
|
2018-12-14 13:44:46 +00:00
|
|
|
struct spdk_vhost_virtqueue virtqueue[SPDK_VHOST_MAX_VQUEUES];
|
2018-12-17 15:33:30 +00:00
|
|
|
|
|
|
|
TAILQ_ENTRY(spdk_vhost_session) tailq;
|
2019-03-16 23:00:57 +00:00
|
|
|
|
|
|
|
struct spdk_vhost_session_fn_ctx *event_ctx;
|
2018-12-14 13:44:46 +00:00
|
|
|
};
|
|
|
|
|
2017-05-22 12:53:27 +00:00
|
|
|
struct spdk_vhost_dev {
|
|
|
|
char *name;
|
2017-06-19 14:37:51 +00:00
|
|
|
char *path;
|
2017-05-22 12:53:27 +00:00
|
|
|
|
2017-12-21 16:48:31 +00:00
|
|
|
struct spdk_cpuset *cpumask;
|
2018-01-26 13:46:26 +00:00
|
|
|
bool registered;
|
2017-05-22 12:53:27 +00:00
|
|
|
|
2017-08-01 13:46:51 +00:00
|
|
|
const struct spdk_vhost_dev_backend *backend;
|
2017-05-25 17:45:26 +00:00
|
|
|
|
2018-06-15 15:10:58 +00:00
|
|
|
/* Saved orginal values used to setup coalescing to avoid integer
|
|
|
|
* rounding issues during save/load config.
|
|
|
|
*/
|
|
|
|
uint32_t coalescing_delay_us;
|
|
|
|
uint32_t coalescing_iops_threshold;
|
|
|
|
|
2018-12-17 15:33:30 +00:00
|
|
|
/* Current connections to the device */
|
|
|
|
TAILQ_HEAD(, spdk_vhost_session) vsessions;
|
|
|
|
|
|
|
|
/* Increment-only session counter */
|
|
|
|
uint64_t vsessions_num;
|
2018-02-12 20:02:15 +00:00
|
|
|
|
2019-01-23 12:39:40 +00:00
|
|
|
/* Number of started and actively polled sessions */
|
|
|
|
uint32_t active_session_num;
|
|
|
|
|
2019-01-07 23:30:57 +00:00
|
|
|
/* Number of pending asynchronous operations */
|
|
|
|
uint32_t pending_async_op_num;
|
|
|
|
|
2018-02-12 20:02:15 +00:00
|
|
|
TAILQ_ENTRY(spdk_vhost_dev) tailq;
|
2017-05-22 12:53:27 +00:00
|
|
|
};
|
|
|
|
|
2018-12-15 23:49:00 +00:00
|
|
|
/**
|
|
|
|
* Synchronized vhost session event used for backend callbacks.
|
|
|
|
*
|
|
|
|
* \param vdev vhost device. If the device has been deleted
|
|
|
|
* in the meantime, this function will be called one last
|
|
|
|
* time with vdev == NULL.
|
|
|
|
* \param vsession vhost session. If all sessions have been
|
|
|
|
* iterated through, this function will be called one last
|
|
|
|
* time with vsession == NULL.
|
|
|
|
* \param arg user-provided parameter.
|
|
|
|
*
|
|
|
|
* \return negative values will break the foreach call, meaning
|
|
|
|
* the function won't be called again. Return codes zero and
|
|
|
|
* positive don't have any effect.
|
|
|
|
*/
|
|
|
|
typedef int (*spdk_vhost_session_fn)(struct spdk_vhost_dev *vdev,
|
|
|
|
struct spdk_vhost_session *vsession,
|
|
|
|
void *arg);
|
|
|
|
|
2019-01-06 22:45:11 +00:00
|
|
|
struct spdk_vhost_dev_backend {
|
|
|
|
uint64_t virtio_features;
|
|
|
|
uint64_t disabled_features;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Size of additional per-session context data
|
|
|
|
* allocated whenever a new client connects.
|
|
|
|
*/
|
|
|
|
size_t session_ctx_size;
|
|
|
|
|
2019-01-22 11:57:09 +00:00
|
|
|
int (*start_session)(struct spdk_vhost_session *vsession);
|
|
|
|
int (*stop_session)(struct spdk_vhost_session *vsession);
|
2019-01-06 22:45:11 +00:00
|
|
|
|
|
|
|
int (*vhost_get_config)(struct spdk_vhost_dev *vdev, uint8_t *config, uint32_t len);
|
|
|
|
int (*vhost_set_config)(struct spdk_vhost_dev *vdev, uint8_t *config,
|
|
|
|
uint32_t offset, uint32_t size, uint32_t flags);
|
|
|
|
|
|
|
|
void (*dump_info_json)(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
|
|
|
void (*write_config_json)(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
|
|
|
int (*remove_device)(struct spdk_vhost_dev *vdev);
|
|
|
|
};
|
|
|
|
|
2018-12-13 10:51:34 +00:00
|
|
|
void *spdk_vhost_gpa_to_vva(struct spdk_vhost_session *vsession, uint64_t addr, uint64_t len);
|
2017-05-25 15:52:16 +00:00
|
|
|
|
2017-08-31 14:38:35 +00:00
|
|
|
uint16_t spdk_vhost_vq_avail_ring_get(struct spdk_vhost_virtqueue *vq, uint16_t *reqs,
|
2017-05-24 12:52:07 +00:00
|
|
|
uint16_t reqs_len);
|
|
|
|
|
2017-10-09 15:28:00 +00:00
|
|
|
/**
|
|
|
|
* Get a virtio descriptor at given index in given virtqueue.
|
|
|
|
* The descriptor will provide access to the entire descriptor
|
|
|
|
* chain. The subsequent descriptors are accesible via
|
|
|
|
* \c spdk_vhost_vring_desc_get_next.
|
2018-12-13 10:51:34 +00:00
|
|
|
* \param vsession vhost session
|
2017-10-09 15:28:00 +00:00
|
|
|
* \param vq virtqueue
|
|
|
|
* \param req_idx descriptor index
|
|
|
|
* \param desc pointer to be set to the descriptor
|
|
|
|
* \param desc_table descriptor table to be used with
|
|
|
|
* \c spdk_vhost_vring_desc_get_next. This might be either
|
|
|
|
* default virtqueue descriptor table or per-chain indirect
|
|
|
|
* table.
|
|
|
|
* \param desc_table_size size of the *desc_table*
|
|
|
|
* \return 0 on success, -1 if given index is invalid.
|
2017-10-13 13:30:05 +00:00
|
|
|
* If -1 is returned, the content of params is undefined.
|
2017-10-09 15:28:00 +00:00
|
|
|
*/
|
2018-12-13 10:51:34 +00:00
|
|
|
int spdk_vhost_vq_get_desc(struct spdk_vhost_session *vsession, struct spdk_vhost_virtqueue *vq,
|
2017-08-31 14:38:35 +00:00
|
|
|
uint16_t req_idx, struct vring_desc **desc, struct vring_desc **desc_table,
|
|
|
|
uint32_t *desc_table_size);
|
2017-09-11 17:45:56 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send IRQ/call client (if pending) for \c vq.
|
2018-12-13 10:51:34 +00:00
|
|
|
* \param vsession vhost session
|
2017-09-11 17:45:56 +00:00
|
|
|
* \param vq virtqueue
|
|
|
|
* \return
|
|
|
|
* 0 - if no interrupt was signalled
|
|
|
|
* 1 - if interrupt was signalled
|
|
|
|
*/
|
2018-12-13 10:51:34 +00:00
|
|
|
int spdk_vhost_vq_used_signal(struct spdk_vhost_session *vsession, struct spdk_vhost_virtqueue *vq);
|
2017-09-11 17:45:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send IRQs for all queues that need to be signaled.
|
2018-12-13 10:51:34 +00:00
|
|
|
* \param vsession vhost session
|
2017-09-11 17:45:56 +00:00
|
|
|
* \param vq virtqueue
|
|
|
|
*/
|
2018-12-13 10:51:34 +00:00
|
|
|
void spdk_vhost_session_used_signal(struct spdk_vhost_session *vsession);
|
2017-09-11 17:45:56 +00:00
|
|
|
|
2018-12-13 10:51:34 +00:00
|
|
|
void spdk_vhost_vq_used_ring_enqueue(struct spdk_vhost_session *vsession,
|
|
|
|
struct spdk_vhost_virtqueue *vq,
|
2017-05-24 12:52:07 +00:00
|
|
|
uint16_t id, uint32_t len);
|
2017-10-09 15:28:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get subsequent descriptor from given table.
|
|
|
|
* \param desc current descriptor, will be set to the
|
|
|
|
* next descriptor (NULL in case this is the last
|
|
|
|
* descriptor in the chain or the next desc is invalid)
|
|
|
|
* \param desc_table descriptor table
|
|
|
|
* \param desc_table_size size of the *desc_table*
|
|
|
|
* \return 0 on success, -1 if given index is invalid
|
|
|
|
* The *desc* param will be set regardless of the
|
|
|
|
* return value.
|
|
|
|
*/
|
|
|
|
int spdk_vhost_vring_desc_get_next(struct vring_desc **desc,
|
|
|
|
struct vring_desc *desc_table, uint32_t desc_table_size);
|
2017-05-24 12:52:07 +00:00
|
|
|
bool spdk_vhost_vring_desc_is_wr(struct vring_desc *cur_desc);
|
|
|
|
|
2018-12-13 10:51:34 +00:00
|
|
|
int spdk_vhost_vring_desc_to_iov(struct spdk_vhost_session *vsession, struct iovec *iov,
|
2017-07-28 15:36:53 +00:00
|
|
|
uint16_t *iov_index, const struct vring_desc *desc);
|
2018-02-16 15:38:32 +00:00
|
|
|
|
|
|
|
static inline bool __attribute__((always_inline))
|
2018-12-13 10:51:34 +00:00
|
|
|
spdk_vhost_dev_has_feature(struct spdk_vhost_session *vsession, unsigned feature_id)
|
2018-02-16 15:38:32 +00:00
|
|
|
{
|
2018-12-13 10:51:34 +00:00
|
|
|
return vsession->negotiated_features & (1ULL << feature_id);
|
2018-02-16 15:38:32 +00:00
|
|
|
}
|
2017-06-02 17:51:19 +00:00
|
|
|
|
2018-01-26 13:09:39 +00:00
|
|
|
int spdk_vhost_dev_register(struct spdk_vhost_dev *vdev, const char *name, const char *mask_str,
|
2018-01-26 14:29:20 +00:00
|
|
|
const struct spdk_vhost_dev_backend *backend);
|
2018-01-26 13:09:39 +00:00
|
|
|
int spdk_vhost_dev_unregister(struct spdk_vhost_dev *vdev);
|
2017-06-02 17:51:19 +00:00
|
|
|
|
2017-08-10 17:56:20 +00:00
|
|
|
int spdk_vhost_scsi_controller_construct(void);
|
2017-05-24 14:48:22 +00:00
|
|
|
int spdk_vhost_blk_controller_construct(void);
|
2018-03-19 18:01:57 +00:00
|
|
|
void spdk_vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
2018-12-15 23:49:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Call function for each active session on the provided
|
|
|
|
* vhost device. The function will be called one-by-one
|
|
|
|
* on each session's thread.
|
|
|
|
*
|
|
|
|
* \param vdev vhost device
|
|
|
|
* \param fn function to call
|
|
|
|
* \param arg additional argument to \c fn
|
|
|
|
*/
|
|
|
|
void spdk_vhost_dev_foreach_session(struct spdk_vhost_dev *dev,
|
|
|
|
spdk_vhost_session_fn fn, void *arg);
|
2019-01-22 11:57:09 +00:00
|
|
|
|
|
|
|
/**
|
2019-03-17 11:13:01 +00:00
|
|
|
* Call a function on the provided lcore and block until either
|
2019-03-17 12:08:25 +00:00
|
|
|
* spdk_vhost_session_start_done() or spdk_vhost_session_stop_done()
|
|
|
|
* is called.
|
2019-01-22 11:57:09 +00:00
|
|
|
*
|
2019-03-16 23:50:51 +00:00
|
|
|
* This must be called under the global vhost mutex, which this function
|
2019-03-17 12:08:25 +00:00
|
|
|
* will unlock for the time it's waiting. It's meant to be called only
|
|
|
|
* from start/stop session callbacks.
|
2019-01-22 11:57:09 +00:00
|
|
|
*
|
2019-03-17 11:13:01 +00:00
|
|
|
* \param lcore target session's lcore
|
2019-01-22 11:57:09 +00:00
|
|
|
* \param vsession vhost session
|
|
|
|
* \param cb_fn the function to call. The void *arg parameter in cb_fn
|
2019-03-16 23:00:57 +00:00
|
|
|
* is always NULL.
|
2019-01-22 11:57:09 +00:00
|
|
|
* \param timeout_sec timeout in seconds. This function will still
|
|
|
|
* block after the timeout expires, but will print the provided errmsg.
|
|
|
|
* \param errmsg error message to print once the timeout expires
|
|
|
|
* \return return the code passed to spdk_vhost_session_event_done().
|
|
|
|
*/
|
2019-03-17 11:13:01 +00:00
|
|
|
int spdk_vhost_session_send_event(int32_t lcore, struct spdk_vhost_session *vsession,
|
2019-03-17 12:08:25 +00:00
|
|
|
spdk_vhost_session_fn cb_fn, unsigned timeout_sec,
|
|
|
|
const char *errmsg);
|
2019-01-22 11:57:09 +00:00
|
|
|
|
|
|
|
/**
|
2019-03-17 12:08:25 +00:00
|
|
|
* Finish a blocking spdk_vhost_session_send_event() call and finally
|
|
|
|
* start the session. This must be called on the target lcore, which
|
|
|
|
* will now receive all session-related messages (e.g. from
|
|
|
|
* spdk_vhost_dev_foreach_session()).
|
|
|
|
*
|
|
|
|
* Must be called under the global vhost lock.
|
|
|
|
*
|
|
|
|
* \param vsession vhost session
|
|
|
|
* \param response return code
|
|
|
|
*/
|
|
|
|
void spdk_vhost_session_start_done(struct spdk_vhost_session *vsession, int response);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Finish a blocking spdk_vhost_session_send_event() call and finally
|
|
|
|
* stop the session. This must be called on the session's lcore which
|
|
|
|
* used to receive all session-related messages (e.g. from
|
2019-03-17 11:13:01 +00:00
|
|
|
* spdk_vhost_dev_foreach_session()). After this call, the session-
|
|
|
|
* related messages will be once again processed by any arbitrary thread.
|
2019-03-17 12:08:25 +00:00
|
|
|
*
|
|
|
|
* Must be called under the global vhost lock.
|
2019-01-22 11:57:09 +00:00
|
|
|
*
|
2019-03-16 23:50:51 +00:00
|
|
|
* Must be called under the global vhost mutex.
|
|
|
|
*
|
2019-03-16 23:00:57 +00:00
|
|
|
* \param vsession vhost session
|
2019-01-22 11:57:09 +00:00
|
|
|
* \param response return code
|
|
|
|
*/
|
2019-03-17 12:08:25 +00:00
|
|
|
void spdk_vhost_session_stop_done(struct spdk_vhost_session *vsession, int response);
|
2019-01-22 11:57:09 +00:00
|
|
|
|
2019-02-23 11:59:34 +00:00
|
|
|
struct spdk_vhost_session *spdk_vhost_session_find_by_vid(int vid);
|
|
|
|
void spdk_vhost_session_install_rte_compat_hooks(struct spdk_vhost_session *vsession);
|
2019-03-04 21:34:44 +00:00
|
|
|
void spdk_vhost_dev_install_rte_compat_hooks(struct spdk_vhost_dev *vdev);
|
2019-02-23 11:59:34 +00:00
|
|
|
|
2019-01-22 15:25:35 +00:00
|
|
|
void spdk_vhost_free_reactor(uint32_t lcore);
|
|
|
|
uint32_t spdk_vhost_allocate_reactor(struct spdk_cpuset *cpumask);
|
|
|
|
|
2017-11-22 06:01:48 +00:00
|
|
|
int spdk_remove_vhost_controller(struct spdk_vhost_dev *vdev);
|
2019-02-25 00:57:46 +00:00
|
|
|
|
|
|
|
#ifdef SPDK_CONFIG_VHOST_INTERNAL_LIB
|
2017-11-22 06:01:48 +00:00
|
|
|
int spdk_vhost_nvme_admin_passthrough(int vid, void *cmd, void *cqe, void *buf);
|
|
|
|
int spdk_vhost_nvme_set_cq_call(int vid, uint16_t qid, int fd);
|
2018-06-21 08:30:29 +00:00
|
|
|
int spdk_vhost_nvme_set_bar_mr(int vid, void *bar_addr, uint64_t bar_size);
|
2017-11-22 06:01:48 +00:00
|
|
|
int spdk_vhost_nvme_get_cap(int vid, uint64_t *cap);
|
|
|
|
int spdk_vhost_nvme_controller_construct(void);
|
|
|
|
int spdk_vhost_nvme_dev_construct(const char *name, const char *cpumask, uint32_t io_queues);
|
|
|
|
int spdk_vhost_nvme_dev_remove(struct spdk_vhost_dev *vdev);
|
|
|
|
int spdk_vhost_nvme_dev_add_ns(struct spdk_vhost_dev *vdev,
|
|
|
|
const char *bdev_name);
|
2019-02-25 00:57:46 +00:00
|
|
|
#endif
|
2017-05-26 12:00:56 +00:00
|
|
|
|
2017-05-22 12:53:27 +00:00
|
|
|
#endif /* SPDK_VHOST_INTERNAL_H */
|