FD.io VPP  v19.08.3-2-gbabecb413
Vector Packet Processing
pci.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  virtio_pci_cap_t
 
struct  virtio_pci_notify_cap_t
 
struct  virtio_pci_common_cfg_t
 
struct  vring_desc_t
 
struct  vring_avail_t
 
struct  vring_used_elem_t
 
struct  vring_used_t
 
struct  virtio_pci_create_if_args_t
 

Macros

#define VIRTIO_PCI_ABI_VERSION   0
 
#define VIRTIO_PCI_HOST_FEATURES   0 /* host's supported features (32bit, RO) */
 
#define VIRTIO_PCI_GUEST_FEATURES   4 /* guest's supported features (32, RW) */
 
#define VIRTIO_PCI_QUEUE_PFN   8 /* physical address of VQ (32, RW) */
 
#define VIRTIO_PCI_QUEUE_NUM   12 /* number of ring entries (16, RO) */
 
#define VIRTIO_PCI_QUEUE_SEL   14 /* current VQ selection (16, RW) */
 
#define VIRTIO_PCI_QUEUE_NOTIFY   16 /* notify host regarding VQ (16, RW) */
 
#define VIRTIO_PCI_STATUS   18 /* device status register (8, RW) */
 
#define VIRTIO_PCI_ISR
 
#define VIRTIO_MSI_CONFIG_VECTOR   20 /* configuration change vector (16, RW) */
 
#define VIRTIO_MSI_QUEUE_VECTOR
 
#define VIRTIO_PCI_ISR_INTR   0x1
 
#define VIRTIO_PCI_ISR_CONFIG   0x2
 
#define VIRTIO_ID_NETWORK   0x01
 
#define foreach_virtio_config_status_flags
 
#define foreach_virtio_net_feature_flags
 
#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS   2
 
#define VIRTIO_NET_F_MTU   3
 
#define VIRTIO_NET_S_LINK_UP   1 /* Link is up */
 
#define VIRTIO_NET_S_ANNOUNCE   2 /* Announcement is needed */
 
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS   5
 
#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET   0
 
#define VIRTIO_PCI_CAP_COMMON_CFG   1
 
#define VIRTIO_PCI_CAP_NOTIFY_CFG   2
 
#define VIRTIO_PCI_CAP_ISR_CFG   3
 
#define VIRTIO_PCI_CAP_DEVICE_CFG   4
 
#define VIRTIO_PCI_CAP_PCI_CFG   5
 
#define VIRTIO_PCI_QUEUE_ADDR_SHIFT   12
 
#define VIRTIO_PCI_VRING_ALIGN   4096
 
#define virtio_log_debug(vim, vif, f, ...)
 
#define virtio_log_warning(vim, vif, f, ...)
 
#define virtio_log_error(vim, vif, f, ...)
 

Enumerations

enum  virtio_config_status_flags_t { foreach_virtio_config_status_flags }
 
enum  virtio_msix_status_t { VIRTIO_MSIX_NONE = 0, VIRTIO_MSIX_DISABLED = 1, VIRTIO_MSIX_ENABLED = 2 }
 

Functions

void debug_device_config_space (vlib_main_t *vm, virtio_if_t *vif)
 
void device_status (vlib_main_t *vm, virtio_if_t *vif)
 
void virtio_pci_create_if (vlib_main_t *vm, virtio_pci_create_if_args_t *args)
 
int virtio_pci_delete_if (vlib_main_t *vm, virtio_if_t *ad)
 

Macro Definition Documentation

◆ foreach_virtio_config_status_flags

#define foreach_virtio_config_status_flags
Value:
_ (VIRTIO_CONFIG_STATUS_RESET, 0x00) \
_ (VIRTIO_CONFIG_STATUS_ACK, 0x01) \
_ (VIRTIO_CONFIG_STATUS_DRIVER, 0x02) \
_ (VIRTIO_CONFIG_STATUS_DRIVER_OK, 0x04) \
_ (VIRTIO_CONFIG_STATUS_FEATURES_OK, 0x08) \
_ (VIRTIO_CONFIG_STATUS_DEVICE_NEEDS_RESET, 0x40) \
_ (VIRTIO_CONFIG_STATUS_FAILED, 0x80)

Definition at line 54 of file pci.h.

◆ foreach_virtio_net_feature_flags

#define foreach_virtio_net_feature_flags
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. */ \
#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 70 of file pci.h.

◆ VIRTIO_ID_NETWORK

#define VIRTIO_ID_NETWORK   0x01

Definition at line 51 of file pci.h.

◆ virtio_log_debug

#define virtio_log_debug (   vim,
  vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_DEBUG, vim->log_default, "%U: " f, \
format_vlib_pci_addr, &vif->pci_addr, \
##__VA_ARGS__); \
};
format_function_t format_vlib_pci_addr
Definition: pci.h:324

Definition at line 135 of file pci.h.

◆ virtio_log_error

#define virtio_log_error (   vim,
  vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_ERR, vim->log_default, "%U: " f, \
format_vlib_pci_addr, &vif->pci_addr, \
##__VA_ARGS__); \
};
format_function_t format_vlib_pci_addr
Definition: pci.h:324

Definition at line 149 of file pci.h.

◆ virtio_log_warning

#define virtio_log_warning (   vim,
  vif,
  f,
  ... 
)
Value:
{ \
vlib_log(VLIB_LOG_LEVEL_WARNING, vim->log_default, "%U: " f, \
format_vlib_pci_addr, &vif->pci_addr, \
##__VA_ARGS__); \
};
format_function_t format_vlib_pci_addr
Definition: pci.h:324

Definition at line 142 of file pci.h.

◆ VIRTIO_MSI_CONFIG_VECTOR

#define VIRTIO_MSI_CONFIG_VECTOR   20 /* configuration change vector (16, RW) */

Definition at line 35 of file pci.h.

◆ VIRTIO_MSI_QUEUE_VECTOR

#define VIRTIO_MSI_QUEUE_VECTOR
Value:
22 /* vector for selected VQ notifications
(16, RW) */

Definition at line 36 of file pci.h.

◆ VIRTIO_NET_CTRL_GUEST_OFFLOADS

#define VIRTIO_NET_CTRL_GUEST_OFFLOADS   5

Definition at line 117 of file pci.h.

◆ VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET

#define VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET   0

Definition at line 118 of file pci.h.

◆ VIRTIO_NET_F_CTRL_GUEST_OFFLOADS

#define VIRTIO_NET_F_CTRL_GUEST_OFFLOADS   2

Definition at line 104 of file pci.h.

◆ VIRTIO_NET_F_MTU

#define VIRTIO_NET_F_MTU   3

Definition at line 105 of file pci.h.

◆ VIRTIO_NET_S_ANNOUNCE

#define VIRTIO_NET_S_ANNOUNCE   2 /* Announcement is needed */

Definition at line 107 of file pci.h.

◆ VIRTIO_NET_S_LINK_UP

#define VIRTIO_NET_S_LINK_UP   1 /* Link is up */

Definition at line 106 of file pci.h.

◆ VIRTIO_PCI_ABI_VERSION

#define VIRTIO_PCI_ABI_VERSION   0

Definition at line 20 of file pci.h.

◆ VIRTIO_PCI_CAP_COMMON_CFG

#define VIRTIO_PCI_CAP_COMMON_CFG   1

Definition at line 121 of file pci.h.

◆ VIRTIO_PCI_CAP_DEVICE_CFG

#define VIRTIO_PCI_CAP_DEVICE_CFG   4

Definition at line 127 of file pci.h.

◆ VIRTIO_PCI_CAP_ISR_CFG

#define VIRTIO_PCI_CAP_ISR_CFG   3

Definition at line 125 of file pci.h.

◆ VIRTIO_PCI_CAP_NOTIFY_CFG

#define VIRTIO_PCI_CAP_NOTIFY_CFG   2

Definition at line 123 of file pci.h.

◆ VIRTIO_PCI_CAP_PCI_CFG

#define VIRTIO_PCI_CAP_PCI_CFG   5

Definition at line 129 of file pci.h.

◆ VIRTIO_PCI_GUEST_FEATURES

#define VIRTIO_PCI_GUEST_FEATURES   4 /* guest's supported features (32, RW) */

Definition at line 26 of file pci.h.

◆ VIRTIO_PCI_HOST_FEATURES

#define VIRTIO_PCI_HOST_FEATURES   0 /* host's supported features (32bit, RO) */

Definition at line 25 of file pci.h.

◆ VIRTIO_PCI_ISR

#define VIRTIO_PCI_ISR
Value:
19 /* interrupt status register, reading
* also clears the register (8, RO) */

Definition at line 32 of file pci.h.

◆ VIRTIO_PCI_ISR_CONFIG

#define VIRTIO_PCI_ISR_CONFIG   0x2

Definition at line 48 of file pci.h.

◆ VIRTIO_PCI_ISR_INTR

#define VIRTIO_PCI_ISR_INTR   0x1

Definition at line 46 of file pci.h.

◆ VIRTIO_PCI_QUEUE_ADDR_SHIFT

#define VIRTIO_PCI_QUEUE_ADDR_SHIFT   12

Definition at line 131 of file pci.h.

◆ VIRTIO_PCI_QUEUE_NOTIFY

#define VIRTIO_PCI_QUEUE_NOTIFY   16 /* notify host regarding VQ (16, RW) */

Definition at line 30 of file pci.h.

◆ VIRTIO_PCI_QUEUE_NUM

#define VIRTIO_PCI_QUEUE_NUM   12 /* number of ring entries (16, RO) */

Definition at line 28 of file pci.h.

◆ VIRTIO_PCI_QUEUE_PFN

#define VIRTIO_PCI_QUEUE_PFN   8 /* physical address of VQ (32, RW) */

Definition at line 27 of file pci.h.

◆ VIRTIO_PCI_QUEUE_SEL

#define VIRTIO_PCI_QUEUE_SEL   14 /* current VQ selection (16, RW) */

Definition at line 29 of file pci.h.

◆ VIRTIO_PCI_STATUS

#define VIRTIO_PCI_STATUS   18 /* device status register (8, RW) */

Definition at line 31 of file pci.h.

◆ VIRTIO_PCI_VRING_ALIGN

#define VIRTIO_PCI_VRING_ALIGN   4096

Definition at line 133 of file pci.h.

Enumeration Type Documentation

◆ virtio_config_status_flags_t

Enumerator
foreach_virtio_config_status_flags 

Definition at line 63 of file pci.h.

◆ virtio_msix_status_t

Enumerator
VIRTIO_MSIX_NONE 
VIRTIO_MSIX_DISABLED 
VIRTIO_MSIX_ENABLED 

Definition at line 156 of file pci.h.

Function Documentation

◆ debug_device_config_space()

void debug_device_config_space ( vlib_main_t vm,
virtio_if_t vif 
)
inline

Definition at line 390 of file pci.c.

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

◆ device_status()

void device_status ( vlib_main_t vm,
virtio_if_t vif 
)
inline

Definition at line 362 of file pci.c.

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

◆ virtio_pci_create_if()

void virtio_pci_create_if ( vlib_main_t vm,
virtio_pci_create_if_args_t args 
)

Definition at line 1047 of file pci.c.

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

◆ virtio_pci_delete_if()

int virtio_pci_delete_if ( vlib_main_t vm,
virtio_if_t ad 
)

Definition at line 1242 of file pci.c.

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