From nobody Thu Apr 18 22:40:55 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=1669291864; cv=none; d=zohomail.com; s=zohoarc; b=WCZlyUcJWAWzlQQ/AZyyDRNkRJeyMGgbi48Pds10ZTQp23sdOWbWiDt/BC1Xc0ixpqz4vKSvKwCMB2mcABVyH1h5Ofwjti4FecLXLta862MLicS9mWWsp+d/pIYMsQ/MpON67qiFk724d+X4sFAtu7DSc4+c0DvD1KmraaM8s9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669291864; 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=gnNdWOgvXflPwJAK8sMrM3HB5QwGc1IjacW8iapZAP0=; b=SAbdeVwpJzAYehLYLo8Ox5eP57+1PrZq0PQneMWzPp/njNhEzdP+1gNvo0nngtSk8Mpt6BFBwQJmaZJjSMnNOs6rPH+0R4FW5Cqsyu0/PFk4pC4+OeJnNd6mrYePLLjORvrpUvd9iGJ1ll/zJQAkaSKCROs7gyMmNOEQC6b1ods= 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 1669291864699260.1142734287931; Thu, 24 Nov 2022 04:11:04 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-aD6ODnI-PzmA1krBhTet1Q-1; Thu, 24 Nov 2022 07:10:52 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 380873C0E46D; Thu, 24 Nov 2022 12:10:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22D98C15BA5; Thu, 24 Nov 2022 12:10:49 +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 6BE78194658C; Thu, 24 Nov 2022 12:10:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 840AA1946587 for ; Thu, 24 Nov 2022 12:10:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 59A60200B42E; Thu, 24 Nov 2022 12:10:21 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id F12B32027064 for ; Thu, 24 Nov 2022 12:10:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669291863; 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=gnNdWOgvXflPwJAK8sMrM3HB5QwGc1IjacW8iapZAP0=; b=az+M6F9n46JlcR7oZoNGD+ZEcVPO8rXA/g+V67SdcrvPvnhaA3c+rRBfanna290JGiR2Qa 3IxA+hHiuJbzTBrO7ekjQYFKi+8tDW0GhGVxZcGZdaCk0/K7Fh7tKxd8PDttbvxrbAFvHR 9cTfGfcSt6MnIRZDVOrgHbGkGE4e6dI= X-MC-Unique: aD6ODnI-PzmA1krBhTet1Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] conf: Make VIR_DOMAIN_NET_TYPE_ETHERNET not share 'host view' Date: Thu, 24 Nov 2022 13:10:16 +0100 Message-Id: <2985a56dc02d87cf99543f7b0563dc2259822426.1669291733.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.8 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: 1669291866343100002 Content-Type: text/plain; charset="utf-8"; x-default="true" When setting up QoS for a domain , or when reporting its statistics we may need to swap TX/RX values. This is all explained in comment to virDomainNetTypeSharesHostView(). However, this function claims that VIR_DOMAIN_NET_TYPE_ETHERNET also shares the 'host view', meaning the TX/RX values must be swapped. But that's not true. An easy reproducer is to start a domain with two -s: one type of network, the other of type ethernet and configure the same for both. Reversed setting can then be observed (e.g. via tc). Reported-by: Oleg Vasilev Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark Tested-by: Oleg Vasilev --- src/conf/domain_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3790121cf7..ef930b1687 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -29106,9 +29106,9 @@ virDomainNetTypeSharesHostView(const virDomainNetDe= f *net) virDomainNetType actualType =3D virDomainNetGetActualType(net); switch (actualType) { case VIR_DOMAIN_NET_TYPE_DIRECT: - case VIR_DOMAIN_NET_TYPE_ETHERNET: return true; case VIR_DOMAIN_NET_TYPE_USER: + case VIR_DOMAIN_NET_TYPE_ETHERNET: case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: --=20 2.37.4 From nobody Thu Apr 18 22:40:55 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=1669291854; cv=none; d=zohomail.com; s=zohoarc; b=ed/02OrneL50a2qP3hUa1Y4YpQrSKAalhu1zObT+tQ8XQC+HPZ5XUh5Rh+z8Az5kwGvq2L7fgCEMeeciRMJX/rg0N550lHrvpkG7Zx0NFQq5DYENFSjGbes1RUEWgxEZDpVjDVlKhtrVeN19hbyrYYpmNchEFtRPXaPJEbnph4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669291854; 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=XjD6DaXrh10BSi80hm7iT7vdBr35mUWyr/76AfiVZyg=; b=aR4Ko+rQPPcK0d1XPbKeq8pueffvz4SqA3wkbf558r1k+d7x+SGMWAsZSv0+uKso1qwY8S8Az/C9C8c8wyqMpRn03r4zr4cWyPMKxBx/uK1SdNCBJggDCRtUHyE4zWPoiTT/XscyDeFYFZ0tcR3LzhhWybZvDTZxQDQLHAKXRq4= 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 1669291854708309.11849548002317; Thu, 24 Nov 2022 04:10:54 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-440-Zy49AVHNNrO1aJfAiAzPkg-1; Thu, 24 Nov 2022 07:10:49 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A7573804502; Thu, 24 Nov 2022 12:10:47 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27D9240C94AA; Thu, 24 Nov 2022 12:10:47 +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 03B241946A7E; Thu, 24 Nov 2022 12:10:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A6AAB1946A66 for ; Thu, 24 Nov 2022 12:10:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8CAB82028E94; Thu, 24 Nov 2022 12:10:22 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 313232028E8F for ; Thu, 24 Nov 2022 12:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669291853; 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=XjD6DaXrh10BSi80hm7iT7vdBr35mUWyr/76AfiVZyg=; b=HXI+2NDgzZPFc5QzLkuSETZHSbzjdjsl2YjfCTweghi6mepq4OoAz4Cijs/MEOmxNCeXhx aVnu3WML+gYNUbdEC83A3xMwHQxwu5nacsvntUDr71A/5OeaxHiEipcKW8eT3Q3GMavRZH Vv9PB1TbGc8Xx/1Z6kF9pEOmOD/NXd0= X-MC-Unique: Zy49AVHNNrO1aJfAiAzPkg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] virnetdevbandwidth: Unbreak tc filter update on Linux-4.20+ Date: Thu, 24 Nov 2022 13:10:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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.2 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: 1669291856269100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Guests are allowed to change their MAC addresses. Subsequently, we may respond to that with tweaking that part of host side configuration that depends on it. In this particular case: QoS. Some parts of QoS are in fact set on corresponding bridge, where overall view on traffic can be seen. Here, TC filters are used to place incoming packets into qdiscs. These filters match source MAC address. Therefore, upon guest changing its MAC address, the corresponding TC filter needs to be updated too. This is done by simply removing the old one and instantiating a new one, with new MAC address. Now, u32 filters (which we use) use a hash table for matching, internally. And when deleting the old filter, we used to remove the hash table (ID =3D 800::) and let the new filter instantiate new hash table. This used to work, until kernel release 4.20 (specifically commit v4.20-rc1~27^2~131^2~11 and its friends) where this practice was turned into error. But that's okay - we can delete the specific filter we are after and not touch the hash table at all. Signed-off-by: Michal Privoznik Reviewed-by: Jiri Denemark --- src/util/virnetdevbandwidth.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c index d816bcbf06..e67cbd164d 100644 --- a/src/util/virnetdevbandwidth.c +++ b/src/util/virnetdevbandwidth.c @@ -114,8 +114,10 @@ virNetDevBandwidthManipulateFilter(const char *ifname, goto cleanup; } =20 - /* u32 filters must have 800:: prefix. Don't ask. */ - filter_id =3D g_strdup_printf("800::%u", id); + /* u32 filters must have 800:: prefix. Don't ask. Furthermore, handles + * start at 800. Therefore, we want the filter ID to look like this: + * 800::(800 + id) */ + filter_id =3D g_strdup_printf("800::%u", 800 + id); =20 if (remove_old) { g_autoptr(virCommand) cmd =3D virCommandNew(TC); --=20 2.37.4