FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
virtio.h File Reference
+ Include dependency graph for virtio.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  virtio_net_config_t
 
struct  virtio_vring_t
 
union  pci_addr_t
 
struct  virtio_if_t
 
struct  virtio_main_t
 

Macros

#define foreach_virtio_net_features
 
#define foreach_virtio_if_flag
 
#define VIRTIO_NUM_RX_DESC   256
 
#define VIRTIO_NUM_TX_DESC   256
 
#define VIRTIO_FEATURE(X)   (1ULL << X)
 
#define TX_QUEUE(X)   ((X*2) + 1)
 
#define RX_QUEUE(X)   (X*2)
 
#define TX_QUEUE_ACCESS(X)   (X/2)
 
#define RX_QUEUE_ACCESS(X)   (X/2)
 
#define foreach_virtio_if_types
 
#define VIRTIO_RING_FLAG_MASK_INT   1
 
#define VRING_TX_OUT_OF_ORDER   1
 
#define virtio_log_debug(vif, f, ...)
 
#define virtio_log_warning(vif, f, ...)
 
#define virtio_log_error(vif, f, ...)
 

Enumerations

enum  virtio_if_flag_t { foreach_virtio_if_flag }
 
enum  virtio_if_type_t { VIRTIO_IF_N_TYPES = (1 << 3) }
 

Functions

clib_error_tvirtio_vring_init (vlib_main_t *vm, virtio_if_t *vif, u16 idx, u16 sz)
 
clib_error_tvirtio_vring_free_rx (vlib_main_t *vm, virtio_if_t *vif, u32 idx)
 
clib_error_tvirtio_vring_free_tx (vlib_main_t *vm, virtio_if_t *vif, u32 idx)
 
void virtio_vring_set_numa_node (vlib_main_t *vm, virtio_if_t *vif, u32 idx)
 
void virtio_free_used_desc (vlib_main_t *vm, virtio_vring_t *vring)
 
void virtio_free_rx_buffers (vlib_main_t *vm, virtio_vring_t *vring)
 
void virtio_set_net_hdr_size (virtio_if_t *vif)
 
void virtio_show (vlib_main_t *vm, u32 *hw_if_indices, u8 show_descr, u32 type)
 
void virtio_pci_legacy_notify_queue (vlib_main_t *vm, virtio_if_t *vif, u16 queue_id)
 
static_always_inline void virtio_kick (vlib_main_t *vm, virtio_vring_t *vring, virtio_if_t *vif)
 

Variables

virtio_main_t virtio_main
 
vnet_device_class_t virtio_device_class
 
vlib_node_registration_t virtio_input_node
 (constructor) VLIB_REGISTER_NODE (virtio_input_node) More...
 
format_function_t format_virtio_device_name
 
format_function_t format_virtio_log_name
 

Macro Definition Documentation

◆ foreach_virtio_if_flag

#define foreach_virtio_if_flag
Value:
_(0, ADMIN_UP, "admin-up") \
_(1, DELETING, "deleting")

Definition at line 61 of file virtio.h.

◆ foreach_virtio_if_types

#define foreach_virtio_if_types
Value:
_ (TAP, 0) \
_ (TUN, 1) \
_ (PCI, 2)

Definition at line 82 of file virtio.h.

◆ foreach_virtio_net_features

#define foreach_virtio_net_features
Value:
_ (VIRTIO_NET_F_CSUM, 0) /* Host handles pkts w/ partial csum */ \
_ (VIRTIO_NET_F_GUEST_CSUM, 1) /* Guest handles pkts w/ partial csum */ \
_ (VIRTIO_NET_F_CTRL_GUEST_OFFLOADS, 2) /* Dynamic offload configuration. */ \
_ (VIRTIO_NET_F_MTU, 3) /* Initial MTU advice. */ \
_ (VIRTIO_NET_F_MAC, 5) /* Host has given MAC address. */ \
_ (VIRTIO_NET_F_GSO, 6) /* Host handles pkts w/ any GSO. */ \
_ (VIRTIO_NET_F_GUEST_TSO4, 7) /* Guest can handle TSOv4 in. */ \
_ (VIRTIO_NET_F_GUEST_TSO6, 8) /* Guest can handle TSOv6 in. */ \
_ (VIRTIO_NET_F_GUEST_ECN, 9) /* Guest can handle TSO[6] w/ ECN in. */ \
_ (VIRTIO_NET_F_GUEST_UFO, 10) /* Guest can handle UFO in. */ \
_ (VIRTIO_NET_F_HOST_TSO4, 11) /* Host can handle TSOv4 in. */ \
_ (VIRTIO_NET_F_HOST_TSO6, 12) /* Host can handle TSOv6 in. */ \
_ (VIRTIO_NET_F_HOST_ECN, 13) /* Host can handle TSO[6] w/ ECN in. */ \
_ (VIRTIO_NET_F_HOST_UFO, 14) /* Host can handle UFO in. */ \
_ (VIRTIO_NET_F_MRG_RXBUF, 15) /* Host can merge receive buffers. */ \
_ (VIRTIO_NET_F_STATUS, 16) /* virtio_net_config.status available */ \
_ (VIRTIO_NET_F_CTRL_VQ, 17) /* Control channel available */ \
_ (VIRTIO_NET_F_CTRL_RX, 18) /* Control channel RX mode support */ \
_ (VIRTIO_NET_F_CTRL_VLAN, 19) /* Control channel VLAN filtering */ \
_ (VIRTIO_NET_F_CTRL_RX_EXTRA, 20) /* Extra RX mode control support */ \
_ (VIRTIO_NET_F_GUEST_ANNOUNCE, 21) /* Guest can announce device on the network */ \
_ (VIRTIO_NET_F_MQ, 22) /* Device supports Receive Flow Steering */ \
_ (VIRTIO_NET_F_CTRL_MAC_ADDR, 23) /* Set MAC address */ \
_ (VIRTIO_F_NOTIFY_ON_EMPTY, 24) \
_ (VHOST_F_LOG_ALL, 26) /* Log all write descriptors */ \
_ (VIRTIO_F_ANY_LAYOUT, 27) /* Can the device handle any descriptor layout */ \
_ (VIRTIO_RING_F_INDIRECT_DESC, 28) /* Support indirect buffer descriptors */ \
_ (VIRTIO_RING_F_EVENT_IDX, 29) /* The Guest publishes the used index for which it expects an interrupt \
* at the end of the avail ring. Host should ignore the avail->flags field. */ \
/* The Host publishes the avail index for which it expects a kick \
* at the end of the used ring. Guest should ignore the used->flags field. */ \
_ (VIRTIO_F_VERSION_1, 32)
#define VHOST_USER_F_PROTOCOL_FEATURES
Definition: vhost_user.h:42
#define VIRTIO_NET_F_MTU
Definition: pci.h:105
#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS
Definition: pci.h:104

Definition at line 26 of file virtio.h.

◆ RX_QUEUE

#define RX_QUEUE (   X)    (X*2)

Definition at line 78 of file virtio.h.

◆ RX_QUEUE_ACCESS

#define RX_QUEUE_ACCESS (   X)    (X/2)

Definition at line 80 of file virtio.h.

◆ TX_QUEUE

#define TX_QUEUE (   X)    ((X*2) + 1)

Definition at line 77 of file virtio.h.

◆ TX_QUEUE_ACCESS

#define TX_QUEUE_ACCESS (   X)    (X/2)

Definition at line 79 of file virtio.h.

◆ VIRTIO_FEATURE

#define VIRTIO_FEATURE (   X)    (1ULL << X)

Definition at line 75 of file virtio.h.

◆ virtio_log_debug

#define virtio_log_debug (   vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_DEBUG, virtio_main.log_default, \
"%U: " f, format_virtio_log_name, vif, \
##__VA_ARGS__); \
};
format_function_t format_virtio_log_name
Definition: virtio.h:218
virtio_main_t virtio_main
Definition: virtio.c:37
vlib_log_class_t log_default
Definition: virtio.h:193

Definition at line 236 of file virtio.h.

◆ virtio_log_error

#define virtio_log_error (   vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_ERR, virtio_main.log_default, \
"%U: " f, format_virtio_log_name, vif, \
##__VA_ARGS__); \
};
format_function_t format_virtio_log_name
Definition: virtio.h:218
virtio_main_t virtio_main
Definition: virtio.c:37
vlib_log_class_t log_default
Definition: virtio.h:193

Definition at line 250 of file virtio.h.

◆ virtio_log_warning

#define virtio_log_warning (   vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_WARNING, virtio_main.log_default, \
"%U: " f, format_virtio_log_name, vif, \
##__VA_ARGS__); \
};
format_function_t format_virtio_log_name
Definition: virtio.h:218
virtio_main_t virtio_main
Definition: virtio.c:37
vlib_log_class_t log_default
Definition: virtio.h:193

Definition at line 243 of file virtio.h.

◆ VIRTIO_NUM_RX_DESC

#define VIRTIO_NUM_RX_DESC   256

Definition at line 72 of file virtio.h.

◆ VIRTIO_NUM_TX_DESC

#define VIRTIO_NUM_TX_DESC   256

Definition at line 73 of file virtio.h.

◆ VIRTIO_RING_FLAG_MASK_INT

#define VIRTIO_RING_FLAG_MASK_INT   1

Definition at line 104 of file virtio.h.

◆ VRING_TX_OUT_OF_ORDER

#define VRING_TX_OUT_OF_ORDER   1

Definition at line 120 of file virtio.h.

Enumeration Type Documentation

◆ virtio_if_flag_t

Enumerator
foreach_virtio_if_flag 

Definition at line 65 of file virtio.h.

◆ virtio_if_type_t

Enumerator
VIRTIO_IF_N_TYPES 

Definition at line 87 of file virtio.h.

Function Documentation

◆ virtio_free_rx_buffers()

void virtio_free_rx_buffers ( vlib_main_t vm,
virtio_vring_t vring 
)
inline

Definition at line 138 of file virtio.c.

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

◆ virtio_free_used_desc()

void virtio_free_used_desc ( vlib_main_t vm,
virtio_vring_t vring 
)
inline

Definition at line 175 of file virtio.c.

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

◆ virtio_kick()

static_always_inline void virtio_kick ( vlib_main_t vm,
virtio_vring_t vring,
virtio_if_t vif 
)

Definition at line 221 of file virtio.h.

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

◆ virtio_pci_legacy_notify_queue()

void virtio_pci_legacy_notify_queue ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_id 
)
inline

Definition at line 218 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_set_net_hdr_size()

void virtio_set_net_hdr_size ( virtio_if_t vif)
inline

Definition at line 240 of file virtio.c.

+ Here is the caller graph for this function:

◆ virtio_show()

void virtio_show ( vlib_main_t vm,
u32 hw_if_indices,
u8  show_descr,
u32  type 
)
inline

Definition at line 250 of file virtio.c.

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

◆ virtio_vring_free_rx()

clib_error_t* virtio_vring_free_rx ( vlib_main_t vm,
virtio_if_t vif,
u32  idx 
)

Definition at line 153 of file virtio.c.

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

◆ virtio_vring_free_tx()

clib_error_t* virtio_vring_free_tx ( vlib_main_t vm,
virtio_if_t vif,
u32  idx 
)

Definition at line 201 of file virtio.c.

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

◆ virtio_vring_init()

clib_error_t* virtio_vring_init ( vlib_main_t vm,
virtio_if_t vif,
u16  idx,
u16  sz 
)

Definition at line 65 of file virtio.c.

+ Here is the call graph for this function:

◆ virtio_vring_set_numa_node()

void virtio_vring_set_numa_node ( vlib_main_t vm,
virtio_if_t vif,
u32  idx 
)

Definition at line 224 of file virtio.c.

+ Here is the call graph for this function:

Variable Documentation

◆ format_virtio_device_name

format_function_t format_virtio_device_name

Definition at line 217 of file virtio.h.

◆ format_virtio_log_name

format_function_t format_virtio_log_name

Definition at line 218 of file virtio.h.

◆ virtio_device_class

vnet_device_class_t virtio_device_class

◆ virtio_input_node

vlib_node_registration_t virtio_input_node

(constructor) VLIB_REGISTER_NODE (virtio_input_node)

Definition at line 442 of file node.c.

◆ virtio_main

virtio_main_t virtio_main

Definition at line 37 of file virtio.c.