rte_vhost_device_ops(3)
π¦ rte_vhost_device_ops(3) β the vhost device ops struct, explained bestie
Okay so real talk, this is the rte_vhost_device_ops struct from the DPDK library manual, and it's literally the whole personality of your vhost device π
β¨ NAME β¨
rte_vhost_device_ops β no cap, that's the name, that's the vibe πΈ
π SYNOPSIS π
#include <rte_vhost.h>
π Data Fields
So here's the squad β all six function pointers, exactly as they live in the struct:
int(* new_device )(int vid)void(* destroy_device )(int vid)int(* vring_state_changed )(int vid, uint16_t queue_id, int enable)int(* features_changed )(int vid, uint64_t features)void(* guest_notified )(int vid)bool(* guest_notify )(int vid, uint16_t queue_id)
π Detailed Description π
Device and vring operations. That's it, that's the whole thing β this struct is the collection of callbacks your app gets to hook into for device + vring events π
Fr fr, the definition lives at line 277 of file rte_vhost.h β go look, it's right there π«Ά
π Field Documentation π
π int(* new_device) (int vid)
Add device. New device just dropped, tell the app π₯
Definition at line 278 of file rte_vhost.h.
π void(* destroy_device) (int vid)
Remove device. Device said bye, tell the app π€
Definition at line 279 of file rte_vhost.h.
β¨ int(* vring_state_changed) (int vid, uint16_t queue_id, int enable)
Triggered when a vring is enabled or disabled. Like a little status ping for your virtqueue, iykyk π
Definition at line 281 of file rte_vhost.h.
π§ int(* features_changed) (int vid, uint64_t features)
Features could be changed after the feature negotiation. For example, VHOST_F_LOG_ALL will be set/cleared at the start/end of live migration, respectively. This callback is used to inform the application on such change.
So yeah β feature negotiation finishes, and then stuff can still shift under you. VHOST_F_LOG_ALL gets set at the start of live migration and cleared at the end (respectively, bestie, pay attention to the order π). This callback is literally how the app finds out about it.
Definition at line 289 of file rte_vhost.h.
π void(* guest_notified) (int vid)
This callback gets called each time a guest gets notified about waiting packets. This is the interrupt handling through the eventfd_write(callfd), which can be used for counting these "slow" syscalls.
Translation: every single guest notification about waiting packets = one callback, and behind it is an interrupt handled via eventfd_write(callfd). Those are the "slow" syscalls, and this hook is where you can count them π
Definition at line 300 of file rte_vhost.h.
π bool(* guest_notify) (int vid, uint16_t queue_id)
If this callback is registered, notification to the guest can be handled by the front-end calling rte_vhost_notify_guest(). If it's not handled, 'false' should be returned. This can be used to remove the "slow" eventfd_write() syscall from the datapath.
So like β register it and the front-end can handle guest notification itself by calling rte_vhost_notify_guest(). If you don't handle it, return 'false', periodt. The whole point? Yeeting that "slow" eventfd_write() syscall right out of the datapath π₯
Definition at line 308 of file rte_vhost.h.
π Author π
Generated automatically by Doxygen for DPDK from the source code. Not a human, just Doxygen doing its little automagic thing π€β¨
That's the whole page, bestie β every field, every line number, every syscall, nothing skipped π
Okay bye, this was rte_vhost_device_ops(3) from DPDK, Version 26.03.0 β dated with that rte_vhost_device_ops(3) footer energy. Go slay your vhost callbacks π¦π
π¦ 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