summaryrefslogtreecommitdiffstats
path: root/sys/dev/virtio/virtqueue.h
diff options
context:
space:
mode:
authorbryanv <bryanv@FreeBSD.org>2013-09-01 04:16:43 +0000
committerbryanv <bryanv@FreeBSD.org>2013-09-01 04:16:43 +0000
commitf175a1e7f9ee74ccf0005d916bdd3fc622355974 (patch)
tree04428f70dac94ec59e4e25ed5c69c4687625024c /sys/dev/virtio/virtqueue.h
parentee4b8e07a829f3d8f11cf458601290079e0ed62f (diff)
downloadFreeBSD-src-f175a1e7f9ee74ccf0005d916bdd3fc622355974.zip
FreeBSD-src-f175a1e7f9ee74ccf0005d916bdd3fc622355974.tar.gz
Add support for postponing VirtIO virtqueue interrupts
Partial support for the EVENT_IDX feature was added a while ago, but this commit adds an interface for the device driver to hint how long (in terms of descriptors) the next interrupt should be delayed. The first user of this will be used to reduce VirtIO net's Tx completion interrupts.
Diffstat (limited to 'sys/dev/virtio/virtqueue.h')
-rw-r--r--sys/dev/virtio/virtqueue.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/dev/virtio/virtqueue.h b/sys/dev/virtio/virtqueue.h
index 128a10a..0d4ed94 100644
--- a/sys/dev/virtio/virtqueue.h
+++ b/sys/dev/virtio/virtqueue.h
@@ -41,6 +41,16 @@ struct sglist;
/* Device callback for a virtqueue interrupt. */
typedef void virtqueue_intr_t(void *);
+/*
+ * Hint on how long the next interrupt should be postponed. This is
+ * only used when the EVENT_IDX feature is negotiated.
+ */
+typedef enum {
+ VQ_POSTPONE_SHORT,
+ VQ_POSTPONE_LONG,
+ VQ_POSTPONE_EMPTIED /* Until all available desc are used. */
+} vq_postpone_t;
+
#define VIRTQUEUE_MAX_NAME_SZ 32
/* One for each virtqueue the device wishes to allocate. */
@@ -73,7 +83,7 @@ int virtqueue_reinit(struct virtqueue *vq, uint16_t size);
int virtqueue_intr_filter(struct virtqueue *vq);
void virtqueue_intr(struct virtqueue *vq);
int virtqueue_enable_intr(struct virtqueue *vq);
-int virtqueue_postpone_intr(struct virtqueue *vq);
+int virtqueue_postpone_intr(struct virtqueue *vq, vq_postpone_t hint);
void virtqueue_disable_intr(struct virtqueue *vq);
/* Get physical address of the virtqueue ring. */
OpenPOWER on IntegriCloud