FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
vhost_user.h File Reference
+ Include dependency graph for vhost_user.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vhost_user_create_if_args_t
 
struct  vhost_user_memory_region
 
struct  vhost_user_memory
 
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_INIT_MQ_PAIR_SZ   8
 
#define VHOST_VRING_MAX_MQ_PAIR_SZ   128
 
#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 VHOST_USER_PROTOCOL_F_MQ   0
 
#define VHOST_USER_PROTOCOL_F_LOG_SHMFD   1
 
#define VHOST_VRING_F_LOG   0
 
#define VHOST_USER_PROTOCOL_FEATURES
 
#define vu_log_debug(dev, f, ...)
 
#define vu_log_warn(dev, f, ...)
 
#define vu_log_err(dev, f, ...)
 
#define UNIX_GET_FD(unixfd_idx)
 
#define foreach_virtio_trace_flags
 
#define FEATURE_VIRTIO_NET_F_HOST_TSO_FEATURE_BITS
 
#define FEATURE_VIRTIO_NET_F_GUEST_TSO_FEATURE_BITS
 
#define FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS
 
#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  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, vhost_user_create_if_args_t *args)
 
int vhost_user_modify_if (vnet_main_t *vnm, vlib_main_t *vm, vhost_user_create_if_args_t *args)
 
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]
 
vhost_user_req_t request
 
u32 flags
 
u32 size
 
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

◆ FEATURE_VIRTIO_NET_F_GUEST_TSO_FEATURE_BITS

#define FEATURE_VIRTIO_NET_F_GUEST_TSO_FEATURE_BITS
Value:
(VIRTIO_FEATURE (VIRTIO_NET_F_GUEST_CSUM) | \
VIRTIO_FEATURE (VIRTIO_NET_F_GUEST_UFO) | \
VIRTIO_FEATURE (VIRTIO_NET_F_GUEST_TSO4) | \
VIRTIO_FEATURE (VIRTIO_NET_F_GUEST_TSO6))

Definition at line 90 of file vhost_user.h.

◆ FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS

#define FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS
Value:
FEATURE_VIRTIO_NET_F_GUEST_TSO_FEATURE_BITS)

Definition at line 96 of file vhost_user.h.

◆ FEATURE_VIRTIO_NET_F_HOST_TSO_FEATURE_BITS

#define FEATURE_VIRTIO_NET_F_HOST_TSO_FEATURE_BITS
Value:
(VIRTIO_FEATURE (VIRTIO_NET_F_CSUM) | \
VIRTIO_FEATURE (VIRTIO_NET_F_HOST_UFO) | \
VIRTIO_FEATURE (VIRTIO_NET_F_HOST_TSO4) | \
VIRTIO_FEATURE (VIRTIO_NET_F_HOST_TSO6))

Definition at line 84 of file vhost_user.h.

◆ foreach_virtio_trace_flags

#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 71 of file vhost_user.h.

◆ UNIX_GET_FD

#define UNIX_GET_FD (   unixfd_idx)
Value:
({ \
typeof(unixfd_idx) __unixfd_idx = (unixfd_idx); \
(__unixfd_idx != ~0) ? \
__unixfd_idx)->file_descriptor : -1; })

Definition at line 65 of file vhost_user.h.

◆ VHOST_MEMORY_MAX_NREGIONS

#define VHOST_MEMORY_MAX_NREGIONS   8

Definition at line 23 of file vhost_user.h.

◆ VHOST_USER_COPY_ARRAY_N

#define VHOST_USER_COPY_ARRAY_N   (4 * VLIB_FRAME_SIZE)

Definition at line 310 of file vhost_user.h.

◆ VHOST_USER_EVENT_START_TIMER

#define VHOST_USER_EVENT_START_TIMER   1

Definition at line 236 of file vhost_user.h.

◆ VHOST_USER_EVENT_STOP_TIMER

#define VHOST_USER_EVENT_STOP_TIMER   2

Definition at line 237 of file vhost_user.h.

◆ VHOST_USER_MSG_HDR_SZ

#define VHOST_USER_MSG_HDR_SZ   12

Definition at line 24 of file vhost_user.h.

◆ VHOST_USER_PROTOCOL_F_LOG_SHMFD

#define VHOST_USER_PROTOCOL_F_LOG_SHMFD   1

Definition at line 39 of file vhost_user.h.

◆ VHOST_USER_PROTOCOL_F_MQ

#define VHOST_USER_PROTOCOL_F_MQ   0

Definition at line 38 of file vhost_user.h.

◆ VHOST_USER_PROTOCOL_FEATURES

#define VHOST_USER_PROTOCOL_FEATURES
Value:

Definition at line 42 of file vhost_user.h.

◆ VHOST_USER_RX_BUFFERS_N

#define VHOST_USER_RX_BUFFERS_N   (2 * VLIB_FRAME_SIZE + 2)

Definition at line 309 of file vhost_user.h.

◆ VHOST_USER_VRING_NOFD_MASK

#define VHOST_USER_VRING_NOFD_MASK   0x100

Definition at line 36 of file vhost_user.h.

◆ VHOST_VRING_F_LOG

#define VHOST_VRING_F_LOG   0

Definition at line 40 of file vhost_user.h.

◆ VHOST_VRING_IDX_RX

#define VHOST_VRING_IDX_RX (   qid)    (2*qid)

Definition at line 33 of file vhost_user.h.

◆ VHOST_VRING_IDX_TX

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

Definition at line 34 of file vhost_user.h.

◆ VHOST_VRING_INIT_MQ_PAIR_SZ

#define VHOST_VRING_INIT_MQ_PAIR_SZ   8

Definition at line 25 of file vhost_user.h.

◆ VHOST_VRING_MAX_MQ_PAIR_SZ

#define VHOST_VRING_MAX_MQ_PAIR_SZ   128

Definition at line 32 of file vhost_user.h.

◆ vu_log_debug

#define vu_log_debug (   dev,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_DEBUG, vhost_user_main.log_default, "%U: " f, \
dev->hw_if_index, ##__VA_ARGS__); \
};

Definition at line 45 of file vhost_user.h.

◆ vu_log_err

#define vu_log_err (   dev,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_ERR, vhost_user_main.log_default, "%U: " f, \
dev->hw_if_index, ##__VA_ARGS__); \
};

Definition at line 58 of file vhost_user.h.

◆ vu_log_warn

#define vu_log_warn (   dev,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_WARNING, vhost_user_main.log_default, "%U: " f, \
dev->hw_if_index, ##__VA_ARGS__); \
};

Definition at line 52 of file vhost_user.h.

Typedef Documentation

◆ vhost_user_req_t

Enumeration Type Documentation

◆ vhost_user_req

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 141 of file vhost_user.h.

◆ virtio_trace_flag_t

Enumerator
foreach_virtio_trace_flags 

Definition at line 77 of file vhost_user.h.

Function Documentation

◆ vhost_user_create_if()

int vhost_user_create_if ( vnet_main_t vnm,
vlib_main_t vm,
vhost_user_create_if_args_t args 
)

Definition at line 1622 of file vhost_user.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vhost_user_delete_if()

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

Definition at line 1387 of file vhost_user.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vhost_user_dump_ifs()

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

Definition at line 1843 of file vhost_user.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vhost_user_modify_if()

int vhost_user_modify_if ( vnet_main_t vnm,
vlib_main_t vm,
vhost_user_create_if_args_t args 
)

Definition at line 1678 of file vhost_user.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ @244

union { ... }

◆ addr

Definition at line 130 of file vhost_user.h.

◆ flags

u32 flags

Definition at line 124 of file vhost_user.h.

◆ guest_phys_addr

u64 guest_phys_addr

Definition at line 123 of file vhost_user.h.

◆ log

Definition at line 132 of file vhost_user.h.

◆ memory

vhost_user_memory_t memory

Definition at line 131 of file vhost_user.h.

◆ memory_size

u64 memory_size

Definition at line 124 of file vhost_user.h.

◆ mmap_offset

u64 mmap_offset

Definition at line 126 of file vhost_user.h.

◆ nregions

u32 nregions

Definition at line 123 of file vhost_user.h.

◆ padding

u32 padding

Definition at line 124 of file vhost_user.h.

◆ regions

vhost_user_memory_region_t regions[VHOST_MEMORY_MAX_NREGIONS]

Definition at line 125 of file vhost_user.h.

◆ request

Definition at line 123 of file vhost_user.h.

◆ size

u32 size

Definition at line 125 of file vhost_user.h.

◆ state

Definition at line 129 of file vhost_user.h.

◆ u64

Definition at line 128 of file vhost_user.h.

◆ userspace_addr

u64 userspace_addr

Definition at line 125 of file vhost_user.h.

◆ vhost_user_device_class

vnet_device_class_t vhost_user_device_class

◆ vhost_user_input_node

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,
}

(constructor) VLIB_REGISTER_NODE (vhost_user_input_node)

Definition at line 1447 of file vhost_user_input.c.

◆ vhost_user_main

vhost_user_main_t vhost_user_main

Definition at line 55 of file vhost_user.c.

◆ vhost_user_send_interrupt_node

vlib_node_registration_t vhost_user_send_interrupt_node

(constructor) VLIB_REGISTER_NODE (vhost_user_send_interrupt_node)

Definition at line 52 of file vhost_user.c.

file_main
clib_file_main_t file_main
Definition: main.c:63
f
vlib_frame_t * f
Definition: interface_output.c:1080
pool_elt_at_index
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:553
VLIB_NODE_TYPE_INPUT
@ VLIB_NODE_TYPE_INPUT
Definition: node.h:76
VHOST_USER_INPUT_FUNC_N_ERROR
@ VHOST_USER_INPUT_FUNC_N_ERROR
Definition: vhost_user_input.c:84
VIRTIO_FEATURE
#define VIRTIO_FEATURE(X)
Definition: virtio_std.h:67
vnet_get_main
vnet_main_t * vnet_get_main(void)
Definition: pnat_test_stubs.h:56
VHOST_USER_PROTOCOL_F_LOG_SHMFD
#define VHOST_USER_PROTOCOL_F_LOG_SHMFD
Definition: vhost_user.h:39
format_vnet_hw_if_index_name
format_function_t format_vnet_hw_if_index_name
Definition: interface_funcs.h:451
VLIB_NODE_FLAG_TRACE_SUPPORTED
#define VLIB_NODE_FLAG_TRACE_SUPPORTED
Definition: node.h:295
clib_file_main_t::file_pool
clib_file_t * file_pool
Definition: file.h:88
VHOST_USER_PROTOCOL_F_MQ
#define VHOST_USER_PROTOCOL_F_MQ
Definition: vhost_user.h:38
format_ethernet_header_with_length
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:97
FEATURE_VIRTIO_NET_F_HOST_TSO_FEATURE_BITS
#define FEATURE_VIRTIO_NET_F_HOST_TSO_FEATURE_BITS
Definition: vhost_user.h:84
format_vhost_trace
static_always_inline u8 * format_vhost_trace(u8 *s, va_list *va)
Definition: vhost_user_inline.h:210
vhost_user_input_func_error_strings
static __clib_unused char * vhost_user_input_func_error_strings[]
Definition: vhost_user_input.c:87
vhost_user_main_t::log_default
vlib_log_class_t log_default
Definition: vhost_user.h:348
vhost_user_main
vhost_user_main_t vhost_user_main
Definition: vhost_user.c:55