FD.io VPP  v18.07-34-g55fbdb9
Vector Packet Processing
vhost_user.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vhost_user_memory_region
 
struct  vhost_user_memory
 
struct  vhost_user_log
 
struct  vhost_user_msg
 
struct  vhost_user_vring_t
 
struct  vhost_user_intf_t
 
struct  vhost_copy_t
 
struct  vhost_trace_t
 
struct  vhost_cpu_t
 
struct  vhost_user_main_t
 
struct  vhost_user_intf_details_t
 

Macros

#define VHOST_MEMORY_MAX_NREGIONS   8
 
#define VHOST_USER_MSG_HDR_SZ   12
 
#define VHOST_VRING_MAX_SIZE   32768
 
#define VHOST_VRING_MAX_N   16
 
#define VHOST_VRING_IDX_RX(qid)   (2*qid)
 
#define VHOST_VRING_IDX_TX(qid)   (2*qid + 1)
 
#define VHOST_USER_VRING_NOFD_MASK   0x100
 
#define VIRTQ_DESC_F_NEXT   1
 
#define VIRTQ_DESC_F_INDIRECT   4
 
#define VHOST_USER_REPLY_MASK   (0x1 << 2)
 
#define VHOST_USER_PROTOCOL_F_MQ   0
 
#define VHOST_USER_PROTOCOL_F_LOG_SHMFD   1
 
#define VHOST_VRING_F_LOG   0
 
#define VHOST_USER_F_PROTOCOL_FEATURES   30
 
#define VHOST_USER_PROTOCOL_FEATURES
 
#define VIRTIO_NET_CTRL_MQ   4
 
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET   0
 
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN   1
 
#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX   0x8000
 
#define VRING_USED_F_NO_NOTIFY   1
 
#define VRING_AVAIL_F_NO_INTERRUPT   1
 
#define DBG_SOCK(args...)
 
#define VHOST_DEBUG_VQ   0
 
#define DBG_VQ(args...)
 
#define UNIX_GET_FD(unixfd_idx)
 
#define foreach_virtio_trace_flags
 
#define foreach_virtio_net_feature
 
#define VHOST_USER_EVENT_START_TIMER   1
 
#define VHOST_USER_EVENT_STOP_TIMER   2
 
#define VHOST_USER_RX_BUFFERS_N   (2 * VLIB_FRAME_SIZE + 2)
 
#define VHOST_USER_COPY_ARRAY_N   (4 * VLIB_FRAME_SIZE)
 

Typedefs

typedef enum vhost_user_req vhost_user_req_t
 

Enumerations

enum  virtio_trace_flag_t { foreach_virtio_trace_flags }
 
enum  virtio_net_feature_t { foreach_virtio_net_feature }
 
enum  vhost_user_req {
  VHOST_USER_NONE = 0, VHOST_USER_GET_FEATURES = 1, VHOST_USER_SET_FEATURES = 2, VHOST_USER_SET_OWNER = 3,
  VHOST_USER_RESET_OWNER = 4, VHOST_USER_SET_MEM_TABLE = 5, VHOST_USER_SET_LOG_BASE = 6, VHOST_USER_SET_LOG_FD = 7,
  VHOST_USER_SET_VRING_NUM = 8, VHOST_USER_SET_VRING_ADDR = 9, VHOST_USER_SET_VRING_BASE = 10, VHOST_USER_GET_VRING_BASE = 11,
  VHOST_USER_SET_VRING_KICK = 12, VHOST_USER_SET_VRING_CALL = 13, VHOST_USER_SET_VRING_ERR = 14, VHOST_USER_GET_PROTOCOL_FEATURES = 15,
  VHOST_USER_SET_PROTOCOL_FEATURES = 16, VHOST_USER_GET_QUEUE_NUM = 17, VHOST_USER_SET_VRING_ENABLE = 18, VHOST_USER_MAX
}
 

Functions

int vhost_user_create_if (vnet_main_t *vnm, vlib_main_t *vm, const char *sock_filename, u8 is_server, u32 *sw_if_index, u64 feature_mask, u8 renumber, u32 custom_dev_instance, u8 *hwaddr)
 
int vhost_user_modify_if (vnet_main_t *vnm, vlib_main_t *vm, const char *sock_filename, u8 is_server, u32 sw_if_index, u64 feature_mask, u8 renumber, u32 custom_dev_instance)
 
int vhost_user_delete_if (vnet_main_t *vnm, vlib_main_t *vm, u32 sw_if_index)
 
int vhost_user_dump_ifs (vnet_main_t *vnm, vlib_main_t *vm, vhost_user_intf_details_t **out_vuids)
 

Variables

u64 guest_phys_addr
 
u64 memory_size
 
u64 userspace_addr
 
u64 mmap_offset
 
u32 nregions
 
u32 padding
 
vhost_user_memory_region_t regions [VHOST_MEMORY_MAX_NREGIONS]
 
u64 size
 
u64 offset
 
vhost_user_req_t request
 
u32 flags
 
union {
   u64   u64
 
   vhost_vring_state_t   state
 
   vhost_vring_addr_t   addr
 
   vhost_user_memory_t   memory
 
   vhost_user_log_t   log
 
}; 
 
vlib_node_registration_t vhost_user_send_interrupt_node
 (constructor) VLIB_REGISTER_NODE (vhost_user_send_interrupt_node) More...
 
vnet_device_class_t vhost_user_device_class
 
vlib_node_registration_t vhost_user_input_node
 (constructor) VLIB_REGISTER_NODE (vhost_user_input_node) More...
 
vhost_user_main_t vhost_user_main
 

Macro Definition Documentation

#define DBG_SOCK (   args...)
Value:
{ \
vhost_user_main_t *_vum = &vhost_user_main; \
if (_vum->debug) \
clib_warning(args); \
};
#define clib_warning(format, args...)
Definition: error.h:59
vhost_user_main_t vhost_user_main
Definition: vhost_user.c:56

Definition at line 48 of file vhost_user.h.

#define DBG_VQ (   args...)

Definition at line 60 of file vhost_user.h.

#define foreach_virtio_net_feature
Value:
_ (VIRTIO_NET_F_MRG_RXBUF, 15) \
_ (VIRTIO_NET_F_CTRL_VQ, 17) \
_ (VIRTIO_NET_F_GUEST_ANNOUNCE, 21) \
_ (VIRTIO_NET_F_MQ, 22) \
_ (VHOST_F_LOG_ALL, 26) \
_ (VIRTIO_F_ANY_LAYOUT, 27) \
_ (VIRTIO_F_INDIRECT_DESC, 28) \
_ (VIRTIO_F_VERSION_1, 32)
#define VHOST_USER_F_PROTOCOL_FEATURES
Definition: vhost_user.h:35

Definition at line 82 of file vhost_user.h.

#define foreach_virtio_trace_flags
Value:
_ (SIMPLE_CHAINED, 0, "Simple descriptor chaining") \
_ (SINGLE_DESC, 1, "Single descriptor packet") \
_ (INDIRECT, 2, "Indirect descriptor") \
_ (MAP_ERROR, 4, "Memory mapping error")

Definition at line 69 of file vhost_user.h.

#define UNIX_GET_FD (   unixfd_idx)
Value:
({ \
typeof(unixfd_idx) __unixfd_idx = (unixfd_idx); \
(__unixfd_idx != ~0) ? \
__unixfd_idx)->file_descriptor : -1; })
clib_file_main_t file_main
Definition: main.c:63
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:464

Definition at line 63 of file vhost_user.h.

#define VHOST_DEBUG_VQ   0

Definition at line 55 of file vhost_user.h.

#define VHOST_MEMORY_MAX_NREGIONS   8

Definition at line 19 of file vhost_user.h.

#define VHOST_USER_COPY_ARRAY_N   (4 * VLIB_FRAME_SIZE)

Definition at line 314 of file vhost_user.h.

#define VHOST_USER_EVENT_START_TIMER   1

Definition at line 250 of file vhost_user.h.

#define VHOST_USER_EVENT_STOP_TIMER   2

Definition at line 251 of file vhost_user.h.

#define VHOST_USER_F_PROTOCOL_FEATURES   30

Definition at line 35 of file vhost_user.h.

#define VHOST_USER_MSG_HDR_SZ   12

Definition at line 20 of file vhost_user.h.

#define VHOST_USER_PROTOCOL_F_LOG_SHMFD   1

Definition at line 32 of file vhost_user.h.

#define VHOST_USER_PROTOCOL_F_MQ   0

Definition at line 31 of file vhost_user.h.

#define VHOST_USER_PROTOCOL_FEATURES
Value:
#define VHOST_USER_PROTOCOL_F_LOG_SHMFD
Definition: vhost_user.h:32
#define VHOST_USER_PROTOCOL_F_MQ
Definition: vhost_user.h:31

Definition at line 36 of file vhost_user.h.

#define VHOST_USER_REPLY_MASK   (0x1 << 2)

Definition at line 29 of file vhost_user.h.

#define VHOST_USER_RX_BUFFERS_N   (2 * VLIB_FRAME_SIZE + 2)

Definition at line 313 of file vhost_user.h.

#define VHOST_USER_VRING_NOFD_MASK   0x100

Definition at line 26 of file vhost_user.h.

#define VHOST_VRING_F_LOG   0

Definition at line 33 of file vhost_user.h.

#define VHOST_VRING_IDX_RX (   qid)    (2*qid)

Definition at line 23 of file vhost_user.h.

#define VHOST_VRING_IDX_TX (   qid)    (2*qid + 1)

Definition at line 24 of file vhost_user.h.

#define VHOST_VRING_MAX_N   16

Definition at line 22 of file vhost_user.h.

#define VHOST_VRING_MAX_SIZE   32768

Definition at line 21 of file vhost_user.h.

#define VIRTIO_NET_CTRL_MQ   4

Definition at line 40 of file vhost_user.h.

#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX   0x8000

Definition at line 43 of file vhost_user.h.

#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN   1

Definition at line 42 of file vhost_user.h.

#define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET   0

Definition at line 41 of file vhost_user.h.

#define VIRTQ_DESC_F_INDIRECT   4

Definition at line 28 of file vhost_user.h.

#define VIRTQ_DESC_F_NEXT   1

Definition at line 27 of file vhost_user.h.

#define VRING_AVAIL_F_NO_INTERRUPT   1

Definition at line 46 of file vhost_user.h.

#define VRING_USED_F_NO_NOTIFY   1

Definition at line 45 of file vhost_user.h.

Typedef Documentation

Enumeration Type Documentation

Enumerator
VHOST_USER_NONE 
VHOST_USER_GET_FEATURES 
VHOST_USER_SET_FEATURES 
VHOST_USER_SET_OWNER 
VHOST_USER_RESET_OWNER 
VHOST_USER_SET_MEM_TABLE 
VHOST_USER_SET_LOG_BASE 
VHOST_USER_SET_LOG_FD 
VHOST_USER_SET_VRING_NUM 
VHOST_USER_SET_VRING_ADDR 
VHOST_USER_SET_VRING_BASE 
VHOST_USER_GET_VRING_BASE 
VHOST_USER_SET_VRING_KICK 
VHOST_USER_SET_VRING_CALL 
VHOST_USER_SET_VRING_ERR 
VHOST_USER_GET_PROTOCOL_FEATURES 
VHOST_USER_SET_PROTOCOL_FEATURES 
VHOST_USER_GET_QUEUE_NUM 
VHOST_USER_SET_VRING_ENABLE 
VHOST_USER_MAX 

Definition at line 144 of file vhost_user.h.

Enumerator
foreach_virtio_net_feature 

Definition at line 93 of file vhost_user.h.

Enumerator
foreach_virtio_trace_flags 

Definition at line 75 of file vhost_user.h.

Function Documentation

int vhost_user_create_if ( vnet_main_t vnm,
vlib_main_t vm,
const char *  sock_filename,
u8  is_server,
u32 sw_if_index,
u64  feature_mask,
u8  renumber,
u32  custom_dev_instance,
u8 hwaddr 
)

Definition at line 1430 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vhost_user_delete_if ( vnet_main_t vnm,
vlib_main_t vm,
u32  sw_if_index 
)

Definition at line 1214 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vhost_user_dump_ifs ( vnet_main_t vnm,
vlib_main_t vm,
vhost_user_intf_details_t **  out_vuids 
)

Definition at line 1651 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vhost_user_modify_if ( vnet_main_t vnm,
vlib_main_t vm,
const char *  sock_filename,
u8  is_server,
u32  sw_if_index,
u64  feature_mask,
u8  renumber,
u32  custom_dev_instance 
)

Definition at line 1488 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

union { ... }
vhost_vring_addr_t addr

Definition at line 116 of file vhost_user.h.

u32 flags

Definition at line 110 of file vhost_user.h.

u64 guest_phys_addr

Definition at line 109 of file vhost_user.h.

vhost_user_log_t log

Definition at line 118 of file vhost_user.h.

vhost_user_memory_t memory

Definition at line 117 of file vhost_user.h.

u64 memory_size

Definition at line 110 of file vhost_user.h.

u64 mmap_offset

Definition at line 112 of file vhost_user.h.

u32 nregions

Definition at line 109 of file vhost_user.h.

Definition at line 110 of file vhost_user.h.

u32 padding

Definition at line 110 of file vhost_user.h.

vhost_user_memory_region_t regions[VHOST_MEMORY_MAX_NREGIONS]

Definition at line 111 of file vhost_user.h.

Definition at line 109 of file vhost_user.h.

u32 size

Definition at line 109 of file vhost_user.h.

vhost_vring_state_t state

Definition at line 115 of file vhost_user.h.

Definition at line 114 of file vhost_user.h.

u64 userspace_addr

Definition at line 111 of file vhost_user.h.

vnet_device_class_t vhost_user_device_class

Definition at line 56 of file vhost_user_output.c.

vlib_node_registration_t vhost_user_input_node
Initial value:
= {
.name = "vhost-user-input",
.sibling_of = "device-input",
.state = VLIB_NODE_STATE_DISABLED,
.format_trace = format_vhost_trace,
}
static_always_inline u8 * format_vhost_trace(u8 *s, va_list *va)
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:91
static __clib_unused char * vhost_user_input_func_error_strings[]

(constructor) VLIB_REGISTER_NODE (vhost_user_input_node)

Definition at line 659 of file vhost_user_input.c.

vhost_user_main_t vhost_user_main

Definition at line 56 of file vhost_user.c.

vlib_node_registration_t vhost_user_send_interrupt_node

(constructor) VLIB_REGISTER_NODE (vhost_user_send_interrupt_node)

Definition at line 53 of file vhost_user.c.