FD.io VPP  v20.05.1-6-gf53edbc3b
Vector Packet Processing
pci.c File Reference
+ Include dependency graph for pci.c:

Go to the source code of this file.

Data Structures

struct  virtio_ctrl_msg
 

Macros

#define PCI_VENDOR_ID_VIRTIO   0x1af4
 
#define PCI_DEVICE_ID_VIRTIO_NIC   0x1000
 
#define PCI_DEVICE_ID_VIRTIO_NIC_MODERN   0x1041
 
#define PCI_CAPABILITY_LIST   0x34
 
#define PCI_CAP_ID_VNDR   0x09
 
#define PCI_CAP_ID_MSIX   0x11
 
#define PCI_MSIX_ENABLE   0x8000
 
#define PCI_CONFIG_SIZE(vif)
 

Functions

static void virtio_pci_legacy_read_config (vlib_main_t *vm, virtio_if_t *vif, void *dst, int len, u32 addr)
 
static void virtio_pci_legacy_write_config (vlib_main_t *vm, virtio_if_t *vif, void *src, int len, u32 addr)
 
static u64 virtio_pci_legacy_get_host_features (vlib_main_t *vm, virtio_if_t *vif)
 
static u32 virtio_pci_legacy_get_guest_features (vlib_main_t *vm, virtio_if_t *vif)
 
static u32 virtio_pci_legacy_set_guest_features (vlib_main_t *vm, virtio_if_t *vif, u64 features)
 
static u8 virtio_pci_legacy_get_status (vlib_main_t *vm, virtio_if_t *vif)
 
static void virtio_pci_legacy_set_status (vlib_main_t *vm, virtio_if_t *vif, u8 status)
 
static u8 virtio_pci_legacy_reset (vlib_main_t *vm, virtio_if_t *vif)
 
static u8 virtio_pci_legacy_get_isr (vlib_main_t *vm, virtio_if_t *vif)
 
static u16 virtio_pci_legacy_get_queue_num (vlib_main_t *vm, virtio_if_t *vif, u16 queue_id)
 
static int virtio_pci_legacy_setup_queue (vlib_main_t *vm, virtio_if_t *vif, u16 queue_id, void *p)
 
static void virtio_pci_legacy_del_queue (vlib_main_t *vm, virtio_if_t *vif, u16 queue_id)
 
void virtio_pci_legacy_notify_queue (vlib_main_t *vm, virtio_if_t *vif, u16 queue_id)
 
static u16 virtio_pci_legacy_set_config_irq (vlib_main_t *vm, virtio_if_t *vif, u16 vec)
 
static u16 virtio_pci_legacy_set_queue_irq (vlib_main_t *vm, virtio_if_t *vif, u16 vec, u16 queue_id)
 
static u32 virtio_pci_flag_change (vnet_main_t *vnm, vnet_hw_interface_t *hw, u32 flags)
 
static clib_error_tvirtio_pci_get_max_virtqueue_pairs (vlib_main_t *vm, virtio_if_t *vif)
 
static void virtio_pci_set_mac (vlib_main_t *vm, virtio_if_t *vif)
 
static u32 virtio_pci_get_mac (vlib_main_t *vm, virtio_if_t *vif)
 
static u16 virtio_pci_is_link_up (vlib_main_t *vm, virtio_if_t *vif)
 
static void virtio_pci_irq_queue_handler (vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 line)
 
static void virtio_pci_irq_config_handler (vlib_main_t *vm, vlib_pci_dev_handle_t h, u16 line)
 
static void virtio_pci_irq_handler (vlib_main_t *vm, vlib_pci_dev_handle_t h)
 
void device_status (vlib_main_t *vm, virtio_if_t *vif)
 
void debug_device_config_space (vlib_main_t *vm, virtio_if_t *vif)
 
static int virtio_pci_send_ctrl_msg (vlib_main_t *vm, virtio_if_t *vif, struct virtio_ctrl_msg *data, u32 len)
 
static int virtio_pci_disable_offload (vlib_main_t *vm, virtio_if_t *vif)
 
static int virtio_pci_enable_checksum_offload (vlib_main_t *vm, virtio_if_t *vif)
 
static int virtio_pci_enable_gso (vlib_main_t *vm, virtio_if_t *vif)
 
static int virtio_pci_offloads (vlib_main_t *vm, virtio_if_t *vif, int gso_enabled, int csum_offload_enabled)
 
static int virtio_pci_enable_multiqueue (vlib_main_t *vm, virtio_if_t *vif, u16 num_queues)
 
static u8 virtio_pci_queue_size_valid (u16 qsz)
 
clib_error_tvirtio_pci_control_vring_init (vlib_main_t *vm, virtio_if_t *vif, u16 queue_num)
 
clib_error_tvirtio_pci_vring_init (vlib_main_t *vm, virtio_if_t *vif, u16 queue_num)
 
static void virtio_negotiate_features (vlib_main_t *vm, virtio_if_t *vif, u64 req_features)
 
void virtio_pci_read_device_feature (vlib_main_t *vm, virtio_if_t *vif)
 
int virtio_pci_reset_device (vlib_main_t *vm, virtio_if_t *vif)
 
clib_error_tvirtio_pci_read_caps (vlib_main_t *vm, virtio_if_t *vif)
 
static clib_error_tvirtio_pci_device_init (vlib_main_t *vm, virtio_if_t *vif, virtio_pci_create_if_args_t *args)
 
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 *vif)
 
int virtio_pci_enable_disable_offloads (vlib_main_t *vm, virtio_if_t *vif, int gso_enabled, int checksum_offload_enabled, int offloads_disabled)
 

Variables

static pci_device_id_t virtio_pci_device_ids []
 

Macro Definition Documentation

◆ PCI_CAP_ID_MSIX

#define PCI_CAP_ID_MSIX   0x11

Definition at line 35 of file pci.c.

◆ PCI_CAP_ID_VNDR

#define PCI_CAP_ID_VNDR   0x09

Definition at line 34 of file pci.c.

◆ PCI_CAPABILITY_LIST

#define PCI_CAPABILITY_LIST   0x34

Definition at line 33 of file pci.c.

◆ PCI_CONFIG_SIZE

#define PCI_CONFIG_SIZE (   vif)
Value:
((vif->msix_enabled == VIRTIO_MSIX_ENABLED) ? \
24 : 20)

Definition at line 39 of file pci.c.

◆ PCI_DEVICE_ID_VIRTIO_NIC

#define PCI_DEVICE_ID_VIRTIO_NIC   0x1000

Definition at line 29 of file pci.c.

◆ PCI_DEVICE_ID_VIRTIO_NIC_MODERN

#define PCI_DEVICE_ID_VIRTIO_NIC_MODERN   0x1041

Definition at line 31 of file pci.c.

◆ PCI_MSIX_ENABLE

#define PCI_MSIX_ENABLE   0x8000

Definition at line 37 of file pci.c.

◆ PCI_VENDOR_ID_VIRTIO

#define PCI_VENDOR_ID_VIRTIO   0x1af4

Definition at line 28 of file pci.c.

Function Documentation

◆ debug_device_config_space()

void debug_device_config_space ( vlib_main_t vm,
virtio_if_t vif 
)
inline

Definition at line 407 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 379 of file pci.c.

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

◆ virtio_negotiate_features()

static void virtio_negotiate_features ( vlib_main_t vm,
virtio_if_t vif,
u64  req_features 
)
static

Definition at line 850 of file pci.c.

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

◆ virtio_pci_control_vring_init()

clib_error_t* virtio_pci_control_vring_init ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_num 
)

Definition at line 726 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 1234 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 vif 
)

Definition at line 1420 of file pci.c.

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

◆ virtio_pci_device_init()

static clib_error_t* virtio_pci_device_init ( vlib_main_t vm,
virtio_if_t vif,
virtio_pci_create_if_args_t args 
)
static

Definition at line 1039 of file pci.c.

+ Here is the call graph for this function:

◆ virtio_pci_disable_offload()

static int virtio_pci_disable_offload ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 576 of file pci.c.

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

◆ virtio_pci_enable_checksum_offload()

static int virtio_pci_enable_checksum_offload ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 596 of file pci.c.

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

◆ virtio_pci_enable_disable_offloads()

int virtio_pci_enable_disable_offloads ( vlib_main_t vm,
virtio_if_t vif,
int  gso_enabled,
int  checksum_offload_enabled,
int  offloads_disabled 
)

Definition at line 1507 of file pci.c.

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

◆ virtio_pci_enable_gso()

static int virtio_pci_enable_gso ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 617 of file pci.c.

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

◆ virtio_pci_enable_multiqueue()

static int virtio_pci_enable_multiqueue ( vlib_main_t vm,
virtio_if_t vif,
u16  num_queues 
)
static

Definition at line 699 of file pci.c.

+ Here is the call graph for this function:

◆ virtio_pci_flag_change()

static u32 virtio_pci_flag_change ( vnet_main_t vnm,
vnet_hw_interface_t hw,
u32  flags 
)
static

Definition at line 251 of file pci.c.

◆ virtio_pci_get_mac()

static u32 virtio_pci_get_mac ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 291 of file pci.c.

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

◆ virtio_pci_get_max_virtqueue_pairs()

static clib_error_t* virtio_pci_get_max_virtqueue_pairs ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 258 of file pci.c.

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

◆ virtio_pci_irq_config_handler()

static void virtio_pci_irq_config_handler ( vlib_main_t vm,
vlib_pci_dev_handle_t  h,
u16  line 
)
static

Definition at line 331 of file pci.c.

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

◆ virtio_pci_irq_handler()

static void virtio_pci_irq_handler ( vlib_main_t vm,
vlib_pci_dev_handle_t  h 
)
static

Definition at line 353 of file pci.c.

+ Here is the call graph for this function:

◆ virtio_pci_irq_queue_handler()

static void virtio_pci_irq_queue_handler ( vlib_main_t vm,
vlib_pci_dev_handle_t  h,
u16  line 
)
static

Definition at line 317 of file pci.c.

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

◆ virtio_pci_is_link_up()

static u16 virtio_pci_is_link_up ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 303 of file pci.c.

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

◆ virtio_pci_legacy_del_queue()

static void virtio_pci_legacy_del_queue ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_id 
)
static

Definition at line 208 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_get_guest_features()

static u32 virtio_pci_legacy_get_guest_features ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 122 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_get_host_features()

static u64 virtio_pci_legacy_get_host_features ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 113 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_get_isr()

static u8 virtio_pci_legacy_get_isr ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 171 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_get_queue_num()

static u16 virtio_pci_legacy_get_queue_num ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_id 
)
static

Definition at line 179 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_get_status()

static u8 virtio_pci_legacy_get_status ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 148 of file pci.c.

+ 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_pci_legacy_read_config()

static void virtio_pci_legacy_read_config ( vlib_main_t vm,
virtio_if_t vif,
void *  dst,
int  len,
u32  addr 
)
static

Definition at line 53 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_reset()

static u8 virtio_pci_legacy_reset ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 164 of file pci.c.

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

◆ virtio_pci_legacy_set_config_irq()

static u16 virtio_pci_legacy_set_config_irq ( vlib_main_t vm,
virtio_if_t vif,
u16  vec 
)
static

Definition at line 227 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_set_guest_features()

static u32 virtio_pci_legacy_set_guest_features ( vlib_main_t vm,
virtio_if_t vif,
u64  features 
)
static

Definition at line 132 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_set_queue_irq()

static u16 virtio_pci_legacy_set_queue_irq ( vlib_main_t vm,
virtio_if_t vif,
u16  vec,
u16  queue_id 
)
static

Definition at line 238 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_legacy_set_status()

static void virtio_pci_legacy_set_status ( vlib_main_t vm,
virtio_if_t vif,
u8  status 
)
static

Definition at line 156 of file pci.c.

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

◆ virtio_pci_legacy_setup_queue()

static int virtio_pci_legacy_setup_queue ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_id,
void *  p 
)
static

Definition at line 191 of file pci.c.

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

◆ virtio_pci_legacy_write_config()

static void virtio_pci_legacy_write_config ( vlib_main_t vm,
virtio_if_t vif,
void *  src,
int  len,
u32  addr 
)
static

Definition at line 83 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_offloads()

static int virtio_pci_offloads ( vlib_main_t vm,
virtio_if_t vif,
int  gso_enabled,
int  csum_offload_enabled 
)
static

Definition at line 638 of file pci.c.

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

◆ virtio_pci_queue_size_valid()

static u8 virtio_pci_queue_size_valid ( u16  qsz)
static

Definition at line 716 of file pci.c.

+ Here is the caller graph for this function:

◆ virtio_pci_read_caps()

clib_error_t* virtio_pci_read_caps ( vlib_main_t vm,
virtio_if_t vif 
)

Definition at line 939 of file pci.c.

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

◆ virtio_pci_read_device_feature()

void virtio_pci_read_device_feature ( vlib_main_t vm,
virtio_if_t vif 
)

Definition at line 900 of file pci.c.

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

◆ virtio_pci_reset_device()

int virtio_pci_reset_device ( vlib_main_t vm,
virtio_if_t vif 
)

Definition at line 906 of file pci.c.

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

◆ virtio_pci_send_ctrl_msg()

static int virtio_pci_send_ctrl_msg ( vlib_main_t vm,
virtio_if_t vif,
struct virtio_ctrl_msg data,
u32  len 
)
static

Definition at line 480 of file pci.c.

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

◆ virtio_pci_set_mac()

static void virtio_pci_set_mac ( vlib_main_t vm,
virtio_if_t vif 
)
static

Definition at line 284 of file pci.c.

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

◆ virtio_pci_vring_init()

clib_error_t* virtio_pci_vring_init ( vlib_main_t vm,
virtio_if_t vif,
u16  queue_num 
)

Definition at line 778 of file pci.c.

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

Variable Documentation

◆ virtio_pci_device_ids

pci_device_id_t virtio_pci_device_ids[]
static
Initial value:
= {
{
.vendor_id = PCI_VENDOR_ID_VIRTIO,
.device_id = PCI_DEVICE_ID_VIRTIO_NIC},
{
.vendor_id = PCI_VENDOR_ID_VIRTIO,
{0},
}
#define PCI_DEVICE_ID_VIRTIO_NIC
Definition: pci.c:29
#define PCI_DEVICE_ID_VIRTIO_NIC_MODERN
Definition: pci.c:31
#define PCI_VENDOR_ID_VIRTIO
Definition: pci.c:28

Definition at line 42 of file pci.c.