int (*new_connection)(int vid);
void (*destroy_connection)(int vid);
- void *reserved[2]; /**< Reserved for future extension */
+ /**
+ * This callback gets called each time a guest gets notified
+ * about waiting packets. This is the interrupt handling trough
+ * the eventfd_write(callfd), which can be used for counting these
+ * "slow" syscalls.
+ */
+ void (*guest_notified)(int vid);
+
+ void *reserved[1]; /**< Reserved for future extension */
};
/**
if ((vhost_need_event(vhost_used_event(vq), new, old) &&
(vq->callfd >= 0)) ||
- unlikely(!signalled_used_valid))
+ unlikely(!signalled_used_valid)) {
eventfd_write(vq->callfd, (eventfd_t) 1);
+ if (dev->notify_ops->guest_notified)
+ dev->notify_ops->guest_notified(dev->vid);
+ }
} else {
/* Kick the guest if necessary. */
if (!(vq->avail->flags & VRING_AVAIL_F_NO_INTERRUPT)
- && (vq->callfd >= 0))
+ && (vq->callfd >= 0)) {
eventfd_write(vq->callfd, (eventfd_t)1);
+ if (dev->notify_ops->guest_notified)
+ dev->notify_ops->guest_notified(dev->vid);
+ }
}
}
if (vhost_need_event(off, new, old))
kick = true;
kick:
- if (kick)
+ if (kick) {
eventfd_write(vq->callfd, (eventfd_t)1);
+ if (dev->notify_ops->guest_notified)
+ dev->notify_ops->guest_notified(dev->vid);
+ }
}
static __rte_always_inline void