aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/virtio.h2
-rw-r--r--include/linux/virtio_config.h23
-rw-r--r--include/linux/virtio_ring.h3
3 files changed, 27 insertions, 1 deletions
diff --git a/include/linux/virtio.h b/include/linux/virtio.h
index a1ba8bbd9fbe..533b1157f22e 100644
--- a/include/linux/virtio.h
+++ b/include/linux/virtio.h
@@ -50,6 +50,8 @@ void *virtqueue_detach_unused_buf(struct virtqueue *vq);
50 50
51unsigned int virtqueue_get_vring_size(struct virtqueue *vq); 51unsigned int virtqueue_get_vring_size(struct virtqueue *vq);
52 52
53int virtqueue_get_queue_index(struct virtqueue *vq);
54
53/** 55/**
54 * virtio_device - representation of a device using virtio 56 * virtio_device - representation of a device using virtio
55 * @index: unique position on the virtio bus 57 * @index: unique position on the virtio bus
diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
index fc457f452f64..e2850a7ea276 100644
--- a/include/linux/virtio_config.h
+++ b/include/linux/virtio_config.h
@@ -84,7 +84,9 @@
84 * nvqs: the number of virtqueues to find 84 * nvqs: the number of virtqueues to find
85 * vqs: on success, includes new virtqueues 85 * vqs: on success, includes new virtqueues
86 * callbacks: array of callbacks, for each virtqueue 86 * callbacks: array of callbacks, for each virtqueue
87 * include a NULL entry for vqs that do not need a callback
87 * names: array of virtqueue names (mainly for debugging) 88 * names: array of virtqueue names (mainly for debugging)
89 * include a NULL entry for vqs unused by driver
88 * Returns 0 on success or error status 90 * Returns 0 on success or error status
89 * @del_vqs: free virtqueues found by find_vqs(). 91 * @del_vqs: free virtqueues found by find_vqs().
90 * @get_features: get the array of feature bits for this device. 92 * @get_features: get the array of feature bits for this device.
@@ -98,6 +100,7 @@
98 * vdev: the virtio_device 100 * vdev: the virtio_device
99 * This returns a pointer to the bus name a la pci_name from which 101 * This returns a pointer to the bus name a la pci_name from which
100 * the caller can then copy. 102 * the caller can then copy.
103 * @set_vq_affinity: set the affinity for a virtqueue.
101 */ 104 */
102typedef void vq_callback_t(struct virtqueue *); 105typedef void vq_callback_t(struct virtqueue *);
103struct virtio_config_ops { 106struct virtio_config_ops {
@@ -116,6 +119,7 @@ struct virtio_config_ops {
116 u32 (*get_features)(struct virtio_device *vdev); 119 u32 (*get_features)(struct virtio_device *vdev);
117 void (*finalize_features)(struct virtio_device *vdev); 120 void (*finalize_features)(struct virtio_device *vdev);
118 const char *(*bus_name)(struct virtio_device *vdev); 121 const char *(*bus_name)(struct virtio_device *vdev);
122 int (*set_vq_affinity)(struct virtqueue *vq, int cpu);
119}; 123};
120 124
121/* If driver didn't advertise the feature, it will never appear. */ 125/* If driver didn't advertise the feature, it will never appear. */
@@ -190,5 +194,24 @@ const char *virtio_bus_name(struct virtio_device *vdev)
190 return vdev->config->bus_name(vdev); 194 return vdev->config->bus_name(vdev);
191} 195}
192 196
197/**
198 * virtqueue_set_affinity - setting affinity for a virtqueue
199 * @vq: the virtqueue
200 * @cpu: the cpu no.
201 *
202 * Pay attention the function are best-effort: the affinity hint may not be set
203 * due to config support, irq type and sharing.
204 *
205 */
206static inline
207int virtqueue_set_affinity(struct virtqueue *vq, int cpu)
208{
209 struct virtio_device *vdev = vq->vdev;
210 if (vdev->config->set_vq_affinity)
211 return vdev->config->set_vq_affinity(vq, cpu);
212 return 0;
213}
214
215
193#endif /* __KERNEL__ */ 216#endif /* __KERNEL__ */
194#endif /* _LINUX_VIRTIO_CONFIG_H */ 217#endif /* _LINUX_VIRTIO_CONFIG_H */
diff --git a/include/linux/virtio_ring.h b/include/linux/virtio_ring.h
index e338730c2660..c2d793a06ad7 100644
--- a/include/linux/virtio_ring.h
+++ b/include/linux/virtio_ring.h
@@ -165,7 +165,8 @@ static inline int vring_need_event(__u16 event_idx, __u16 new_idx, __u16 old)
165struct virtio_device; 165struct virtio_device;
166struct virtqueue; 166struct virtqueue;
167 167
168struct virtqueue *vring_new_virtqueue(unsigned int num, 168struct virtqueue *vring_new_virtqueue(unsigned int index,
169 unsigned int num,
169 unsigned int vring_align, 170 unsigned int vring_align,
170 struct virtio_device *vdev, 171 struct virtio_device *vdev,
171 bool weak_barriers, 172 bool weak_barriers,