rte_vhost.h(3)
๐ rte_vhost.h(3) โ Library Functions Manual โจ
okay so bestie, this is the manual page for rte_vhost.h(3) โ the Library Functions Manual entry for the vhost-user interface. We're gonna go through every detail with the exact names and values, no cap. ๐
๐ธ NAME ๐ธ
rte_vhost.h โ that's the name, periodt. Simple, iconic. ๐
โจ SYNOPSIS โจ
first up, the includes, exactly as they show up:
#include <stdbool.h>
#include <stdint.h>
#include <sys/eventfd.h>
#include <rte_compat.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <linux/vhost.h>
#include <linux/virtio_ring.h>
#include <linux/virtio_net.h>
๐ Data Structures ๐
here's the struct squad, bestie:
struct rte_vhost_mem_regionstruct rte_vhost_memorystruct rte_vhost_user_extern_opsstruct rte_vhost_device_opsstruct rte_vhost_power_monitor_condstruct rte_vhost_statstruct rte_vhost_stat_name
๐งธ Macros ๐งธ
the macro moment, verbatim:
#define VHOST_USER_PROTOCOL_F_MQ 0
#define VHOST_USER_F_PROTOCOL_FEATURES 30
#define RTE_VHOST_STATS_NAME_SIZE 64
๐ช Typedefs ๐ช
one typedef, and it's giving callback energy:
typedef enum rte_vhost_msg_result(* rte_vhost_msg_handle) (int vid, void *msg)
๐ฎ Enumerations ๐ฎ
enum rte_vhost_msg_result
๐ Functions ๐
okay so here's the whole function lineup from the synopsis โ yes, all of them, bestie:
static __rte_always_inline uint64_t rte_vhost_va_from_guest_pa (struct rte_vhost_memory *mem, uint64_t gpa, uint64_t *len)
void rte_vhost_log_write (int vid, uint64_t addr, uint64_t len)
void rte_vhost_log_used_vring (int vid, uint16_t vring_idx, uint64_t offset, uint64_t len)
__rte_experimental void rte_vhost_notify_guest (int vid, uint16_t queue_id)
int rte_vhost_driver_register (const char *path, uint64_t flags)
int rte_vhost_driver_attach_vdpa_device (const char *path, struct rte_vdpa_device *dev)
int rte_vhost_driver_detach_vdpa_device (const char *path)
struct rte_vdpa_device * rte_vhost_driver_get_vdpa_device (const char *path)
int rte_vhost_driver_get_vdpa_dev_type (const char *path, uint32_t *type)
int rte_vhost_driver_set_features (const char *path, uint64_t features)
int rte_vhost_driver_enable_features (const char *path, uint64_t features)
int rte_vhost_driver_disable_features (const char *path, uint64_t features)
int rte_vhost_driver_get_features (const char *path, uint64_t *features)
int rte_vhost_driver_set_protocol_features (const char *path, uint64_t protocol_features)
int rte_vhost_driver_get_protocol_features (const char *path, uint64_t *protocol_features)
int rte_vhost_driver_get_queue_num (const char *path, uint32_t *queue_num)
int rte_vhost_driver_set_max_queue_num (const char *path, uint32_t max_queue_pairs)
int rte_vhost_get_negotiated_features (int vid, uint64_t *features)
int rte_vhost_get_negotiated_protocol_features (int vid, uint64_t *protocol_features)
int rte_vhost_driver_start (const char *path)
int rte_vhost_get_mtu (int vid, uint16_t *mtu)
int rte_vhost_get_numa_node (int vid)
uint16_t rte_vhost_get_vring_num (int vid)
int rte_vhost_get_ifname (int vid, char *buf, size_t len)
uint16_t rte_vhost_avail_entries (int vid, uint16_t queue_id)
uint16_t rte_vhost_enqueue_burst (int vid, uint16_t queue_id, struct rte_mbuf **pkts, uint16_t count)
uint16_t rte_vhost_dequeue_burst (int vid, uint16_t queue_id, struct rte_mempool *mbuf_pool, struct rte_mbuf **pkts, uint16_t count)
int rte_vhost_get_mem_table (int vid, struct rte_vhost_memory **mem)
int rte_vhost_get_vhost_vring (int vid, uint16_t vring_idx, struct rte_vhost_vring *vring)
int rte_vhost_get_vhost_ring_inflight (int vid, uint16_t vring_idx, struct rte_vhost_ring_inflight *vring)
int rte_vhost_set_inflight_desc_split (int vid, uint16_t vring_idx, uint16_t idx)
int rte_vhost_set_inflight_desc_packed (int vid, uint16_t vring_idx, uint16_t head, uint16_t last, uint16_t *inflight_entry)
int rte_vhost_set_last_inflight_io_split (int vid, uint16_t vring_idx, uint16_t idx)
int rte_vhost_set_last_inflight_io_packed (int vid, uint16_t vring_idx, uint16_t head)
int rte_vhost_clr_inflight_desc_split (int vid, uint16_t vring_idx, uint16_t last_used_idx, uint16_t idx)
int rte_vhost_clr_inflight_desc_packed (int vid, uint16_t vring_idx, uint16_t head)
int rte_vhost_vring_call (int vid, uint16_t vring_idx)
int rte_vhost_vring_call_nonblock (int vid, uint16_t vring_idx)
uint32_t rte_vhost_rx_queue_count (int vid, uint16_t qid)
int rte_vhost_get_monitor_addr (int vid, uint16_t queue_id, struct rte_vhost_power_monitor_cond *pmc)
int rte_vhost_get_log_base (int vid, uint64_t *log_base, uint64_t *log_size)
int rte_vhost_get_vring_base (int vid, uint16_t queue_id, uint16_t *last_avail_idx, uint16_t *last_used_idx)
int rte_vhost_get_vring_base_from_inflight (int vid, uint16_t queue_id, uint16_t *last_avail_idx, uint16_t *last_used_idx)
int rte_vhost_set_vring_base (int vid, uint16_t queue_id, uint16_t last_avail_idx, uint16_t last_used_idx)
int rte_vhost_extern_callback_register (int vid, struct rte_vhost_user_extern_ops const *const ops, void *ctx)
struct rte_vdpa_device * rte_vhost_get_vdpa_device (int vid)
int rte_vhost_backend_config_change (int vid, bool need_reply)
int rte_vhost_vring_stats_get_names (int vid, uint16_t queue_id, struct rte_vhost_stat_name *name, unsigned int size)
int rte_vhost_vring_stats_get (int vid, uint16_t queue_id, struct rte_vhost_stat *stats, unsigned int n)
int rte_vhost_vring_stats_reset (int vid, uint16_t queue_id)
๐ Detailed Description ๐
Interface to vhost-user. ๐ฆ
Definition in file rte_vhost.h.
๐ Macro Definition Documentation ๐
๐ VHOST_USER_PROTOCOL_F_MQ
#define VHOST_USER_PROTOCOL_F_MQ 0
Protocol features. โจ
Definition at line 65 of file rte_vhost.h.
๐ VHOST_USER_F_PROTOCOL_FEATURES
#define VHOST_USER_F_PROTOCOL_FEATURES 30
Indicate whether protocol features negotiation is supported. ๐
Definition at line 118 of file rte_vhost.h.
๐ RTE_VHOST_STATS_NAME_SIZE
#define RTE_VHOST_STATS_NAME_SIZE 64
Maximum name length for the statistics counters. ๐
Definition at line 337 of file rte_vhost.h.
๐ช Typedef Documentation ๐ช
๐ซ rte_vhost_msg_handle
typedef enum rte_vhost_msg_result(* rte_vhost_msg_handle) (int vid, void *msg)
Function prototype for the vhost backend to handle specific vhost user messages. ๐ซถ
Parameters:
vidโ vhost device idmsgโ Message pointer.
Returns: RTE_VHOST_MSG_RESULT_OK on success, RTE_VHOST_MSG_RESULT_REPLY on success with reply, RTE_VHOST_MSG_RESULT_ERR on failure, RTE_VHOST_MSG_RESULT_NOT_HANDLED if message was not handled.
Definition at line 1 of file rte_vhost.h.
๐ฎ Enumeration Type Documentation ๐ฎ
enum rte_vhost_msg_result
Possible results of the vhost user message handling callbacks. ๐
Definition at line 237 of file rte_vhost.h.
๐ Function Documentation ๐
๐ซ rte_vhost_va_from_guest_pa ๐ซ
__rte_always_inline uint64_t rte_vhost_va_from_guest_pa (struct rte_vhost_memory *mem, uint64_t gpa, uint64_t *len)
This one is marked [static] in the docs. It converts a guest physical address to a host virtual address. ๐ฆ
Parameters:
memโ the guest memory regionsgpaโ the guest physical address for queryinglenโ the size of the requested area to map, updated with actual size mapped
Returns: the host virtual address on success, 0 on failure.
Definition at line 375 of file rte_vhost.h.
๐ซ rte_vhost_log_write ๐ซ
void rte_vhost_log_write (int vid, uint64_t addr, uint64_t len)
This logs the memory write start with the given address. โจ Lowkey you only need to invoke it when live migration starts โ so most of the time you won't need to call it at all. To keep the performance impact as tiny as possible, the move is to check before calling it:
if (unlikely(RTE_VHOST_NEED_LOG(features)))
rte_vhost_log_write(vid, addr, len);
Parameters:
vidโ vhost device IDaddrโ the starting address for write (in guest physical address space)lenโ the length to write
๐ซ rte_vhost_log_used_vring ๐ซ
void rte_vhost_log_used_vring (int vid, uint16_t vring_idx, uint64_t offset, uint64_t len)
This logs the used ring update start at the given offset. Same as rte_vhost_log_write, the docs suggest doing a check before calling it:
if (unlikely(RTE_VHOST_NEED_LOG(features)))
rte_vhost_log_used_vring(vid, vring_idx, offset, len);
Parameters:
vidโ vhost device IDvring_idxโ the vring indexoffsetโ the offset inside the used ringlenโ the length to write
๐ซ rte_vhost_notify_guest ๐ซ
__rte_experimental void rte_vhost_notify_guest (int vid, uint16_t queue_id)
โ ๏ธ Warning: EXPERIMENTAL: this API may change, or be removed, without prior notice.
This injects the offloaded interrupt into the vhost device's queue. ๐
See also: guest_notify vhost device operation
Parameters:
vidโ vhost device IDqueue_idโ virtio queue index
๐ซ rte_vhost_driver_register ๐ซ
int rte_vhost_driver_register (const char *path, uint64_t flags)
This registers the vhost driver. The path could be different for multiple instance support. ๐
๐ซ rte_vhost_driver_attach_vdpa_device ๐ซ
int rte_vhost_driver_attach_vdpa_device (const char *path, struct rte_vdpa_device *dev)
This sets the vdpa device id and enforces a single connection per socket. ๐ซถ
Parameters:
pathโ The vhost-user socket file pathdevโ vDPA device pointer
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_detach_vdpa_device ๐ซ
int rte_vhost_driver_detach_vdpa_device (const char *path)
This unsets the vdpa device id. ๐
Parameters:
pathโ The vhost-user socket file path
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_get_vdpa_device ๐ซ
struct rte_vdpa_device * rte_vhost_driver_get_vdpa_device (const char *path)
This gets the device id. ๐
Parameters:
pathโ The vhost-user socket file path
Returns: vDPA device pointer, NULL on failure.
๐ซ rte_vhost_driver_get_vdpa_dev_type ๐ซ
int rte_vhost_driver_get_vdpa_dev_type (const char *path, uint32_t *type)
This gets the device type of the vdpa device. โจ
Parameters:
pathโ The vhost-user socket file pathtypeโ the device type of the vdpa device
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_set_features ๐ซ
int rte_vhost_driver_set_features (const char *path, uint64_t features)
This sets the feature bits that the vhost-user driver supports. ๐ธ
Parameters:
pathโ The vhost-user socket file pathfeaturesโ Supported features
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_enable_features ๐ซ
int rte_vhost_driver_enable_features (const char *path, uint64_t features)
This enables vhost-user driver features. ๐ฆ
Note that:
- the param
featuresshould be a subset of the feature bits provided byrte_vhost_driver_set_features(). - it must be invoked before vhost-user negotiation starts.
Parameters:
pathโ The vhost-user socket file pathfeaturesโ Features to enable
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_disable_features ๐ซ
int rte_vhost_driver_disable_features (const char *path, uint64_t features)
This disables vhost-user driver features. ๐
The two notes at rte_vhost_driver_enable_features() also apply here.
Parameters:
pathโ The vhost-user socket file pathfeaturesโ Features to disable
Returns: 0 on success, -1 on failure.
๐ซ rte_vhost_driver_get_features ๐ซ
int rte_vhost_driver_get_features (const char *path, uint64_t *features)
This gets the feature bits before feature negotiation. ๐
Parameters:
pathโ The vhost-user socket file pathfeaturesโ A pointer to store the queried feature bits
Returns: 0 on success, -1 on failure.
int rte_vhost_driver_set_protocol_features (const char * path, uint64_t protocol_features)
Okay so bestie, this one lets you set the protocol feature bits before feature negotiation happens. Like picking your outfit before the party even starts ๐
pathโ the vhost-user socket file pathprotocol_featuresโ the supported protocol features
Returns 0 on success, -1 on failure.
int rte_vhost_driver_get_protocol_features (const char * path, uint64_t * protocol_features)
The matching reader ๐ โ get the protocol feature bits, again before feature negotiation.
pathโ the vhost-user socket file pathprotocol_featuresโ a pointer to store the queried protocol feature bits
Returns 0 on success, -1 on failure.
int rte_vhost_driver_get_queue_num (const char * path, uint32_t * queue_num)
Grabs the queue number bits, and yep โ still before feature negotiation. Timing is everything, periodt โฐ
pathโ the vhost-user socket file pathqueue_numโ a pointer to store the queried queue number bits
Returns 0 on success, -1 on failure.
int rte_vhost_driver_set_max_queue_num (const char * path, uint32_t max_queue_pairs)
Sets the max number of queue pairs the device can handle. Lowkey important detail: the value you set is ignored for Vhost-user backends โ it only counts with VDUSE backends ๐ซถ
pathโ the vhost-user socket file pathmax_queue_pairsโ the maximum number of queue pairs
Returns 0 on success, -1 on failure.
int rte_vhost_get_negotiated_features (int vid, uint64_t * features)
Now we're after the negotiation glow-up โจ โ this gets the feature bits once negotiation is done.
vidโ Vhost device IDfeaturesโ a pointer to store the queried feature bits
Returns 0 on success, -1 on failure.
int rte_vhost_get_negotiated_protocol_features (int vid, uint64_t * protocol_features)
Same energy, but for the protocol feature bits โ post-negotiation edition ๐
vidโ Vhost device IDprotocol_featuresโ a pointer to store the queried protocol feature bits
Returns 0 on success, -1 on failure.
int rte_vhost_driver_start (const char * path)
Starts the vhost-user driver. This is the moment, the main character moment ๐ โ it triggers the vhost-user negotiation.
pathโ the vhost-user socket file path
Returns 0 on success, -1 on failure.
int rte_vhost_get_mtu (int vid, uint16_t * mtu)
Gets the MTU value of the device, if it's set in QEMU (conditional queen ๐ธ).
vidโ virtio-net device IDmtuโ the variable to store the MTU value
Returns:
0โ success-EAGAINโ device not yet started-ENOTSUPโ device does not support MTU feature
int rte_vhost_get_numa_node (int vid)
Tells you which numa node the virtio net device's memory is allocated from ๐ง
vidโ vhost device ID
Returns the numa node, or -1 on failure.
uint16_t rte_vhost_get_vring_num (int vid)
How many vrings does this device even support, bestie? That's the whole question ๐ซ
vidโ vhost device ID
Returns the number of vrings, or 0 on failure.
int rte_vhost_get_ifname (int vid, char * buf, size_t len)
Gets the virtio net device's ifname โ which, fun fact, is the vhost-user socket file path ๐
vidโ vhost device IDbufโ the buffer to stored the queried ifnamelenโ the length ofbuf
Returns 0 on success, -1 on failure.
uint16_t rte_vhost_avail_entries (int vid, uint16_t queue_id)
How many avail entries are still chilling in the queue? ๐
vidโ vhost device IDqueue_idโ virtio queue index
Returns the num of avail entries left.
uint16_t rte_vhost_enqueue_burst (int vid, uint16_t queue_id, struct rte_mbuf ** pkts, uint16_t count)
This one adds buffers to the virtio device's RX virtqueue ๐ Buffers can come from the physical port or from another virtual device. You get a packet count back showing how many packets actually made it into the RX queue successfully.
vidโ vhost device IDqueue_idโ virtio queue index in mq casepktsโ array to contain packets to be enqueuedcountโ packets num to be enqueued
Returns the num of packets enqueued.
uint16_t rte_vhost_dequeue_burst (int vid, uint16_t queue_id, struct rte_mempool * mbuf_pool, struct rte_mbuf ** pkts, uint16_t count)
The reverse vibes ๐ โ pulls guest buffers out of the virtio device's TX virtqueue, builds host mbufs, copies the guest buffer content into those host mbufs, and stashes them in pkts so you can go process them.
vidโ vhost device IDqueue_idโ virtio queue index in mq casembuf_poolโmbuf_poolwhere host mbuf is allocated.pktsโ array to contain packets to be dequeuedcountโ packets num to be dequeued
Returns the num of packets dequeued.
int rte_vhost_get_mem_table (int vid, struct rte_vhost_memory ** mem)
Gets the guest mem table โ literally just a list of memory regions ๐๏ธ
An rte_vhost_vhost_memory object gets allocated internally to hold the guest memory regions. Heads up bestie: the application should free it at the destroy_device() callback. Don't leave it hanging ๐
vidโ vhost device IDmemโ to store the returned mem regions
Returns 0 on success, -1 on failure.
int rte_vhost_get_vhost_vring (int vid, uint16_t vring_idx, struct rte_vhost_vring * vring)
Gets all the guest vring info โ the vring address, the vring size, the whole little package โจ
vidโ vhost device IDvring_idxโ vring indexvringโ the structure to hold the requested vring info
Returns 0 on success, -1 on failure.
int rte_vhost_get_vhost_ring_inflight (int vid, uint16_t vring_idx, struct rte_vhost_ring_inflight * vring)
Same but inflight-flavoured ๐ฆ โ gets the guest inflight vring info, which includes the inflight ring and the resubmit list.
vidโ vhost device IDvring_idxโ vring indexvringโ the structure to hold the requested inflight vring info
Returns 0 on success, -1 on failure.
int rte_vhost_set_inflight_desc_split (int vid, uint16_t vring_idx, uint16_t idx)
Sets a split inflight descriptor. This function saves descriptors that have been consumed in the available ring ๐พ
vidโ vhost device IDvring_idxโ vring indexidxโ inflight entry index
Returns 0 on success, -1 on failure.
int rte_vhost_set_inflight_desc_packed (int vid, uint16_t vring_idx, uint16_t head, uint16_t last, uint16_t * inflight_entry)
Sets a packed inflight descriptor and grabs the corresponding inflight entry โ two-for-one, we love efficiency ๐ This function saves descriptors that have been consumed.
vidโ vhost device IDvring_idxโ vring indexheadโ head of descriptorslastโ last of descriptorsinflight_entryโ corresponding inflight entry
Returns 0 on success, -1 on failure.
int rte_vhost_set_last_inflight_io_split (int vid, uint16_t vring_idx, uint16_t idx)
Saves the head of the list that the last batch of used descriptors points at ๐
vidโ vhost device IDvring_idxโ vring indexidxโ descriptor entry index
Returns 0 on success, -1 on failure.
int rte_vhost_set_last_inflight_io_packed (int vid, uint16_t vring_idx, uint16_t head)
Updates inflight free_head, used_idx and used_wrap_counter ๐
Note the ordering, bestie: it updates status first, before updating descriptors to used. Order matters, no cap.
vidโ vhost device IDvring_idxโ vring indexheadโ head of descriptors
Returns 0 on success, -1 on failure.
int rte_vhost_clr_inflight_desc_split (int vid, uint16_t vring_idx, uint16_t last_used_idx, uint16_t idx)
Clears the split inflight status ๐งนโจ
vidโ vhost device IDvring_idxโ vring indexlast_used_idxโ last used idx of used ringidxโ inflight entry index
Returns 0 on success, -1 on failure.
int rte_vhost_clr_inflight_desc_packed (int vid, uint16_t vring_idx, uint16_t head)
Clears the packed inflight status. Same cleansing energy, packed flavour ๐ซง
vidโ vhost device IDvring_idxโ vring indexheadโ inflight entry index
Returns 0 on success, -1 on failure.
int rte_vhost_vring_call (int vid, uint16_t vring_idx)
Notifies the guest that used descriptors have been added to the vring ๐ And important: this function acts as a memory barrier.
vidโ vhost device IDvring_idxโ vring index
Returns 0 on success, -1 on failure.
int rte_vhost_vring_call_nonblock (int vid, uint16_t vring_idx)
Same notification business โ tells the guest that used descriptors landed in the vring, and it acts as a memory barrier too ๐ But this one's the nonblocking sibling: it returns -EAGAIN when vq's access lock is held by another thread, and then you should try again later. Polite queueing, honestly ๐
vidโ vhost device IDvring_idxโ vring index
Returns 0 on success, -1 on failure, -EAGAIN for another retry.
uint32_t rte_vhost_rx_queue_count (int vid, uint16_t qid)
Gets the vhost RX queue avail count ๐
vidโ vhost device IDqidโ virtio queue index in mq case
Returns the num of desc available.
int rte_vhost_get_monitor_addr (int vid, uint16_t queue_id, struct rte_vhost_power_monitor_cond * pmc)
Gets the power monitor address of the vhost device โก๐ฑ
vidโ vhost device IDqueue_idโ vhost queue IDpmcโ power monitor condition
Returns 0 on success, -1 on failure.
int rte_vhost_get_log_base (int vid, uint64_t * log_base, uint64_t * log_size)
Gets the log base and the log size of the vhost device โ the whole log situation ๐
vidโ vhost device IDlog_baseโ vhost log baselog_sizeโ vhost log size
Returns 0 on success, -1 on failure.
int rte_vhost_get_vring_base (int vid, uint16_t queue_id, uint16_t * last_avail_idx, uint16_t * last_used_idx)
Gets the last_avail/used_idx of the vhost virtqueue ๐
vidโ vhost device IDqueue_idโ vhost queue indexlast_avail_idxโ vhostlast_avail_idxto getlast_used_idxโ vhostlast_used_idxto get
Returns 0 on success, -1 on failure.
int rte_vhost_get_vring_base_from_inflight (int vid, uint16_t queue_id, uint16_t * last_avail_idx, uint16_t * last_used_idx)
Gets last_avail/last_used of the vhost virtqueue ๐ This one is designed for the reconnection and it's specific for the packed ring, because we can get those two parameters from the inflight queueregion. Iykyk ๐ซ
vidโ vhost device IDqueue_idโ vhost queue indexlast_avail_idxโ vhostlast_avail_idxto getlast_used_idxโ vhostlast_used_idxto get
Returns 0 on success, -1 on failure.
int rte_vhost_set_vring_base (int vid, uint16_t queue_id, uint16_t last_avail_idx, uint16_t last_used_idx)
Sets the last_avail/used_idx of the vhost virtqueue โ๏ธ The setter to the getter above, we love a matched pair ๐ซถ
vidโ vhost device IDqueue_idโ vhost queue indexlast_avail_idxโlast_avail_idxto setlast_used_idxโlast_used_idxto set
Returns 0 on success, -1 on failure.
int rte_vhost_extern_callback_register (int vid, struct rte_vhost_user_extern_ops const *const ops, void * ctx)
Bestie, this is the โhook me up with external message handling callbacksโ function. It registers external message handling callbacks. Slay.
Parameters
vidโ vhost device IDopsโ virtio external callbacks to registerctxโ additional context passed to the callbacks
Returns
0 on success, -1 on failure. No cap.
struct rte_vdpa_device * rte_vhost_get_vdpa_device (int vid)
Grab the vdpa device id for a vhost device. Itโs giving โfind my vDPA bestie.โ
Parameters
vidโ vhost device id
Returns
vDPA device pointer on success, NULL on failure. ๐ซถ
int rte_vhost_backend_config_change (int vid, bool need_reply)
Notify the guest that it should get virtio configuration space from the backend. Communication era ๐ .
Parameters
vidโ vhost device IDneed_replyโ wait for the frontend response the status of this operation
Returns
0 on success, < 0 on failure.
int rte_vhost_vring_stats_get_names (int vid, uint16_t queue_id, struct rte_vhost_stat_name * name, unsigned int size)
Retrieve names of statistics of a Vhost virtqueue. Iconic little name-collector behavior.
There is an assumption that stat_names and stats arrays are matched by array index: stats_names[i].name => stats[i].value.
Parameters
vidโ vhost device IDqueue_idโ vhost queue indexnameโ array of at leastsizeelements to be filled. If set toNULL, the function returns the required number of elements.sizeโ The number of elements instats_namesarray.
Returns
- Success if greater than
0and lower or equal tosize. The return value indicates the number of elements filled in thenamesarray. - Failure if greater than
size. The return value indicates the number of elements thenamesarray that should be given to succeed. - Failure if lower than
0. The device ID or queue ID is invalid or- statistics collection is not enabled.
int rte_vhost_vring_stats_get (int vid, uint16_t queue_id, struct rte_vhost_stat * stats, unsigned int n)
Retrieve statistics of a Vhost virtqueue. This is the actual stats-haver of the situation.
There is an assumption that stat_names and stats arrays are matched by array index: stats_names[i].name => stats[i].value.
Parameters
vidโ vhost device IDqueue_idโ vhost queue indexstatsโ A pointer to a table of structure of typerte_vhost_statto be filled with virtqueue statistics ids and values.nโ The number of elements instatsarray.
Returns
- Success if greater than
0and lower or equal ton. The return value indicates the number of elements filled in thestatsarray. - Failure if greater than
n. The return value indicates the number of elements thestatsarray that should be given to succeed. - Failure if lower than
0. The device ID or queue ID is invalid, or statistics collection is not enabled.
int rte_vhost_vring_stats_reset (int vid, uint16_t queue_id)
Reset statistics of a Vhost virtqueue. Clean-slate moment, we love a fresh start โจ.
Parameters
vidโ vhost device IDqueue_idโ vhost queue index
Returns
- Success if
0. Statistics have been reset. - Failure if lower than
0. The device ID or queue ID is invalid, or statistics collection is not enabled.
โจ AUTHOR โจ
Generated automatically by Doxygen for DPDK from the source code.
Okay bestie, cute little footer sign-off: this page is from DPDK Version 26.03.0 and itโs rte_vhost.h(3) โ and the date line is whatever Doxygen stamped down there, because thatโs its main character moment. ๐โจ
๐ฆ where this page comes from
- nixos 26.05: dpdk 26.03
- nixpkgs unstable: dpdk 26.03
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms