diff options
Diffstat (limited to 'include/linux/virtio_config.h')
| -rw-r--r-- | include/linux/virtio_config.h | 23 |
1 files changed, 23 insertions, 0 deletions
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 | */ |
| 102 | typedef void vq_callback_t(struct virtqueue *); | 105 | typedef void vq_callback_t(struct virtqueue *); |
| 103 | struct virtio_config_ops { | 106 | struct 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 | */ | ||
| 206 | static inline | ||
| 207 | int 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 */ |
