FD.io VPP  v19.08.3-2-gbabecb413
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 VIRTIO_RING_FLAG_MASK_INT   1
 
#define VRING_TX_OUT_OF_ORDER   1
 

Enumerations

enum  virtio_if_flag_t { foreach_virtio_if_flag }
 
enum  virtio_if_type_t { VIRTIO_IF_TYPE_TAP, VIRTIO_IF_TYPE_PCI, VIRTIO_IF_N_TYPES }
 

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
 

Macro Definition Documentation

◆ foreach_virtio_if_flag

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

Definition at line 62 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 descripor 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:35
#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 79 of file virtio.h.

◆ RX_QUEUE_ACCESS

#define RX_QUEUE_ACCESS (   X)    (X/2)

Definition at line 81 of file virtio.h.

◆ TX_QUEUE

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

Definition at line 78 of file virtio.h.

◆ TX_QUEUE_ACCESS

#define TX_QUEUE_ACCESS (   X)    (X/2)

Definition at line 80 of file virtio.h.

◆ VIRTIO_FEATURE

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

Definition at line 76 of file virtio.h.

◆ VIRTIO_NUM_RX_DESC

#define VIRTIO_NUM_RX_DESC   256

Definition at line 73 of file virtio.h.

◆ VIRTIO_NUM_TX_DESC

#define VIRTIO_NUM_TX_DESC   256

Definition at line 74 of file virtio.h.

◆ VIRTIO_RING_FLAG_MASK_INT

#define VIRTIO_RING_FLAG_MASK_INT   1

Definition at line 99 of file virtio.h.

◆ VRING_TX_OUT_OF_ORDER

#define VRING_TX_OUT_OF_ORDER   1

Definition at line 115 of file virtio.h.

Enumeration Type Documentation

◆ virtio_if_flag_t

Enumerator
foreach_virtio_if_flag 

Definition at line 66 of file virtio.h.

◆ virtio_if_type_t

Enumerator
VIRTIO_IF_TYPE_TAP 
VIRTIO_IF_TYPE_PCI 
VIRTIO_IF_N_TYPES 

Definition at line 83 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 161 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 198 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 218 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 208 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 263 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 273 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 176 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 224 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 66 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 247 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 215 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 398 of file node.c.

◆ virtio_main

virtio_main_t virtio_main

Definition at line 37 of file virtio.c.