|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
21 #include <sys/ioctl.h>
22 #include <sys/socket.h>
25 #include <sys/types.h>
27 #include <netinet/in.h>
30 #include <linux/if_arp.h>
31 #include <linux/if_tun.h>
85 ssize_t map_sz = (vui->
regions[
i].memory_size +
87 page_sz - 1) & ~(page_sz - 1);
93 vu_log_debug (vui,
"unmap memory region %d addr 0x%lx len 0x%lx "
101 vu_log_err (vui,
"failed to unmap memory region (errno %d)",
109 for (q = 0; q < vui->
num_qid; q++)
128 for (qid = 0; qid < vui->
num_qid / 2; qid++)
179 vu_log_warn (vui,
"unable to set rx mode for interface %d, "
188 int i, found[2] = { };
194 return found[0] && found[1];
205 is_ready ?
"ready" :
"down");
217 __attribute__ ((unused))
int n;
240 __attribute__ ((unused)) ssize_t n;
246 u32 is_txq = qid & 1;
291 if (qid == 0 || qid == 1)
314 if (vring->
errfd != -1)
316 close (vring->
errfd);
345 for (q = 0; q < vui->
num_qid; q++)
356 int fd, number_of_fds = 0;
358 vhost_user_msg_t msg;
363 struct cmsghdr *cmsg;
380 iov[0].iov_base = (
void *) &msg;
385 mh.msg_control = control;
386 mh.msg_controllen =
sizeof (control);
394 vu_log_debug (vui,
"recvmsg returned error %d %s", errno,
399 vu_log_debug (vui,
"n (%d) != VHOST_USER_MSG_HDR_SZ (%d)",
405 if (mh.msg_flags & MSG_CTRUNC)
411 cmsg = CMSG_FIRSTHDR (&mh);
413 if (cmsg && (cmsg->cmsg_len > 0) && (cmsg->cmsg_level == SOL_SOCKET) &&
414 (cmsg->cmsg_type == SCM_RIGHTS) &&
415 (cmsg->cmsg_len - CMSG_LEN (0) <=
418 number_of_fds = (cmsg->cmsg_len - CMSG_LEN (0)) /
sizeof (
int);
423 if ((msg.flags & 7) != 1)
425 vu_log_debug (vui,
"malformed message received. closing socket");
439 else if (
rv != msg.size)
441 vu_log_debug (vui,
"message too short (read %dB should be %dB)",
rv,
469 msg.size =
sizeof (msg.u64);
470 vu_log_debug (vui,
"if %d msg VHOST_USER_GET_FEATURES - reply "
482 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_FEATURES features "
518 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_MEM_TABLE nregions %d",
521 if ((msg.memory.nregions < 1) ||
524 vu_log_debug (vui,
"number of mem regions must be between 1 and %i",
529 if (msg.memory.nregions != number_of_fds)
537 for (
i = 0;
i < msg.memory.nregions;
i++)
542 ssize_t map_sz = (msg.memory.regions[
i].memory_size +
543 msg.memory.regions[
i].mmap_offset +
544 page_sz - 1) & ~(page_sz - 1);
546 region_mmap_addr[
i] = mmap (0, map_sz, PROT_READ | PROT_WRITE,
547 MAP_SHARED, fds[
i], 0);
548 if (region_mmap_addr[
i] == MAP_FAILED)
550 vu_log_err (vui,
"failed to map memory. errno is %d", errno);
551 for (j = 0; j <
i; j++)
552 munmap (region_mmap_addr[j], map_sz);
555 vu_log_debug (vui,
"map memory region %d addr 0 len 0x%lx fd %d "
556 "mapped 0x%lx page_sz 0x%x",
i, map_sz, fds[
i],
557 region_mmap_addr[
i], page_sz);
562 for (
i = 0;
i < msg.memory.nregions;
i++)
565 sizeof (vhost_user_memory_region_t));
582 for (q = 0; q < vui->
num_qid; q++)
599 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_VRING_NUM idx %d num %d",
602 if ((msg.state.num > 32768) ||
603 (msg.state.num == 0) ||
604 ((msg.state.num - 1) & msg.state.num) ||
605 (msg.state.index >= vui->
num_qid))
607 vu_log_debug (vui,
"invalid VHOST_USER_SET_VRING_NUM: msg.state.num"
608 " %d, msg.state.index %d, curruent max q %d",
609 msg.state.num, msg.state.index, vui->
num_qid);
616 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_VRING_ADDR idx %d",
619 if (msg.state.index >= vui->
num_qid)
621 vu_log_debug (vui,
"invalid vring index VHOST_USER_SET_VRING_ADDR:"
622 " %u >= %u", msg.state.index, vui->
num_qid);
626 if (msg.size < sizeof (msg.addr))
628 vu_log_debug (vui,
"vhost message is too short (%d < %d)",
629 msg.size, sizeof (msg.addr));
637 if ((desc == NULL) || (used == NULL) || (avail == NULL))
639 vu_log_debug (vui,
"failed to map user memory for hw_if_index %d",
671 VRING_EVENT_F_DISABLE;
688 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_VRING_CALL %d",
691 q = (
u8) (msg.u64 & 0xFF);
706 vui->
num_qid = (q & 1) ? (q + 1) : (q + 2);
734 vui->
num_qid = (q & 1) ? (q + 1) : (q + 2);
739 if (number_of_fds != 1)
746 template.file_descriptor = fds[0];
747 template.private_data =
749 template.description =
format (0,
"vhost user");
757 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_VRING_KICK %d",
760 q = (
u8) (msg.u64 & 0xFF);
763 vu_log_debug (vui,
"invalid vring index VHOST_USER_SET_VRING_KICK:"
778 if (number_of_fds != 1)
785 template.file_descriptor = fds[0];
786 template.private_data =
802 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_VRING_ERR %d",
805 q = (
u8) (msg.u64 & 0xFF);
808 vu_log_debug (vui,
"invalid vring index VHOST_USER_SET_VRING_ERR:"
818 if (number_of_fds != 1)
829 "if %d msg VHOST_USER_SET_VRING_BASE idx %d num 0x%x",
831 if (msg.state.index >= vui->
num_qid)
833 vu_log_debug (vui,
"invalid vring index VHOST_USER_SET_VRING_ADDR:"
834 " %u >= %u", msg.state.index, vui->
num_qid);
853 msg.state.num & 0x7fff;
856 ! !(msg.state.num & (1 << 15));
881 if (msg.state.index >= vui->
num_qid)
883 vu_log_debug (vui,
"invalid vring index VHOST_USER_GET_VRING_BASE:"
884 " %u >= %u", msg.state.index, vui->
num_qid);
905 msg.size =
sizeof (msg.state);
914 "if %d msg VHOST_USER_GET_VRING_BASE idx %d num 0x%x",
934 if (msg.size != sizeof (msg.log))
936 vu_log_debug (vui,
"invalid msg size for VHOST_USER_SET_LOG_BASE:"
937 " %d instead of %d", msg.size, sizeof (msg.log));
943 vu_log_debug (vui,
"VHOST_USER_PROTOCOL_F_LOG_SHMFD not set but "
944 "VHOST_USER_SET_LOG_BASE received");
952 (msg.log.size + msg.log.offset + page_sz - 1) & ~(page_sz - 1);
954 void *log_base_addr = mmap (0, map_sz, PROT_READ | PROT_WRITE,
957 vu_log_debug (vui,
"map log region addr 0 len 0x%lx off 0x%lx fd %d "
958 "mapped 0x%lx", map_sz, msg.log.offset, fd,
961 if (log_base_addr == MAP_FAILED)
963 vu_log_err (vui,
"failed to map memory. errno is %d", errno);
974 msg.size =
sizeof (msg.u64);
992 msg.size =
sizeof (msg.u64);
993 vu_log_debug (vui,
"if %d msg VHOST_USER_GET_PROTOCOL_FEATURES - "
1005 vu_log_debug (vui,
"if %d msg VHOST_USER_SET_PROTOCOL_FEATURES "
1013 msg.size =
sizeof (msg.u64);
1014 vu_log_debug (vui,
"if %d msg VHOST_USER_GET_QUEUE_NUM - reply %d",
1026 vu_log_debug (vui,
"if %d VHOST_USER_SET_VRING_ENABLE: %s queue %d",
1027 vui->
hw_if_index, msg.state.num ?
"enable" :
"disable",
1029 if (msg.state.index >= vui->
num_qid)
1031 vu_log_debug (vui,
"invalid vring idx VHOST_USER_SET_VRING_ENABLE:"
1032 " %u >= %u", msg.state.index, vui->
num_qid);
1042 vu_log_debug (vui,
"unknown vhost-user message %d received. "
1043 "closing socket", msg.request);
1075 int client_fd, client_len;
1076 struct sockaddr_un client;
1083 client_len =
sizeof (client);
1085 (
struct sockaddr *) &client,
1086 (socklen_t *) & client_len);
1093 vu_log_debug (vui,
"Close client socket for vhost interface %d, fd %d",
1098 vu_log_debug (vui,
"New client socket for vhost interface %d, fd %d",
1102 template.file_descriptor = client_fd;
1150 f64 timeout = 3153600000.0 ;
1151 uword event_type, *event_data = 0;
1154 f64 now, poll_time_remaining;
1160 poll_time_remaining =
1169 timeout = poll_time_remaining;
1190 next_timeout = timeout;
1191 for (qid = 0; qid < vui->
num_qid / 2; qid += 2)
1196 if (txvq->
qid == -1)
1214 if ((next_timeout < timeout) && (next_timeout > 0.0))
1215 timeout = next_timeout;
1222 clib_warning (
"BUG: unhandled event type %d", event_type);
1229 timeout = 3153600000.0;
1238 .name =
"vhost-user-send-interrupt-process",
1248 struct sockaddr_un sun;
1251 f64 timeout = 3153600000.0 ;
1252 uword *event_data = 0;
1255 sun.sun_family = AF_UNIX;
1274 ((sockfd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0))
1283 (
"Error: Could not open unix socket for %s",
1292 sizeof (sun.sun_path) - 1);
1293 sun.sun_path[
sizeof (sun.sun_path) - 1] = 0;
1296 if (fcntl(sockfd, F_SETFL, O_NONBLOCK) < 0)
1299 if (connect (sockfd, (
struct sockaddr *) &sun,
1300 sizeof (
struct sockaddr_un)) == 0)
1303 if (fcntl(sockfd, F_SETFL, 0) < 0)
1307 template.file_descriptor = sockfd;
1308 template.private_data =
1310 template.description =
format (0,
"vhost user process");
1329 getsockopt (fd, SOL_SOCKET, SO_ERROR, &
error, &
len);
1348 .name =
"vhost-user-process",
1367 for (q = 0; q < vui->
num_qid; q++)
1399 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1403 vu_log_debug (vui,
"Deleting vhost-user interface %s (instance %d)",
1406 for (qid = 1; qid < vui->
num_qid / 2; qid += 2)
1410 if (txvq->
qid == -1)
1475 struct sockaddr_un
un = { };
1478 if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
1479 return VNET_API_ERROR_SYSCALL_ERROR_1;
1481 un.sun_family = AF_UNIX;
1482 strncpy ((
char *)
un.sun_path, (
char *) sock_filename,
1483 sizeof (
un.sun_path) - 1);
1486 unlink ((
char *) sock_filename);
1488 if (bind (fd, (
struct sockaddr *) &
un,
sizeof (
un)) == -1)
1490 rv = VNET_API_ERROR_SYSCALL_ERROR_2;
1494 if (listen (fd, 1) == -1)
1496 rv = VNET_API_ERROR_SYSCALL_ERROR_3;
1559 if (server_sock_fd != -1)
1563 template.file_descriptor = server_sock_fd;
1565 template.description =
format (0,
"vhost user %d", sw);
1628 int server_sock_fd = -1;
1634 return VNET_API_ERROR_INVALID_ARGUMENT;
1643 return VNET_API_ERROR_IF_ALREADY_EXISTS;
1650 &server_sock_fd)) != 0)
1684 int server_sock_fd = -1;
1692 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
1695 return VNET_API_ERROR_INVALID_ARGUMENT;
1705 if (if_index && (*if_index != vui->
if_index))
1706 return VNET_API_ERROR_IF_ALREADY_EXISTS;
1711 &server_sock_fd)) != 0)
1754 else if (
unformat (line_input,
"server"))
1756 else if (
unformat (line_input,
"gso"))
1758 else if (
unformat (line_input,
"packed"))
1760 else if (
unformat (line_input,
"event-idx"))
1762 else if (
unformat (line_input,
"feature-mask 0x%llx",
1768 else if (
unformat (line_input,
"renumber %d",
1851 u32 *hw_if_indices = 0;
1861 for (
i = 0;
i <
vec_len (hw_if_indices);
i++)
1882 *out_vuids = r_vuids;
1890 char *
fmt = va_arg (*args,
char *);
1893 int idx = va_arg (*args,
int);
1894 u32 *mem_hint = va_arg (*args,
u32 *);
1897 desc_table[idx].
flags, desc_table[idx].
next,
1915 int show_descr,
int show_verbose)
1926 "used event idx %u used.idx %d\n", vq->
avail->
flags,
1936 " slot addr len flags next "
1939 " ===== ================== ===== ====== ===== "
1940 "==================\n");
1941 for (j = 0; j < vq->
qsz_mask + 1; j++)
1943 desc_table = vq->
desc;
1945 " %-5d 0x%016lx %-5d 0x%04x %-5d 0x%016lx\n", vui,
1946 desc_table, j, &mem_hint);
1953 for (idx = 0; idx <
clib_min (20, n_entries); idx++)
1957 "> %-4u 0x%016lx %-5u 0x%04x %-5u 0x%016lx\n", vui,
1958 desc_table, idx, &mem_hint);
1960 if (n_entries >= 20)
1972 char *
fmt = va_arg (*args,
char *);
1974 vring_packed_desc_t *desc_table = va_arg (*args, vring_packed_desc_t *);
1975 int idx = va_arg (*args,
int);
1976 u32 *mem_hint = va_arg (*args,
u32 *);
1979 desc_table[idx].
flags, desc_table[idx].
id,
1994 static event_idx_flags event_idx_array[] = {
1995 #define _(s,v) { .str = #s, .value = v, },
1999 u32 num_entries =
sizeof (event_idx_array) /
sizeof (event_idx_flags);
2001 if (
flags < num_entries)
2010 int show_descr,
int show_verbose)
2016 vring_packed_desc_t *desc_table;
2041 " slot addr len flags id "
2044 " ===== ================== ===== ====== ===== "
2045 "==================\n");
2046 for (j = 0; j < vq->
qsz_mask + 1; j++)
2050 " %-5u 0x%016lx %-5u 0x%04x %-5u 0x%016lx\n", vui,
2051 desc_table, j, &mem_hint);
2054 n_entries = desc_table[j].len >> 4;
2058 for (idx = 0; idx <
clib_min (20, n_entries); idx++)
2062 "> %-4u 0x%016lx %-5u 0x%04x %-5u 0x%016lx\n", vui,
2063 desc_table, idx, &mem_hint);
2065 if (n_entries >= 20)
2083 u32 hw_if_index, *hw_if_indices = 0;
2089 int show_verbose = 0;
2095 struct feat_struct *feat_entry;
2097 static struct feat_struct feat_array[] = {
2098 #define _(s,b) { .str = #s, .bit = b, },
2104 #define foreach_protocol_feature \
2105 _(VHOST_USER_PROTOCOL_F_MQ) \
2106 _(VHOST_USER_PROTOCOL_F_LOG_SHMFD)
2108 static struct feat_struct proto_feat_array[] = {
2109 #define _(s) { .str = #s, .bit = s},
2127 vec_add1 (hw_if_indices, hw_if_index);
2131 else if (
unformat (input,
"verbose"))
2140 if (
vec_len (hw_if_indices) == 0)
2152 for (
i = 0;
i <
vec_len (hw_if_indices);
i++)
2168 " features mask (0x%llx): \n"
2169 " features (0x%llx): \n",
2173 feat_entry = (
struct feat_struct *) &feat_array;
2174 while (feat_entry->str)
2176 if (vui->
features & (1ULL << feat_entry->bit))
2184 feat_entry = (
struct feat_struct *) &proto_feat_array;
2185 while (feat_entry->str)
2202 for (qid = 1; qid < vui->
num_qid / 2; qid += 2)
2208 if (txvq->
qid == -1)
2232 " region fd guest_phys_addr memory_size userspace_addr mmap_offset mmap_addr\n");
2234 " ====== ===== ================== ================== ================== ================== ==================\n");
2236 for (j = 0; j < vui->
nregions; j++)
2239 " %d %-5d 0x%016lx 0x%016lx 0x%016lx 0x%016lx 0x%016lx\n",
2241 vui->
regions[j].guest_phys_addr,
2243 vui->
regions[j].userspace_addr,
2247 for (q = 0; q < vui->
num_qid; q++)
2253 (q & 1) ?
"RX" :
"TX",
2257 " qsz %d last_avail_idx %d last_used_idx %d"
2337 .path =
"create vhost-user",
2338 .short_help =
"create vhost-user socket <socket-filename> [server] "
2339 "[feature-mask <hex>] [hwaddr <mac-addr>] [renumber <dev_instance>] [gso] "
2340 "[packed] [event-idx]",
2360 .path =
"delete vhost-user",
2361 .short_help =
"delete vhost-user {<interface> | sw_if_index <sw_idx>}",
2500 .path =
"show vhost-user",
2501 .short_help =
"show vhost-user [<interface> [<interface> [..]]] "
2502 "[[descriptors] [verbose]]",
2519 else if (
unformat (input,
"dont-dump-memory"))
#define vec_reset_length(v)
Reset vector length to zero NULL-pointer tolerant.
static_always_inline void vhost_user_tx_thread_placement(vhost_user_intf_t *vui)
static void clib_spinlock_init(clib_spinlock_t *p)
static_always_inline void vhost_user_update_gso_interface_count(vhost_user_intf_t *vui, u8 add)
#define VNET_HW_IF_RXQ_THREAD_ANY
static void vhost_user_term_if(vhost_user_intf_t *vui)
Disables and reset interface structure.
#define VHOST_USER_MSG_HDR_SZ
static_always_inline void vhost_user_send_call(vlib_main_t *vm, vhost_user_intf_t *vui, vhost_user_vring_t *vq)
uword unformat_ethernet_address(unformat_input_t *input, va_list *args)
clib_file_main_t file_main
void vlib_worker_thread_barrier_release(vlib_main_t *vm)
u64 region_guest_addr_lo[VHOST_MEMORY_MAX_NREGIONS]
static u8 * format_vhost_user_packed_desc(u8 *s, va_list *args)
@ VNET_HW_IF_RX_MODE_ADAPTIVE
void vnet_sw_interface_set_mtu(vnet_main_t *vnm, u32 sw_if_index, u32 mtu)
static void vhost_user_vui_init(vnet_main_t *vnm, vhost_user_intf_t *vui, int server_sock_fd, vhost_user_create_if_args_t *args, u32 *sw_if_index)
@ VHOST_USER_SET_VRING_KICK
#define VHOST_VRING_F_LOG
#define VNET_HW_INTERFACE_CAP_SUPPORTS_L4_TX_CKSUM
vnet_hw_interface_capabilities_t caps
#define clib_memcpy(d, s, n)
@ foreach_virtio_net_features
int vnet_interface_name_renumber(u32 sw_if_index, u32 new_show_dev_instance)
static_always_inline void vhost_user_thread_placement(vhost_user_intf_t *vui, u32 qid)
int vhost_user_dump_ifs(vnet_main_t *vnm, vlib_main_t *vm, vhost_user_intf_details_t **out_vuids)
#define VHOST_MEMORY_MAX_NREGIONS
int vnet_hw_if_set_rx_queue_mode(vnet_main_t *vnm, u32 queue_index, vnet_hw_if_rx_mode mode)
static uword pointer_to_uword(const void *p)
static void vhost_user_show_fds(vlib_main_t *vm, vhost_user_vring_t *vq)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static void vhost_user_show_desc_packed(vlib_main_t *vm, vhost_user_intf_t *vui, int q, int show_descr, int show_verbose)
static_always_inline u16 vhost_user_avail_event_idx(vhost_user_vring_t *vq)
vnet_device_class_t vhost_user_device_class
static clib_error_t * vhost_user_socket_error(clib_file_t *uf)
__clib_export errno_t memcpy_s(void *__restrict__ dest, rsize_t dmax, const void *__restrict__ src, rsize_t n)
copy src to dest, at most n bytes, up to dmax
vlib_log_class_t vlib_log_register_class(char *class, char *subclass)
static void stop_timer(wg_peer_t *peer, u32 timer_id)
static vlib_node_registration_t vhost_user_process_node
(constructor) VLIB_REGISTER_NODE (vhost_user_process_node)
#define clib_error_return(e, args...)
clib_file_function_t * read_function
static clib_error_t * vhost_user_callfd_read_ready(clib_file_t *uf)
#define pool_put(P, E)
Free an object E in pool P.
static uword * mhash_get(mhash_t *h, const void *key)
@ VNET_HW_IF_RX_MODE_POLLING
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static clib_error_t * vhost_user_config(vlib_main_t *vm, unformat_input_t *input)
#define VIRTIO_FEATURE(X)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
VNET_HW_INTERFACE_CLASS(vhost_interface_class, static)
#define clib_error_report(e)
vnet_hw_if_output_node_runtime_t * r
vring_desc_event_t * avail_event
static void vlib_process_signal_event(vlib_main_t *vm, uword node_index, uword type_opaque, uword data)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static void mhash_init_c_string(mhash_t *h, uword n_value_bytes)
static clib_error_t * vhost_user_socksvr_accept_ready(clib_file_t *uf)
vlib_node_registration_t vhost_user_input_node
(constructor) VLIB_REGISTER_NODE (vhost_user_input_node)
#define clib_unix_warning(format, args...)
@ VHOST_USER_SET_VRING_NUM
@ VHOST_USER_GET_PROTOCOL_FEATURES
@ VHOST_USER_SET_LOG_BASE
static u32 random_u32(u32 *seed)
32-bit random number generator
#define VHOST_VRING_IDX_RX(qid)
#define VHOST_USER_VRING_NOFD_MASK
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_TCP_CKSUM
#define VLIB_CONFIG_FUNCTION(x, n,...)
static void vhost_user_show_desc(vlib_main_t *vm, vhost_user_intf_t *vui, int q, int show_descr, int show_verbose)
vhost_user_memory_region_t regions[VHOST_MEMORY_MAX_NREGIONS]
@ VHOST_USER_SET_PROTOCOL_FEATURES
static uword vlib_process_get_events(vlib_main_t *vm, uword **data_vector)
Return the first event type which has occurred and a vector of per-event data of that type,...
static_always_inline u64 vhost_user_is_packed_ring_supported(vhost_user_intf_t *vui)
void vhost_user_unmap_all(void)
#define pool_foreach(VAR, POOL)
Iterate through pool.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
format_function_t format_vnet_hw_if_rx_mode
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define vec_add1(V, E)
Add 1 element to end of vector (unspecified alignment).
#define VHOST_USER_EVENT_STOP_TIMER
#define VRING_DESC_F_AVAIL
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
#define FEATURE_VIRTIO_NET_F_HOST_GUEST_TSO_FEATURE_BITS
#define vlib_worker_thread_barrier_sync(X)
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TCP_GSO
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static vnet_hw_interface_t * vnet_get_sup_hw_interface_api_visible_or_null(vnet_main_t *vnm, u32 sw_if_index)
#define foreach_protocol_feature
#define static_always_inline
clib_error_t * vhost_user_connect_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
clib_error_t * show_vhost_user_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VRING_DESC_F_INDIRECT
#define VHOST_USER_PROTOCOL_F_LOG_SHMFD
static vlib_cli_command_t vhost_user_connect_command
(constructor) VLIB_CLI_COMMAND (vhost_user_connect_command)
#define vu_log_err(dev, f,...)
#define vu_log_warn(dev, f,...)
#define vec_foreach_index(var, v)
Iterate over vector indices.
format_function_t format_vnet_hw_if_index_name
static_always_inline void * map_user_mem(vhost_user_intf_t *vui, uword addr)
void vnet_hw_if_update_runtime_data(vnet_main_t *vnm, u32 hw_if_index)
static vlib_cli_command_t show_vhost_user_command
(constructor) VLIB_CLI_COMMAND (show_vhost_user_command)
static_always_inline u16 vhost_user_used_event_idx(vhost_user_vring_t *vq)
static_always_inline void vhost_user_update_iface_state(vhost_user_intf_t *vui)
@ VNET_HW_IF_RX_MODE_INTERRUPT
sll srl srl sll sra u16x4 i
vring_packed_desc_t * packed_desc
static void clib_spinlock_free(clib_spinlock_t *p)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
vhost_user_vring_t * vrings
#define VLIB_CLI_COMMAND(x,...)
static_always_inline void vnet_hw_if_rx_queue_set_int_pending(vnet_main_t *vnm, u32 queue_index)
@ VHOST_USER_SET_VRING_BASE
@ VHOST_USER_SET_FEATURES
unformat_function_t unformat_vnet_hw_interface
#define VRING_USED_F_NO_NOTIFY
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vhost_cpu_t * cpus
Per-CPU data for vhost-user.
#define VHOST_USER_PROTOCOL_F_MQ
void vnet_hw_if_set_rx_queue_file_index(vnet_main_t *vnm, u32 queue_index, u32 file_index)
static_always_inline int vhost_user_intf_ready(vhost_user_intf_t *vui)
Returns whether at least one TX and one RX vring are enabled.
void * region_mmap_addr[VHOST_MEMORY_MAX_NREGIONS]
@ VHOST_USER_GET_VRING_BASE
vring_desc_event_t * used_event
#define VHOST_VRING_INIT_MQ_PAIR_SZ
#define vec_free(V)
Free vector's memory (no header).
static uword vhost_user_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
#define VHOST_USER_EVENT_START_TIMER
static long get_huge_page_size(int fd)
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
static f64 vlib_process_wait_for_event_or_clock(vlib_main_t *vm, f64 dt)
Suspend a cooperative multi-tasking thread Waits for an event, or for the indicated number of seconds...
description fragment has unexpected format
u32 * show_dev_instance_by_real_dev_instance
static void clib_file_del(clib_file_main_t *um, clib_file_t *f)
vhost_user_main_t vhost_user_main
static vnet_sw_interface_t * vnet_get_hw_sw_interface(vnet_main_t *vnm, u32 hw_if_index)
#define VLIB_BUFFER_PRE_DATA_SIZE
#define VLIB_INIT_FUNCTION(x)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
static vlib_cli_command_t vhost_user_delete_command
(constructor) VLIB_CLI_COMMAND (vhost_user_delete_command)
static clib_error_t * vhost_user_kickfd_read_ready(clib_file_t *uf)
static_always_inline void vhost_user_vring_init(vhost_user_intf_t *vui, u32 qid)
#define vec_foreach(var, vec)
Vector iterator.
u64 region_guest_addr_hi[VHOST_MEMORY_MAX_NREGIONS]
#define clib_error_return_unix(e, args...)
static uword clib_file_add(clib_file_main_t *um, clib_file_t *template)
static clib_error_t * vhost_user_init(vlib_main_t *vm)
static uword vhost_user_send_interrupt_process(vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
int vhost_user_modify_if(vnet_main_t *vnm, vlib_main_t *vm, vhost_user_create_if_args_t *args)
static_always_inline void vhost_user_vring_close(vhost_user_intf_t *vui, u32 qid)
@ foreach_virtio_event_idx_flags
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
u32 vnet_hw_if_register_rx_queue(vnet_main_t *vnm, u32 hw_if_index, u32 queue_id, u32 thread_index)
#define VHOST_VRING_MAX_MQ_PAIR_SZ
static vlib_main_t * vlib_get_main(void)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
vnet_interface_output_runtime_t * rt
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
static u8 * format_vhost_user_desc(u8 *s, va_list *args)
static void unmap_all_mem_regions(vhost_user_intf_t *vui)
static_always_inline void * map_guest_mem(vhost_user_intf_t *vui, uword addr, u32 *hint)
static int vhost_user_init_server_sock(const char *sock_filename, int *sock_fd)
Open server unix socket on specified sock_filename.
@ VHOST_USER_SET_VRING_ENABLE
clib_spinlock_t vring_lock
@ VNET_HW_INTERFACE_CAP_SUPPORTS_TX_UDP_CKSUM
static u8 * format_vhost_user_event_idx_flags(u8 *s, va_list *args)
#define UNIX_GET_FD(unixfd_idx)
static_always_inline void vhost_user_rx_thread_placement(vhost_user_intf_t *vui, u32 qid)
Unassign existing interface/queue to thread mappings and re-assign new interface/queue to thread mapp...
#define clib_warning(format, args...)
static uword vlib_process_suspend_time_is_zero(f64 dt)
Returns TRUE if a process suspend time is less than 10us.
#define vu_log_debug(dev, f,...)
@ VHOST_USER_GET_FEATURES
@ VNET_HW_INTERFACE_CAP_SUPPORTS_INT_MODE
static void vhost_user_create_ethernet(vnet_main_t *vnm, vlib_main_t *vm, vhost_user_intf_t *vui, vhost_user_create_if_args_t *args)
Create ethernet interface for vhost user interface.
vhost_user_intf_t * vhost_user_interfaces
int vhost_user_delete_if(vnet_main_t *vnm, vlib_main_t *vm, u32 sw_if_index)
u32 region_mmap_fd[VHOST_MEMORY_MAX_NREGIONS]
static_always_inline void vhost_user_if_disconnect(vhost_user_intf_t *vui)
vlib_log_class_t log_default
static f64 vlib_time_now(vlib_main_t *vm)
#define VLIB_MAIN_LOOP_EXIT_FUNCTION(x)
@ VHOST_USER_GET_QUEUE_NUM
@ VHOST_USER_SET_VRING_ERR
static_always_inline u32 vnet_hw_if_get_rx_queue_thread_index(vnet_main_t *vnm, u32 queue_index)
static vlib_thread_main_t * vlib_get_thread_main()
@ VHOST_USER_SET_VRING_CALL
int dont_dump_vhost_user_memory
vl_api_interface_index_t sw_if_index
u32 random
Pseudo random iterator.
static clib_error_t * vhost_user_socket_read(clib_file_t *uf)
__clib_export uword mhash_set_mem(mhash_t *h, void *key, uword *new_value, uword *old_value)
__clib_export uword mhash_unset(mhash_t *h, void *key, uword *old_value)
vlib_node_registration_t vhost_user_send_interrupt_node
(constructor) VLIB_REGISTER_NODE (vhost_user_send_interrupt_node)
static clib_error_t * vhost_user_exit(vlib_main_t *vm)
@ VHOST_USER_SET_MEM_TABLE
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
void vnet_hw_if_set_input_node(vnet_main_t *vnm, u32 hw_if_index, u32 node_index)
@ VNET_HW_IF_RX_MODE_UNKNOWN
int vhost_user_create_if(vnet_main_t *vnm, vlib_main_t *vm, vhost_user_create_if_args_t *args)
mhash_t if_index_by_sock_name
@ VHOST_USER_SET_VRING_ADDR
#define VLIB_REGISTER_NODE(x,...)
static uword random_default_seed(void)
Default random seed (unix/linux user-mode)
vl_api_address_union_t un
vl_api_wireguard_peer_flags_t flags
clib_error_t * vhost_user_delete_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)