thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

Blame SOURCES/kvm-vhost-net-vdpa-add-stubs-for-when-no-virtio-net-devi.patch

29b115
From a9095850da8dd4ea3fdb725cb7f79118144e22fa Mon Sep 17 00:00:00 2001
29b115
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
29b115
Date: Thu, 21 Jul 2022 15:39:27 +0200
29b115
Subject: [PATCH 22/32] vhost-net-vdpa: add stubs for when no virtio-net device
29b115
 is present
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Eugenio Pérez <eperezma@redhat.com>
29b115
RH-MergeRequest: 108: Net Control Virtqueue shadow Support
29b115
RH-Commit: [22/27] a2b25a805bb06094a5fab27ce8f82bee12a9fcb5 (eperezmartin/qemu-kvm)
29b115
RH-Bugzilla: 1939363
29b115
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
29b115
RH-Acked-by: Cindy Lu <lulu@redhat.com>
29b115
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
29b115
29b115
Bugzilla: https://bugzilla.redhat.com/1939363
29b115
29b115
Upstream Status: git://git.qemu.org/qemu.git
29b115
29b115
commit 94c643732dc110d04bbdf0eb43c41bce23b3593e
29b115
Author: Eugenio Pérez <eperezma@redhat.com>
29b115
Date:   Wed Jul 20 08:59:41 2022 +0200
29b115
29b115
    vhost-net-vdpa: add stubs for when no virtio-net device is present
29b115
29b115
    net/vhost-vdpa.c will need functions that are declared in
29b115
    vhost-shadow-virtqueue.c, that needs functions of virtio-net.c.
29b115
29b115
    Copy the vhost-vdpa-stub.c code so
29b115
    only the constructor net_init_vhost_vdpa needs to be defined.
29b115
29b115
    Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
29b115
    Signed-off-by: Jason Wang <jasowang@redhat.com>
29b115
29b115
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
29b115
---
29b115
 net/meson.build       |  3 ++-
29b115
 net/vhost-vdpa-stub.c | 21 +++++++++++++++++++++
29b115
 2 files changed, 23 insertions(+), 1 deletion(-)
29b115
 create mode 100644 net/vhost-vdpa-stub.c
29b115
29b115
diff --git a/net/meson.build b/net/meson.build
29b115
index c965e83b26..116a9e7cbb 100644
29b115
--- a/net/meson.build
29b115
+++ b/net/meson.build
29b115
@@ -41,7 +41,8 @@ endif
29b115
 softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_posix))
29b115
 softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c'))
29b115
 if have_vhost_net_vdpa
29b115
-  softmmu_ss.add(files('vhost-vdpa.c'))
29b115
+  softmmu_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-vdpa.c'), if_false: files('vhost-vdpa-stub.c'))
29b115
+  softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-vdpa-stub.c'))
29b115
 endif
29b115
 
29b115
 subdir('can')
29b115
diff --git a/net/vhost-vdpa-stub.c b/net/vhost-vdpa-stub.c
29b115
new file mode 100644
29b115
index 0000000000..1732ed2443
29b115
--- /dev/null
29b115
+++ b/net/vhost-vdpa-stub.c
29b115
@@ -0,0 +1,21 @@
29b115
+/*
29b115
+ * vhost-vdpa-stub.c
29b115
+ *
29b115
+ * Copyright (c) 2022 Red Hat, Inc.
29b115
+ *
29b115
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
29b115
+ * See the COPYING file in the top-level directory.
29b115
+ *
29b115
+ */
29b115
+
29b115
+#include "qemu/osdep.h"
29b115
+#include "clients.h"
29b115
+#include "net/vhost-vdpa.h"
29b115
+#include "qapi/error.h"
29b115
+
29b115
+int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
29b115
+                        NetClientState *peer, Error **errp)
29b115
+{
29b115
+    error_setg(errp, "vhost-vdpa requires frontend driver virtio-net-*");
29b115
+    return -1;
29b115
+}
29b115
-- 
29b115
2.31.1
29b115