From patchwork Mon Feb 12 10:38:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Huettner X-Patchwork-Id: 1897680 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TYLY34rGGz23fC for ; Mon, 12 Feb 2024 21:39:03 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id BC61E6120A; Mon, 12 Feb 2024 10:39:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id m862aIkYrE5W; Mon, 12 Feb 2024 10:38:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 39A46607A8 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7; dkim=fail reason="signature verification failed" (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id 39A46607A8; Mon, 12 Feb 2024 10:38:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 0C6DEC0077; Mon, 12 Feb 2024 10:38:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1ABC2C0037 for ; Mon, 12 Feb 2024 10:38:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id F05BA418E3 for ; Mon, 12 Feb 2024 10:38:56 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ueDu58R3ysSH for ; Mon, 12 Feb 2024 10:38:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2613::601; helo=eur05-vi1-obe.outbound.protection.outlook.com; envelope-from=felix.huettner@mail.schwarz; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4DCBF40098 Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=reject dis=none) header.from=mail.schwarz DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4DCBF40098 Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7; dkim=pass (2048-bit key) header.d=mail.schwarz header.i=@mail.schwarz header.a=rsa-sha256 header.s=selector1 header.b=eeQ1ZhQ7 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2613::601]) by smtp4.osuosl.org (Postfix) with ESMTPS id 4DCBF40098 for ; Mon, 12 Feb 2024 10:38:54 +0000 (UTC) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=lqzb0NRJXduCt88gmUt4vbORr4HS5Se1h32VbwyUKs+H/uTo1MMgTr1j99WFKVdFOJ9uNifWogUpgvqmL4ziSFtYPyKO9qGaoM+rIzgxJVdycCd5tUZw+0AcAyp4AibcTQAGCioKzeaIPD9M5ZUaUfa+CWcVSj+tnteNa5tQb070sib2fi2JtA05IdUjdBtfL7G7hWvkTPw5Vnkt3wuRQpGZk7eSvgd0XTLD7JuYkPD5l1i7TIhwQUmpEL+jm9wk9JmAEro1Yu3/zs1QgpuKkFLcZ7sHsuYVc3dFLEr0xnDK7VJMoRn/r4z8TQisyMrj6Lqt32TkGQXnYX3Zs6n0/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FCOo0u2uNZAPMMPDT1dg3R5M3i0vU1+nrTgK4BGFNS0=; b=R/gf1N6sAvSHC0L4zWH5FtUXARq6wd7KGVzV8awmjPyJ/BYqB6r0kAT4qo1NMc6lYQkllVF6DePhBW/JhsXWyz2EUEFvpxch3uWv2tMZc2wNyuV3q5rXjXZFxCyi9sRGBO+t5QqAl+V9YaoPRyHhBbpNleZY9pbERT6NL56fL6VWW5Wl+MXi2skw4M5BAL93JTqqQVFSNrJjOfTS4kj4KihUP5PrFmYG0yY5v80uxyD/pBh2eYz4DLPLKc08cAwAVSmL4qogF+gem2/WWBCZ36jYKigi/8EQU/q4nsLnXwwywrUK2GAi323AZlFy7qbfewPz2DB/wp3yX6sji4aDrQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 104.40.229.156) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=mail.schwarz; dmarc=pass (p=reject sp=none pct=100) action=none header.from=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=mail.schwarz] dkim=[1,1,header.d=mail.schwarz] dmarc=[1,1,header.from=mail.schwarz]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FCOo0u2uNZAPMMPDT1dg3R5M3i0vU1+nrTgK4BGFNS0=; b=eeQ1ZhQ7VkeoTyaNr/9SWbHTx7IBtXLZXI8qR+rS+2tMHR+FFcR/DGNG0mdVcBii+OT9EMcAgPve+mJeZqgL/fD6ECf4X0d2FhmM8knRKmkAY0nFqtiutCans6gneBt/8cjerbGee6W6oCUBBzP6Uy7bOBr1kgCgqICgz8yY7SX3RwugCO8Q3+g2Cc9u1Rlnl9zbgqw/YDdB+OXExyzdNSxqHIFF8UkI5p7UcVYiVHX+qbGUSBo1Z00S1UmwoxOVCmp9qRTNgWW2ow7EUP7bMg7OnrMqQdBzpXM1LGB9KVUtlNsMyAXl8YRIL3Hgq9WewyAFGMAz59WKvVhXlme+2A== Received: from DU2PR04CA0181.eurprd04.prod.outlook.com (2603:10a6:10:28d::6) by VI1PR10MB3679.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:800:134::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38; Mon, 12 Feb 2024 10:38:50 +0000 Received: from DB1PEPF00039234.eurprd03.prod.outlook.com (2603:10a6:10:28d:cafe::52) by DU2PR04CA0181.outlook.office365.com (2603:10a6:10:28d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Mon, 12 Feb 2024 10:38:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 104.40.229.156) smtp.mailfrom=mail.schwarz; dkim=pass (signature was verified) header.d=mail.schwarz;dmarc=pass action=none header.from=mail.schwarz; Received-SPF: Pass (protection.outlook.com: domain of mail.schwarz designates 104.40.229.156 as permitted sender) receiver=protection.outlook.com; client-ip=104.40.229.156; helo=eu1.smtp.exclaimer.net; pr=C Received: from eu1.smtp.exclaimer.net (104.40.229.156) by DB1PEPF00039234.mail.protection.outlook.com (10.167.8.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.7249.19 via Frontend Transport; Mon, 12 Feb 2024 10:38:48 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (104.47.12.51) by eu1.smtp.exclaimer.net (104.40.229.156) with Exclaimer Signature Manager ESMTP Proxy eu1.smtp.exclaimer.net (tlsversion=TLS12, tlscipher=TLS_ECDHE_WITH_AES256_SHA384); Mon, 12 Feb 2024 10:38:48 +0000 X-ExclaimerHostedSignatures-MessageProcessed: true X-ExclaimerProxyLatency: 5257762 X-ExclaimerImprintLatency: 1738986 X-ExclaimerImprintAction: eb71543000ff4db2a03e8f725cb11b36 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ieoOo1c3zoomMYvp7JiuOsMDrH4qtSU43pDV6MfFvDth5wqBDOXyBaFiSU27or2v1oGUOeGiJBY6RVWYkKM4cYhBodI1a4wlvB7bt9/Tv7OCYadXVbHOeNXBj/F0+120+Y1tBs0nZv47KtAHaMyUJpyiXxdTj+qlWjhHXH22PlTvioYgH2TWDgcs2w0i+7mV2WyAt3V4a5Ifg0LokTLow9NCAVvcWKmPc0g3FAeoz84LSKqtjPTerPTwiO5WFQuw4AwtCo9/QM282Ey2wpEBe1DQBN0FlHq85J4UCb1UMI6rvAw0GlWIFOFfdjbnbYTSOgZhfhz6aD+GOVt83IbDrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FCOo0u2uNZAPMMPDT1dg3R5M3i0vU1+nrTgK4BGFNS0=; b=K2WMX3nnEi/r/6bcXCnYvUu+pSBZKgGreUirgv6A1pacVuHTsDg1QrYqndgP1HQiq5Tx2GOR1n6ihk7mhlTFoT4EvMowSilkJMDh6lXuejd+6qIKcsBpO2ZJSBy/nO/oRiO1WupHgSvbe8QKkwUJMRLvhiL1uMQeq9NO35LokYa22TkQveevFxrCPXQ5tPnmE9/JWmht1T6uKS+gyhN+HR59mYVm5lC/hAZ+hXkkYg13GP/BZnc04Mg7MldckJVCCvnnm6rc25uMznEtlf4kSzQJWCKkznf55iX3I9EJdoYD3GyYTPt7/Eqb33ZXUpT+UkJhJqvv9DmIfBLiWOms1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mail.schwarz; dmarc=pass action=none header.from=mail.schwarz; dkim=pass header.d=mail.schwarz; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.schwarz; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FCOo0u2uNZAPMMPDT1dg3R5M3i0vU1+nrTgK4BGFNS0=; b=eeQ1ZhQ7VkeoTyaNr/9SWbHTx7IBtXLZXI8qR+rS+2tMHR+FFcR/DGNG0mdVcBii+OT9EMcAgPve+mJeZqgL/fD6ECf4X0d2FhmM8knRKmkAY0nFqtiutCans6gneBt/8cjerbGee6W6oCUBBzP6Uy7bOBr1kgCgqICgz8yY7SX3RwugCO8Q3+g2Cc9u1Rlnl9zbgqw/YDdB+OXExyzdNSxqHIFF8UkI5p7UcVYiVHX+qbGUSBo1Z00S1UmwoxOVCmp9qRTNgWW2ow7EUP7bMg7OnrMqQdBzpXM1LGB9KVUtlNsMyAXl8YRIL3Hgq9WewyAFGMAz59WKvVhXlme+2A== Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=mail.schwarz; Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) by DU2PR10MB7648.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:10:490::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 10:38:45 +0000 Received: from PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::1d63:bb69:8522:de5b]) by PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM ([fe80::1d63:bb69:8522:de5b%7]) with mapi id 15.20.7270.036; Mon, 12 Feb 2024 10:38:45 +0000 Date: Mon, 12 Feb 2024 11:38:43 +0100 To: dev@openvswitch.org Message-ID: Mail-Followup-To: dev@openvswitch.org, luca.czesla@mail.schwarz, max.lamprecht@mail.schwarz Content-Disposition: inline X-ClientProxiedBy: FR3P281CA0111.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::14) To PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:30d::9) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: PAVPR10MB6914:EE_|DU2PR10MB7648:EE_|DB1PEPF00039234:EE_|VI1PR10MB3679:EE_ X-MS-Office365-Filtering-Correlation-Id: 647b6b7e-7e8d-40c6-6b9a-08dc2bb6cbee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 3+nO0PVRmrxnBIOy0Kaw7bADRnZl5DwYNnnD/sWj4aXMZKRHpCU5i1y61QZN+DDk/eIw8AuDQvUSMw21D+5SfOXMRLiHeNPiT1FnR7nIXjB1vxnNpke/IehvlTsllk87bjGIlN6Zotj7NskNhIQvClzQxgXhdPi3QjENLbWp/Q1glRBZ+ynHXk8+lbpbhxdo9xhToKoPI+PsqtFf7cvKaZfWbY9RsyXm87Vk0Io0f9RimVf6oFql4asDHcsddOowgKpQFIlie51JqmFEGTfvIc4863bQ5i3ym4g8Ts7uxXmOpVfrFWuSkVy1bZXZJbf51pRq8zAPUZLfwG9OizDarTCh3jbNTaK8BEVz7kiIKPluq+XtW3WjFIj12iiy8RPSvmZmuhRMK5YBkTNNkIN6tA1j+G7XSimx425cdpVPNpHgHA+vCCxNvKK5beNhDvmFrbKikfSUWBq/JEx/CWWvL1mELMG5nW3XDPl2abpS2lkEIxHdCJLUSrOLHGrZCRUZNqneSyuzKBc8YAXyCwr6JM0ns04Jrw7rOzwPd4URiiI= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PAVPR10MB6914.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230031)(366004)(39860400002)(346002)(396003)(136003)(376002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(9686003)(6512007)(6486002)(6506007)(966005)(44832011)(2906002)(5660300002)(66946007)(86362001)(82960400001)(38100700002)(66556008)(478600001)(316002)(107886003)(4326008)(83380400001)(66574015)(66476007)(8676002)(8936002)(6916009)(26005)(41300700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU2PR10MB7648 X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB1PEPF00039234.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 188800c6-f5b5-4c59-f191-08dc2bb6ca24 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I+OHXNIQ0s4F/x5+oDhH87NG0xNT0wdL3eqWmdpHTN1dsNFZ4LrMyvbQqwpHgmEmbDHHTHGaEtZKNYgCTv0Xh8umvzGVxN4Hm1gu2cGGVAxj907vAFxYAE+cEWXYm5MYEi/yOo87TYvNF3HUermKiq2L8srFIFdLH/G8HxJlfJ+tD3QbqVe25sa8YOMEgy9yK4C9wx4RgZkC4hjbOOsVzUHS0fnt3WzTemcBi29adSv0LX96QongE8vlQ89anRG5Bj63hGQZc6/vHpumcZk7gA5Ij2Nh3bhTQHPnYR2LE1qphOYg+G6bDGUlCQhwkDA/Sn5o4qZ5h1Lfl+IDYt+xukbpXzbZRAUfMh10prQrLBBKG20SJL3i2zXWDv4jqLejGu1OeQtLYvPn1bYZGbpIy7GRzPBfFGgQPfQLisNRmI9EeKqMLTy3oqr14+I8tGE8VF3bshIs3Fb4jCz4cgmG8oroHGlIV2xb7lDtE3CCoC1a4X2V6A46AXvIbnYVAjuMaDfex8spswFM82/pudrIGKyrv3gTxCVNHruNgtTtr3gccFXoiKbU+olcDFje88ZazF9N7dtjJZTLdt4CPJ1bnw== X-Forefront-Antispam-Report: CIP:104.40.229.156; CTRY:NL; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:eu1.smtp.exclaimer.net; PTR:eu1.smtp.exclaimer.net; CAT:NONE; SFS:(13230031)(4636009)(346002)(376002)(396003)(39860400002)(136003)(230922051799003)(64100799003)(186009)(82310400011)(1800799012)(451199024)(46966006)(36840700001)(40470700004)(6486002)(478600001)(966005)(41300700001)(5660300002)(8936002)(8676002)(4326008)(44832011)(2906002)(70206006)(70586007)(6916009)(6506007)(6512007)(9686003)(316002)(83380400001)(26005)(66574015)(336012)(82960400001)(82740400003)(7636003)(356005)(86362001)(7596003)(107886003); DIR:OUT; SFP:1101; X-OriginatorOrg: mail.schwarz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Feb 2024 10:38:48.2710 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 647b6b7e-7e8d-40c6-6b9a-08dc2bb6cbee X-MS-Exchange-CrossTenant-Id: d04f4717-5a6e-4b98-b3f9-6918e0385f4c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=d04f4717-5a6e-4b98-b3f9-6918e0385f4c; Ip=[104.40.229.156]; Helo=[eu1.smtp.exclaimer.net] X-MS-Exchange-CrossTenant-AuthSource: DB1PEPF00039234.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB3679 Subject: [ovs-dev] [PATCH v3] netlink-conntrack: Optimize flushing ct zone. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Felix Huettner via dev From: Felix Huettner Reply-To: Felix Huettner Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Previously the kernel did not provide a netlink interface to flush/list only conntrack entries matching a specific zone. With [1] and [2] it is now possible to flush and list conntrack entries filtered by zone. Older kernels not yet supporting this feature will ignore the filter. For the list request that means just returning all entries (which we can then filter in userspace as before). For the flush request that means deleting all conntrack entries. These significantly improves the performance of flushing conntrack zones when the conntrack table is large. Since flushing a conntrack zone is normally triggered via an openflow command it blocks the main ovs thread and thereby also blocks new flows from being applied. Using this new feature we can reduce the flushing time for zones by around 93%. In combination with OVN the creation of a Logical_Router (which causes the flushing of a ct zone) could block other operations, e.g. the failover of Logical_Routers (as they cause new flows to be created). This is visible from a user perspective as a ovn-controller that is idle (as it waits for vswitchd) and vswitchd reporting: "blocked 1000 ms waiting for main to quiesce" (potentially with ever increasing times). The following performance tests where run in a qemu vm with 500.000 conntrack entries distributed evenly over 500 ct zones using `ovstest test-netlink-conntrack flush zone=`. With this patch and kernel v6.8-rc4: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 0.260 0.319 0.335 0.348 0.362 0.320 80.02 250 flush zone with no entry 0.228 0.298 0.325 0.340 0.348 0.296 73.93 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- With this patch and kernel v6.7.1: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 3.946 4.237 4.367 4.495 4.543 4.236 1058.992 250 flush zone with no entry 3.462 4.460 4.662 4.931 5.390 4.430 1107.479 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- Without this patch and kernel v6.8-rc4: ----------------------------------------------------------------------------------------------------------------------------------------------------- Min (s) Median (s) 90%ile (s) 99%ile (s) Max (s) Mean (s) Total (s) Count ----------------------------------------------------------------------------------------------------------------------------------------------------- flush zone with 1000 entries 3.497 4.349 4.522 4.773 5.054 4.331 1082.802 250 flush zone with no entry 3.212 4.010 4.572 6.003 6.396 4.071 1017.838 250 ----------------------------------------------------------------------------------------------------------------------------------------------------- [1]: https://github.com/torvalds/linux/commit/eff3c558bb7e61c41b53e4c8130e514a5a4df9ba [2]: https://github.com/torvalds/linux/commit/fa173a1b4e3fd1ab5451cbc57de6fc624c824b0a Co-Authored-By: Luca Czesla Signed-off-by: Luca Czesla Co-Authored-By: Max Lamprecht Signed-off-by: Max Lamprecht Signed-off-by: Felix Huettner --- v2->v3: - update description to include upstream fix (Thanks to Ilya for finding that issue) v1->v2: - fixed wrong signed-off-by lib/netlink-conntrack.c | 57 +++++++++++++++++++++++++++++++++++++++-- tests/system-traffic.at | 8 ++++++ 2 files changed, 63 insertions(+), 2 deletions(-) base-commit: b3fc822208e89c6ba04e1fc972da0bf4426a5847 diff --git a/lib/netlink-conntrack.c b/lib/netlink-conntrack.c index 492bfcffb..1b050894d 100644 --- a/lib/netlink-conntrack.c +++ b/lib/netlink-conntrack.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "byte-order.h" #include "compiler.h" @@ -141,6 +142,9 @@ nl_ct_dump_start(struct nl_ct_dump_state **statep, const uint16_t *zone, nl_msg_put_nfgenmsg(&state->buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + if (zone) { + nl_msg_put_be16(&state->buf, CTA_ZONE, htons(*zone)); + } nl_dump_start(&state->dump, NETLINK_NETFILTER, &state->buf); ofpbuf_clear(&state->buf); @@ -283,23 +287,72 @@ nl_ct_flush_zone(uint16_t flush_zone) return err; } #else + +static bool +netlink_flush_supports_zone(void) +{ + static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; + static bool supported = false; + + if (ovsthread_once_start(&once)) { + struct utsname utsname; + int major, minor; + + if (uname(&utsname) == -1) { + VLOG_WARN("uname failed (%s)", ovs_strerror(errno)); + } else if (!ovs_scan(utsname.release, "%d.%d", &major, &minor)) { + VLOG_WARN("uname reported bad OS release (%s)", utsname.release); + } else if (major < 6 || (major == 6 && minor < 8)) { + VLOG_INFO("disabling conntrack flush by zone in Linux kernel %s", + utsname.release); + } else { + supported = true; + } + ovsthread_once_done(&once); + } + return supported; +} + int nl_ct_flush_zone(uint16_t flush_zone) { - /* Apparently, there's no netlink interface to flush a specific zone. + /* In older kernels, there was no netlink interface to flush a specific + * conntrack zone. * This code dumps every connection, checks the zone and eventually * delete the entry. + * In newer kernels there is the option to specifiy a zone for filtering + * during dumps. Older kernels ignore this option. We set it here in the + * hope we only get relevant entries back, but fall back to filtering here + * to keep compatibility. * - * This is race-prone, but it is better than using shell scripts. */ + * This is race-prone, but it is better than using shell scripts. + * + * Additionally newer kernels also support flushing a zone without listing + * it first. */ struct nl_dump dump; struct ofpbuf buf, reply, delete; + int err; + + if (netlink_flush_supports_zone()) { + ofpbuf_init(&buf, NL_DUMP_BUFSIZE); + + nl_msg_put_nfgenmsg(&buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, + IPCTNL_MSG_CT_DELETE, NLM_F_REQUEST); + nl_msg_put_be16(&buf, CTA_ZONE, htons(flush_zone)); + + err = nl_transact(NETLINK_NETFILTER, &buf, NULL); + ofpbuf_uninit(&buf); + + return err; + } ofpbuf_init(&buf, NL_DUMP_BUFSIZE); ofpbuf_init(&delete, NL_DUMP_BUFSIZE); nl_msg_put_nfgenmsg(&buf, 0, AF_UNSPEC, NFNL_SUBSYS_CTNETLINK, IPCTNL_MSG_CT_GET, NLM_F_REQUEST); + nl_msg_put_be16(&buf, CTA_ZONE, htons(flush_zone)); nl_dump_start(&dump, NETLINK_NETFILTER, &buf); ofpbuf_clear(&buf); diff --git a/tests/system-traffic.at b/tests/system-traffic.at index 4fd5dbe59..14010dc41 100644 --- a/tests/system-traffic.at +++ b/tests/system-traffic.at @@ -3297,6 +3297,14 @@ AT_CHECK([ovs-appctl dpctl/dump-conntrack | FORMAT_CT(10.1.1.4)], [0], [dnl tcp,orig=(src=10.1.1.3,dst=10.1.1.4,sport=,dport=),reply=(src=10.1.1.4,dst=10.1.1.3,sport=,dport=),zone=2,protoinfo=(state=) ]) +dnl flushing one zone should leave the others intact +AT_CHECK([ovs-appctl dpctl/flush-conntrack zone=2]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=1 | FORMAT_CT(10.1.1.2)], [0], [dnl +tcp,orig=(src=10.1.1.1,dst=10.1.1.2,sport=,dport=),reply=(src=10.1.1.2,dst=10.1.1.1,sport=,dport=),zone=1,protoinfo=(state=) +]) +AT_CHECK([ovs-appctl dpctl/dump-conntrack zone=2 | FORMAT_CT(10.1.1.4)], [0], [dnl +]) + OVS_TRAFFIC_VSWITCHD_STOP AT_CLEANUP