FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
virtio_std.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vring_desc_t
 
struct  vring_avail_t
 
struct  vring_used_elem_t
 
struct  vring_used_t
 
struct  vring_t
 

Macros

#define foreach_virtio_net_features
 
#define VIRTIO_FEATURE(X)   (1ULL << X)
 
#define VRING_MAX_SIZE   32768
 
#define VRING_DESC_F_NEXT   1
 
#define VRING_DESC_F_WRITE   2
 
#define VRING_DESC_F_INDIRECT   4
 
#define VRING_DESC_F_AVAIL   (1 << 7)
 
#define VRING_DESC_F_USED   (1 << 15)
 
#define foreach_virtio_event_idx_flags
 
#define VRING_USED_F_NO_NOTIFY   1
 
#define VRING_AVAIL_F_NO_INTERRUPT   1
 
#define VIRTIO_NET_HDR_F_NEEDS_CSUM   1 /* Use csum_start, csum_offset */
 
#define VIRTIO_NET_HDR_F_DATA_VALID   2 /* Csum is valid */
 
#define VIRTIO_NET_HDR_GSO_NONE   0 /* Not a GSO frame */
 
#define VIRTIO_NET_HDR_GSO_TCPV4   1 /* GSO frame, IPv4 TCP (TSO) */
 
#define VIRTIO_NET_HDR_GSO_UDP   3 /* GSO frame, IPv4 UDP (UFO) */
 
#define VIRTIO_NET_HDR_GSO_TCPV6   4 /* GSO frame, IPv6 TCP */
 
#define VIRTIO_NET_HDR_GSO_ECN   0x80 /* TCP has ECN set */
 

Enumerations

enum  virtio_net_feature_t { foreach_virtio_net_features }
 
enum  virtio_event_idx_flags_t { foreach_virtio_event_idx_flags }
 

Functions

typedef CLIB_PACKED (struct { u64 addr;u32 len;u16 id;u16 flags;}) vring_packed_desc_t
 
 STATIC_ASSERT_SIZEOF (vring_packed_desc_t, 16)
 
typedef CLIB_PACKED (struct { u16 off_wrap;u16 flags;}) vring_desc_event_t
 
typedef CLIB_PACKED (struct { u8 flags;u8 gso_type;u16 hdr_len;u16 gso_size;u16 csum_start;u16 csum_offset;u16 num_buffers;}) virtio_net_hdr_v1_t
 
typedef CLIB_PACKED (struct { u8 flags;u8 gso_type;u16 hdr_len;u16 gso_size;u16 csum_start;u16 csum_offset;}) virtio_net_hdr_t
 
typedef CLIB_PACKED (struct { virtio_net_hdr_t hdr;u16 num_buffers;}) virtio_net_hdr_mrg_rxbuf_t
 
static_always_inline void vring_init (vring_t *vr, u32 num, void *p, u32 align)
 
static_always_inline u16 vring_size (u32 num, u32 align)
 

Macro Definition Documentation

◆ foreach_virtio_event_idx_flags

#define foreach_virtio_event_idx_flags
Value:
_ (VRING_EVENT_F_ENABLE, 0) \
_ (VRING_EVENT_F_DISABLE, 1) \
_ (VRING_EVENT_F_DESC, 2)

Definition at line 78 of file virtio_std.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. */ \
_ (VHOST_USER_F_PROTOCOL_FEATURES, 30) \
_ (VIRTIO_F_VERSION_1, 32) /* v1.0 compliant. */ \
_ (VIRTIO_F_IOMMU_PLATFORM, 33) \
_ (VIRTIO_F_RING_PACKED, 34) \
_ (VIRTIO_F_IN_ORDER, 35) /* all buffers are used by the device in the */ \
/* same order in which they have been made available */ \
_ (VIRTIO_F_ORDER_PLATFORM, 36) /* memory accesses by the driver and the */ \
/* device are ordered in a way described by the platfor */ \
_ (VIRTIO_F_NOTIFICATION_DATA, 38) /* the driver passes extra data (besides */ \
/* identifying the virtqueue) in its device notifications. */ \
_ (VIRTIO_NET_F_SPEED_DUPLEX, 63) /* Device set linkspeed and duplex */

Definition at line 18 of file virtio_std.h.

◆ VIRTIO_FEATURE

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

Definition at line 67 of file virtio_std.h.

◆ VIRTIO_NET_HDR_F_DATA_VALID

#define VIRTIO_NET_HDR_F_DATA_VALID   2 /* Csum is valid */

Definition at line 141 of file virtio_std.h.

◆ VIRTIO_NET_HDR_F_NEEDS_CSUM

#define VIRTIO_NET_HDR_F_NEEDS_CSUM   1 /* Use csum_start, csum_offset */

Definition at line 140 of file virtio_std.h.

◆ VIRTIO_NET_HDR_GSO_ECN

#define VIRTIO_NET_HDR_GSO_ECN   0x80 /* TCP has ECN set */

Definition at line 147 of file virtio_std.h.

◆ VIRTIO_NET_HDR_GSO_NONE

#define VIRTIO_NET_HDR_GSO_NONE   0 /* Not a GSO frame */

Definition at line 143 of file virtio_std.h.

◆ VIRTIO_NET_HDR_GSO_TCPV4

#define VIRTIO_NET_HDR_GSO_TCPV4   1 /* GSO frame, IPv4 TCP (TSO) */

Definition at line 144 of file virtio_std.h.

◆ VIRTIO_NET_HDR_GSO_TCPV6

#define VIRTIO_NET_HDR_GSO_TCPV6   4 /* GSO frame, IPv6 TCP */

Definition at line 146 of file virtio_std.h.

◆ VIRTIO_NET_HDR_GSO_UDP

#define VIRTIO_NET_HDR_GSO_UDP   3 /* GSO frame, IPv4 UDP (UFO) */

Definition at line 145 of file virtio_std.h.

◆ VRING_AVAIL_F_NO_INTERRUPT

#define VRING_AVAIL_F_NO_INTERRUPT   1

Definition at line 91 of file virtio_std.h.

◆ VRING_DESC_F_AVAIL

#define VRING_DESC_F_AVAIL   (1 << 7)

Definition at line 75 of file virtio_std.h.

◆ VRING_DESC_F_INDIRECT

#define VRING_DESC_F_INDIRECT   4

Definition at line 73 of file virtio_std.h.

◆ VRING_DESC_F_NEXT

#define VRING_DESC_F_NEXT   1

Definition at line 71 of file virtio_std.h.

◆ VRING_DESC_F_USED

#define VRING_DESC_F_USED   (1 << 15)

Definition at line 76 of file virtio_std.h.

◆ VRING_DESC_F_WRITE

#define VRING_DESC_F_WRITE   2

Definition at line 72 of file virtio_std.h.

◆ VRING_MAX_SIZE

#define VRING_MAX_SIZE   32768

Definition at line 69 of file virtio_std.h.

◆ VRING_USED_F_NO_NOTIFY

#define VRING_USED_F_NO_NOTIFY   1

Definition at line 90 of file virtio_std.h.

Enumeration Type Documentation

◆ virtio_event_idx_flags_t

Enumerator
foreach_virtio_event_idx_flags 

Definition at line 83 of file virtio_std.h.

◆ virtio_net_feature_t

Enumerator
foreach_virtio_net_features 

Definition at line 60 of file virtio_std.h.

Function Documentation

◆ CLIB_PACKED() [1/5]

typedef CLIB_PACKED ( struct { u16 off_wrap;u16 flags;}  )

◆ CLIB_PACKED() [2/5]

typedef CLIB_PACKED ( struct { u64 addr;u32 len;u16 id;u16 flags;}  )

◆ CLIB_PACKED() [3/5]

typedef CLIB_PACKED ( struct { u8 flags;u8 gso_type;u16 hdr_len;u16 gso_size;u16 csum_start;u16 csum_offset;u16 num_buffers;}  )

◆ CLIB_PACKED() [4/5]

typedef CLIB_PACKED ( struct { u8 flags;u8 gso_type;u16 hdr_len;u16 gso_size;u16 csum_start;u16 csum_offset;}  )

◆ CLIB_PACKED() [5/5]

typedef CLIB_PACKED ( struct { virtio_net_hdr_t hdr;u16 num_buffers;}  )

◆ STATIC_ASSERT_SIZEOF()

STATIC_ASSERT_SIZEOF ( vring_packed_desc_t  ,
16   
)

◆ vring_init()

static_always_inline void vring_init ( vring_t vr,
u32  num,
void *  p,
u32  align 
)

Definition at line 187 of file virtio_std.h.

+ Here is the caller graph for this function:

◆ vring_size()

static_always_inline u16 vring_size ( u32  num,
u32  align 
)

Definition at line 200 of file virtio_std.h.

+ Here is the caller graph for this function: