From nobody Fri Nov 7 10:27:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547574166993442.06148752916897; Tue, 15 Jan 2019 09:42:46 -0800 (PST) Received: from localhost ([127.0.0.1]:59185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjSjd-0001if-VG for importer@patchew.org; Tue, 15 Jan 2019 12:42:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56127) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjSaq-0002kE-Fu for qemu-devel@nongnu.org; Tue, 15 Jan 2019 12:33:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjSao-0007p8-Mc for qemu-devel@nongnu.org; Tue, 15 Jan 2019 12:33:40 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:53626) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjSao-0007jE-DT for qemu-devel@nongnu.org; Tue, 15 Jan 2019 12:33:38 -0500 Received: by mail-wm1-x343.google.com with SMTP id d15so4159937wmb.3 for ; Tue, 15 Jan 2019 09:33:30 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id n9sm62982018wrx.80.2019.01.15.09.33.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Jan 2019 09:33:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=svxHMm89H++K7kq7zcKWU4xe69K6HIgJULl2pjVcnGI=; b=RMTaDSKJf0YS0nX8sAtRPGP1MgPEl8bkH0MU5tZy83Sq+ievUJT14GzpHsqTKWg8pg JlrH6JwRlxmgsXM/98+ueg3c+kac8QY+zaJ1ydCkJsJJMssC9Oh48oWdyx8aHWX5Kc+C eUjcJkQIN3YjnE6xXyc0hCaZFWJYNqR3a8nBC74/Ph/vkFgUo+Qq+VZWeFlBspAGGXMh KkA9Rog2HYRV5KnPBh1nOT9Wnb+6yG8l7MivrZZL2FjFJ8O62ayRzpPAlXv72xk67zRB ZemqoMqexKb2gNrfLgrC1XnqON+ji4lN/mWTqORp64VA35TrBp0z4ZDqNGtZKCRdOIpM vFUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=svxHMm89H++K7kq7zcKWU4xe69K6HIgJULl2pjVcnGI=; b=bNfy7+dBNrWpuFsllCOZGZ14U5JHY+uBl/OJOPAlVvfXO4t+HJteF2OYt+x0kJD+D1 TuoItCZfRuUFfhUpiRaMZ2WAF+xPYryPthQYvZ+VzwZHDd1XJLtSyjkxYrt7TJZ1z7IA AaOPVCrdJ/vHblvqdUsU5468k2LXIlSO5Y2x0cKJO8DTHaHCVPnLiZSrbtbDgVdq9ouG HGHQcqn5Uio+Hcbe32As6rD05UN7l9U96GpoKWXPWpAGM7dM77JsCwH3G4PL9478EmT/ ScQ+zg/jbGHlQ5bMukeUG5xRXgGt/EpSc6Q8b9Be8jiFd9evEyCqp9+IZiNjjDQh/9mK fSzg== X-Gm-Message-State: AJcUukfSJ9k3JPOl07lBgHFBDRPfi6i2K01iPmyuQ0Yt/vV70jitGTps 1SKsNikikOF73G4AurGVLYq09d8M X-Google-Smtp-Source: ALg8bN4FtrUwxpEriyx49c1e6/gRPjG+f2IXHO/pfPU5yQ5vOLUd7vtdvHvOz7xLes9wNLoBj5z5ng== X-Received: by 2002:a1c:5f8a:: with SMTP id t132mr4375364wmb.40.1547573609007; Tue, 15 Jan 2019 09:33:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 15 Jan 2019 18:33:21 +0100 Message-Id: <1547573605-25711-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1547573605-25711-1-git-send-email-pbonzini@redhat.com> References: <1547573605-25711-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 Subject: [Qemu-devel] [PATCH 1/5] vhost-net: move stubs to a separate file X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: philmd@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) There is no reason for CONFIG_VHOST_NET to be specific to a single target; it is a host feature that can be add to all targets, as long as they support the virtio-net device. Currently CONFIG_VHOST_NET depends on CONFIG_KVM, but ioeventfd support is present in the core memory API and works with other accelerators as well. As a first step, move the vhost-net stubs to a separate file. Later, they will become conditional on CONFIG_VIRTIO_NET, which is not available in .c files. Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-2-git-send-email-pbonzini@redhat.com> --- hw/net/Makefile.objs | 4 ++- hw/net/vhost_net-stub.c | 92 +++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/net/vhost_net.c | 74 --------------------------------------- 3 files changed, 95 insertions(+), 75 deletions(-) create mode 100644 hw/net/vhost_net-stub.c diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs index fa461d4..c2705e6 100644 --- a/hw/net/Makefile.objs +++ b/hw/net/Makefile.objs @@ -37,7 +37,9 @@ obj-$(CONFIG_PSERIES) +=3D spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) +=3D xilinx_ethlite.o =20 obj-$(CONFIG_VIRTIO_NET) +=3D virtio-net.o -obj-y +=3D vhost_net.o +obj-$(CONFIG_VHOST_NET) +=3D vhost_net.o +common-obj-$(call lnot,$(CONFIG_VHOST_NET)) +=3D vhost_net-stub.o +common-obj-$(CONFIG_ALL) +=3D vhost_net-stub.o =20 obj-$(CONFIG_ETSEC) +=3D fsl_etsec/etsec.o fsl_etsec/registers.o \ fsl_etsec/rings.o fsl_etsec/miim.o diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c new file mode 100644 index 0000000..aac0e98 --- /dev/null +++ b/hw/net/vhost_net-stub.c @@ -0,0 +1,92 @@ +/* + * vhost-net support + * + * Copyright Red Hat, Inc. 2010 + * + * Authors: + * Michael S. Tsirkin + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "net/net.h" +#include "net/tap.h" +#include "net/vhost-user.h" + +#include "hw/virtio/virtio-net.h" +#include "net/vhost_net.h" +#include "qemu/error-report.h" + + +uint64_t vhost_net_get_max_queues(VHostNetState *net) +{ + return 1; +} + +struct vhost_net *vhost_net_init(VhostNetOptions *options) +{ + error_report("vhost-net support is not compiled in"); + return NULL; +} + +int vhost_net_start(VirtIODevice *dev, + NetClientState *ncs, + int total_queues) +{ + return -ENOSYS; +} +void vhost_net_stop(VirtIODevice *dev, + NetClientState *ncs, + int total_queues) +{ +} + +void vhost_net_cleanup(struct vhost_net *net) +{ +} + +uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) +{ + return features; +} + +void vhost_net_ack_features(struct vhost_net *net, uint64_t features) +{ +} + +uint64_t vhost_net_get_acked_features(VHostNetState *net) +{ + return 0; +} + +bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) +{ + return false; +} + +void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, + int idx, bool mask) +{ +} + +int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr) +{ + return -1; +} + +VHostNetState *get_vhost_net(NetClientState *nc) +{ + return 0; +} + +int vhost_set_vring_enable(NetClientState *nc, int enable) +{ + return 0; +} + +int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu) +{ + return 0; +} diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e037db6..b901306 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -23,7 +23,6 @@ #include "qemu/error-report.h" =20 =20 -#ifdef CONFIG_VHOST_NET #include #include #include @@ -449,76 +448,3 @@ int vhost_net_set_mtu(struct vhost_net *net, uint16_t = mtu) =20 return vhost_ops->vhost_net_set_mtu(&net->dev, mtu); } - -#else -uint64_t vhost_net_get_max_queues(VHostNetState *net) -{ - return 1; -} - -struct vhost_net *vhost_net_init(VhostNetOptions *options) -{ - error_report("vhost-net support is not compiled in"); - return NULL; -} - -int vhost_net_start(VirtIODevice *dev, - NetClientState *ncs, - int total_queues) -{ - return -ENOSYS; -} -void vhost_net_stop(VirtIODevice *dev, - NetClientState *ncs, - int total_queues) -{ -} - -void vhost_net_cleanup(struct vhost_net *net) -{ -} - -uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) -{ - return features; -} - -void vhost_net_ack_features(struct vhost_net *net, uint64_t features) -{ -} - -uint64_t vhost_net_get_acked_features(VHostNetState *net) -{ - return 0; -} - -bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) -{ - return false; -} - -void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, - int idx, bool mask) -{ -} - -int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr) -{ - return -1; -} - -VHostNetState *get_vhost_net(NetClientState *nc) -{ - return 0; -} - -int vhost_set_vring_enable(NetClientState *nc, int enable) -{ - return 0; -} - -int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu) -{ - return 0; -} -#endif --=20 1.8.3.1