From patchwork Tue Jan 12 09:50:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parvathy Tarur Ramachandran X-Patchwork-Id: 1425117 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=openvswitch.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.a=rsa-sha256 header.s=selector1 header.b=pvHwIw+1; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DFRX32zh6z9sXH for ; Tue, 12 Jan 2021 21:24:35 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E138686004; Tue, 12 Jan 2021 10:24:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gfb7ZWz7GDSd; Tue, 12 Jan 2021 10:24:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2A85D85F8D; Tue, 12 Jan 2021 10:24:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 102DFC0893; Tue, 12 Jan 2021 10:24:31 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id DBF84C013A for ; Tue, 12 Jan 2021 10:24:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CAA9585F7B for ; Tue, 12 Jan 2021 10:24:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7Iv10Vk7eJ_N for ; Tue, 12 Jan 2021 10:24:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2065.outbound.protection.outlook.com [40.107.22.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 405C985E40 for ; Tue, 12 Jan 2021 10:24:29 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NrjFXvODSF4xKGpPFpi3zSSsg6Vjq2edFq4zQC4VwSwbBxyFf8iAZ2+3OgnIoTnWWp63jeDlsknc14iEsisIxgdEixKKy0tJn35of5znEbIWDEAgIM7FInThv4Sn60JtAnaUuFAj/NxnPNcjrKVCjdjmh/3gixFEKot+MUflRzjzmOTpmSk0QjljtzQwU6PRmlpbgl3edbYc6/mV3oGkmrHSS7nbKKclL9edcgxF7sifVYmoSD5e5P5h2Q3MxDIleJ7TYvw1r04i3wxlC6GT/C6av0lbXlqK/v1ql0DYBcf5n11jXpC7RKrMafwCXoqXLloL9KFl6tS/DCtxCHct9Q== 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-SenderADCheck; bh=M4tCMnctXCD/PKwheGsj7Zc7T8BLlY6jH5v7YkBrUHw=; b=AfSSr2k3otEPdRg/JjLajc7an6lcKfaI3Oz55y3ybSLk0OAgtZuI10EgHUq8nObnMFErrbon7NHr+qRtuKORYeLZ9ORejzER2n1OY5QL+znV0RIXOaHkrNYGBpvmTRVkyvNsaa8IoHBBuF/dHWTnriOYYAALpR0wZ3RRtQqgapJ4amGqJkE7LSFvrI/sHGtq0epmR8wMRenb4EN+UpbHmk02EWTAN29xjiHoWJjKg75x+we4ud5/1yk+jYdyIuxt2B+awb1XJE/yba/eQvuI8OLmiyxvUx9DyZt6Ac9z/aUglojlyAhEVQxksLLoqsMRmArbkWL2hx15Xm5sSanFOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 192.176.1.74) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=ericsson.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=ericsson.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=M4tCMnctXCD/PKwheGsj7Zc7T8BLlY6jH5v7YkBrUHw=; b=pvHwIw+1X7HD5WzSNxqS0CiBh/NQ/uXChQiywjyXVZ0NfOwwRenDC4aWGGV3ge38aHM0AkA+LXic0WKG4X6w0nsb4/T/kXUJZbFwH0ffocxEN/ofX8FBCIeL1rxLZy2HRJrD6u1ml+mzUR73wpDSxcrB1aT/Z0LH916BaBIGprM= Received: from AM6P193CA0140.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:85::45) by DB6PR0701MB2630.eurprd07.prod.outlook.com (2603:10a6:4:24::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.2; Tue, 12 Jan 2021 10:09:00 +0000 Received: from AM5EUR02FT006.eop-EUR02.prod.protection.outlook.com (2603:10a6:209:85:cafe::4) by AM6P193CA0140.outlook.office365.com (2603:10a6:209:85::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.9 via Frontend Transport; Tue, 12 Jan 2021 10:09:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 192.176.1.74) smtp.mailfrom=ericsson.com; openvswitch.org; dkim=none (message not signed) header.d=none;openvswitch.org; dmarc=pass action=none header.from=ericsson.com; Received-SPF: Pass (protection.outlook.com: domain of ericsson.com designates 192.176.1.74 as permitted sender) receiver=protection.outlook.com; client-ip=192.176.1.74; helo=oa.msg.ericsson.com; Received: from oa.msg.ericsson.com (192.176.1.74) by AM5EUR02FT006.mail.protection.outlook.com (10.152.8.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3742.6 via Frontend Transport; Tue, 12 Jan 2021 10:08:59 +0000 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMR503.ericsson.se (153.88.183.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Tue, 12 Jan 2021 11:08:58 +0100 Received: from localhost.localdomain (153.88.183.153) by ESESSMB501.ericsson.se (153.88.183.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Tue, 12 Jan 2021 11:08:58 +0100 To: Date: Tue, 12 Jan 2021 10:50:27 +0100 Message-ID: <1610445027-23835-1-git-send-email-parvathy.tarur.ramachandran@ericsson.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [153.88.183.153] X-ClientProxiedBy: ESESBMB502.ericsson.se (153.88.183.169) To ESESSMB501.ericsson.se (153.88.183.162) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a0db038-a55f-444f-8938-08d8b6e21454 X-MS-TrafficTypeDiagnostic: DB6PR0701MB2630: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JjEd1On3cffbT0+CM4OEX+u1FK7OJ7p4ZjxjMml5MZ6N+K0F+cCLmyE3TkyvihUWE2xB0kQz3E4wqHo4vZ5NbtwfFPmK2zpB2wiu0yH9mrBjDt0FC1WvQIKvNHGhLwynHJuAc/XpMpGWY7vE1dpJQWmuT97Djo5Rf837Y3Jc36gsCecxfrlX9jv2bBFdI7ID+yAzTAihxRO3h1GVrQVa3A74DkWETvBdAx5Dfz7wz/x8z310pZJPY/DL1kBhlWE4YrdNGe7tZ7IZ0i5FWwkVeEiB1Ez52f8r1xRiLM5Qa79L6VoUfZFzd8txAJgoxWtoLadzwqzAorIEpeqANmx5DJNyW26JwwKauNT7bFc3JgVGiQJSNhSba73WRY2pWAy9qc9grWceDp6Y8aSkFY2Lzjqam9uYeiS/9ULxZVpCvSZCo5TF7NYJ9RoV+97zVbdOXIE8b22S2ypY0sCmedVpl1t6P3urpj5LAXsvRhWBINVGGnSU/yE1ws/PpcP2AmKg X-Forefront-Antispam-Report: CIP:192.176.1.74; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:oa.msg.ericsson.com; PTR:office365.se.ericsson.net; CAT:NONE; SFS:(4636009)(396003)(136003)(376002)(39860400002)(346002)(46966006)(16526019)(186003)(956004)(2616005)(356005)(70206006)(5660300002)(8676002)(316002)(82740400003)(47076005)(83380400001)(36756003)(107886003)(7636003)(6916009)(2906002)(70586007)(6666004)(8936002)(4326008)(26005)(336012)(34020700004)(478600001)(82310400003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jan 2021 10:08:59.2304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0db038-a55f-444f-8938-08d8b6e21454 X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=92e84ceb-fbfd-47ab-be52-080c6b87953f; Ip=[192.176.1.74]; Helo=[oa.msg.ericsson.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT006.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB2630 Cc: Parvathy Tarur Ramachandran Subject: [ovs-dev] [PATCH] flow: Consistent VXLAN UDP src ports for fragmented packets 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: Parvathy Tarur Ramachandran via dev From: Parvathy Tarur Ramachandran Reply-To: Parvathy Tarur Ramachandran Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Issue: The src-port for UDP is based on RSS hash in the packet metadata. In case of packets coming from VM it will be 5-tuple, if available, otherwise just IP addresses. If the VM fragments a large IP packet and sends the fragments to OVS, only the first fragment will contain the L4 header. Therefore, the first fragment and subsequent fragments get different UDP src ports in the outgoing VXLAN header. This can lead to fragment re-ordering in the fabric as packet will take different paths. Fix: With this patch, we ignore the L4 header during hash calculation in the case of fragmented packets. Signed-off-by: Parvathy Tarur Ramachandran --- lib/flow.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/flow.c b/lib/flow.c index cc1b3f2..38bf377 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -2178,7 +2178,7 @@ miniflow_hash_5tuple(const struct miniflow *flow, uint32_t basis) if (flow) { ovs_be16 dl_type = MINIFLOW_GET_BE16(flow, dl_type); - uint8_t nw_proto; + uint8_t nw_proto, nw_frag; if (dl_type == htons(ETH_TYPE_IPV6)) { struct flowmap map = FLOWMAP_EMPTY_INITIALIZER; @@ -2200,6 +2200,14 @@ miniflow_hash_5tuple(const struct miniflow *flow, uint32_t basis) nw_proto = MINIFLOW_GET_U8(flow, nw_proto); hash = hash_add(hash, nw_proto); + /* Skip l4 header fields if IP packet is fragmented since + * only first fragment will carry l4 header. + */ + nw_frag = MINIFLOW_GET_U8(flow, nw_frag); + if (nw_frag) { + goto out; + } + if (nw_proto != IPPROTO_TCP && nw_proto != IPPROTO_UDP && nw_proto != IPPROTO_SCTP && nw_proto != IPPROTO_ICMP && nw_proto != IPPROTO_ICMPV6) {