thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

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

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