From nobody Mon Feb 9 11:32:24 2026 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