From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940690; cv=none; d=zohomail.com; s=zohoarc; b=H6Jv9xoIr1I67CzZGWFSqXacuojkjuevXFoRO6vFT0dXkz7i0ud3LwEersm5PAwc5zSBz5SRhBxGDo6xcf2uix9b7xLkl5P1Hp45p3EZgbwRqEMxUsTCN+IOLykir7uC5coKLmnIm/hN8rX+eDd0HIWZHQ359i+srVGOJFuvkFo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940690; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QqPxIjNblMrQIu0xDYDaDYdDXYQeUE40f8Xt34tguDI=; b=SifCFaoZBobMN2WDd/cogAN1IzOwwumvB6u5CT/vcamQo9evs31CdyOzoWtX1g5Lq8N4zdj8gm2QL/BB2bGLK+LkhqYfnzclAifH4W72D1vD/5c944KK8wcQrf1oJxiNTb08KS1b/DZXwI196RAzvZnQCjZd2jHgSt2yaFbKyuk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623940690450345.369776226426; Thu, 17 Jun 2021 07:38:10 -0700 (PDT) Received: from localhost ([::1]:52300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt9l-0004GX-EU for importer@patchew.org; Thu, 17 Jun 2021 10:38:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5a-0004EN-Vc for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:54 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]:46008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5N-0001LL-FI for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:49 -0400 Received: by mail-lf1-x133.google.com with SMTP id a1so10677792lfr.12 for ; Thu, 17 Jun 2021 07:33:36 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QqPxIjNblMrQIu0xDYDaDYdDXYQeUE40f8Xt34tguDI=; b=GF0U98IiSNtjJ+ttiEDzslfu2GvAntN81s5+ckT3wYAUlZUwE6yHoFqpbOaeonjx5g M1u2oR9Q75VM8Ao8+KkL0e6F8195Y+c+O6sJ/EKp6lcaa157B2EayFDbpWMbeohL771R vB4NYaok1A47eqU15bpnhYc3WTc9LKZ92RYyW8RDOYqLuwui7JNDXpWTWzBCrOjgbvnz IlpKrrJy1vhxLuEgBTRAupEE5OZypXufUQzg+NHXZ1WXOVgI/ex45B7x7TeZLAyB/fT4 IfuDeyj/UqekqOYEMy4+vdHN1ajHpamRBzefYncjmS0qgedOYHd1N86s43TrjmegxsQN IX0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QqPxIjNblMrQIu0xDYDaDYdDXYQeUE40f8Xt34tguDI=; b=rNLsmODykY55ZOuzy0gYm0wvzSNQTDwpivTaXSHFOLQojfWFS0XqFfHvt+dhalkeQm yswwnhkI0iVWewiKIfgGgfNl8fmUBXprGxzMD21cM1sY/9w04OyhHmmXbQ5UeSlnbbpD yLDyxLuuDpEJA3u6DEbWCRKboZk382KXKkoJdCO9OxqcbUahkfDFfCIibfUDwp9vR+86 ZbrkpnL11/nttY54gRGL7sPeNUg932mauywSdjyoN7+wvrl2subItfsc3QjvbdaXydl0 ORFiQkuSC1E3XDMM7E+QNpqkMWE9Uty0ZdNP/Ty2XRMFaCysTH7gIHSE/wyGVHU1JRPR t9CQ== X-Gm-Message-State: AOAM5335Xb09JI3ohesHzCr/P/xGeBIenXHM+ei4jPjcZsFugkRw8pRJ dvRiFkdA127O+FkLvcsdr80iMPhosfxipNRy X-Google-Smtp-Source: ABdhPJxRO8d/oJR3tqKmwLao8CbQCufDJVKuX/LNHIRZERchNSG3iPxGhd4CM7YOtlcDG7enzZEX1A== X-Received: by 2002:a05:6512:3483:: with SMTP id v3mr4363408lfr.154.1623940414276; Thu, 17 Jun 2021 07:33:34 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 1/7] net/vmnet: dependencies setup, initial preparations Date: Thu, 17 Jun 2021 17:32:40 +0300 Message-Id: <20210617143246.55336-2-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Add 'vmnet' customizable option and 'vmnet.framework' probe into configure; Create source files for network client driver, update meson.build; Add 'vmnet' into qapi::net::NetClientDriver options list. Signed-off-by: Vladislav Yaroshchuk --- configure | 31 +++++++++++++++++++++++++++++++ meson.build | 5 +++++ net/clients.h | 4 ++++ net/meson.build | 1 + net/net.c | 6 ++++++ net/vmnet.c | 22 ++++++++++++++++++++++ qapi/net.json | 3 ++- 7 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 net/vmnet.c diff --git a/configure b/configure index 8dcb9965b2..cdc171988b 100755 --- a/configure +++ b/configure @@ -307,6 +307,7 @@ mpath=3D"auto" vnc=3D"enabled" sparse=3D"auto" vde=3D"$default_feature" +vmnet=3D"auto" vnc_sasl=3D"auto" vnc_jpeg=3D"auto" vnc_png=3D"auto" @@ -1059,6 +1060,10 @@ for opt do ;; --enable-vde) vde=3D"yes" ;; + --disable-vmnet) vmnet=3D"no" + ;; + --enable-vmnet) vmnet=3D"yes" + ;; --disable-netmap) netmap=3D"no" ;; --enable-netmap) netmap=3D"yes" @@ -1871,6 +1876,7 @@ disabled with --disable-FEATURE, default is enabled i= f available rdma Enable RDMA-based migration pvrdma Enable PVRDMA support vde support for vde network + vmnet vmnet.framework support (macOS) netmap support for netmap network linux-aio Linux AIO support linux-io-uring Linux io_uring support @@ -3157,6 +3163,28 @@ EOF fi fi =20 +########################################## +# vmnet.framework probe +if test "$vmnet" !=3D "no" ; then + vmnet_flags=3D"-framework vmnet" + cat > $TMPC << EOF +#include +int main(void) +{ + (void) vmnet_allocate_mac_address_key; + return 0; +} +EOF + if compile_prog "" "$vmnet_flags" ; then + vmnet=3Dyes + else + if test "$vmnet" =3D "yes" ; then + feature_not_found "vmnet" "'vmnet.framework' in unsupported in this = build" + fi + vmnet=3Dno + fi +fi + ########################################## # netmap support probe # Apart from looking for netmap headers, we make sure that the host API ve= rsion @@ -5559,6 +5587,9 @@ if test "$vde" =3D "yes" ; then echo "CONFIG_VDE=3Dy" >> $config_host_mak echo "VDE_LIBS=3D$vde_libs" >> $config_host_mak fi +if test "$vmnet" =3D "yes" ; then + echo "CONFIG_VMNET=3Dy" >> $config_host_mak +fi if test "$netmap" =3D "yes" ; then echo "CONFIG_NETMAP=3Dy" >> $config_host_mak fi diff --git a/meson.build b/meson.build index a2311eda6e..df254522af 100644 --- a/meson.build +++ b/meson.build @@ -173,6 +173,7 @@ iokit =3D [] emulator_link_args =3D [] nvmm =3Dnot_found hvf =3D not_found +vmnet =3D not_found if targetos =3D=3D 'windows' socket =3D cc.find_library('ws2_32') winmm =3D cc.find_library('winmm') @@ -184,6 +185,9 @@ if targetos =3D=3D 'windows' elif targetos =3D=3D 'darwin' coref =3D dependency('appleframeworks', modules: 'CoreFoundation') iokit =3D dependency('appleframeworks', modules: 'IOKit') + if config_host.has_key('CONFIG_VMNET') + vmnet =3D dependency('appleframeworks', modules: 'vmnet') + endif elif targetos =3D=3D 'sunos' socket =3D [cc.find_library('socket'), cc.find_library('nsl'), @@ -2522,6 +2526,7 @@ summary_info +=3D {'vhost-user support': config_host.= has_key('CONFIG_VHOST_USER')} summary_info +=3D {'vhost-user-blk server support': have_vhost_user_blk_se= rver} summary_info +=3D {'vhost-user-fs support': config_host.has_key('CONFIG_VH= OST_USER_FS')} summary_info +=3D {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST= _VDPA')} +summary_info +=3D {'vmnet support': vmnet.found()} summary_info +=3D {'build guest agent': config_host.has_key('CONFIG_GUEST_= AGENT')} summary(summary_info, bool_yn: true, section: 'Configurable features') =20 diff --git a/net/clients.h b/net/clients.h index 92f9b59aed..ac19843aab 100644 --- a/net/clients.h +++ b/net/clients.h @@ -63,4 +63,8 @@ int net_init_vhost_user(const Netdev *netdev, const char = *name, =20 int net_init_vhost_vdpa(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp); +#ifdef CONFIG_VMNET +int net_init_vmnet(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp); +#endif #endif /* QEMU_NET_CLIENTS_H */ diff --git a/net/meson.build b/net/meson.build index 1076b0a7ab..196cf321a2 100644 --- a/net/meson.build +++ b/net/meson.build @@ -38,4 +38,5 @@ softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_p= osix)) softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c')) softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c= ')) =20 +softmmu_ss.add(when: ['CONFIG_VMNET', vmnet], if_true: files('vmnet.c')) subdir('can') diff --git a/net/net.c b/net/net.c index 76bbb7c31b..645c52ef6e 100644 --- a/net/net.c +++ b/net/net.c @@ -1001,6 +1001,9 @@ static int (* const net_client_init_fun[NET_CLIENT_DR= IVER__MAX])( #ifdef CONFIG_L2TPV3 [NET_CLIENT_DRIVER_L2TPV3] =3D net_init_l2tpv3, #endif +#ifdef CONFIG_VMNET + [NET_CLIENT_DRIVER_VMNET] =3D net_init_vmnet, +#endif }; =20 =20 @@ -1086,6 +1089,9 @@ void show_netdevs(void) #endif #ifdef CONFIG_VHOST_VDPA "vhost-vdpa", +#endif +#ifdef CONFIG_VMNET + "vmnet", #endif }; =20 diff --git a/net/vmnet.c b/net/vmnet.c new file mode 100644 index 0000000000..f8b64e2a27 --- /dev/null +++ b/net/vmnet.c @@ -0,0 +1,22 @@ +/* + * vmnet.c - network client wrapper for Apple vmnet.framework + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + +int net_init_vmnet(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) { + error_setg(errp, "vmnet is not implemented yet"); + return -1; +} diff --git a/qapi/net.json b/qapi/net.json index 7fab2e7cd8..c5de234e2c 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -460,10 +460,11 @@ # Since: 2.7 # # @vhost-vdpa since 5.1 +# @vmnet since 6.1 ## { 'enum': 'NetClientDriver', 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', - 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa' ] } + 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa', 'vm= net' ] } =20 ## # @Netdev: --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940552; cv=none; d=zohomail.com; s=zohoarc; b=Pz6HsRcJ/zmi4Gm3itPpsYaiys/j8Dkkbkz4HuqEB7uUCmXZDxdEZz4Yv8Apji7LhicyYSATBttJ5LBhEyW+NQRvprotAMrmXeQ30QoyjH9iAa8woSVfkMiDUEuF+w0OJl+ugsaFGo+OFA0Vr/tQhR+o3IIbVvNmh7pSm/YUKbI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940552; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RnZNig+HPYwjDLIZM8d7KTBP8pyS6/2dSByH2E+4cpE=; b=PaIXhLrj7WqZaQnP7w14srhKfc7YBpXwd4VVvqWJNEbsU8OTRIhK+9pkhwvIjeXy6k/7c1ZP7npmzhXUnAdnGC6I6C9BLeN4nwTzoclViL7ZffHGLposNWew9zQup0pat+WPSvUhkCHEntlAcXqOOjFbM8Wbyo1gEnzDFbRSu+w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16239405525173.0346611899138907; Thu, 17 Jun 2021 07:35:52 -0700 (PDT) Received: from localhost ([::1]:43780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt7X-0006rj-Au for importer@patchew.org; Thu, 17 Jun 2021 10:35:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5Q-0004Aj-1j for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:40 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]:46726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5N-0001M5-2S for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:39 -0400 Received: by mail-lf1-x136.google.com with SMTP id m21so10854743lfg.13 for ; Thu, 17 Jun 2021 07:33:36 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RnZNig+HPYwjDLIZM8d7KTBP8pyS6/2dSByH2E+4cpE=; b=Wd48rUV/P9HHJTNKw1lBKQXExQN5p1XzlGq9AueG8iZ/OLqHVSjwbaVVWoHGF4e+KK g8qWrJZlSazm7qrpe74lruQkj6pLMG58hb6ZLgxnSaX5K1e6P9FSW6XZ/qQLPQm+u3ST lVHVjlL4ZkIB9KJmO5/MFPSBoFXLSbQGJRI4dtjmEp4fN8DioeVhK8Nh2CWXAr0Y4jJs uJBb5vKW5vZ7/ZbY3fzrcIOgcnySUymvwJHXmv1fwNwT3XkKk4FhZiSEhunh8o7GiFTJ 9jiYyaN3Fui731GNu1H7WFDeOi3ozn7/tMNhlCTM8sgtdGZK+B6LuNMn0iu06zdVClpD hdvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RnZNig+HPYwjDLIZM8d7KTBP8pyS6/2dSByH2E+4cpE=; b=LXAfyoze19TO2aVRUBmHGUtZaC8VOvhL2FYZpkdSh8O42UihyE17t8GUJ75kdrdMXh kQKJm2DUcy3gJcNHWQjyxXtt6MEMp/BkljiHvvLIn7Eo/gf2gIBPanAUJrn2tgZ66ChT PpL7HOpQjDE/yLKJzPP9XA0pKcE62pmWgFxCxmpYRx9bmPUlKNwtz4fRHfvbB7G8uENz t856ojl9EW8N5dhJ7U0lbRxAqKjV7kqSuURA1HVmt13IgN+r8XmABY4YP106Eflnn+Mr RqMo3gUOZRNv7MwY+oX/Mt20SByAfcqIhURQUXqykh66vgi2hoKzI5kSiG3f/DypFqac ftqA== X-Gm-Message-State: AOAM533myAqJ8tpzUeNX4gznasA2/PKq9snvU32U4AXKKcFA0HfZcsHy fU81pXVCIVnSCk8Zv7zxtp0yEjmtEKLP1JhM X-Google-Smtp-Source: ABdhPJwnK2YP1JtIccgY1ci8qnVgV+FMX40AQM/jbPefhy1EmqTPNSLxDzFH3HFFma32S8SQ/DAUYA== X-Received: by 2002:a05:6512:239f:: with SMTP id c31mr4290334lfv.233.1623940415083; Thu, 17 Jun 2021 07:33:35 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 2/7] net/vmnet: add new netdevs to qapi/net Date: Thu, 17 Jun 2021 17:32:41 +0300 Message-Id: <20210617143246.55336-3-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lf1-x136.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Created separate netdev per each vmnet operating mode because they use quite different settings. Especially since macOS 11.0 (vmnet.framework API gets lots of updates) Three new netdevs are added: - vmnet-host - vmnet-shared - vmnet-bridged Signed-off-by: Vladislav Yaroshchuk --- net/clients.h | 11 +++++- net/net.c | 10 +++-- net/vmnet.c | 14 ++++++- qapi/net.json | 100 ++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 126 insertions(+), 9 deletions(-) diff --git a/net/clients.h b/net/clients.h index ac19843aab..c9157789f2 100644 --- a/net/clients.h +++ b/net/clients.h @@ -64,7 +64,14 @@ int net_init_vhost_user(const Netdev *netdev, const char= *name, int net_init_vhost_vdpa(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp); #ifdef CONFIG_VMNET -int net_init_vmnet(const Netdev *netdev, const char *name, +int net_init_vmnet_host(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp); -#endif + +int net_init_vmnet_shared(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp); + +int net_init_vmnet_bridged(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp); +#endif /* CONFIG_VMNET */ + #endif /* QEMU_NET_CLIENTS_H */ diff --git a/net/net.c b/net/net.c index 645c52ef6e..87a6f96665 100644 --- a/net/net.c +++ b/net/net.c @@ -1002,8 +1002,10 @@ static int (* const net_client_init_fun[NET_CLIENT_D= RIVER__MAX])( [NET_CLIENT_DRIVER_L2TPV3] =3D net_init_l2tpv3, #endif #ifdef CONFIG_VMNET - [NET_CLIENT_DRIVER_VMNET] =3D net_init_vmnet, -#endif + [NET_CLIENT_DRIVER_VMNET_HOST] =3D net_init_vmnet_host, + [NET_CLIENT_DRIVER_VMNET_SHARED] =3D net_init_vmnet_shared, + [NET_CLIENT_DRIVER_VMNET_BRIDGED] =3D net_init_vmnet_bridged, +#endif /* CONFIG_VMNET */ }; =20 =20 @@ -1091,7 +1093,9 @@ void show_netdevs(void) "vhost-vdpa", #endif #ifdef CONFIG_VMNET - "vmnet", + "vmnet-host", + "vmnet-shared", + "vmnet-bridged", #endif }; =20 diff --git a/net/vmnet.c b/net/vmnet.c index f8b64e2a27..3f25afd7e8 100644 --- a/net/vmnet.c +++ b/net/vmnet.c @@ -15,7 +15,19 @@ =20 #include =20 -int net_init_vmnet(const Netdev *netdev, const char *name, +int net_init_vmnet_host(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) { + error_setg(errp, "vmnet is not implemented yet"); + return -1; +} + +int net_init_vmnet_shared(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) { + error_setg(errp, "vmnet is not implemented yet"); + return -1; +} + +int net_init_vmnet_bridged(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { error_setg(errp, "vmnet is not implemented yet"); return -1; diff --git a/qapi/net.json b/qapi/net.json index c5de234e2c..a548d7a7f4 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -452,6 +452,89 @@ '*vhostdev': 'str', '*queues': 'int' } } =20 +## +# @NetdevVmnetHostOptions: +# +# vmnet (host mode) network backend. +# +# Allows the vmnet interface to communicate with +# other vmnet interfaces that are in host mode and also with the native ho= st. +# +# @dhcpstart: The starting IPv4 address to use for the interface. Must be = in the +# private IP range (RFC 1918). Must be specified along +# with @dhcpend and @subnetmask. +# This address is used as the gateway address. The subsequent = address +# up to and including dhcpend are placed in the DHCP pool. +# +# @dhcpend: The DHCP IPv4 range end address to use for the interface. Must= be in +# the private IP range (RFC 1918). Must be specified along +# with @dhcpstart and @subnetmask. +# +# @subnetmask: The IPv4 subnet mask to use on the interface. Must be speci= fied +# along with @dhcpstart and @subnetmask. +# +# +# Since: 6.1, +## +{ 'struct': 'NetdevVmnetHostOptions', + 'data': { + '*dhcpstart': 'str', + '*dhcpend': 'str', + '*subnetmask': 'str' + }, + 'if': 'defined(CONFIG_VMNET)' } + +## +# @NetdevVmnetSharedOptions: +# +# vmnet (shared mode) network backend. +# +# Allows traffic originating from the vmnet interface to reach the +# Internet through a network address translator (NAT). The vmnet interface +# can also communicate with the native host. By default, the vmnet interfa= ce +# is able to communicate with other shared mode interfaces. If a subnet ra= nge +# is specified, the vmnet interface can communicate with other shared mode +# interfaces on the same subnet. +# +# @dhcpstart: The starting IPv4 address to use for the interface. Must be = in the +# private IP range (RFC 1918). Must be specified along +# with @dhcpend and @subnetmask. +# This address is used as the gateway address. The subsequent = address +# up to and including dhcpend are placed in the DHCP pool. +# +# @dhcpend: The DHCP IPv4 range end address to use for the interface. Must= be in +# the private IP range (RFC 1918). Must be specified along +# with @dhcpstart and @subnetmask. +# +# @subnetmask: The IPv4 subnet mask to use on the interface. Must be speci= fied +# along with @dhcpstart and @subnetmask. +# +# +# Since: 6.1, +## +{ 'struct': 'NetdevVmnetSharedOptions', + 'data': { + '*dhcpstart': 'str', + '*dhcpend': 'str', + '*subnetmask': 'str' + }, + 'if': 'defined(CONFIG_VMNET)' } + +## +# @NetdevVmnetBridgedOptions: +# +# vmnet (bridged mode) network backend. +# +# Bridges the vmnet interface with a physical network interface. +# +# @ifname: The name of the physical interface to be bridged. +# +# Since: 6.1 +## +{ 'struct': 'NetdevVmnetBridgedOptions', + 'data': { 'ifname': 'str' }, + 'if': 'defined(CONFIG_VMNET)' } + ## # @NetClientDriver: # @@ -460,11 +543,16 @@ # Since: 2.7 # # @vhost-vdpa since 5.1 -# @vmnet since 6.1 +# @vmnet-host since 6.1 +# @vmnet-shared since 6.1 +# @vmnet-bridged since 6.1 ## { 'enum': 'NetClientDriver', 'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde', - 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa', 'vm= net' ] } + 'bridge', 'hubport', 'netmap', 'vhost-user', 'vhost-vdpa', + { 'name': 'vmnet-host', 'if': 'defined(CONFIG_VMNET)' }, + { 'name': 'vmnet-shared', 'if': 'defined(CONFIG_VMNET)' }, + { 'name': 'vmnet-bridged', 'if': 'defined(CONFIG_VMNET)' }] } =20 ## # @Netdev: @@ -478,6 +566,9 @@ # Since: 1.2 # # 'l2tpv3' - since 2.1 +# 'vmnet-host' - since 6.1 +# 'vmnet-shared' - since 6.1 +# 'vmnet-bridged' - since 6.1 ## { 'union': 'Netdev', 'base': { 'id': 'str', 'type': 'NetClientDriver' }, @@ -493,7 +584,10 @@ 'hubport': 'NetdevHubPortOptions', 'netmap': 'NetdevNetmapOptions', 'vhost-user': 'NetdevVhostUserOptions', - 'vhost-vdpa': 'NetdevVhostVDPAOptions' } } + 'vhost-vdpa': 'NetdevVhostVDPAOptions', + 'vmnet-host': 'NetdevVmnetHostOptions', + 'vmnet-shared': 'NetdevVmnetSharedOptions', + 'vmnet-bridged': 'NetdevVmnetBridgedOptions' } } =20 ## # @RxState: --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940555; cv=none; d=zohomail.com; s=zohoarc; b=GqAYIbvarwo/QObGHJu2q3PRScVYg+jFJOdanxOd3mfVjy/2atsQWyLMYb447ZCnrHL0LnxD1YLpbd1PXmcnEQBXfFkk4ukdibjjTsQ8gRqUCIufvZHmKSveWs0lxPp/2Qg1xSoNdaUIHc3G6NcqVvw5fhSIrxQGF7LU1ShA6B0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940555; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gtLaycDdICWu7/AUl/hrECYbXp2281mwsRjGskQkFgo=; b=LBofw5btowTI0m/YSez3rl1DD0cnxTE9BemitwKwIFnKK3pYuasCLPkEcpnE+Jxkb4qNSIaY3sFHlpsmugY0acAuf66RYYGKdvfIKkDIIT0h65VhbZvv1V3W8q2qT+KAoCAePUU5L8VB49MUnqxoV+N+3j1Owdm+MUIgdQL2dn8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16239405559491007.6678603293741; Thu, 17 Jun 2021 07:35:55 -0700 (PDT) Received: from localhost ([::1]:43976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt7a-0006zr-QV for importer@patchew.org; Thu, 17 Jun 2021 10:35:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5b-0004EP-2r for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:57 -0400 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]:46715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5N-0001M9-Ns for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:48 -0400 Received: by mail-lf1-x12a.google.com with SMTP id m21so10854807lfg.13 for ; Thu, 17 Jun 2021 07:33:37 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gtLaycDdICWu7/AUl/hrECYbXp2281mwsRjGskQkFgo=; b=EDT1z7VDjG1mtcN21APMIEtUlE4rc6QzzDRZT6Tbuf0nOUvtVh4PnB78JkvpYY8m3y If/Fy6fmgy82fpPjo7CXlb/cAG3T90qpR0FPJzjR7T2/TM1G9Y+2qmCg320JQcpsW9IU jxADR8knbHn750vHY/xjRQtgHyYKrFuGUrQ8yFWxWg1Woe44XTVoeOOiGAlSEodxIXFq 9C7cDuYUcUDAc+vBj5IpagRKD3PwSYsf96NuhEGr0qknyu/2QeyDntT4qEaf5t0V1g/6 lkuPOyCHgmYXqWrHCUjaGHbK5uzM/hqVg89WI6dFSEaRp00wBBrnucFFWiPXgfa5bs0m 5bMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gtLaycDdICWu7/AUl/hrECYbXp2281mwsRjGskQkFgo=; b=MbvoIoP+hP0qW0z1p6aKcrn+6M/xsQjdtcuvqVsvnlKfFwRB7vdG7NYfH7JXISb6mg GOz/MuDOUXG17tRcuTAHweg3F1SVRXo7FZLKXsJoi1KZr08nXkk87e1iOp2rODim0zZD 4i5fohbRDP1WQ7gcifZZnlrhBbZPg1jmtUEiBHCIlV6ejQxb6kpYCHtx9/KHlonCb80C RBItAVsqUJqhOHZpeUtbFJeTuJIkOqT6nkm4Y+9SI0SuEBNYAS+OctKaB6kXH36A/ied PwuxarjgIX7c1H4rrS5uLlGtUo8a3SDZu0meClxGiroyTCREDA03sw3nQSJ01n9Bpo7G cdRg== X-Gm-Message-State: AOAM533fkUAjhbgZ46iSyX5ShQSTmevX8wyxbmlW7c9CMQGoWwS1yXRJ 05OH5nqadiLpCkd7mOWVJlZneG1KqueystCc X-Google-Smtp-Source: ABdhPJzy5G2eUmPYqT84L69z3PAgeoEZ/7BDbAbSPfxqRaFO54sKn7foTwCia61ecYxGW8Bl0vt9Xw== X-Received: by 2002:ac2:4a83:: with SMTP id l3mr4171548lfp.406.1623940415848; Thu, 17 Jun 2021 07:33:35 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 3/7] net/vmnet: create common netdev state structure Date: Thu, 17 Jun 2021 17:32:42 +0300 Message-Id: <20210617143246.55336-4-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lf1-x12a.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladislav Yaroshchuk --- net/meson.build | 8 +++++++- net/vmnet-bridged.c | 25 +++++++++++++++++++++++++ net/vmnet-common.c | 20 ++++++++++++++++++++ net/vmnet-host.c | 24 ++++++++++++++++++++++++ net/vmnet-shared.c | 25 +++++++++++++++++++++++++ net/vmnet.c | 34 ---------------------------------- net/vmnet_int.h | 25 +++++++++++++++++++++++++ 7 files changed, 126 insertions(+), 35 deletions(-) create mode 100644 net/vmnet-bridged.c create mode 100644 net/vmnet-common.c create mode 100644 net/vmnet-host.c create mode 100644 net/vmnet-shared.c delete mode 100644 net/vmnet.c create mode 100644 net/vmnet_int.h diff --git a/net/meson.build b/net/meson.build index 196cf321a2..82eed63c8f 100644 --- a/net/meson.build +++ b/net/meson.build @@ -38,5 +38,11 @@ softmmu_ss.add(when: 'CONFIG_POSIX', if_true: files(tap_= posix)) softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-win32.c')) softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c= ')) =20 -softmmu_ss.add(when: ['CONFIG_VMNET', vmnet], if_true: files('vmnet.c')) +vmnet_files =3D files( + 'vmnet-common.c', + 'vmnet-bridged.c', + 'vmnet-host.c', + 'vmnet-shared.c' +) +softmmu_ss.add(when: ['CONFIG_VMNET', vmnet], if_true: vmnet_files) subdir('can') diff --git a/net/vmnet-bridged.c b/net/vmnet-bridged.c new file mode 100644 index 0000000000..9226c42353 --- /dev/null +++ b/net/vmnet-bridged.c @@ -0,0 +1,25 @@ +/* + * vmnet-bridged.c + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + +int net_init_vmnet_bridged(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) +{ + error_setg(errp, "vmnet-bridged is not implemented yet"); + return -1; +} diff --git a/net/vmnet-common.c b/net/vmnet-common.c new file mode 100644 index 0000000000..8ba31dc7b2 --- /dev/null +++ b/net/vmnet-common.c @@ -0,0 +1,20 @@ +/* + * vmnet.c - network client wrapper for Apple vmnet.framework + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * Copyright(c) 2021 Phillip Tennen + * + * 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 "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + diff --git a/net/vmnet-host.c b/net/vmnet-host.c new file mode 100644 index 0000000000..1d3484b51e --- /dev/null +++ b/net/vmnet-host.c @@ -0,0 +1,24 @@ +/* + * vmnet-host.c + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + +int net_init_vmnet_host(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) { + error_setg(errp, "vmnet-host is not implemented yet"); + return -1; +} diff --git a/net/vmnet-shared.c b/net/vmnet-shared.c new file mode 100644 index 0000000000..177b5a48ec --- /dev/null +++ b/net/vmnet-shared.c @@ -0,0 +1,25 @@ +/* + * vmnet-shared.c + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + +int net_init_vmnet_shared(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) +{ + error_setg(errp, "vmnet-shared is not implemented yet"); + return -1; +} diff --git a/net/vmnet.c b/net/vmnet.c deleted file mode 100644 index 3f25afd7e8..0000000000 --- a/net/vmnet.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * vmnet.c - network client wrapper for Apple vmnet.framework - * - * Copyright(c) 2021 Vladislav Yaroshchuk - * - * 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 "clients.h" -#include "qemu/error-report.h" -#include "qapi/error.h" - -#include - -int net_init_vmnet_host(const Netdev *netdev, const char *name, - NetClientState *peer, Error **errp) { - error_setg(errp, "vmnet is not implemented yet"); - return -1; -} - -int net_init_vmnet_shared(const Netdev *netdev, const char *name, - NetClientState *peer, Error **errp) { - error_setg(errp, "vmnet is not implemented yet"); - return -1; -} - -int net_init_vmnet_bridged(const Netdev *netdev, const char *name, - NetClientState *peer, Error **errp) { - error_setg(errp, "vmnet is not implemented yet"); - return -1; -} diff --git a/net/vmnet_int.h b/net/vmnet_int.h new file mode 100644 index 0000000000..c5982259a4 --- /dev/null +++ b/net/vmnet_int.h @@ -0,0 +1,25 @@ +/* + * vmnet_int.h + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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. + * + */ +#ifndef VMNET_INT_H +#define VMNET_INT_H + +#include "qemu/osdep.h" +#include "vmnet_int.h" +#include "clients.h" + +#include + +typedef struct VmnetCommonState { + NetClientState nc; + +} VmnetCommonState; + + +#endif /* VMNET_INT_H */ --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940556; cv=none; d=zohomail.com; s=zohoarc; b=DgVzdVqVZvW+Uc0Zvh46EwvjkpymuwWM6Pn91GyBOL2A/x4el7hngsjOo1PphScWZ9omnzlJ/FX/aY5k4z2q8bNE1akcowKaPxy1ssr1xgqJ2A7kEd0otUnCVB51GbtYPJ8UeSkiELOvxmDGwLvOb9XRd3cyD3OA013kmRN89a8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940556; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AsirMuvXQZR2XXuh1voANfL7ODQci6QThA/Q5ruNU1o=; b=hFJ6PXainrXV7m/0dErbEoGik9Kh7IGG6EKtOj5gtE6ha683syWMpQ3XRbeiikdCp6aiAueQMx3sCwL1FDoKdOFtzZOMGR9V2QKdL3jOTeHD9yNj4lBpmdPCgWqOXUyp1n/nt+6L5FqhCR4t35jAlcg8FhsQKHktz0nCH/3kqp4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623940556358562.2754078973481; Thu, 17 Jun 2021 07:35:56 -0700 (PDT) Received: from localhost ([::1]:43952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt7Z-0006yb-Sx for importer@patchew.org; Thu, 17 Jun 2021 10:35:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47588) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5U-0004CS-VE for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:46 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:46006) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5O-0001Mq-FZ for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:44 -0400 Received: by mail-lf1-x130.google.com with SMTP id a1so10678037lfr.12 for ; Thu, 17 Jun 2021 07:33:38 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AsirMuvXQZR2XXuh1voANfL7ODQci6QThA/Q5ruNU1o=; b=KFxnJFLubIgqyC8Lw2eNOvnXraf+NEmtXj+ZzJIIsA1SNno9Pa9PYV6IlEhnHd1BEx LbOy2KGcJL8JGWCBbOgr+poeYk6EMZT9g6VhDMvf/Q/ouO8fMlSX1XaQDAjiZG2phP6g ig3MHGjvCCFI3tCiKwI++IuhXtKDoXVGYO2zcIj2UiGsg+RPe0yHuHpk74FLvrdYKjvJ VQuyiVnxcIg9IchPnbXf7K8aY/rMRsv9exXrjCKTv0pcikKItGhNqpHGoNE6XHNUTky/ 1C6iAj8Juszq6Ax1tpnr+QPi8fmQgFWXM/vNkT7PD6N6LJh9gZbgyBIfGLEYqdP8jrsS yYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AsirMuvXQZR2XXuh1voANfL7ODQci6QThA/Q5ruNU1o=; b=fl384rys4PieW13016LKvURTj+nQ3zXGeFKj+Tlk4AxHGLvx13NdYknJjI/dZQ68v0 sDMyEx5rt6WPg2znJsmuyxS50sga01+P9i5MRazIp+Eo3bRdwXGeDP4J7LXTfuYJjOQj k89HyebvfkHpcuy8sPwdbWl/i1UBDm5mCpwaJS3hqNse3X7W6Q/a94BlRYYd6tw0kRJg 8KOmeLx+XKn4Ngm4GoJhenRI0FRdciAmu/mnqOnZNqFYwikCzzLN3rI39OsFWXaaUWNs JstxyzuPgbGiDf46HPff0j30787Jj0SxvVTi4rrzO+s1V2It/AsqmXG2H33Fre46wjAn ZXgA== X-Gm-Message-State: AOAM533ryFWo3MZy/VknhFMOvGHPzOtxDMYbIMmB4Vrhe15yX2uZ6Sz/ SnwCLetEY2m5uVqx3rEg1mF/9Cjl3qdelqcQ X-Google-Smtp-Source: ABdhPJzc41+Fisvjm2jOVYukdzc/5NmDo0gBVpznSGPTgd75ZnB/owgoemPp2ixvP/OmNGkLqp+5PQ== X-Received: by 2002:a19:c4b:: with SMTP id 72mr4268693lfm.15.1623940416771; Thu, 17 Jun 2021 07:33:36 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 4/7] net/vmnet: implement shared mode (vmnet-shared) Date: Thu, 17 Jun 2021 17:32:43 +0300 Message-Id: <20210617143246.55336-5-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Still not implemented: - port forwarding - ipv6 prefix setting Signed-off-by: Vladislav Yaroshchuk --- net/meson.build | 2 +- net/vmnet-common.c | 20 --- net/vmnet-common.m | 294 +++++++++++++++++++++++++++++++++++++++++++++ net/vmnet-shared.c | 73 ++++++++++- net/vmnet_int.h | 23 ++++ 5 files changed, 389 insertions(+), 23 deletions(-) delete mode 100644 net/vmnet-common.c create mode 100644 net/vmnet-common.m diff --git a/net/meson.build b/net/meson.build index 82eed63c8f..1df498ad99 100644 --- a/net/meson.build +++ b/net/meson.build @@ -39,7 +39,7 @@ softmmu_ss.add(when: 'CONFIG_WIN32', if_true: files('tap-= win32.c')) softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: files('vhost-vdpa.c= ')) =20 vmnet_files =3D files( - 'vmnet-common.c', + 'vmnet-common.m', 'vmnet-bridged.c', 'vmnet-host.c', 'vmnet-shared.c' diff --git a/net/vmnet-common.c b/net/vmnet-common.c deleted file mode 100644 index 8ba31dc7b2..0000000000 --- a/net/vmnet-common.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * vmnet.c - network client wrapper for Apple vmnet.framework - * - * Copyright(c) 2021 Vladislav Yaroshchuk - * Copyright(c) 2021 Phillip Tennen - * - * 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 "qapi-types-net.h" -#include "vmnet_int.h" -#include "clients.h" -#include "qemu/error-report.h" -#include "qapi/error.h" - -#include - diff --git a/net/vmnet-common.m b/net/vmnet-common.m new file mode 100644 index 0000000000..c6e7df99e0 --- /dev/null +++ b/net/vmnet-common.m @@ -0,0 +1,294 @@ +/* + * vmnet.c - network backend based on vmnet.framework + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "qemu/main-loop.h" +#include "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include +#include + +typedef struct vmpktdesc vmpktdesc_t; +typedef struct iovec iovec_t; + +static void vmnet_set_send_enabled(VmnetCommonState *s, bool enable) +{ + s->send_enabled =3D enable; +} + + +static void vmnet_send_completed(NetClientState *nc, ssize_t len) +{ + VmnetCommonState *s =3D DO_UPCAST(VmnetCommonState, nc, nc); + vmnet_set_send_enabled(s, true); +} + + +static void vmnet_send(NetClientState *nc, + interface_event_t event_id, + xpc_object_t event) +{ + assert(event_id =3D=3D VMNET_INTERFACE_PACKETS_AVAILABLE); + + VmnetCommonState *s; + uint64_t packets_available; + + struct iovec *iov; + struct vmpktdesc *packets; + int pkt_cnt; + int i; + + vmnet_return_t if_status; + ssize_t size; + + s =3D DO_UPCAST(VmnetCommonState, nc, nc); + + packets_available =3D xpc_dictionary_get_uint64( + event, + vmnet_estimated_packets_available_key + ); + + pkt_cnt =3D (packets_available < VMNET_PACKETS_LIMIT) ? + packets_available : + VMNET_PACKETS_LIMIT; + + + iov =3D s->iov_buf; + packets =3D s->packets_buf; + + for (i =3D 0; i < pkt_cnt; ++i) { + packets[i].vm_pkt_size =3D s->max_packet_size; + packets[i].vm_pkt_iovcnt =3D 1; + packets[i].vm_flags =3D 0; + } + + if_status =3D vmnet_read(s->vmnet_if, packets, &pkt_cnt); + if (if_status !=3D VMNET_SUCCESS) { + error_printf("vmnet: read failed: %s\n", + vmnet_status_map_str(if_status)); + } + qemu_mutex_lock_iothread(); + for (i =3D 0; i < pkt_cnt; ++i) { + size =3D qemu_send_packet_async(nc, + iov[i].iov_base, + packets[i].vm_pkt_size, + vmnet_send_completed); + if (size =3D=3D 0) { + vmnet_set_send_enabled(s, false); + } else if (size < 0) { + break; + } + } + qemu_mutex_unlock_iothread(); + +} + + +static void vmnet_register_event_callback(VmnetCommonState *s) +{ + dispatch_queue_t avail_pkt_q =3D dispatch_queue_create( + "org.qemu.vmnet.if_queue", + DISPATCH_QUEUE_SERIAL + ); + + vmnet_interface_set_event_callback( + s->vmnet_if, + VMNET_INTERFACE_PACKETS_AVAILABLE, + avail_pkt_q, + ^(interface_event_t event_id, xpc_object_t event) { + if (s->send_enabled) { + vmnet_send(&s->nc, event_id, event); + } + }); +} + + +static void vmnet_bufs_init(VmnetCommonState *s) +{ + int i; + struct vmpktdesc *packets; + struct iovec *iov; + + packets =3D s->packets_buf; + iov =3D s->iov_buf; + + for (i =3D 0; i < VMNET_PACKETS_LIMIT; ++i) { + iov[i].iov_len =3D s->max_packet_size; + iov[i].iov_base =3D g_malloc0(iov[i].iov_len); + packets[i].vm_pkt_iov =3D iov + i; + } +} + + +const char *vmnet_status_map_str(vmnet_return_t status) +{ + switch (status) { + case VMNET_SUCCESS: + return "success"; + case VMNET_FAILURE: + return "general failure"; + case VMNET_MEM_FAILURE: + return "memory allocation failure"; + case VMNET_INVALID_ARGUMENT: + return "invalid argument specified"; + case VMNET_SETUP_INCOMPLETE: + return "interface setup is not complete"; + case VMNET_INVALID_ACCESS: + return "invalid access, permission denied"; + case VMNET_PACKET_TOO_BIG: + return "packet size is larger than MTU"; + case VMNET_BUFFER_EXHAUSTED: + return "buffers exhausted in kernel"; + case VMNET_TOO_MANY_PACKETS: + return "packet count exceeds limit"; + default: + return "unknown vmnet error"; + } +} + + +int vmnet_if_create(NetClientState *nc, + xpc_object_t if_desc, + Error **errp, + void (*completion_callback)(xpc_object_t interface_par= am)) +{ + VmnetCommonState *s; + + dispatch_queue_t if_create_q; + dispatch_semaphore_t if_created_sem; + + __block vmnet_return_t if_status; + + if_create_q =3D dispatch_queue_create("org.qemu.vmnet.create", + DISPATCH_QUEUE_SERIAL); + if_created_sem =3D dispatch_semaphore_create(0); + + s =3D DO_UPCAST(VmnetCommonState, nc, nc); + s->vmnet_if =3D vmnet_start_interface( + if_desc, + if_create_q, + ^(vmnet_return_t status, xpc_object_t interface_param) { + if_status =3D status; + if (status !=3D VMNET_SUCCESS || !interface_param) { + dispatch_semaphore_signal(if_created_sem); + return; + } + + s->mtu =3D xpc_dictionary_get_uint64( + interface_param, + vmnet_mtu_key); + s->max_packet_size =3D xpc_dictionary_get_uint64( + interface_param, + vmnet_max_packet_size_key); + + if (completion_callback) { + completion_callback(interface_param); + } + dispatch_semaphore_signal(if_created_sem); + }); + + if (s->vmnet_if =3D=3D NULL) { + error_setg(errp, "unable to create interface with requested params= "); + return -1; + } + + dispatch_semaphore_wait(if_created_sem, DISPATCH_TIME_FOREVER); + dispatch_release(if_create_q); + + if (if_status !=3D VMNET_SUCCESS) { + error_setg(errp, + "interface creation error: %s", + vmnet_status_map_str(if_status)); + return -1; + } + + vmnet_register_event_callback(s); + vmnet_bufs_init(s); + vmnet_set_send_enabled(s, true); + + return 0; +} + + +ssize_t vmnet_receive_common(NetClientState *nc, + const uint8_t *buf, + size_t size) +{ + VmnetCommonState *s; + vmpktdesc_t packet; + iovec_t iov; + int pkt_cnt; + vmnet_return_t if_status; + + s =3D DO_UPCAST(VmnetCommonState, nc, nc); + + if (size > s->max_packet_size) { + warn_report("vmnet: packet is too big, %zu > %llu\n", + packet.vm_pkt_size, + s->max_packet_size); + return -1; + } + + iov.iov_base =3D (char *) buf; + iov.iov_len =3D size; + + packet.vm_pkt_iovcnt =3D 1; + packet.vm_flags =3D 0; + packet.vm_pkt_size =3D size; + packet.vm_pkt_iov =3D &iov; + + pkt_cnt =3D 1; + if_status =3D vmnet_write(s->vmnet_if, &packet, &pkt_cnt); + + if (if_status !=3D VMNET_SUCCESS) { + error_report("vmnet: write error: %s\n", + vmnet_status_map_str(if_status)); + } + + if (if_status =3D=3D VMNET_SUCCESS && pkt_cnt) { + return size; + } + return 0; +} + + +void vmnet_cleanup_common(NetClientState *nc) +{ + VmnetCommonState *s; + dispatch_queue_t if_destroy_q; + + s =3D DO_UPCAST(VmnetCommonState, nc, nc); + + qemu_purge_queued_packets(nc); + vmnet_set_send_enabled(s, false); + + if (s->vmnet_if =3D=3D NULL) { + return; + } + + if_destroy_q =3D dispatch_queue_create( + "org.qemu.vmnet.destroy", + DISPATCH_QUEUE_SERIAL + ); + + vmnet_stop_interface( + s->vmnet_if, + if_destroy_q, + ^(vmnet_return_t status) { + }); + + for (int i =3D 0; i < VMNET_PACKETS_LIMIT; ++i) { + g_free(s->iov_buf[i].iov_base); + } +} diff --git a/net/vmnet-shared.c b/net/vmnet-shared.c index 177b5a48ec..a9db0ad52b 100644 --- a/net/vmnet-shared.c +++ b/net/vmnet-shared.c @@ -17,9 +17,78 @@ =20 #include =20 +typedef struct VmnetSharedState { + VmnetCommonState common; + +} VmnetSharedState; + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp); + +static NetClientInfo net_vmnet_shared_info =3D { + .type =3D NET_CLIENT_DRIVER_VMNET_SHARED, + .size =3D sizeof(VmnetSharedState), + .receive =3D vmnet_receive_common, + .cleanup =3D vmnet_cleanup_common, +}; + int net_init_vmnet_shared(const Netdev *netdev, const char *name, NetClientState *peer, Error **errp) { - error_setg(errp, "vmnet-shared is not implemented yet"); - return -1; + NetClientState *nc; + xpc_object_t if_desc; + + nc =3D qemu_new_net_client(&net_vmnet_shared_info, + peer, "vmnet-shared", name); + if_desc =3D create_if_desc(netdev, errp); + return vmnet_if_create(nc, if_desc, errp, NULL); +} + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp) +{ + const NetdevVmnetSharedOptions *options; + xpc_object_t if_desc; + + if_desc =3D xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_uint64( + if_desc, + vmnet_operation_mode_key, + VMNET_SHARED_MODE + ); + + xpc_dictionary_set_bool( + if_desc, + vmnet_allocate_mac_address_key, + false + ); + + options =3D &(netdev->u.vmnet_shared); + + if (options->has_dhcpstart || + options->has_dhcpend || + options->has_subnetmask) { + + if (options->has_dhcpstart && + options->has_dhcpend && + options->has_subnetmask) { + + xpc_dictionary_set_string(if_desc, + vmnet_start_address_key, + options->dhcpstart); + xpc_dictionary_set_string(if_desc, + vmnet_end_address_key, + options->dhcpend); + xpc_dictionary_set_string(if_desc, + vmnet_subnet_mask_key, + options->subnetmask); + } else { + error_setg( + errp, + "'dhcpstart', 'dhcpend', 'subnetmask' " + "must be provided together" + ); + } + } + + return if_desc; } + diff --git a/net/vmnet_int.h b/net/vmnet_int.h index c5982259a4..3979fe4678 100644 --- a/net/vmnet_int.h +++ b/net/vmnet_int.h @@ -16,10 +16,33 @@ =20 #include =20 +#define VMNET_PACKETS_LIMIT 50 + typedef struct VmnetCommonState { NetClientState nc; + interface_ref vmnet_if; + + bool send_enabled; + + uint64_t mtu; + uint64_t max_packet_size; + + struct vmpktdesc packets_buf[VMNET_PACKETS_LIMIT]; + struct iovec iov_buf[VMNET_PACKETS_LIMIT]; =20 } VmnetCommonState; =20 +const char *vmnet_status_map_str(vmnet_return_t status); + +int vmnet_if_create(NetClientState *nc, + xpc_object_t if_desc, + Error **errp, + void (*completion_callback)(xpc_object_t interface_par= am)); + +ssize_t vmnet_receive_common(NetClientState *nc, + const uint8_t *buf, + size_t size); + +void vmnet_cleanup_common(NetClientState *nc); =20 #endif /* VMNET_INT_H */ --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940686; cv=none; d=zohomail.com; s=zohoarc; b=eu8ydFjY0SE+P7BVjG4T0eaLskuRbHMm4I6k0B9/cWcLyzz4mnu3VR0UTRveQe0namAk2KQXVFJWmfeozRW4M7VSAiljFP4hlbP7uNAj7hyv6r2YJ752+xpkyPPuA0g03j+0i4FF6jz2M1XtLBXGNfd1OBW3vbWbhN8ullHal4Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940686; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=oE/CTQccPGQwH7DHVloQHpvY33VY/8DHBhYmKwKIpCU=; b=Gf2JRaFQxz1UMbw6/JRCR+5sBrSI5h1zKdD/Gw6duR5iDUNkqG5BrQBYsLzXhbcKF5hSP5scYrKO1VMCqZWu4TaS2S++17K0LT/Ns4XnpUL0lGvaYo8JoZ5uPZSg2eb+CzGdbGefZAVh5H7VmIFz2MLdF4RexDBWladks5bMDdE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623940686462301.83655177465903; Thu, 17 Jun 2021 07:38:06 -0700 (PDT) Received: from localhost ([::1]:52030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt9h-00045v-Ai for importer@patchew.org; Thu, 17 Jun 2021 10:38:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5b-0004ER-4b for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:57 -0400 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]:36503) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5P-0001NX-G9 for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:50 -0400 Received: by mail-lf1-x129.google.com with SMTP id d16so3459245lfn.3 for ; Thu, 17 Jun 2021 07:33:39 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oE/CTQccPGQwH7DHVloQHpvY33VY/8DHBhYmKwKIpCU=; b=aclhlSyc/ZjrL/UVBh4yzBvhhPSR67vjdzDuxJz23BDuqTKIx0ACxzAFPB39kxTShg c0uBZj8uTwHb+lt+ZsS+fLRyY6AKB6UWJnkxY/AQvaS8DABP5UVc0izu0tHsTAtgSjX+ A1+FvkHPIu0c83/eVjvmGzf98xZHxBhjSS/kLKwJsiPysiDqrJrRcCb+/eqX/5uuG/hI XJWOlgEkDtHBwnnSUUJ9ENG61dMX4ClLlAT6mcydW5Cu/MGhO6+aPmYd7yLVCxrz/ROi /5VIMH/hcFMlY2w9TyuqWi6fL/59PVH+RhJXe5YLucRQMqRyPhcrBESRTzWqLMD9Zrxl HzDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oE/CTQccPGQwH7DHVloQHpvY33VY/8DHBhYmKwKIpCU=; b=LtGyQxyzKbVKRGOT+ReItMITcX8J+NmvzqVPjqyZdEd9eeHsIOfSVCeQyUokyYJ1Ov XJSqDSOXBkBTMYEMLmKGuWAQ2nc6ADons8+eNASj+u7zpIzTX32Jm1GwSV9pSn1pa9iT JoCnoEvPl3Gd9ReotXVTgY0W/NBt2K90g20Ffdpd0/NxlW0Md17SonCjRV2R3nT1Yljh 1bXBSpNFv9dxDr5F5AyoqXUwoO9GvRT+jOdhtuTl8HVlgrcAZlXqVBfC85twoR4k9tS4 +DK36FahXfTD4QRNiJAtSH7iyPm1jobTDnhF1g9LCgjt1Cpw/JvThVCQ4KoGUa1nQRmw Pl+w== X-Gm-Message-State: AOAM532QIyErmW+2K3rnMmxGl8JLaJO+rygkzv+eETgKK/1d/qEoIGeA xpssHG0P0o8EFmeEknDOTjB5G5CingMJdQZs X-Google-Smtp-Source: ABdhPJxpsiRT6fAaNYIpTxg6sOoNo1tfhV00OHLyd/cNwkzFcxq6zlv/iHRQ1m+IAVMtjRz8mi6rkA== X-Received: by 2002:ac2:425a:: with SMTP id m26mr4319677lfl.458.1623940417620; Thu, 17 Jun 2021 07:33:37 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 5/7] net/vmnet: implement host mode (vmnet-host) Date: Thu, 17 Jun 2021 17:32:44 +0300 Message-Id: <20210617143246.55336-6-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::129; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lf1-x129.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Still not implemented: - port forwarding Signed-off-by: Vladislav Yaroshchuk --- net/vmnet-host.c | 75 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/net/vmnet-host.c b/net/vmnet-host.c index 1d3484b51e..77a2c20b48 100644 --- a/net/vmnet-host.c +++ b/net/vmnet-host.c @@ -17,8 +17,77 @@ =20 #include =20 +typedef struct VmnetHostState { + VmnetCommonState common; + +} VmnetHostState; + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp); + +static NetClientInfo net_vmnet_host_info =3D { + .type =3D NET_CLIENT_DRIVER_VMNET_HOST, + .size =3D sizeof(VmnetHostState), + .receive =3D vmnet_receive_common, + .cleanup =3D vmnet_cleanup_common, +}; + int net_init_vmnet_host(const Netdev *netdev, const char *name, - NetClientState *peer, Error **errp) { - error_setg(errp, "vmnet-host is not implemented yet"); - return -1; + NetClientState *peer, Error **errp) +{ + NetClientState *nc; + xpc_object_t if_desc; + + nc =3D qemu_new_net_client(&net_vmnet_host_info, + peer, "vmnet-host", name); + if_desc =3D create_if_desc(netdev, errp); + return vmnet_if_create(nc, if_desc, errp, NULL); +} + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp) +{ + const NetdevVmnetHostOptions *options; + xpc_object_t if_desc; + + if_desc =3D xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_uint64( + if_desc, + vmnet_operation_mode_key, + VMNET_HOST_MODE + ); + + xpc_dictionary_set_bool( + if_desc, + vmnet_allocate_mac_address_key, + false + ); + + options =3D &(netdev->u.vmnet_host); + + if (options->has_dhcpstart || + options->has_dhcpend || + options->has_subnetmask) { + + if (options->has_dhcpstart && + options->has_dhcpend && + options->has_subnetmask) { + + xpc_dictionary_set_string(if_desc, + vmnet_start_address_key, + options->dhcpstart); + xpc_dictionary_set_string(if_desc, + vmnet_end_address_key, + options->dhcpend); + xpc_dictionary_set_string(if_desc, + vmnet_subnet_mask_key, + options->subnetmask); + } else { + error_setg( + errp, + "'dhcpstart', 'dhcpend', 'subnetmask' " + "must be provided together" + ); + } + } + + return if_desc; } --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940763; cv=none; d=zohomail.com; s=zohoarc; b=UkANm98zlvKJF2LXbzMICEO3FpheHXEGZLkWx+FgayYoh9+ZyZPJhMSK02DeS299vrz0kzPbIFIdwtCvP1ExXjtLeQsaz1dRQLYfhCQmYzgBzf6dDJsJeepr8bFj+gO8vaNwATJDW++vwiD+0b8IP8+BhxjZjgD4j831PSUjKXE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940763; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mQO9Jtuj60CqwGL2PeMxqW7qhxlXNo242GuzLYoT+MU=; b=DHROdgd1ZTrdOYtBwKf7bSPg1MoSoedpZxXBDDCQtfQd24kTMyzVvIsfD8yv3tdZc2DfVlIILbR9HwO1+hGNM+mWGtkENMlBUUKOjxGOAVyn1C28B+2si5soP4O/WnrgVHPj0p4Ggs7RMIAEEYqMbc14x4VgMOIGlBE1H+3/lRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623940763857191.17280473544542; Thu, 17 Jun 2021 07:39:23 -0700 (PDT) Received: from localhost ([::1]:57142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lttAw-0007Xx-SV for importer@patchew.org; Thu, 17 Jun 2021 10:39:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47632) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5b-0004EO-2K for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:57 -0400 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]:44840) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5U-0001Ng-8a for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:49 -0400 Received: by mail-lj1-x234.google.com with SMTP id d2so9303908ljj.11 for ; Thu, 17 Jun 2021 07:33:40 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mQO9Jtuj60CqwGL2PeMxqW7qhxlXNo242GuzLYoT+MU=; b=UlZxlsLDsNhbB17rz2rXv1FvQnenhg3Pq2Z4bVvmcd0OUFmeOgoi7nH1imFpNcgiL2 MPl6Fmmo3IBo4+8Io4O6qRnnfwo1JcQqPH/ysLUszn7CDB5He5VPxY9r7s854+4eDWfL 13e2+hanXkN8Oh3JH+jL4+v5y8jsSaMDBwJ4ZSZ30TuHyD6nWw1sD4pncKGVuhj/oSIG 8olrmBi2A1w66Ntw7/4UTzpMkG3uFPUeiXeJaxIvN6wCbjzmjZR1h9H+37cz1wPTekBl pQA7RljKEi/TPcTpWsem5tomnyjeBwSOuIStzZfSLA8o5khxXgVbk7+V/vIfzvwnLo3L xC6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mQO9Jtuj60CqwGL2PeMxqW7qhxlXNo242GuzLYoT+MU=; b=ObDuMYh/NbErY08qHdXsGvZwMc9B5UsPST1GC0vLhFB5Ikr0E3iScLsxz3VVsU00/N G70eEw4ijHTcKy8vGNIh6yS2QdMWMnDZrj9Jw7WsWgF08qIayyT9XjLF4k0VZHdT4u9V 8AE1KK9erLl85GZZdvIZ0Ou7Jd8cQOGv+csiZamQO0L/UBZL/00373MctGdayYbVNFsr fsxoZTvwJs6YbacrEEFXZepTI5/PEwJdYec0332lgW87/nvFgynpnJpkozLy9WD4kB82 qrNRbuSSEj4vwvnu1iOYY0/mAtNlunv/4m0oipgd52MeI1RSmfdQJ+SJV1XyoQEDr3e+ PzLA== X-Gm-Message-State: AOAM530q+hcFJ+Ke1kcWai8FEqoC5c3OUcZO01tt9LJgl7GzxIuTdaPC G4KXMLpl7CImvAPJ6vyohFG9xl/+m0VGsviJ X-Google-Smtp-Source: ABdhPJxGinud23z7cTsxp5olEjf0RM6NYl3THUZQbnAfcbtH5IYS0jdIdLETaM15OsCC1ajDrC9CEw== X-Received: by 2002:a2e:9945:: with SMTP id r5mr4977761ljj.324.1623940418573; Thu, 17 Jun 2021 07:33:38 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 6/7] net/vmnet: implement bridged mode (vmnet-bridged) Date: Thu, 17 Jun 2021 17:32:45 +0300 Message-Id: <20210617143246.55336-7-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::234; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lj1-x234.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladislav Yaroshchuk --- net/meson.build | 2 +- net/vmnet-bridged.c | 25 --------- net/vmnet-bridged.m | 123 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 124 insertions(+), 26 deletions(-) delete mode 100644 net/vmnet-bridged.c create mode 100644 net/vmnet-bridged.m diff --git a/net/meson.build b/net/meson.build index 1df498ad99..495419e964 100644 --- a/net/meson.build +++ b/net/meson.build @@ -40,7 +40,7 @@ softmmu_ss.add(when: 'CONFIG_VHOST_NET_VDPA', if_true: fi= les('vhost-vdpa.c')) =20 vmnet_files =3D files( 'vmnet-common.m', - 'vmnet-bridged.c', + 'vmnet-bridged.m', 'vmnet-host.c', 'vmnet-shared.c' ) diff --git a/net/vmnet-bridged.c b/net/vmnet-bridged.c deleted file mode 100644 index 9226c42353..0000000000 --- a/net/vmnet-bridged.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * vmnet-bridged.c - * - * Copyright(c) 2021 Vladislav Yaroshchuk - * - * 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 "qapi-types-net.h" -#include "vmnet_int.h" -#include "clients.h" -#include "qemu/error-report.h" -#include "qapi/error.h" - -#include - -int net_init_vmnet_bridged(const Netdev *netdev, const char *name, - NetClientState *peer, Error **errp) -{ - error_setg(errp, "vmnet-bridged is not implemented yet"); - return -1; -} diff --git a/net/vmnet-bridged.m b/net/vmnet-bridged.m new file mode 100644 index 0000000000..61a96ce11a --- /dev/null +++ b/net/vmnet-bridged.m @@ -0,0 +1,123 @@ +/* + * vmnet-bridged.c + * + * Copyright(c) 2021 Vladislav Yaroshchuk + * + * 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 "qapi-types-net.h" +#include "vmnet_int.h" +#include "clients.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +#include + +typedef struct VmnetBridgedState { + VmnetCommonState common; + +} VmnetBridgedState; + +static NetClientInfo net_vmnet_bridged_info =3D { + .type =3D NET_CLIENT_DRIVER_VMNET_BRIDGED, + .size =3D sizeof(VmnetBridgedState), + .receive =3D vmnet_receive_common, + .cleanup =3D vmnet_cleanup_common, +}; + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp); + +static bool validate_ifname(const char *ifname); + +static const char *get_valid_ifnames(void); + +int net_init_vmnet_bridged(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) +{ + NetClientState *nc; + xpc_object_t if_desc; + + nc =3D qemu_new_net_client(&net_vmnet_bridged_info, + peer, "vmnet-bridged", name); + if_desc =3D create_if_desc(netdev, errp); + if (!if_desc) { + error_setg(errp, + "unsupported ifname, should be one of: %s", + get_valid_ifnames()); + return -1; + } + + return vmnet_if_create(nc, if_desc, errp, NULL); +} + +static xpc_object_t create_if_desc(const Netdev *netdev, Error **errp) +{ + const NetdevVmnetBridgedOptions *options; + xpc_object_t if_desc; + + if_desc =3D xpc_dictionary_create(NULL, NULL, 0); + xpc_dictionary_set_uint64( + if_desc, + vmnet_operation_mode_key, + VMNET_BRIDGED_MODE + ); + + xpc_dictionary_set_bool( + if_desc, + vmnet_allocate_mac_address_key, + false + ); + + options =3D &(netdev->u.vmnet_bridged); + if (validate_ifname(options->ifname)) { + xpc_dictionary_set_string(if_desc, + vmnet_shared_interface_name_key, + options->ifname); + } else { + return NULL; + } + return if_desc; +} + +static bool validate_ifname(const char *ifname) +{ + xpc_object_t shared_if_list =3D vmnet_copy_shared_interface_list(); + __block bool match =3D false; + + xpc_array_apply( + shared_if_list, + ^bool(size_t index, xpc_object_t value) { + if (strcmp(xpc_string_get_string_ptr(value), ifname) =3D=3D 0) { + match =3D true; + return false; + } + return true; + }); + + return match; +} + +static const char *get_valid_ifnames(void) +{ + xpc_object_t shared_if_list =3D vmnet_copy_shared_interface_list(); + __block char *if_list =3D NULL; + + xpc_array_apply( + shared_if_list, + ^bool(size_t index, xpc_object_t value) { + if_list =3D g_strconcat(xpc_string_get_string_ptr(value), + " ", + if_list, + NULL); + return true; + }); + + if (if_list) { + return if_list; + } + return "[no interfaces]"; +} --=20 2.23.0 From nobody Mon May 6 22:47:39 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1623940685; cv=none; d=zohomail.com; s=zohoarc; b=UNApp492hwz+5Etm1p/CzEu89QKLbUenLAyMhXIvig57qHoD90FXacazWdPBKSiJ/PnjMQm9dNNsXZHcZb/Myvni+dnAXeb+11pw1Jpo94oOFxaJqTLIse5GSEvgzVdFFOt8sO63QHaph3h/Eb7oB1ou2u5wE/11yLVp4Qt4qaQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623940685; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Z5w2yufnx/vm54xPNes++PujG3U/PMHkDseAnV/HU/4=; b=khnH8NHg3paJtGRjJ0abo+CL8hrVWuTo+RJd4Q8qiqD2Qe79noyZGZm3TfKFIAp9NT3Mvz0SGipDGN4SFsd8gyG2vR51eZSDw/ngl5McGlHiWy0B/lv18liHXmta82r2C5iGdYxk6u1+7Z1/PwYo1K+pq5LMWY4pqYzfGzfqAr0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623940685414380.1590512761261; Thu, 17 Jun 2021 07:38:05 -0700 (PDT) Received: from localhost ([::1]:51910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ltt9g-000411-Cl for importer@patchew.org; Thu, 17 Jun 2021 10:38:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47652) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ltt5e-0004EU-AK for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:58 -0400 Received: from mail-lj1-x229.google.com ([2a00:1450:4864:20::229]:40743) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ltt5U-0001Nq-MW for qemu-devel@nongnu.org; Thu, 17 Jun 2021 10:33:52 -0400 Received: by mail-lj1-x229.google.com with SMTP id x14so9321098ljp.7 for ; Thu, 17 Jun 2021 07:33:40 -0700 (PDT) Received: from localhost.localdomain ([5.18.249.207]) by smtp.gmail.com with ESMTPSA id d9sm597406lfv.47.2021.06.17.07.33.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Jun 2021 07:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z5w2yufnx/vm54xPNes++PujG3U/PMHkDseAnV/HU/4=; b=SLIA0Z1OQDkp2vZXXqOddCscQ1SX8EmkXaqYfFliCK0ieDQPijykAcTLLypubJz5cn zdZ7UUOLiTKDffmxwfbXyMhca337YcxPJGSpLR52cIFZKD306U8HPXhkFpE0FI8MDNfN v8T9ef7e7SrOdxMhJecNRlwulRkQHwJekFle1JZRhcYrAKW1UWva6jpqLbaC1S20LfNc COK2MDyxnhAKus5+CPeeJgTPaoBrrs+GUHsiejucEQ7QVOgU5v8oPNi6NW5l23F/DHBm SeDIxtqIq7Kaa8vfny0R0N4qQvb6z6dpY+vc/Ax8zCdlpxa3e488KtKqf9eaAY/xPA1h bTHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z5w2yufnx/vm54xPNes++PujG3U/PMHkDseAnV/HU/4=; b=PcZlzbYA6Q8ZjGIeXca7IprbAmPlMU7k53NfU5cgujZQGZpPVlLep90KVxe1LwXsIe 2jB5gQm5wcoEuYRKBanTwi5y+UJEJeAdjHt2mF68tR/JX958U078rh6NKN4UUvDpVQ9A +NvFVb6WOe98M5j18RIQGTQtwMOJXtetlmoYir/zXifKMUos7g6PqcH0esix8WbJ3p41 CioR0/mOonI1Pm81V5ZOXL70HrFq7LVpa5PSq7fYg6hlDqIDyO0a2blB3A6+clww7fui IKIWfKpfcvlo+Jwh6cy0hGYd+J7GxPATMedDXeOOgX+vSfmhMmDCd9NMKl4Hk3V/pIK8 atrA== X-Gm-Message-State: AOAM531anSx5iDQaoRz47nV2erCFO2HbLQ9DmZ3HfldxpqnApl3oHEWt rSftOoNjqoumwPoQsYRg3PILLaeksHzQCMtA X-Google-Smtp-Source: ABdhPJzLSD7rczqqZtNkK2C8i+KbTB5ZDxjpuBuCJLEA/gOjPsHqRSwO6RPm5n309vElfl4uTBZvmQ== X-Received: by 2002:a2e:9a87:: with SMTP id p7mr5014832lji.477.1623940419254; Thu, 17 Jun 2021 07:33:39 -0700 (PDT) From: Vladislav Yaroshchuk To: qemu-devel@nongnu.org Subject: [PATCH 7/7] net/vmnet: update qemu-options.hx Date: Thu, 17 Jun 2021 17:32:46 +0300 Message-Id: <20210617143246.55336-8-yaroshchuk2000@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210617143246.55336-1-yaroshchuk2000@gmail.com> References: <20210617143246.55336-1-yaroshchuk2000@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=2a00:1450:4864:20::229; envelope-from=yaroshchuk2000@gmail.com; helo=mail-lj1-x229.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jasowang@redhat.com, r.bolshakov@yadro.com, Vladislav Yaroshchuk Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Vladislav Yaroshchuk --- qemu-options.hx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/qemu-options.hx b/qemu-options.hx index 14258784b3..631572f2d4 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2582,6 +2582,17 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, #ifdef __linux__ "-netdev vhost-vdpa,id=3Dstr,vhostdev=3D/path/to/dev\n" " configure a vhost-vdpa network,Establish a vhost-vdpa= netdev\n" +#endif +#ifdef CONFIG_VMNET + "-netdev vmnet-host,id=3Dstr,[dhcpstart=3Daddr,dhcpend=3Daddr,subnetma= sk=3Dmask]\n" + " configure a vmnet network backend in host mode with I= D 'str',\n" + " configure its DHCP server and choose a subnet\n" + "-netdev vmnet-shared,id=3Dstr,[dhcpstart=3Daddr,dhcpend=3Daddr,subnet= mask=3Dmask]\n" + " configure a vmnet network backend in shared mode with= ID 'str',\n" + " configure its DHCP server and choose a subnet\n" + "-netdev vmnet-bridged,id=3Dstr,ifname=3Dname\n" + " configure a vmnet network backend in bridged mode wit= h ID 'str'\n" + " use 'ifname=3Dname' to select a physical network inte= rface to be bridged\n" #endif "-netdev hubport,id=3Dstr,hubid=3Dn[,netdev=3Dnd]\n" " configure a hub port on the hub with ID 'n'\n", QEMU_= ARCH_ALL) @@ -2601,6 +2612,9 @@ DEF("nic", HAS_ARG, QEMU_OPTION_nic, #endif #ifdef CONFIG_POSIX "vhost-user|" +#endif +#ifdef CONFIG_VMNET + "vmnet-host|vmnet-shared|vmnet-bridged|" #endif "socket][,option][,...][mac=3Dmacaddr]\n" " initialize an on-board / default host NIC (using MAC = address\n" @@ -2623,6 +2637,9 @@ DEF("net", HAS_ARG, QEMU_OPTION_net, #endif #ifdef CONFIG_NETMAP "netmap|" +#endif +#ifdef CONFIG_VMNET + "vmnet-host|vmnet-shared|vmnet-bridged|" #endif "socket][,option][,option][,...]\n" " old way to initialize a host network interface\n" --=20 2.23.0