From nobody Sat Feb 7 09:30:16 2026 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 --- 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