aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2020-04-19 23:51:02 +0200
committerHauke Mehrtens <hauke@hauke-m.de>2020-04-21 22:15:13 +0200
commit43111b9715e8a56d4372efc4bdc677cbf3336df6 (patch)
tree9b014792e33ab9ca5320d919962c21f1106de188
parentc8673347371956c6986a2898e10dfb567f0685ad (diff)
downloadbackports-43111b9715e8a56d4372efc4bdc677cbf3336df6.tar.gz
backports: virtio_config: Add virtio_find_vqs()
The virtio_find_vqs() function is now used by the mac80211_hwsim driver. This is just a wrapper around the find_vqs callback. The find_vqs callback changed over the time. With kernel 4.10 the names parameter was changed from "const char *names[]" to "const char * const names[]". With kernel 4.11 the "struct irq_affinity *desc" was added. We have to define struct irq_affinity here for older kernel versions, because it is used in this new parameter in kernel >= 4.12 this is already done in the upstream header file. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/virtio_config.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/backport/backport-include/linux/virtio_config.h b/backport/backport-include/linux/virtio_config.h
new file mode 100644
index 00000000..aeb1ba10
--- /dev/null
+++ b/backport/backport-include/linux/virtio_config.h
@@ -0,0 +1,31 @@
+#ifndef _COMPAT_LINUX_VIRTIO_CONFIG_H
+#define _COMPAT_LINUX_VIRTIO_CONFIG_H
+#include_next <linux/virtio_config.h>
+
+#include <linux/version.h>
+
+#if LINUX_VERSION_IS_LESS(4,11,0)
+struct irq_affinity;
+#endif
+
+#if LINUX_VERSION_IS_LESS(4,12,0)
+static inline
+int virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
+ struct virtqueue *vqs[], vq_callback_t *callbacks[],
+#if LINUX_VERSION_IS_LESS(4,10,0)
+ const char * const names[],
+#else
+ const char *names[],
+#endif
+ struct irq_affinity *desc)
+{
+#if LINUX_VERSION_IS_LESS(4,11,0)
+ return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names);
+#else
+ return vdev->config->find_vqs(vdev, nvqs, vqs, callbacks, names, desc);
+#endif
+}
+#endif /* < 4.12 */
+
+
+#endif /* _COMPAT_LINUX_VIRTIO_CONFIG_H */