From patchwork Mon Jun 17 03:30:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wilson Peng X-Patchwork-Id: 1948358 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" (1024-bit key; unprotected) header.d=vmware.com header.i=@vmware.com header.a=rsa-sha256 header.s=selector2 header.b=djCG6RI7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4W2b4z6m99z20Wg for ; Mon, 17 Jun 2024 13:30:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C7E27810C6; Mon, 17 Jun 2024 03:30:57 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id GgCP1BXPyyuL; Mon, 17 Jun 2024 03:30:56 +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 smtp1.osuosl.org 5202B810A2 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key, unprotected) header.d=vmware.com header.i=@vmware.com header.a=rsa-sha256 header.s=selector2 header.b=djCG6RI7 Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5202B810A2; Mon, 17 Jun 2024 03:30:56 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 16A13C0012; Mon, 17 Jun 2024 03:30:56 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2D510C0011 for ; Mon, 17 Jun 2024 03:30:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 11A4540558 for ; Mon, 17 Jun 2024 03:30:55 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oEPtqPvTazdt for ; Mon, 17 Jun 2024 03:30:54 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a01:111:f403:2414::614; helo=nam11-bn8-obe.outbound.protection.outlook.com; envelope-from=svc.ovs-community@vmware.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp2.osuosl.org B80124054A Authentication-Results: smtp2.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=vmware.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B80124054A Authentication-Results: smtp2.osuosl.org; dkim=pass (1024-bit key, unprotected) header.d=vmware.com header.i=@vmware.com header.a=rsa-sha256 header.s=selector2 header.b=djCG6RI7 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20614.outbound.protection.outlook.com [IPv6:2a01:111:f403:2414::614]) by smtp2.osuosl.org (Postfix) with ESMTPS id B80124054A for ; Mon, 17 Jun 2024 03:30:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b7/XnyLsMvguLcgGjK19p2KXjG2/FHIaozIXI1SZEdBRe+9c130MxKMWkat2xbQyfYsySD+B5HNyd62NOWIjRMH02QGHYqFDoIPwhKzxdMAfc5dZpiBkLcE0QpALY4lq37nYaUhDU9eB4ZgG9FZhwxlWHNKxxqTkPBCRNlEfrgYXVXJq+zgPo9nPEkFzcGpLWDIAEioLm8yhX3I4xEUU54bnXRlzwIOLotQK+3yp8XkRsPt75R0DzvsZ7opW6pt9XDqZw180VPfvJKYsdUfp0be3gytegn49WQ0zMeLS+rkRNXL3f3CbvH1jvtMgGwD2V6r5x3QrzZzfU31XVANS0A== 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=VujMofR6yIlVAM8YoE4Wt3z8dOhr5+k2uajeiEzJDqY=; b=IS8Mw3K7tayNzjaSKGySOg4V7JVRcxWutb0C6lHGslS/DPZwo3k+eNomDvTvW+wvoGZNhcR3dnBkurGyNizT3lnhoVNLnIYtqeT42P+FuDZbPOopl+ijwUJb02C2JejtebNpVQN58YRH2YHMey47mYAQguFdgXKgaNUjdV2B3fICGIka3IARguyPSSIcbivwqEYiscAQVH7F7hVoiQ3BDrZZqusRRGv0cPt/uaWsvIt7nxH49MsdGN6d4qk6bcjwHAk5iJ+NIV9VgP/H0VSpdq/G4+8JRg0hzM481vFfowqcW690DCz4tzGd5dsAwkjQ19t+zT6RIyFN+zWan2+45Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VujMofR6yIlVAM8YoE4Wt3z8dOhr5+k2uajeiEzJDqY=; b=djCG6RI7id1LOSgVaIcGjazdvPsBpxJrUXO3VquE8Wj5dV+Dfe+pwixv4dhlog5pajEOT4CyCcAA8XyxFP/RgU6f2kX+fP6kv8SOwzQE+KXVsJ09Sf8JyGEzrQKWEp7UPr1wyatyxx3umN9WGympx3qj6d/Oo9qgPlV2sRka93E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vmware.com; Received: from BYAPR05MB5989.namprd05.prod.outlook.com (2603:10b6:a03:da::28) by IA1PR05MB9170.namprd05.prod.outlook.com (2603:10b6:208:3aa::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 03:30:48 +0000 Received: from BYAPR05MB5989.namprd05.prod.outlook.com ([fe80::5da:377d:e8bf:afcf]) by BYAPR05MB5989.namprd05.prod.outlook.com ([fe80::5da:377d:e8bf:afcf%3]) with mapi id 15.20.7677.030; Mon, 17 Jun 2024 03:30:48 +0000 To: dev@openvswitch.org Date: Mon, 17 Jun 2024 11:30:34 +0800 Message-Id: <20240617033034.38665-1-svc.ovs-community@vmware.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) X-ClientProxiedBy: SI2PR06CA0006.apcprd06.prod.outlook.com (2603:1096:4:186::19) To BYAPR05MB5989.namprd05.prod.outlook.com (2603:10b6:a03:da::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR05MB5989:EE_|IA1PR05MB9170:EE_ X-MS-Office365-Filtering-Correlation-Id: fb6f0a0c-0913-4aff-4072-08dc8e7de167 X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtFwd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230037|366013|376011|52116011|1800799021|38350700011; X-Microsoft-Antispam-Message-Info: =?utf-8?q?ghzoQfOdUxggmCHIbRWdwu2ASwSm3Q6?= =?utf-8?q?H9m4DnM4BSNlAE4F4SyxzQrKhiFS9vxHkz/0vtuStpzvbxi1mgr33CDJynh6oRHBp?= =?utf-8?q?R6429lh4ke7jiHXa8UFZ3inlWMWBXxgtRxWQrt1e3zXeUnEf2y2Wg8q/4PEpoG/SL?= =?utf-8?q?S7vrKNVmaeTWFtEGhpNj7KZCyHkquQ/dsVV+VB+yFPJCMPtUyPbQ4seeOWDIayLH9?= =?utf-8?q?LVedeReG6u8h8KZja9RoggzNIG0Wnzswjx+TajM7G8WNNcaFjF2iv1mOMhhXyybRd?= =?utf-8?q?MFY73T7grHJEPaaZAOlRTdR8kYRrT+lZy7v5GPwdjMdYKIBaBCrzO2RS32DSbJFCG?= =?utf-8?q?3l8nlZK03G50QwK7V08kKLMOdP+DgteoPQBUDzQ/XI54bOgvTMNseVpiZiE2wB+pQ?= =?utf-8?q?p1G7sXBnsPxhDyTMCaI7rRS19QOXjiBGao5d7UwHHBEy0h63gkfSl2MzgFB5sqmHk?= =?utf-8?q?D9/553+XvHEfmOCKaYxwQfaAwcr9z5hq0BlRUcnyxtFaDRVn2AKMgi66Psm4dAMws?= =?utf-8?q?S6ofvlyMXo8KGydFSSg8/MVTW/rIc18680btqchA0WbhmCbGEy2P3BqfOpde0z3rX?= =?utf-8?q?BsbbWqApAbEY42Tju1IhUBoJvP0pUfpnU4OChAG0aXSyZ/SAwzsjCnPdEwX89h1WP?= =?utf-8?q?d8fydYvY6RyQpLnAdaMwDGKsbV8C8K7dghsuUcwv0/jGiux6WT1b91xEEtqPYF/Te?= =?utf-8?q?nXvMqhAiVSYQRGStsk5nbIEW1+dbozo4wguvusuFDaCRA70M8jpRpPLlbwhHMoh1+?= =?utf-8?q?2uVwyI3tfqE+QFL4tk08Lh49OqEHKdUvCJwzvcsxQahrAiN7w93gUnprQJ2IPJ2E8?= =?utf-8?q?+1Lv/Ki4vxN2auoWtDK6fvR9RtMmgeivYKE/smhnHj+Mg1TPT2liPgw8zYmr2arw3?= =?utf-8?q?D7px2GLEfe85dc4LEMRtUlxOEBguT1BPpuz/Dwdb9dj7lRG4J+PzVjzQ6nEuxQJ24?= =?utf-8?q?vG+nRIY3gWbKLGQIvvR1WW2+qEf/8solHtF05ze/O3+mbnsLXs06JHT9jQM5iTCAm?= =?utf-8?q?aM/hNuSgJ1OBPMwL44VDXRYrrlyfhu7H/wEsEvlfkLXlJNCuELZNarYJHAU18vnz3?= =?utf-8?q?oWhnvYeaufFn/oq1EEmLFD9y4X9UULVxFBTKGnQg8b3Rmdl3gPWTyo96Wav1oiGbP?= =?utf-8?q?d1B8tkGkBG16z9qEfe5nuCkiLu3ffcg7z2wwRZSxOcU/avpOZuEMyN+pDsE+IoeFX?= =?utf-8?q?qCxwFd99joh2nLFkeuOtyFbSpSDyooPeilrdE8ZS6cuSn5TqUEseVRacKBzome6pC?= =?utf-8?q?bJXPXHeUGuVlnPYtxMGCVS7OdskRt3ki143aRSzEy0c311Uqu8Z9Tpc4=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR05MB5989.namprd05.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230037)(366013)(376011)(52116011)(1800799021)(38350700011); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?WDC8qRdqqsUy1witCorzfyaI2Gex?= =?utf-8?q?uYznQarpqZRs3XFaoZSFo/XIRXyQwdHFzTikKFGCz37s/eWev0N6yPgYatpPJuGHh?= =?utf-8?q?2hr/A5FNetKoI3b2kLcMJ7Ba+VhRbxQMGD6PMskMqPj55D+HhDm0EOtJB7vlG+q2L?=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+?= =?utf-8?q?cDhtx9Ci4qOA5UyKabmoeq230AtylzsfjFI011N7BhDUL640TPO4BlF0vEEDbTHpd?= =?utf-8?q?3tZb/c+LgaGrO2d5NrHAfmT7vC4jrb7T1hJY8ucWD/b/9Z85VHi/vdUTDLc3SqNMm?= =?utf-8?q?VMDboYxlF6k+Kc9XN7Jk6Ho4Hgf0VZOCVFf+ov+loJZP0r+j7yFuboVM0D60q0aHf?= =?utf-8?q?vWUmWzSd93uGrT8zUUn+bUdazNdLy9swxPxhruyAwq42HFA6BXgaBmQRx9K6Q5Iwg?= =?utf-8?q?9A1zvYYbE9QeJWQaMROE5/RF2ihzl90gIWh7OpKj6ctvbXvQlgv3mpLpqQMGfJEqM?= =?utf-8?q?lRc2/LIF50zFqL6r8rKIt/iZ2VjaRamz5LOdYVaOn97sevs5d/HwSYJMqZHYLyreB?= =?utf-8?q?lH+ON5BknaBWw/z0ZntuReYDHj1fZmWtUYSASZDD2h0L8nmb6CSFgh/FzJzyC1QDD?= =?utf-8?q?hcZ+VOdFHNFhq5ZiJASK3umgBd9p/LTpLvcYrRzD9MgiZrQItMRF5ckFp3hk0gIDJ?= =?utf-8?q?X4xBC3beylT/mRaCZDSAZFBo7WYAJk1Tsw=3D=3D?= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb6f0a0c-0913-4aff-4072-08dc8e7de167 X-MS-Exchange-CrossTenant-AuthSource: BYAPR05MB5989.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 03:30:48.6472 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 8xXYwe1U7paoE1YOPUszfR+e0IqHZz/NBhZwXkvILhcu90Lzz6Z42MoGvxxTP7oEE2kLRyuJ9bHwhqrz8RjWuL7mX5d/bH6Fzksuv66xReY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR05MB9170 Subject: [ovs-dev] [PATCH v3 1/1] datapath-windows : Correct the failure handling in OvsInitConntrack. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Wilson Peng via dev From: Wilson Peng Reply-To: Wilson Peng Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Wilson Peng v2-v3 change: Remove the unneeded sanity check and just correct the failure when OvsNatInit is called failed. While deploying Tanzu Kubernetes(Antrea based solution) in Broadcom customer, Sometimes it is found that the kernel thread OvsConntrackEntryCleaner is not Started after the Windows node is rebooted on unexpected condition. It could Be also observed a similar issue in local Antrea setup via Clean-AntreaNetwork.ps1 Which will Remove-VMSwitch and re-create it on Windows node. After checking the local conntrack dump, OVS doesn’t remove the connection Entries even though the time is overdue, we could find the connection entries Created several hours ago in the dump, within a state (TIME_WAIT) that was Supposed to be deleted earlier. At that time, the count of the existing entries In the OVS conntrack zone is far from the up limit, the actual number is 19k. Then we tried to flush the conntrack with CMD "ovs-dpctl.exe flush-conntrack" And all the conntrack entries could be removed. In this patch, it does make sure return wrong value when OvsNatInit is failed To call on OvsInitConntrack.And also it is to correct the failure inside OvsNatInit and OvsNatCleanup. Antrea team does help do the regression test with build including the patch And it could PASS the testing. And it is not find the Connectract not timeout Essue with same reproducing condition. It is good to backport the fix to main and backported until 2.17. Signed-off-by: Wilson Peng --- datapath-windows/ovsext/Conntrack-nat.c | 2 +- datapath-windows/ovsext/Conntrack.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/datapath-windows/ovsext/Conntrack-nat.c b/datapath-windows/ovsext/Conntrack-nat.c index 497354ec8..a222f6aea 100644 --- a/datapath-windows/ovsext/Conntrack-nat.c +++ b/datapath-windows/ovsext/Conntrack-nat.c @@ -108,6 +108,7 @@ NTSTATUS OvsNatInit() OVS_CT_POOL_TAG); if (ovsUnNatTable == NULL) { OvsFreeMemoryWithTag(ovsNatTable, OVS_CT_POOL_TAG); + ovsNatTable = NULL; return STATUS_INSUFFICIENT_RESOURCES; } @@ -157,7 +158,6 @@ VOID OvsNatFlush(UINT16 zone) VOID OvsNatCleanup() { if (ovsNatTable == NULL) { - NdisFreeSpinLock(&ovsCtNatLock); return; } diff --git a/datapath-windows/ovsext/Conntrack.c b/datapath-windows/ovsext/Conntrack.c index 39ba5cc10..459819851 100644 --- a/datapath-windows/ovsext/Conntrack.c +++ b/datapath-windows/ovsext/Conntrack.c @@ -119,7 +119,7 @@ OvsInitConntrack(POVS_SWITCH_CONTEXT context) if (status != STATUS_SUCCESS) { OvsCleanupConntrack(); } - return STATUS_SUCCESS; + return status; freeBucketLock: for (UINT32 i = 0; i < numBucketLocks; i++) { @@ -172,6 +172,7 @@ OvsCleanupConntrack(VOID) NdisFreeSpinLock(&ovsCtZoneLock); if (zoneInfo) { OvsFreeMemoryWithTag(zoneInfo, OVS_CT_POOL_TAG); + zoneInfo = NULL; } } @@ -1520,6 +1521,8 @@ OvsConntrackEntryCleaner(PVOID data) LOCK_STATE_EX lockState; BOOLEAN success = TRUE; + OVS_LOG_INFO("Start the OVS ConntrackEntry Cleaner system thread," + " context: %p", context); while (success) { if (context->exit) { break; @@ -1541,6 +1544,7 @@ OvsConntrackEntryCleaner(PVOID data) KeWaitForSingleObject(&context->event, Executive, KernelMode, FALSE, (LARGE_INTEGER *)&threadSleepTimeout); } + OVS_LOG_INFO("Terminate the OVS ConntrackEntry Cleaner system thread"); PsTerminateSystemThread(STATUS_SUCCESS); }