From nobody Wed May 1 15:05:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678096053; cv=none; d=zohomail.com; s=zohoarc; b=lkY8mQra6Xv2hPD+bL1hKHpJJ5luaejspxzFb/MwTvqPiFaszkPJrJPTIaWj8pK0CadfIzZ+L+wCC3bhkQjYFlCC9Tthg2OLU8XcMFHhPAaoH+innxuWyLlYIkgzSkiKM+wIMTOaOMs/n0WOR5+ZPGfEzut0XjhAZNosaLCzMsQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678096053; h=Content-Type:Content-Transfer-Encoding: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=IZwmnFcjrhn0M5TqLVS7rM+jn9lO/CBa8Sp6l4Ttxb8=; b=j9b8lB5LxSYEpKSMOHk0GNjIO4sg9IYALKCzT6YefGIyFreKJoa+amwahGUl0u5MhbaffjFZ0wOAatlaB/LBerbIzhYd47ZrJXcljUjLeXrVyDeENJynmz8LPu4kfScNeva102YaiO+B7A982nXra2z23O3EbtmA95MY8JMvS2g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1678096053810668.9576626850921; Mon, 6 Mar 2023 01:47:33 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-282-_C8AlFqbO2m4pXuJDiFF3w-1; Mon, 06 Mar 2023 04:47:31 -0500 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0410B8021BC; Mon, 6 Mar 2023 09:47:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC3C7492B00; Mon, 6 Mar 2023 09:47:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 24FE31946A44; Mon, 6 Mar 2023 09:47:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 626C61946586 for ; Mon, 6 Mar 2023 09:47:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 391EA40C83B6; Mon, 6 Mar 2023 09:47:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5C9640CF8F0 for ; Mon, 6 Mar 2023 09:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678096052; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=IZwmnFcjrhn0M5TqLVS7rM+jn9lO/CBa8Sp6l4Ttxb8=; b=hYJBO6wJSAucENYGCceunOnzHmEaZ5ySbyhYJpvDYrSIRiQhCgJB+U9vrYTgDLxN9MZSYO gQEuUQsjG/qkY9JPWRBKX1mCXAHtqvZ5VvjX39Csh12O9J50vt4huzK5o0dHMQZwcu2Tsl pHTs02aSJ/knKmQl3RrkNck2oGm/S/c= X-MC-Unique: _C8AlFqbO2m4pXuJDiFF3w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] conf: Make macvtap ethernet share host view Date: Mon, 6 Mar 2023 10:47:23 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678096054747100002 Content-Type: text/plain; charset="utf-8"; x-default="true" When fetching stats for a domain's , or when setting up its QoS, we can face two situations: 1) the device "shares" the host view, meaning each packet sent/received on the interface by a domain is accounted for in the same category on the host, or 2) the device is at the other side, and a packet send by a domain, is in fact packet received on the host. This fact affects whether we need to swap RX/TX values when fetching stats, or setting up QoS. We have this convenient helper function (virDomainNetTypeSharesHostView()), which returns to which category given interface type falls into. Now, for unmanaged type=3D'ethernet' our options are quite limited, because it's user's responsibility to set up the host side of the interface. And it can be just anything. Fortunately, we have another convenience function (virNetDevMacVLanIsMacvtap()), which determines whether given interface is a macvtap (which is notoriously known for falling into the first category). Let's use it to help virDomainNetTypeSharesHostView() determine the view more accurately. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2175449 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/domain_conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 34d38f9958..ee74d5ab8a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29576,8 +29576,12 @@ virDomainNetTypeSharesHostView(const virDomainNetD= ef *net) switch (actualType) { case VIR_DOMAIN_NET_TYPE_DIRECT: return true; - case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_ETHERNET: + if (net->managed_tap =3D=3D VIR_TRISTATE_BOOL_NO && + virNetDevMacVLanIsMacvtap(net->ifname)) + return true; + break; + case VIR_DOMAIN_NET_TYPE_USER: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: --=20 2.39.2 From nobody Wed May 1 15:05:36 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1678096053; cv=none; d=zohomail.com; s=zohoarc; b=dTjn9dIQvsmrs4NE3WWJLSBAtNjejiFerHChkNYsSK/W3OlJW40R0n2SaR+WlU/q9CjJvjZQO8QmMWXEDifr7Lxo2mus+KbhLSzCnTdRObn5Fi6UuCXxoTXVbLYE33Jg6s8y6v3eUZzsWOFKhPvv4gm+nU1U0j+M/jxGEASjrXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1678096053; h=Content-Type:Content-Transfer-Encoding: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=/xbjyOm50sAzsRzZ1ro9fSxszwN62u8kLfW1tl8ou9o=; b=duS0Z74MFSnlIPTEJJUK4emjuS3IbTOxpAb1jlIifL/XIjUv1V2lv18dxsSvS+X/W4YThXCr8nKsn/rqiXHLGV1qCUsHcOJa8PJxNPb34cL0uCvtWZCex6RBUzW27k1UDrIA1EBuiS4JkLegEJkWvMsAdu4OnWEayPEM5WtAakU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1678096053694562.7738251912116; Mon, 6 Mar 2023 01:47:33 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-3fq5OfE1P022vBdZwVIwAA-1; Mon, 06 Mar 2023 04:47:31 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 64439811E6E; Mon, 6 Mar 2023 09:47:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 027E72166B26; Mon, 6 Mar 2023 09:47:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E3128194658D; Mon, 6 Mar 2023 09:47:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EF3E11946586 for ; Mon, 6 Mar 2023 09:47:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C75DD400DFA1; Mon, 6 Mar 2023 09:47:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FC5C40C83B6 for ; Mon, 6 Mar 2023 09:47:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678096052; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/xbjyOm50sAzsRzZ1ro9fSxszwN62u8kLfW1tl8ou9o=; b=GQV0lB2DX+/LUQuowUE5vFM7BahpNwM9RMmM7wnpA2d8MvAQeGWFRXbOkxsB87DIz4fbVn ZPK1/z0DZi2yjsohJPAjJaZzgtp2IKX8G6mOZ0Q88aMm0OvL7cCzh2+FploPRTByzip6am Gf0HPTdT4yKaIn1Svj7D4SUmQI9RLgY= X-MC-Unique: 3fq5OfE1P022vBdZwVIwAA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] src: Document virDomainInterfaceStats() limitation Date: Mon, 6 Mar 2023 10:47:24 +0100 Message-Id: <37d3223fa7eff8d87a32edb24117d33952598eb9.1678095981.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1678096054746100001 Content-Type: text/plain; charset="utf-8"; x-default="true" For unmanaged ethernet , it is user's responsibility to set up the interface. And as such it can be just anything. Therefore, it's (almost) impossible for the virDomainInterfaceStats() API to tell whether RX/TX values need to be swapped or copied verbatim into the return structure. Document this limitation. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- docs/manpages/virsh.rst | 3 ++- src/libvirt-domain.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index d5b614dc03..26c328d390 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -2012,7 +2012,8 @@ interface stats are only available for interfaces tha= t have a physical source interface. This does not include, for example, a 'user' interface type since it is a virtual LAN with NAT to the outside world. *interface-device* can be the interface target by -name or MAC address. +name or MAC address. Please note, for an unmanaged *ethernet* +type returned stats might have RX/TX swapped. =20 =20 domiftune diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 3199a27065..379057d9a7 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -5965,6 +5965,9 @@ virDomainBlockStatsFlags(virDomainPtr dom, * * The returned stats are from domain's point of view. * + * Please note, for an unmanaged ethernet type, returned stats + * might have RX/TX swapped. + * * Returns: 0 in case of success or -1 in case of failure. * * Since: 0.3.2 --=20 2.39.2