From nobody Tue Sep 9 23:39:22 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 1748517476914785.2599758476321; Thu, 29 May 2025 04:17:56 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 0248718C9; Thu, 29 May 2025 07:17:55 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BC04C1441; Thu, 29 May 2025 07:17:15 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id D7D881224; Thu, 29 May 2025 07:17:11 -0400 (EDT) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 16E171362 for ; Thu, 29 May 2025 07:17:11 -0400 (EDT) Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-ad1b94382b8so130401166b.0 for ; Thu, 29 May 2025 04:17:11 -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-ada6ad394dasm122537666b.130.2025.05.29.04.17.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 May 2025 04:17:08 -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=1748517429; x=1749122229; 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=OuvOpYf0y4Wqht2MUJIsMocvkY0eF+IJnoS4tuVPsP6bZC7PRYgLkK1q2BF9iABj0E V/1oC9Y/Ckw0ANSxblDbgTsdK7NCZYl/IldwAD1FBrDGGxpyaoZmDZGn+lAZNLxb0HER 9wyzTgw7tT4Kos3jj7odlNPYAM3whsN7VeOMsxzsMJNfkeOD8nfGl3U6p85fdtE6T0NB RZh9BlDcWjZLi1woEgvOc390B5KFYMyxvLe8fdUCaRFzpHbgKIcNEiumRHv3xMO7kGkd S1uXzReICeUUWMTbgkwU3/DK8Vg0+geCxt8Tb/Q8H9jewx2wZtvx+X0lNhKr+Lbb/FHX tKRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748517429; x=1749122229; 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=mGyfOveaAnpuNFNBb0Sdca0tbmV48IQ0kI6+6KZnYZRsSKmCEhjeLpJs0Im6NJVdWB gdADwybnLnzxV5gDB/5+V6BhH1wzItU7V9nDvCzoUuagAlP4qmWZ2x0HbvUAKm8bFs1P QS5LwsgqAgGNZzWAJaXgfcA++XX/6jRI/2Ag1Yg0GeTbaNKRmbInvVYf8PGei+Qub9b1 J7g1DRXd3umLO/Xqlrp4O8+WHW6wQQnd0zR1zkmyf3D0C1CuU8jnZtXjCZX2YR/Bkr1X MvoBJdVCnJqEVbMD0bc2Dy3ypOs/toDzIk020Twcg4gKOQotIUvqVzuU+4UN3m0ynBoX gBcA== X-Gm-Message-State: AOJu0YzRcaaAjJgs84mm35Eak4CJyZ1Z+ccs8PPWCpJsfMjKWtcGaNvd eKTMCuz93E2M+B6E3YaEdHoAaJut4+HB5x22BVg2dwImhe5xaIoMYx0wa9VgKodG1JJlSQ== X-Gm-Gg: ASbGncupI2YeXbqepiGCTBXnOO2v2ywW+6ReDsyLV25ko+9SfoqQN8IhjkFipsulgFq JCog4/H1cwhtmu42VVUVvu2N/oKzc0zoHpH/GhrLni37miIgTlN9fDLvfUdll2sDoIddlA6+3cZ bMNHHtbtdX5LOOXHqGINOQDF7J6LvYVWrDO0NzHqOEp9WFIaayVMJCNQonAMBnkJlgw4iw/Jwyh aWSTybs+mjm2Eh2sNK0C3wxRSyHZJx6Wo+fIHRjnaft2AZ+4EnzsrCA22Ddy7iha1AxR0bev8Gd 1n+BnNgy0z0kIZaE+XGOxHVjqHW74sSUh5Z6aZNSOshjMFgrgzhNzg6kpk+CChTor0S9RVJQhzz nXaYoGKwppU35/Kot2/VgLB47 X-Google-Smtp-Source: AGHT+IEibHkvdv7GGMka/W2VZIlFm2dPIvYY4eqr4Lpiw35B6MefIInAYgLb1QXr1z4yqY5Pq1MHGw== X-Received: by 2002:a17:906:6a18:b0:ad8:83da:f862 with SMTP id a640c23a62f3a-adabf417c96mr161781166b.0.1748517429155; Thu, 29 May 2025 04:17:09 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH 1/3] bhyve: implement domainInterfaceStats Date: Thu, 29 May 2025 13:15:49 +0200 Message-ID: <20250529111551.43347-2-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250529111551.43347-1-bogorodskiy@gmail.com> References: <20250529111551.43347-1-bogorodskiy@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: LIIYNGAWE6CDOQXUFMEQMK6K4VP5ZJFH X-Message-ID-Hash: LIIYNGAWE6CDOQXUFMEQMK6K4VP5ZJFH 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: 1748517478310116600 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