From nobody Mon Feb 9 17:06:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543238774368872.309841998843; Mon, 26 Nov 2018 05:26:14 -0800 (PST) Received: from localhost ([::1]:35934 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRGto-00019y-0Y for importer@patchew.org; Mon, 26 Nov 2018 08:26:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gRGom-00051i-S8 for qemu-devel@nongnu.org; Mon, 26 Nov 2018 08:20:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gRGoi-0007qt-7i for qemu-devel@nongnu.org; Mon, 26 Nov 2018 08:20:52 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35531) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gRGoi-0007os-1B for qemu-devel@nongnu.org; Mon, 26 Nov 2018 08:20:48 -0500 Received: by mail-wm1-x341.google.com with SMTP id c126so18362517wmh.0 for ; Mon, 26 Nov 2018 05:20:47 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id i16sm951672wmd.28.2018.11.26.05.20.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Nov 2018 05:20:46 -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; bh=to5wQOuVoDFPRFzqVg8bHDRI7dOPuy4M29WMpXFCtbk=; b=PbRspZmjDU69P3RT2VirNvhTEjxwWyY8Gr3secpsdmBmuCfN3n7uOJPvHiHI5O2uLD 5F3wMaNnh5z0RRuJmHT3g6cB9mLa3S2zq+Ds5fhXcMR/lIxAuKJ7/Wa3PTKrba6zNQAR 67XQwTAhSTjZ8mn4YW1ikfljTGQd5eHx5I/23+iIiAjWiHXGRwQdF+7HfXgn9BQOk+IM KmnGebRbNmSbKSkfs7+8NPxzCJWSvsLnXA57gc+a30jUEgmMmSPjifUM7Jul+r1TSKta apzDO0exTomgfxjVnfKkpleyLU373xL1ypwffwUr/Kv163wggqxFZkreN0izo5xMhiYH 1hDQ== 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; bh=to5wQOuVoDFPRFzqVg8bHDRI7dOPuy4M29WMpXFCtbk=; b=Q5ZQHM/H77Ain5jWMoZnHdO3RkIWd70Lt0vquUOJ8xcQ+HAmB8lkIvBs6G+zSrwP+2 hwPGPenNLdKUSkH39DCrNVWYOzGcmGcH0hsHUj+enqr2/tG443KmsG/8Hjtva4beB8U3 M/2/h2Rx8RlYyxsWWHwMlhUwS/LQUcaNk/3zo7J6IXZeeyx/8V4L0+oNOxFDx0VS5j0f YcipZh8hpxQaRzaFC80VbuW0+FIJPROXM32h4MdzFOCK1LDsHehdxJcbs3A83GVgsh7m JDtSkEgMSKnzZjvoTBpyIo3HaYHaSoVZnEnUwEbK9dFWmX+KLqeFhnK00RtFNG3DIOfi vGxQ== X-Gm-Message-State: AGRZ1gJ0qbAMMRiWrmQE1shYW0TOztwf3Y6o+WBfuxdT1ZFyvrHHLfb8 WNL68Gv2WkjKQJ1e75hIkP1dBgZl X-Google-Smtp-Source: AFSGD/VC2eQ4PswtTSb74OVOD0e91WeK6MrsIRd7k38BTln7jT3J2njTbvOZpGbTUSCXP/q88ey3lQ== X-Received: by 2002:a1c:5448:: with SMTP id p8mr24150668wmi.124.1543238446599; Mon, 26 Nov 2018 05:20:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 26 Nov 2018 14:20:39 +0100 Message-Id: <1543238443-4993-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1543238443-4993-1-git-send-email-pbonzini@redhat.com> References: <1543238443-4993-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. Signed-off-by: Paolo Bonzini --- hw/net/Makefile.objs | 4 ++- hw/net/vhost_net-stub.c | 95 +++++++++++++++++++++++++++++++++++++++++++++= ++++ hw/net/vhost_net.c | 74 -------------------------------------- 3 files changed, 98 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..4de1dfb --- /dev/null +++ b/hw/net/vhost_net-stub.c @@ -0,0 +1,95 @@ +/* + * 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. See + * the COPYING file in the top-level directory. + * + * Contributions after 2012-01-13 are licensed under the terms of the + * GNU GPL, version 2 or (at your option) any later version. + */ + +#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