From nobody Tue May 7 17:48:00 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=1641300816; cv=none; d=zohomail.com; s=zohoarc; b=WuIwZ0MnADVQ+uqH5X/1xnmr+ePpHAV5GdT0k9/BXvxkAkezXpVQ4be/todskIx+9gsQOf2MKuXlUPeOxnhFcROPjs6d0pFlZyvJBLAXI8wupv8BpuPbpxPlElCT1vmDnvB3TC0IOdNuRHSpbHo9ASeRK9PlLISS85LctO0PlCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641300816; 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=cUeDVqos4IYB2R/A0ts2rDsiOXhdJCYyAtJI5CeKEjU=; b=ZzvJVnhg5RH6bgSI+mT7HxZqSWrlBNif4/aPA2CwHFodkAms9Sq7qoPig7PgUWNcG/0NYWmLr6YpZYc5YezFc+vaTsQsn4El6lkyxd0xK6lmiTa9VWDN05MSSuSObilfZHqu4O7A2uUYgytZ9i2QrQT2o+q39OxusIfaruSZ2ME= 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 1641300816650634.6837873712834; Tue, 4 Jan 2022 04:53:36 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-2--AibzoWRMIW1-gl12xmeBg-1; Tue, 04 Jan 2022 07:53:32 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5F631015DA2; Tue, 4 Jan 2022 12:53:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CF357AB68; Tue, 4 Jan 2022 12:53:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 6D79C1806D2E; Tue, 4 Jan 2022 12:53:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204CrHvq014879 for ; Tue, 4 Jan 2022 07:53:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id C36397E648; Tue, 4 Jan 2022 12:53:17 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C8D07E647 for ; Tue, 4 Jan 2022 12:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641300815; 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=cUeDVqos4IYB2R/A0ts2rDsiOXhdJCYyAtJI5CeKEjU=; b=RVl3tXjIw8pveD2Xo9Ksq2t/7B1iEpQ2k/035tFCHPoASRcSxK9Au7l+esRrsLwO/g4pKl aE+AM01+03QZbGhZ12+Rf9rmawCi8X7qruqWW+m8VJ1NL+3crqh7Spxv0wXDf1QZzQQu2L bC8b5rqBJgrVcWqVNfuROd80oP2wJso= X-MC-Unique: -AibzoWRMIW1-gl12xmeBg-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] docs: Clarify 'burst' units for QoS Date: Tue, 4 Jan 2022 13:53:05 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1641300817632100001 Content-Type: text/plain; charset="utf-8" The burst attribute for bandwidth specifies how much bytes can be transmitted in a single burst. Therefore, the unit is in multiples of 1024 (thus kibibytes) not SI-like 1000. It always has been like that. The 'tc' output is still confusing though, for instance: # tc class add dev $DEV parent 1: classid 1:1 htb rate 1000kbps burst 209= 7152 # tc class show dev vnet2 class htb 1:1 root rate 8Mbit ceil 8Mbit burst 2Mb cburst 1600b Please note that 2097152 =3D 2*1024*1024. Even the man page is confusing. From tc(8): kb or k Kilobytes mb or m Megabytes But I guess this is because 'tc' predates IEC standardisation of binary multiples and thus can't change without breaking scripts parsing its output. And while at it, adjust _virNetDevBandwidthRate struct member description, to make it obvious which members use SI/IEC units. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- docs/formatnetwork.html.in | 2 +- src/util/virnetdevbandwidth.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index b1b2391f43..fad43f77ea 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -634,7 +634,7 @@
burst
- Optional attribute which specifies the amount of kilobytes that + Optional attribute which specifies the amount of kibibytes that can be transmitted in a single burst at peak speed.
floor
diff --git a/src/util/virnetdevbandwidth.h b/src/util/virnetdevbandwidth.h index 3d520721f6..c82029fc0f 100644 --- a/src/util/virnetdevbandwidth.h +++ b/src/util/virnetdevbandwidth.h @@ -23,10 +23,10 @@ =20 typedef struct _virNetDevBandwidthRate virNetDevBandwidthRate; struct _virNetDevBandwidthRate { - unsigned long long average; /* kbytes/s */ - unsigned long long peak; /* kbytes/s */ - unsigned long long floor; /* kbytes/s */ - unsigned long long burst; /* kbytes */ + unsigned long long average; /* kilobytes/s */ + unsigned long long peak; /* kilobytes/s */ + unsigned long long floor; /* kilobytes/s */ + unsigned long long burst; /* kibibytes */ }; =20 typedef struct _virNetDevBandwidth virNetDevBandwidth; --=20 2.34.1 From nobody Tue May 7 17:48:00 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=1641300810; cv=none; d=zohomail.com; s=zohoarc; b=M8aKYGIWo6xISCinFiKnjzjy9UNEsrhbAzX8j9CEB0ZPzjO6ZIMXd9SokVULJVxgJr952pTMNF4k/88q9mrxSVkBJzL6wL4ta5bHUKKEc0tx/Yqw1Mzz+mqzPC39hlhMKcdJV+VQSeV+Apc2+NrXXSQ6uoWOZPkOMrHCgyOBEaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641300810; 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=xhp25VbV1dGYpwCOpXdzdj01eGViM7TK2+mJTiLFPRs=; b=dOGgVh97t9oXtIQart3kb2d2xLlMAIlKgbCHs52GiW0f8z3wDnLnDvVhwYBC4RCeXFClUS2b3gwVE6ACRJ3n+sgi4y+25xmXl7fDh4XCypYYcqS4Fso5MTeoYamvZ21ZKIC2VG0lg5boH9iDpVcn07Z/9kgJ9k4KePK8tkfrEhw= 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 164130081068684.4153848234588; Tue, 4 Jan 2022 04:53:30 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-55-fM0usolmPd6RnqTDAEyJ0g-1; Tue, 04 Jan 2022 07:53:28 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EDCD41923E20; Tue, 4 Jan 2022 12:53:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A9CE97E91B; Tue, 4 Jan 2022 12:53:21 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 720511806D1D; Tue, 4 Jan 2022 12:53:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204CrIMK014889 for ; Tue, 4 Jan 2022 07:53:18 -0500 Received: by smtp.corp.redhat.com (Postfix) id 91DA57E647; Tue, 4 Jan 2022 12:53:18 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.64]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1B75C7E64B for ; Tue, 4 Jan 2022 12:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641300809; 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=xhp25VbV1dGYpwCOpXdzdj01eGViM7TK2+mJTiLFPRs=; b=dygk9q/GG1+W1oa+apItowomUp/h9qAZrkxpdwIRMKb69GM122HBaZhup8dyiA2i7FuHDf 8vz6jDitlFFSn120EYnQpoK8osvULJaEDq8VLdIt1prEyBAFwlcMkGWuCX1MDoQxmFBxnX 0AtsOdHwq/1YB5LZ0XhsMED23I7p3qM= X-MC-Unique: fM0usolmPd6RnqTDAEyJ0g-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] virnetdevopenvswitch: Fix 'burst' value passed to ovs-vsctl Date: Tue, 4 Jan 2022 13:53:06 +0100 Message-Id: <23ecc22653061d06b7d0f83586bf804c4d0f99c4.1641300769.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1641300812888100001 Content-Type: text/plain; charset="utf-8" As described in the previous commit, the units for 'burst' are kibibytes and not kilobytes, i.e. multiples of 1024 not 1000. Therefore, when constructing ovs-vsctl command the burst value must be multiplied by 1024 and not just 1000. And because ovs expects this size in bits the value has to be multiplied again by 8. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1510237#c26 Signed-off-by: Michal Privoznik --- src/util/virnetdevopenvswitch.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index 5dab545037..8741e0ed3a 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -638,11 +638,13 @@ virNetDevOpenvswitchFindUUID(const char *table, } =20 /* - * Average, peak, floor and burst in virNetDevBandwidth are in kbytes. - * However other_config in ovs qos is in bit. - * ingress_policing_rate in ovs interface is in kbit. + * In virNetDevBandwidthRate, average, peak, floor are in kilobyes and bur= st in + * kibibytes. However other_config in ovs qos is in bits and + * ingress_policing_rate in ovs interface is in kilobit for + * ingress_policing_rate and kibibit for ingress_policing_rate. */ -#define VIR_NETDEV_TX_TO_OVS 8000 +#define KBYTE_TO_BITS(x) (x * 8000ULL) +#define KIBIBYTE_TO_BITS(x) (x * 8192ULL) #define VIR_NETDEV_RX_TO_OVS 8 =20 /** @@ -717,11 +719,11 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifnam= e, g_autofree char *qos_uuid =3D NULL; g_autofree char *queue_uuid =3D NULL; =20 - average =3D g_strdup_printf("%llu", tx->average * VIR_NETDEV_TX_TO= _OVS); + average =3D g_strdup_printf("%llu", KBYTE_TO_BITS(tx->average)); if (tx->burst) - burst =3D g_strdup_printf("%llu", tx->burst * VIR_NETDEV_TX_TO= _OVS); + burst =3D g_strdup_printf("%llu", KIBIBYTE_TO_BITS(tx->burst)); if (tx->peak) - peak =3D g_strdup_printf("%llu", tx->peak * VIR_NETDEV_TX_TO_O= VS); + peak =3D g_strdup_printf("%llu", KBYTE_TO_BITS(tx->peak)); =20 virUUIDFormat(vmuuid, vmuuidstr); vmid_ex_id =3D g_strdup_printf("external-ids:vm-id=3D\"%s\"", vmuu= idstr); --=20 2.34.1