From nobody Tue Sep 9 23:41:31 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1748756551314778.3697136342688; Sat, 31 May 2025 22:42:31 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 54F9112D0; Sun, 1 Jun 2025 01:42:30 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 07B6B13ED; Sun, 1 Jun 2025 01:41:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 74BF11298; Sun, 1 Jun 2025 01:41:45 -0400 (EDT) Received: from mail-ej1-f53.google.com (mail-ej1-f53.google.com [209.85.218.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id B9CEA128E for ; Sun, 1 Jun 2025 01:41:44 -0400 (EDT) Received: by mail-ej1-f53.google.com with SMTP id a640c23a62f3a-adb2bb25105so505682166b.0 for ; Sat, 31 May 2025 22:41:44 -0700 (PDT) Received: from tulp.my.domain (80-115-115-199.cable.dynamic.v4.ziggo.nl. [80.115.115.199]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-adb35af4456sm399732266b.182.2025.05.31.22.41.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 May 2025 22:41:42 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748756503; x=1749361303; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tmeN9qZM+TR8Cj3yHEUiUu8g9XGu6BiYFUYYXw100Xs=; b=XJKx5zZTb1kNLJwbv5TQP+mMjaQ1hb5gCamz8sv7+2HYvAgCgNjDJjngQEeHAr1/2m 6tiR6qEtS/IrfCrH6vMy0SRRLjJK/riXs5LNB+QO1AlP4brkJq3Stq2/DEVIVPY8VK2g jP4F/AvzjAD/Rgq/3SPSi1eY1Io7IAUPYGtU8TbQY0XGQIfzTVRNi1aEwxZNAFhhzWMK QkuYFWIMBNAGW6noO3KIrryVJuXlVaTxZ7s0o0CL/vTtP3QIDdPlLxJATIbogK++XomV vL5qN8vKxPuSUpAtOEvk7PmXco5H2qu2t5lDEUKlNc4AaSyEsYkxwYCqZ3hOie6KE3h3 ycRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748756503; x=1749361303; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tmeN9qZM+TR8Cj3yHEUiUu8g9XGu6BiYFUYYXw100Xs=; b=BI1WDA6lj/9Ln3ccEK7R1EPdxA8zJqjxcOt2w0A3I56o5wzqUVkB/LAbDO4NuDU1nM 9TPirJIbyq1s4fWWTFpThfQs7IJiORILkR0MMtvtyU1X8PhODW52YGQTX10hEwfhvcSs pGNk3LK2qCu2Bx2Iq/UWrhS+ynB8Wjs+bzHwYWwnaNacEECb/1gHThDRuoqvd1ZOOMvQ HqBQhhmCIbtaEQsHk584bH/r+Hu8fJg6uPVKbPH3IHgntQM5DBa8bBEFYrDNVAjMzSu5 sJRhmHnqzPyB3n1+YUGsoy95cGDZ8GOn1flee3bXTBcWq+26q5J37XPOJW6WOHZ7fT8E UVKw== X-Gm-Message-State: AOJu0Yw2QrhtrooWRvwKNEFIzt3fVIK9Ts8uy++9ubVLYzWyD4UFuwgj XB9yCemmW0aVoyXIPilyJm2DSuBC2MhdC9bjIMQKUpXDGrIKW40ZOUKtj2lBwMiV5Ko= X-Gm-Gg: ASbGncvn1/0P7n3gnl6QcAkdvimygjMppyWb8orANFwT7HhE4T+GomtsUliFW4zU4kP VRxK1PzEo4DsX/Qk+91P3K3LHUKwY/V75aSo9DmX1Ps8YhOhSnGcNKnEa9sViUnxaQWInd8cii6 sn2kFTFtXfAMwv6iVEvx+JLg1YPyJeBUv+GDG5gc9RqkFM6VwkNo8evhuiarHIvkuxB6ElVcDiZ xow0UT90YBpP3yLJS0721+JzFZqdaAjYDaDOijOOz4n/FJ6lna5OOQl8gacIZVaFbP3/+fFNmI5 zFB+bO6G0p0K3H6vVWetmeUvv4l4MFYSD4F9Be614+xguG+xT0q/7SNB9nc+9kBgrY5NBZZJObx 6kDxmbbVFnMxUl927XufWn7/I X-Google-Smtp-Source: AGHT+IHh50Ug2e2BSLsjWX5rd2k1KDDNFarzq7YvmRFs0FcHp5hFo6/pmDUIA0UHuJsy9nLqhw1JMQ== X-Received: by 2002:a17:906:6a1d:b0:ad9:adc3:20d4 with SMTP id a640c23a62f3a-adb36b230b5mr818789466b.4.1748756503155; Sat, 31 May 2025 22:41:43 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH v2 1/4] bhyve: implement domainInterfaceStats Date: Sun, 1 Jun 2025 07:40:23 +0200 Message-ID: <20250601054026.59551-2-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250601054026.59551-1-bogorodskiy@gmail.com> References: <20250601054026.59551-1-bogorodskiy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: R42SLOOAHA5LKSVYM4U3OZ45YHSVBREW X-Message-ID-Hash: R42SLOOAHA5LKSVYM4U3OZ45YHSVBREW X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1748756553310116600 Content-Type: text/plain; charset="utf-8" The virNetDevTapInterfaceStats() function already works on FreeBSD, so it's just a matter of wrapping that for domainInterfaceStats. Signed-off-by: Roman Bogorodskiy --- src/bhyve/bhyve_driver.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index db7d440a97..e4698b71bf 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -55,6 +55,7 @@ #include "conf/domain_capabilities.h" #include "virutil.h" #include "domain_driver.h" +#include "virnetdevtap.h" =20 #include "bhyve_conf.h" #include "bhyve_device.h" @@ -1625,6 +1626,38 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn, return ret; } =20 +static int +bhyveDomainInterfaceStats(virDomainPtr domain, + const char *device, + virDomainInterfaceStatsPtr stats) +{ + virDomainObj *vm; + int ret =3D -1; + virDomainNetDef *net =3D NULL; + + if (!(vm =3D bhyveDomObjFromDomain(domain))) + goto cleanup; + + if (virDomainInterfaceStatsEnsureACL(domain->conn, vm->def) < 0) + goto cleanup; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + if (!(net =3D virDomainNetFind(vm->def, device))) + goto cleanup; + + if (virNetDevTapInterfaceStats(net->ifname, stats, + !virDomainNetTypeSharesHostView(net)) <= 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + static virHypervisorDriver bhyveHypervisorDriver =3D { .name =3D "bhyve", .connectURIProbe =3D bhyveConnectURIProbe, @@ -1685,6 +1718,7 @@ static virHypervisorDriver bhyveHypervisorDriver =3D { .connectIsEncrypted =3D bhyveConnectIsEncrypted, /* 1.3.5 */ .connectDomainXMLFromNative =3D bhyveConnectDomainXMLFromNative, /* 2.= 1.0 */ .connectGetDomainCapabilities =3D bhyveConnectGetDomainCapabilities, /= * 2.1.0 */ + .domainInterfaceStats =3D bhyveDomainInterfaceStats, /* 11.5.0 */ }; =20 =20 --=20 2.49.0