DPDK  19.02.0
Data Structures | Functions
rte_vdpa.h File Reference
#include <stdbool.h>
#include <rte_pci.h>
#include "rte_vhost.h"

Go to the source code of this file.

Data Structures

struct  rte_vdpa_dev_addr
struct  rte_vdpa_dev_ops
struct  rte_vdpa_device

Functions

int __rte_experimental rte_vdpa_register_device (struct rte_vdpa_dev_addr *addr, struct rte_vdpa_dev_ops *ops)
int __rte_experimental rte_vdpa_unregister_device (int did)
int __rte_experimental rte_vdpa_find_device_id (struct rte_vdpa_dev_addr *addr)
struct rte_vdpa_device
*__rte_experimental 
rte_vdpa_get_device (int did)
int __rte_experimental rte_vdpa_get_device_num (void)
int __rte_experimental rte_vhost_host_notifier_ctrl (int vid, bool enable)
int __rte_experimental rte_vdpa_relay_vring_avail (int vid, uint16_t qid, void *vring_m)
int __rte_experimental rte_vdpa_relay_vring_used (int vid, uint16_t qid, void *vring_m)

Detailed Description

Device specific vhost lib

Definition in file rte_vdpa.h.

Function Documentation

int __rte_experimental rte_vdpa_register_device ( struct rte_vdpa_dev_addr addr,
struct rte_vdpa_dev_ops ops 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Register a vdpa device

Parameters
addrthe vdpa device address
opsthe vdpa device operations
Returns
device id on success, -1 on failure
int __rte_experimental rte_vdpa_unregister_device ( int  did)
Warning
EXPERIMENTAL: this API may change without prior notice

Unregister a vdpa device

Parameters
didvdpa device id
Returns
device id on success, -1 on failure
int __rte_experimental rte_vdpa_find_device_id ( struct rte_vdpa_dev_addr addr)
Warning
EXPERIMENTAL: this API may change without prior notice

Find the device id of a vdpa device

Parameters
addrthe vdpa device address
Returns
device id on success, -1 on failure
Examples:
examples/vdpa/main.c.
struct rte_vdpa_device* __rte_experimental rte_vdpa_get_device ( int  did)
read
Warning
EXPERIMENTAL: this API may change without prior notice

Find a vdpa device based on device id

Parameters
diddevice id
Returns
rte_vdpa_device on success, NULL on failure
Examples:
examples/vdpa/main.c.
int __rte_experimental rte_vdpa_get_device_num ( void  )
Warning
EXPERIMENTAL: this API may change without prior notice

Get current available vdpa device number

Returns
available vdpa device number
Examples:
examples/vdpa/main.c.
int __rte_experimental rte_vhost_host_notifier_ctrl ( int  vid,
bool  enable 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Enable/Disable host notifier mapping for a vdpa port.

Parameters
vidvhost device id
enabletrue for host notifier map, false for host notifier unmap
Returns
0 on success, -1 on failure
int __rte_experimental rte_vdpa_relay_vring_avail ( int  vid,
uint16_t  qid,
void *  vring_m 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Synchronize the available ring from guest to mediated ring, help to check desc validity to protect against malicious guest driver.

Parameters
vidvhost device id
qidvhost queue id
vring_mmediated virtio ring pointer
Returns
number of synced available entries on success, -1 on failure
int __rte_experimental rte_vdpa_relay_vring_used ( int  vid,
uint16_t  qid,
void *  vring_m 
)
Warning
EXPERIMENTAL: this API may change without prior notice

Synchronize the used ring from mediated ring to guest, log dirty page for each writeable buffer, caller should handle the used ring logging before device stop.

Parameters
vidvhost device id
qidvhost queue id
vring_mmediated virtio ring pointer
Returns
number of synced used entries on success, -1 on failure