FD.io VPP  v16.06
Vector Packet Processing
vhost_user.c File Reference
+ Include dependency graph for vhost_user.c:

Go to the source code of this file.

Data Structures

struct  dpdk_vu_process_state
 

Macros

#define VHOST_USER_DEBUG_SOCKET   0
 
#define DBG_SOCK(args...)
 
#define OFFLOAD_FEATURES
 
#define foreach_dpdk_vhost_feature
 

Functions

static int dpdk_vhost_user_set_vring_enable (u32 hw_if_index, u8 idx, int enable)
 
static uint64_t qva_to_vva (struct virtio_net *dev, uint64_t qemu_va)
 
static dpdk_device_tdpdk_vhost_user_device_from_hw_if_index (u32 hw_if_index)
 
static dpdk_device_tdpdk_vhost_user_device_from_sw_if_index (u32 sw_if_index)
 
static void stop_processing_packets (u32 hw_if_index, u8 idx)
 
static void disable_interface (dpdk_device_t *xd)
 
static voidmap_guest_mem (dpdk_device_t *xd, u64 addr)
 
static clib_error_tdpdk_create_vhost_user_if_internal (u32 *hw_if_index, u32 if_id, u8 *hwaddr)
 
static long get_huge_page_size (int fd)
 
static clib_error_tdpdk_vhost_user_set_protocol_features (u32 hw_if_index, u64 prot_features)
 
static clib_error_tdpdk_vhost_user_get_features (u32 hw_if_index, u64 *features)
 
static clib_error_tdpdk_vhost_user_set_features (u32 hw_if_index, u64 features)
 
static clib_error_tdpdk_vhost_user_set_mem_table (u32 hw_if_index, vhost_user_memory_t *vum, int fd[])
 
static clib_error_tdpdk_vhost_user_set_vring_num (u32 hw_if_index, u8 idx, u32 num)
 
static clib_error_tdpdk_vhost_user_set_vring_addr (u32 hw_if_index, u8 idx, u64 desc, u64 used, u64 avail, u64 log)
 
static clib_error_tdpdk_vhost_user_get_vring_base (u32 hw_if_index, u8 idx, u32 *num)
 
static clib_error_tdpdk_vhost_user_set_vring_base (u32 hw_if_index, u8 idx, u32 num)
 
static clib_error_tdpdk_vhost_user_set_vring_kick (u32 hw_if_index, u8 idx, int fd)
 
static clib_error_tdpdk_vhost_user_callfd_read_ready (unix_file_t *uf)
 
static clib_error_tdpdk_vhost_user_set_vring_call (u32 hw_if_index, u8 idx, int fd)
 
u8 dpdk_vhost_user_want_interrupt (dpdk_device_t *xd, int idx)
 
void dpdk_vhost_user_send_interrupt (vlib_main_t *vm, dpdk_device_t *xd, int idx)
 
static void dpdk_vhost_user_vui_init (vnet_main_t *vnm, dpdk_device_t *xd, int sockfd, const char *sock_filename, u8 is_server, u64 feature_mask, u32 *sw_if_index)
 
static void dpdk_vhost_user_vui_register (vlib_main_t *vm, dpdk_device_t *xd)
 
static void dpdk_vhost_user_if_disconnect (dpdk_device_t *xd)
 
static clib_error_tdpdk_vhost_user_socket_read (unix_file_t *uf)
 
static clib_error_tdpdk_vhost_user_socket_error (unix_file_t *uf)
 
static clib_error_tdpdk_vhost_user_socksvr_accept_ready (unix_file_t *uf)
 
static int dpdk_vhost_user_init_server_sock (const char *sock_filename, int *sockfd)
 
int dpdk_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 dpdk_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 dpdk_vhost_user_delete_if (vnet_main_t *vnm, vlib_main_t *vm, u32 sw_if_index)
 
int dpdk_vhost_user_dump_ifs (vnet_main_t *vnm, vlib_main_t *vm, vhost_user_intf_details_t **out_vuids)
 
void dpdk_vhost_user_process_init (void **ctx)
 
void dpdk_vhost_user_process_cleanup (void *ctx)
 
uword dpdk_vhost_user_process_if (vlib_main_t *vm, dpdk_device_t *xd, void *ctx)
 
static clib_error_tdpdk_vhost_user_connect_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tdpdk_vhost_user_delete_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_dpdk_vhost_user_command_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

static const char * vhost_message_str []
 
vlib_cli_command_t dpdk_vhost_user_connect_command
 (constructor) VLIB_CLI_COMMAND (dpdk_vhost_user_connect_command) More...
 
vlib_cli_command_t dpdk_vhost_user_delete_command
 (constructor) VLIB_CLI_COMMAND (dpdk_vhost_user_delete_command) More...
 
vlib_cli_command_t show_vhost_user_command
 (constructor) VLIB_CLI_COMMAND (show_vhost_user_command) More...
 

Macro Definition Documentation

#define DBG_SOCK (   args...)

Definition at line 39 of file vhost_user.c.

#define foreach_dpdk_vhost_feature
Value:
_ (VIRTIO_NET_F_MRG_RXBUF) \
_ (VIRTIO_NET_F_CTRL_VQ) \
_ (VIRTIO_NET_F_CTRL_RX)

Definition at line 1768 of file vhost_user.c.

#define OFFLOAD_FEATURES
Value:
((1ULL << VIRTIO_NET_F_HOST_TSO4) | \
(1ULL << VIRTIO_NET_F_HOST_TSO6) | \
(1ULL << VIRTIO_NET_F_CSUM) | \
(1ULL << VIRTIO_NET_F_GUEST_CSUM) | \
(1ULL << VIRTIO_NET_F_GUEST_TSO4) | \
(1ULL << VIRTIO_NET_F_GUEST_TSO6))
#define VHOST_USER_DEBUG_SOCKET   0

Definition at line 34 of file vhost_user.c.

Function Documentation

static void disable_interface ( dpdk_device_t xd)
static

Definition at line 167 of file vhost_user.c.

+ Here is the caller graph for this function:

static clib_error_t* dpdk_create_vhost_user_if_internal ( u32 hw_if_index,
u32  if_id,
u8 hwaddr 
)
static

Definition at line 195 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_callfd_read_ready ( unix_file_t uf)
static

Definition at line 794 of file vhost_user.c.

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_connect_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1663 of file vhost_user.c.

+ Here is the call graph for this function:

int dpdk_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 1396 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_delete_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1723 of file vhost_user.c.

+ Here is the call graph for this function:

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

Definition at line 1492 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static dpdk_device_t* dpdk_vhost_user_device_from_hw_if_index ( u32  hw_if_index)
static

Definition at line 132 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static dpdk_device_t* dpdk_vhost_user_device_from_sw_if_index ( u32  sw_if_index)
static

Definition at line 146 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1525 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_get_features ( u32  hw_if_index,
u64 features 
)
static

Definition at line 430 of file vhost_user.c.

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_get_vring_base ( u32  hw_if_index,
u8  idx,
u32 num 
)
static

Definition at line 615 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dpdk_vhost_user_if_disconnect ( dpdk_device_t xd)
inlinestatic

Definition at line 920 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int dpdk_vhost_user_init_server_sock ( const char *  sock_filename,
int *  sockfd 
)
static

Definition at line 1350 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dpdk_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 1442 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpdk_vhost_user_process_cleanup ( void ctx)

Definition at line 1615 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uword dpdk_vhost_user_process_if ( vlib_main_t vm,
dpdk_device_t xd,
void ctx 
)

Definition at line 1620 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpdk_vhost_user_process_init ( void **  ctx)

Definition at line 1603 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void dpdk_vhost_user_send_interrupt ( vlib_main_t vm,
dpdk_device_t xd,
int  idx 
)

Definition at line 852 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_features ( u32  hw_if_index,
u64  features 
)
static

Definition at line 454 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_mem_table ( u32  hw_if_index,
vhost_user_memory_t vum,
int  fd[] 
)
static

Definition at line 495 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_protocol_features ( u32  hw_if_index,
u64  prot_features 
)
static

Definition at line 419 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_vring_addr ( u32  hw_if_index,
u8  idx,
u64  desc,
u64  used,
u64  avail,
u64  log 
)
static

Definition at line 566 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_vring_base ( u32  hw_if_index,
u8  idx,
u32  num 
)
static

Definition at line 671 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_vring_call ( u32  hw_if_index,
u8  idx,
int  fd 
)
static

Definition at line 803 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int dpdk_vhost_user_set_vring_enable ( u32  hw_if_index,
u8  idx,
int  enable 
)
static

Definition at line 754 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_vring_kick ( u32  hw_if_index,
u8  idx,
int  fd 
)
static

Definition at line 693 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_set_vring_num ( u32  hw_if_index,
u8  idx,
u32  num 
)
static

Definition at line 546 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_socket_error ( unix_file_t uf)
static

Definition at line 1288 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_socket_read ( unix_file_t uf)
static

Definition at line 943 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static clib_error_t* dpdk_vhost_user_socksvr_accept_ready ( unix_file_t uf)
static

Definition at line 1307 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dpdk_vhost_user_vui_init ( vnet_main_t vnm,
dpdk_device_t xd,
int  sockfd,
const char *  sock_filename,
u8  is_server,
u64  feature_mask,
u32 sw_if_index 
)
static

Definition at line 878 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dpdk_vhost_user_vui_register ( vlib_main_t vm,
dpdk_device_t xd 
)
static

Definition at line 910 of file vhost_user.c.

+ Here is the caller graph for this function:

u8 dpdk_vhost_user_want_interrupt ( dpdk_device_t xd,
int  idx 
)

Definition at line 836 of file vhost_user.c.

+ Here is the caller graph for this function:

static long get_huge_page_size ( int  fd)
static

Definition at line 409 of file vhost_user.c.

+ Here is the caller graph for this function:

static void* map_guest_mem ( dpdk_device_t xd,
u64  addr 
)
inlinestatic

Definition at line 179 of file vhost_user.c.

+ Here is the caller graph for this function:

static uint64_t qva_to_vva ( struct virtio_net *  dev,
uint64_t  qemu_va 
)
static

Definition at line 110 of file vhost_user.c.

+ Here is the caller graph for this function:

static clib_error_t* show_dpdk_vhost_user_command_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 1774 of file vhost_user.c.

+ Here is the call graph for this function:

static void stop_processing_packets ( u32  hw_if_index,
u8  idx 
)
static

Definition at line 155 of file vhost_user.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vlib_cli_command_t dpdk_vhost_user_connect_command
Initial value:
= {
.path = "create vhost-user",
.short_help = "create vhost-user socket <socket-filename> [server] [feature-mask <hex>] [renumber <dev_instance>]",
}
static clib_error_t * dpdk_vhost_user_connect_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vhost_user.c:1663

(constructor) VLIB_CLI_COMMAND (dpdk_vhost_user_connect_command)

Definition at line 1716 of file vhost_user.c.

vlib_cli_command_t dpdk_vhost_user_delete_command
Initial value:
= {
.path = "delete vhost-user",
.short_help = "delete vhost-user sw_if_index <nn>",
}
static clib_error_t * dpdk_vhost_user_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vhost_user.c:1723

(constructor) VLIB_CLI_COMMAND (dpdk_vhost_user_delete_command)

Definition at line 1762 of file vhost_user.c.

vlib_cli_command_t show_vhost_user_command
Initial value:
= {
.path = "show vhost-user",
.short_help = "show vhost-user interface",
}
static clib_error_t * show_dpdk_vhost_user_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: vhost_user.c:1774

(constructor) VLIB_CLI_COMMAND (show_vhost_user_command)

Definition at line 1919 of file vhost_user.c.

const char* vhost_message_str[]
static
Initial value:
= {
[VHOST_USER_NONE] = "VHOST_USER_NONE",
[VHOST_USER_GET_FEATURES] = "VHOST_USER_GET_FEATURES",
[VHOST_USER_SET_FEATURES] = "VHOST_USER_SET_FEATURES",
[VHOST_USER_SET_OWNER] = "VHOST_USER_SET_OWNER",
[VHOST_USER_RESET_OWNER] = "VHOST_USER_RESET_OWNER",
[VHOST_USER_SET_MEM_TABLE] = "VHOST_USER_SET_MEM_TABLE",
[VHOST_USER_SET_LOG_BASE] = "VHOST_USER_SET_LOG_BASE",
[VHOST_USER_SET_LOG_FD] = "VHOST_USER_SET_LOG_FD",
[VHOST_USER_SET_VRING_NUM] = "VHOST_USER_SET_VRING_NUM",
[VHOST_USER_SET_VRING_ADDR] = "VHOST_USER_SET_VRING_ADDR",
[VHOST_USER_SET_VRING_BASE] = "VHOST_USER_SET_VRING_BASE",
[VHOST_USER_GET_VRING_BASE] = "VHOST_USER_GET_VRING_BASE",
[VHOST_USER_SET_VRING_KICK] = "VHOST_USER_SET_VRING_KICK",
[VHOST_USER_SET_VRING_CALL] = "VHOST_USER_SET_VRING_CALL",
[VHOST_USER_SET_VRING_ERR] = "VHOST_USER_SET_VRING_ERR",
[VHOST_USER_GET_PROTOCOL_FEATURES] = "VHOST_USER_GET_PROTOCOL_FEATURES",
[VHOST_USER_SET_PROTOCOL_FEATURES] = "VHOST_USER_SET_PROTOCOL_FEATURES",
[VHOST_USER_GET_QUEUE_NUM] = "VHOST_USER_GET_QUEUE_NUM",
[VHOST_USER_SET_VRING_ENABLE] = "VHOST_USER_SET_VRING_ENABLE",
}

Definition at line 42 of file vhost_user.c.