rte_virtio/user: removed virtio_user_dev.h
It's contents have been moved to virtio_user/vhost.h and virtio_dev.h. The virtio_user_dev struct can't be hidden in virtio_user.c (similarly to the virtio_hw), due to another abstraction layer in virtio_user - vhost-user and vhost-kernel. Even though only vhost-user is implemented now, let's not close the possibility to implement vhost-kernel in the future. The vhost-user/vhost-kernel code should probably be placed in separate files, with the virtio_user_dev struct in common vhost.h header. Change-Id: I36ee96eff30b398dd129953a874513e727619f98 Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/385622 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
136eb1150a
commit
9daed64edb
@ -49,7 +49,6 @@
|
|||||||
#include <linux/virtio_scsi.h>
|
#include <linux/virtio_scsi.h>
|
||||||
|
|
||||||
#include <virtio_dev.h>
|
#include <virtio_dev.h>
|
||||||
#include <virtio_user/virtio_user_dev.h>
|
|
||||||
|
|
||||||
#include "bdev_virtio.h"
|
#include "bdev_virtio.h"
|
||||||
|
|
||||||
|
@ -438,6 +438,23 @@ void virtio_dev_dump_json_config(struct virtio_dev *vdev, struct spdk_json_write
|
|||||||
*/
|
*/
|
||||||
int virtio_enumerate_pci(void);
|
int virtio_enumerate_pci(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to a vhost-user device and create corresponding virtio_dev.
|
||||||
|
*
|
||||||
|
* \param name name of this virtio device
|
||||||
|
* \param path path to the Unix domain socket of the vhost-user device
|
||||||
|
* \param requested_queues maximum number of request queues that this
|
||||||
|
* device will support
|
||||||
|
* \param queue_size size of each of the queues
|
||||||
|
* \param fixed_queue_num number of queues preceeding the first
|
||||||
|
* request queue. For Virtio-SCSI this is equal to 2, as there are
|
||||||
|
* additional event and control queues.
|
||||||
|
* \return virtio device
|
||||||
|
*/
|
||||||
|
struct virtio_dev *virtio_user_dev_init(const char *name, const char *path,
|
||||||
|
uint16_t requested_queues,
|
||||||
|
uint32_t queue_size, uint16_t fixed_queue_num);
|
||||||
|
|
||||||
extern const struct virtio_pci_ops virtio_user_ops;
|
extern const struct virtio_pci_ops virtio_user_ops;
|
||||||
|
|
||||||
#endif /* _VIRTIO_DEV_H_ */
|
#endif /* _VIRTIO_DEV_H_ */
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <rte_alarm.h>
|
#include <rte_alarm.h>
|
||||||
|
|
||||||
#include "virtio_dev.h"
|
#include "virtio_dev.h"
|
||||||
#include "virtio_user/virtio_user_dev.h"
|
#include "virtio_user/vhost.h"
|
||||||
|
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
|
|
||||||
#include "../virtio_dev.h"
|
#include "../virtio_dev.h"
|
||||||
|
|
||||||
|
#define VIRTIO_MAX_VIRTQUEUES 0x100
|
||||||
|
|
||||||
enum vhost_user_request {
|
enum vhost_user_request {
|
||||||
VHOST_USER_NONE = 0,
|
VHOST_USER_NONE = 0,
|
||||||
VHOST_USER_GET_FEATURES = 1,
|
VHOST_USER_GET_FEATURES = 1,
|
||||||
@ -67,7 +69,22 @@ enum vhost_user_request {
|
|||||||
|
|
||||||
extern const char *const vhost_msg_strings[VHOST_USER_MAX];
|
extern const char *const vhost_msg_strings[VHOST_USER_MAX];
|
||||||
|
|
||||||
struct virtio_user_dev;
|
struct virtio_user_backend_ops;
|
||||||
|
|
||||||
|
struct virtio_user_dev {
|
||||||
|
/* for vhost_user backend */
|
||||||
|
int vhostfd;
|
||||||
|
|
||||||
|
/* for both vhost_user and vhost_kernel */
|
||||||
|
int callfds[VIRTIO_MAX_VIRTQUEUES];
|
||||||
|
int kickfds[VIRTIO_MAX_VIRTQUEUES];
|
||||||
|
uint32_t queue_size;
|
||||||
|
|
||||||
|
uint8_t status;
|
||||||
|
char path[PATH_MAX];
|
||||||
|
struct vring vrings[VIRTIO_MAX_VIRTQUEUES];
|
||||||
|
struct virtio_user_backend_ops *ops;
|
||||||
|
};
|
||||||
|
|
||||||
struct virtio_user_backend_ops {
|
struct virtio_user_backend_ops {
|
||||||
int (*setup)(struct virtio_user_dev *dev);
|
int (*setup)(struct virtio_user_dev *dev);
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include "spdk/stdinc.h"
|
#include "spdk/stdinc.h"
|
||||||
|
|
||||||
#include "vhost.h"
|
#include "vhost.h"
|
||||||
#include "virtio_user_dev.h"
|
|
||||||
|
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
|
|
||||||
|
@ -1,77 +0,0 @@
|
|||||||
/*-
|
|
||||||
* BSD LICENSE
|
|
||||||
*
|
|
||||||
* Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
|
|
||||||
* 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 _VIRTIO_USER_DEV_H
|
|
||||||
#define _VIRTIO_USER_DEV_H
|
|
||||||
|
|
||||||
#include "spdk/stdinc.h"
|
|
||||||
|
|
||||||
#include "vhost.h"
|
|
||||||
|
|
||||||
#include "../virtio_dev.h"
|
|
||||||
|
|
||||||
#define VIRTIO_MAX_VIRTQUEUES 0x100
|
|
||||||
|
|
||||||
struct virtio_user_dev {
|
|
||||||
/* for vhost_user backend */
|
|
||||||
int vhostfd;
|
|
||||||
|
|
||||||
/* for both vhost_user and vhost_kernel */
|
|
||||||
int callfds[VIRTIO_MAX_VIRTQUEUES];
|
|
||||||
int kickfds[VIRTIO_MAX_VIRTQUEUES];
|
|
||||||
uint32_t queue_size;
|
|
||||||
|
|
||||||
uint8_t status;
|
|
||||||
char path[PATH_MAX];
|
|
||||||
struct vring vrings[VIRTIO_MAX_VIRTQUEUES];
|
|
||||||
struct virtio_user_backend_ops *ops;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connect to a vhost-user device and create corresponding virtio_dev.
|
|
||||||
*
|
|
||||||
* \param name name of this virtio device
|
|
||||||
* \param path path to the Unix domain socket of the vhost-user device
|
|
||||||
* \param requested_queues maximum number of request queues that this
|
|
||||||
* device will support
|
|
||||||
* \param queue_size size of each of the queues
|
|
||||||
* \param fixed_queue_num number of queues preceeding the first
|
|
||||||
* request queue. For Virtio-SCSI this is equal to 2, as there are
|
|
||||||
* additional event and control queues.
|
|
||||||
* \return virtio device
|
|
||||||
*/
|
|
||||||
struct virtio_dev *virtio_user_dev_init(const char *name, const char *path,
|
|
||||||
uint16_t requested_queues,
|
|
||||||
uint32_t queue_size, uint16_t fixed_queue_num);
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Reference in New Issue
Block a user