From nobody Wed Feb 11 06:00:07 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=126.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 162917520127155.81844086754063; Mon, 16 Aug 2021 21:40:01 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-heab9ZhtPZKmWrMD5hfoyQ-1; Tue, 17 Aug 2021 00:39:58 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 333BD802B9F; Tue, 17 Aug 2021 04:39:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C62B1AC80; Tue, 17 Aug 2021 04:39:52 +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 CD74E4A704; Tue, 17 Aug 2021 04:39:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17H4dJhX016909 for ; Tue, 17 Aug 2021 00:39:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6338721449DE; Tue, 17 Aug 2021 04:39:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5E9EB21449D9 for ; Tue, 17 Aug 2021 04:39:19 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 46B448007BB for ; Tue, 17 Aug 2021 04:39:19 +0000 (UTC) Received: from m15113.mail.126.com (m15113.mail.126.com [220.181.15.113]) by relay.mimecast.com with ESMTP id us-mta-245-651HU7vQMJy9jmRzdsY2fA-1; Tue, 17 Aug 2021 00:39:14 -0400 Received: from zhangjl0200.home.langchao.com (unknown [58.56.96.27]) by smtp3 (Coremail) with SMTP id DcmowAAX7FtqPRthCBo2AQ--.7384S6; Tue, 17 Aug 2021 12:39:10 +0800 (CST) X-MC-Unique: heab9ZhtPZKmWrMD5hfoyQ-1 X-MC-Unique: 651HU7vQMJy9jmRzdsY2fA-1 From: jx8zjs To: libvir-list@redhat.com Subject: [PATCHv2 4/6] virnetdevovs: Introduce virNetDevOpenvswitchInterfaceClearTxQos and virNetDevOpenvswitchInterfaceClearRxQos Date: Tue, 17 Aug 2021 12:38:14 +0800 Message-Id: <20210817043816.1109-5-jx8zjs@126.com> In-Reply-To: <20210817043816.1109-1-jx8zjs@126.com> References: <20210817043816.1109-1-jx8zjs@126.com> MIME-Version: 1.0 X-CM-TRANSID: DcmowAAX7FtqPRthCBo2AQ--.7384S6 X-Coremail-Antispam: 1Uf129KBjvJXoWxuF1fKw15JFWDAw17uF43Awb_yoWrWFW7pr ykGr90qw10yr1fGwnxCa10gryYyrWrWr1fAas8Z3WUXw4UJr9avw43KrW7Aa15Ar4xJ3Wr AFZ5Zry8Aa47JaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jOgAwUUUUU= X-Originating-IP: [58.56.96.27] X-CM-SenderInfo: dm0y6ybv6rjloofrz/1tbi1w7xSF53W2ZQ9gAAsS X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Cc: shenjiatong@inspur.com, zhangjl02@inspur.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.15 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-ZM-MESSAGEID: 1629175202943100003 Content-Type: text/plain; charset="utf-8" From: Jinsheng Zhang Separate virNetDevOpenvswitchInterfaceClearQos into two steps. When setting qos, we can set only rx or tx and the other one should be cleared. Signed-off-by: zhangjl02 --- src/libvirt_private.syms | 2 ++ src/util/virnetdevopenvswitch.c | 50 +++++++++++++++++++++++++++++++-- src/util/virnetdevopenvswitch.h | 7 +++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 51a400ba59..841cd08435 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2816,6 +2816,8 @@ virNetDevOpenvswitchAddPort; virNetDevOpenvswitchGetMigrateData; virNetDevOpenvswitchGetVhostuserIfname; virNetDevOpenvswitchInterfaceClearQos; +virNetDevOpenvswitchInterfaceClearRxQos; +virNetDevOpenvswitchInterfaceClearTxQos; virNetDevOpenvswitchInterfaceGetMaster; virNetDevOpenvswitchInterfaceParseStats; virNetDevOpenvswitchInterfaceSetQos; diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index e8ec06d3db..7c13e1764f 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -781,6 +781,10 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifname, return -1; } } + } else { + if (virNetDevOpenvswitchInterfaceClearTxQos(ifname, vmuuid) < 0) { + VIR_WARN("Clean tx qos for interface %s failed", ifname); + } } =20 if (rx) { @@ -799,14 +803,18 @@ virNetDevOpenvswitchInterfaceSetQos(const char *ifnam= e, _("Unable to set vlan configuration on port %s"= ), ifname); return -1; } + } else { + if (virNetDevOpenvswitchInterfaceClearRxQos(ifname) < 0) { + VIR_WARN("Clean rx qos for interface %s failed", ifname); + } } =20 return 0; } =20 int -virNetDevOpenvswitchInterfaceClearQos(const char *ifname, - const unsigned char *vmuuid) +virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname, + const unsigned char *vmuuid) { char vmuuidstr[VIR_UUID_STRING_BUFLEN]; g_autoptr(virCommand) cmd =3D NULL; @@ -883,3 +891,41 @@ virNetDevOpenvswitchInterfaceClearQos(const char *ifna= me, =20 return 0; } + +int +virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname) +{ + g_autoptr(virCommand) cmd =3D NULL; + + cmd =3D virNetDevOpenvswitchCreateCmd(); + virCommandAddArgList(cmd, "set", "Interface", ifname, NULL); + virCommandAddArgFormat(cmd, "ingress_policing_rate=3D%llu", 0llu); + virCommandAddArgFormat(cmd, "ingress_policing_burst=3D%llu", 0llu); + + if (virCommandRun(cmd, NULL) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to set vlan configuration on port %s"), i= fname); + return -1; + } + + return 0; +} + +int +virNetDevOpenvswitchInterfaceClearQos(const char *ifname, + const unsigned char *vmuuid) +{ + int ret =3D 0; + + if (virNetDevOpenvswitchInterfaceClearTxQos(ifname, vmuuid) < 0) { + VIR_WARN("Clean tx qos for interface %s failed", ifname); + ret =3D -1; + } + + if (virNetDevOpenvswitchInterfaceClearRxQos(ifname) < 0) { + VIR_WARN("Clean rx qos for interface %s failed", ifname); + ret =3D -1; + } + + return ret; +} diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitc= h.h index 33e52f57c7..cea5f4616d 100644 --- a/src/util/virnetdevopenvswitch.h +++ b/src/util/virnetdevopenvswitch.h @@ -87,3 +87,10 @@ int virNetDevOpenvswitchInterfaceSetQos(const char *ifna= me, int virNetDevOpenvswitchInterfaceClearQos(const char *ifname, const unsigned char *vmid) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; + +int virNetDevOpenvswitchInterfaceClearRxQos(const char *ifname) +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; + +int virNetDevOpenvswitchInterfaceClearTxQos(const char *ifname, + const unsigned char *v= mid) +ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; --=20 2.30.2.windows.1