From patchwork Wed Oct 9 08:36:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li,Rongqing via dev" X-Patchwork-Id: 1173697 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.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.b="oTEAPWRT"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46p76f27sxz9sCJ for ; Wed, 9 Oct 2019 19:43:53 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id F1A4DC21; Wed, 9 Oct 2019 08:43:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 859C7C03 for ; Wed, 9 Oct 2019 08:43:49 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10088.outbound.protection.outlook.com [40.107.1.88]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 840245F4 for ; Wed, 9 Oct 2019 08:43:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xp3uY56X1JKArHyoQOixeVHkBXIvKk/TgYmGmT2UeWPiYgTmdtybDTwlPkk6pLoRXrY8BaT9ivX3yj7te/VUbInwCVq6bEbFZhMWfkmF1nd48cmryHiiwPGRxTBnCB4JNVD4DfvlAkqmWxuss3MNLw+OyiNBaDOP9jT7hrC2tePyolsK3qxXh1k/TJVBQNRURRWj6DjyHi0ba+dOPMr5uKfYTZ5bJpWgMZfvr83EDaU/1aE+My6Xfea4G5nxZ/MPj0x6NNp/e/A91k+FIv49JSQMB8f42jPuTkqFyzsiWKNUbs1wM3lgdORJ1QdUVeKuDqXtvILSWLci9yJbiLMOBA== 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=8zYBy2v+xNC58viZOyC3L9Bz8zP9v7+qQEP66pz5AGw=; b=SZW3ru6f/dnbv6Vfkf/WqPHa1PuFD+m+j8EMSxk07vN4TFH0Gaq4YcT8QI0mP5YgDYwxqxh1wpOv37EoJLZzhicK0cFSiDsVy4JrYP2ebOaCNc9c8StFFOaI6QGvTXr2vZSFacamAPooayjwip0g4S8pQK56jrrLoz5zrFgtBzFwv1aoC8jDbZyWItLRy2LBnR+sXg0bL+aTGjIEeY1uImkBNNVnr3QamFYniHyRrCWTiD62ddLM3+0kAFv4+rnQfKZMvSymZu+lfedqk7GQK3of+4cOZbuXBYyDrYAEIiO2dhdQt8Wte+61vdyDH0aYj/k9RaBSgfxpZmcoht9ONQ== 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=quarantine sp=none 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8zYBy2v+xNC58viZOyC3L9Bz8zP9v7+qQEP66pz5AGw=; b=oTEAPWRTrgEGeP3sTk3IS63Bzswc/CHK+n1nq19x+AbPEhwUvfP2fWVeP1k2JEdBDLPVqI5ZVYaJWly0sZRZACKDC8hU+QEIu0YXrokqylePHDdBpZb5puB4gtIz77R2Z05Qzf4Y2V08EXVvqMVvl/f+gdjpTbwptCnBPzlTReU= Received: from HE1PR0701CA0058.eurprd07.prod.outlook.com (2603:10a6:3:9e::26) by AM6PR07MB5718.eurprd07.prod.outlook.com (2603:10a6:20b:9e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.11; Wed, 9 Oct 2019 08:43:46 +0000 Received: from HE1EUR02FT061.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e05::208) by HE1PR0701CA0058.outlook.office365.com (2603:10a6:3:9e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.11 via Frontend Transport; Wed, 9 Oct 2019 08:43:46 +0000 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 HE1EUR02FT061.mail.protection.outlook.com (10.152.11.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2347.16 via Frontend Transport; Wed, 9 Oct 2019 08:43:45 +0000 Received: from ESESSMB501.ericsson.se (153.88.183.162) by ESESSMR505.ericsson.se (153.88.183.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 9 Oct 2019 10:43:42 +0200 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.1713.5; Wed, 9 Oct 2019 10:43:42 +0200 To: Date: Wed, 9 Oct 2019 14:06:30 +0530 Message-ID: <1570610190-30806-1-git-send-email-vishal.deep.ajmera@ericsson.com> X-Mailer: git-send-email 1.9.1 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-Forefront-Antispam-Report: CIP:192.176.1.74; IPV:NLI; CTRY:SE; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(346002)(376002)(39860400002)(396003)(199004)(189003)(7736002)(8936002)(5660300002)(16586007)(478600001)(51416003)(106002)(54906003)(50226002)(6916009)(7636002)(246002)(2351001)(316002)(356004)(6666004)(305945005)(8676002)(126002)(336012)(2906002)(476003)(70586007)(956004)(486006)(70206006)(86362001)(26005)(386003)(186003)(36756003)(16526019)(50466002)(6116002)(3846002)(4326008)(47776003)(48376002)(107886003)(66066001)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR07MB5718; H:oa.msg.ericsson.com; FPR:; SPF:Pass; LANG:en; PTR:office365.se.ericsson.net; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fece717f-47bb-486d-91d1-08d74c94cc0a X-MS-TrafficTypeDiagnostic: AM6PR07MB5718: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-Forefront-PRVS: 018577E36E X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: d7RowB5areUQ+2DlmY3cABZzkDiOxphrjeUwdfA54d/1dXlQFu/NUYRGH+H5nUDmE7EeVPsi9p5z8Z2tPuZX4WwV1KUYsM+XTqWDuNY/1Orp4s8bPap1n06MWbPZacoXvbdg4MYrsfuXIdZqf14pCgiMT9NRxxQaQWg1Qg55z2AEXTJ1L6HcxILos9cIy0rMDic5LKcs1iU1SlHE4D4/P+qJlL1wLKVYnkoK1JuDwRjUBw71pTItHzWCFFt3M1q8xaHQFGU4qyoUiE4TZ6i7g83Lnr2gc6Vp4vHyOkG/X3fKxHTIZAm4DK7ll/rC28osqdXSwbYcAGmANxFKFuxOlsEIlxik8eClSskQi4E3pfKJew+jtm30Tqgai3XgSqwUKGy+elNcG4SmdFyywvq+kBbDL9N5map2YdPA/L0UDCs= X-OriginatorOrg: ericsson.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Oct 2019 08:43:45.6458 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fece717f-47bb-486d-91d1-08d74c94cc0a 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR07MB5718 X-Spam-Status: No, score=0.4 required=5.0 tests=AC_FROM_MANY_DOTS, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH] ofproto: Fix for frequent invalidation of mega flows for push actions X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Vishal Deep Ajmera via dev From: "Li,Rongqing via dev" Reply-To: Vishal Deep Ajmera Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When a packet is processed by the slow path and the matching OpenFlow rule has actions like push_mpls/set_field and push_vlan/set_field, the ofproto layer un-wildcards the MPLS and VLAN match fields in the megaflow entry that it plans to install. However, when the megaflow entry is actually installed, all protocol match fields that are not present in the packet are wildcarded. Thus, the wildcard bits in the installed megaflow entry could be different from the bits originally generated by the ofproto layer. When the revalidator thread validates a megaflow, it will first query the ofproto layer to get the wildcard bits and then compare it against the wildcard bits in the megaflow. If the bits are different the entry will be removed. A subsequent packet will again result in the same megaflow entry being installed only for it to be removed by the revalidator thread. This cycle will continue and will significantly degrade performance. This patch fixes the issue by wildcarding flow fields which are not present in the incoming packet. Signed-off-by: Vishal Deep Ajmera --- ofproto/ofproto-dpif-xlate.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 44f856d..f92cb62 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -7343,6 +7343,26 @@ xlate_wc_finish(struct xlate_ctx *ctx) ctx->wc->masks.tp_src = 0; ctx->wc->masks.tp_dst = 0; } + + /* Clear flow wildcard bits for fields which are not present + * in the original packet header. These wildcards may get set + * due to push/set_field actions. This results into frequent + * invalidation of datapath flows by revalidator thread. */ + + /* Clear mpls label wc bits if original packet is non-mpls. */ + if (!eth_type_mpls(ctx->xin->upcall_flow->dl_type)) { + for (i = 0; i < FLOW_MAX_MPLS_LABELS; i++) { + ctx->wc->masks.mpls_lse[i] = 0; + } + } + /* Clear vlan header wc bits if original packet does not have + * vlan header. */ + for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) { + if (!eth_type_vlan(ctx->xin->upcall_flow->vlans[i].tpid)) { + ctx->wc->masks.vlans[i].tpid = 0; + ctx->wc->masks.vlans[i].tci = 0; + } + } } /* Translates the flow, actions, or rule in 'xin' into datapath actions in