From patchwork Fri Apr 27 12:20:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 905708 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=fail (p=none dis=none) header.from=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="Y38UKMgY"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="L8gxT26u"; 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 40XY3S3xy1z9s02 for ; Fri, 27 Apr 2018 22:22:28 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 13744941; Fri, 27 Apr 2018 12:21:00 +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 B40B08A6 for ; Fri, 27 Apr 2018 12:20:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 56F7CF8 for ; Fri, 27 Apr 2018 12:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1524831652; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=oeIMv0RkdkTGTn/ajTT3BAxoKi5C3cOrUy1FP5K4ew4=; b=Y38UKMgYOqko/k7Knz6hN6Klg8jbmLJ4W3+VYhihJrMhlKGLCj9IqtAjknVCl+1Q B6SbwtxLtspE/aarx/btkx9DfNIDDoaSH0cGFzKg4613DJGBC2vAvLiSveCkca92 APqpHtFtjGnh/Of5p1NNyuAgejBBmbCuoDOYhcqCVSs=; X-AuditID: c1b4fb3a-112a09c00000729c-68-5ae315a4dce7 Received: from ESESSHC011.ericsson.se (Unknown_Domain [153.88.183.51]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id D7.8D.29340.4A513EA5; Fri, 27 Apr 2018 14:20:52 +0200 (CEST) Received: from ESESBMR505.ericsson.se (153.88.183.201) by ESESSHC011.ericsson.se (153.88.183.51) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 27 Apr 2018 14:20:50 +0200 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESBMR505.ericsson.se (153.88.183.201) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 14:20:50 +0200 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 14:20:50 +0200 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; bh=Df6wQ90Mea1c6NIKgdHUlNJvOw1I7uCXQG3SbqTiph8=; b=L8gxT26ufSe5XpRgAxdN546iOoMI+sS2wHhjTPwd/U8fPo9TNXWR64LNCvBhXUVZ1Uvmos5M54TKGci4bmspZ3h1DMkPYJqyiF2+3hJ8i3MULV9tfS5ZObx1SwStwnoQzWHrLRiuLZymKYQIHSAWGmM2hFYRVaGmC13elHicFV8= Received: from ubuntu.eed.ericsson.se (129.192.10.2) by AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.735.5; Fri, 27 Apr 2018 12:20:47 +0000 From: Jan Scheurich To: Date: Fri, 27 Apr 2018 14:20:32 +0200 Message-ID: <1524831634-7955-2-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> References: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: HE1PR02CA0117.eurprd02.prod.outlook.com (2603:10a6:7:29::46) To AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM3PR07MB0646; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 3:YrcEKL5q9qNCPAVKJMknjy/PjuC2Jc3ySyV2rRurLN2+cAzRFWlcHZQv/pqzpQGPhzzP2K370bUWnO6AxDXL6Ibhc9k3bnE/kSgrjCi9DFIZKAi64C156ihulAXkDAy+nFZETgEx+n1O2mlcllaCRM5/cPigDgjDAiyMTseLCeRj6plmDvOdWXntUVF7fFclVF6n1cE6KhDurGCuBBrnxJj7WaBy42JOKXSzdvamUORkBScXoFLIhopHIxHfciMz; 25:0p4E1lgU2RA57i4wamcoUCnvXbKbi/W2e/FtZryZztTqH/3BJ5vNecqeDqUqu8lBQafL5MpOI/IjeLWbUTiSGPiaykq69yF817xXFrxLJlAod5AsaUGyMcxk3oVaZrNdw0daVcSIb1ooBcHRFr3arkNhCWqkjFj2TLlucqVCuA45u5zr7ysLDbDlwAW4AXVko4kUvWfHKPoQbvjgnKXBiOQ+dJAV0PCgKr2ssVw3CdSxMnFchRT92VsHkzP69DL/Ga/s8TvW/FX0iBHZtIjZor/ve4vtraEa4bIfy1O+QKPSEaYibHj1Ynw//Vv2ymhONOFSavNWLcn8PQSRwjvNtvCA8yBAqhEsVMT7uLXq2oQ=; 31:rDCWGOI6ReF4k1b5JKb+KBfagwq8sK86WnWso8i6dL3KbA8NOGMMh+AaBasCgoHEnd4By6G80JUf37AUYVCY76NrKbavGrURoSY5BQ5zCeOYwA1TQA2Sqw+yJ8PhaQAL6TGa0028uJRuZCUD5Hzsi2yc2G/KmDPsW/tkK7ionR6CdRFVXgA1hA0RbfcLw0/RkkmAebZsJR/T0yrlUfpeayD6aWFasICk+TN8SrQgtqc= X-MS-TrafficTypeDiagnostic: AM3PR07MB0646: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 20:TtsKwqSNXPenyZB3ERgUWjDWtRjiFKrXrKZ5xwRuid0CIUUED2xGwgMszDXMb9Zg2jJ1f3p0DpQ28ZlJyNwcnx3Y4BbdLXbJ3f+n3ug4diPwnZY6sR7nQyVCGHKrIBM3FgX+mZn/qC6/wU35+IXVbT1L2BTXKKjxFlScbLUSWIcC0BPT6W4Bx75YeC6rJhInd1hTlnSKGjS8OxKoDDgLsooJ9qOTHPCFelUUnngABGE5ej485bukgPT/9AenYwovSMFssqCEZIJegzXKQ9kb24A9oHxxYWCxdNwMlSzhz6xCFKd3sztGFQGoGlL7FNJOVy78I1B34xCgqlXakrG1PNy/JgbC8YgE1cms5C0forf8HS0p/dxdVoKA2+lPjNyt9Z5bvNym4QYpSw0ZjOaTutYkr9Suu9eJOccFVMMGpd93RtQ+FEe75HS5kC5yb5OF7RvznPe1l/nSChUbbCESPRShJNa4xx3UpUHrp/bH8icIkVecLJnqwo9TSzNmjmV7; 4:B2WD844SnV4h7Ml/yYdWt1ZYHzrcyuQf2t54iyT4WAgWardpDTm0DzICQmsRz67SZ1waFgpYB73CZKWbs9xTXpHDqblV3urqZipfeOjBMAiFwEPl3ykP4afL8rf7g+5LpCbvDDbYIOEBD3oecp2ZlCpGuYLotXZP7SGEp10wPNRszm9ih241UUaglWf+7IMSlDzY3v/FpRKulgqDzTwj9vMsCN7PyJtyx4gTPrbhYi5J9S2yY/uwmPC18YmwCrP5+PFIdJSekMGMnufUEzKBXQrBKI1WbYT+aqTKw+nJgr5G5BvgaLB0rMSQZU7al/El X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(37575265505322); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231232)(944501410)(52105095)(3002001)(93006095)(93001095)(6041310)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM3PR07MB0646; BCL:0; PCL:0; RULEID:; SRVR:AM3PR07MB0646; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(366004)(396003)(39380400002)(199004)(189003)(11346002)(16586007)(486006)(44832011)(2616005)(36756003)(476003)(316002)(51416003)(26005)(52116002)(956004)(446003)(76176011)(15760500003)(50466002)(47776003)(48376002)(16526019)(2906002)(105586002)(186003)(2361001)(66066001)(2351001)(25786009)(106356001)(478600001)(3846002)(86362001)(8936002)(68736007)(81166006)(81156014)(50226002)(305945005)(6116002)(97736004)(8676002)(7736002)(107886003)(6666003)(6916009)(386003)(6506007)(4326008)(53936002)(5660300001)(6512007)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR07MB0646; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR07MB0646; 23:QG7MnNijxFgGTMKtWpKjOcQm5gBnUJkwkuE55ZTOE?= UrL83+oYJnenwEwteMEcpDbgnqoi/ojAfnN3zj4tQtgPZ8SvgyP8E6g41Wr0iJCIenKjJPUN17SCAJYiu33kWb2OW8Wg9E+UzdIJoEZLj3fBFFD6ZPDufcB9EWtkgQFM5WSTScBdiwLfq5EClVyU5bW2JAAsGCNdjkoAYn6SS/SdukP9Zv/hSeIr4eUWTO1dSyDoh5Nb4yhj+Fm5W0s6orxcW9ODafNX8not09Jx8WSmj0xVgAQOiYWFeqrv0PdOq9WpiTp8Hq2eswvlX46na7KLFfKOZFWW4cl//nIoaKGQ/pHuXJm0WQFSj4QENihxSeORPH3/wAsJtkMrnDzjFhL1yEPbJClu5kf8U2aSQCKrD62wfD0SsWmGwyJh89iGnGNE4VaXRC5xB8Sk4Adz7mynVfJ7/jzBfU7Ru4iY5dTMBNKI/THeR59zoNXqmkRI772maU+DU0pIQgngtV+8gnSoUHVKsXzBrVfAdZ5oGjo4KaNPKn2czdo5yoyBFfIsna3gajyFEMKrWCTGGgQrKPhL4eEj6GGEz6YA4WC2HzwF2AuYh9KkBIq8sCtzCbEm81kKCiFxREx1V4UG/Ds420Fb6JobTs9ihzPpzZufOpsAvFKZjjl5TzeU21XnVnQe1X6vCf60LtTALEkuzPRagnSqEBI4orxE3fkJQclDwQwLavd9lyk1OoU13rqxeQGeGYHXbLevmw5aa775pkzlbX+Gs49CTj35pLPx8EGHRz7AH8rQAT+TxmaTNA55cJYEWiYGmm//PUISs816tLAEk4wnpBYlIv2XrQvtT0khZnnIOkZQnT44f97t/UQgdBwvQpQrk1hAE2Pex9dVM0B1PcefIa+84vFv0UeQqLLqeiunx/NQPaayu6fJROEZzDA7i4HtYQduItKw8J4V+u6cFO7hJTs0Yxoirw7Tq4ORU6A/c5T2b19r9xybCHx8oBYHhSgp4I3HjfcervMuC6/NuPrrO4gqgLfl5Szd/G0+x8+NhzsWqoGofGbEQRRfWcrQKCSuekHv3LFGbq7ZuhH8T2f5gwl8W46d6DbKhZy3pogZ4+oFhVu+YqI9tQzuqmRQf/GIV+UrOGlc8P52x+Ykfa7OSiZOk1DUAGQ8h1VsHxxm8jG+/bAI2XIxi4BZe3G28l3JfvC9W1kdGldXBFOJn/XhBduSPxhJShq3wMrDKGcSzsMB/0KqArPrUtipWxx5tNagLmLtkjde4N7PJKeTKyVkPZabHaby9wTqs+GuKh+hA== X-Microsoft-Antispam-Message-Info: r1129LlBnIoziJjh9Q1chaazTyHgN2aWvjqR1CWqhfnga+gBhMqxRSKhxHg+KmUnJEcoVc+/A4pZ+fxhnWbtB+E8jrlji0t847YSFiZRQLp+qpug7/ysLg3lzVvkClZxU248aCkFf+IidJosDuO0XlVB6WUMrGmWaZ0MxJj4oMCiuw/eLXmMsrVUzbFCZ32s X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 6:N2Svnexn09jAKuYXuopF+WlN1tvtqe1Y5nevQF05sO3N+vR3iYSHfhvFvLqZeP6T+JuMA3yBsAgZBNiG+XRMSi71IbvWD5BT+TKk0QD42CBntPHLZ+O+YLzoxMD5v3m0YeOA2MY3mSCcJl7ZaNievPbvxjiklzy3pftxVlZFVDJZp5Js2Nz8tn153HLf6tTyYopxuI5lOwS+B/Xq7nLF1Mszl5czUB5KIv7VZ7jIhzkEfNmSF0RMetZz663gXGDi4niMSjkXQYJ7hqixikO5YRddn7FIoPdiOlRQAbleu1QJiZ6dUWgt0gCmXxxGTC8U0n2JAaBRhZbTqIkZ3pQZ0mbW2vLr5k7mU2Q412O7oF+NFz47mJ6ta/72yaSsLao6sWRXrsNAfKib9gY1/9qo92Mx90wOoHwwd5AdZRTL86k82ci/uP7TXrVYiiDBgRqXjJWsCRS28mhsrL7hwhtZkw==; 5:xiP1UlymbQySEub2lgmmcfQl869qr9/tiMUp4q1DROaOww86yd+UYOa/79lFZMXBk8XCFJNlMCD3a8DLf67UzMr43qxB0qT9o9NYnVsQmcHzoTq9+IjP3eBrqDh//SbqpZqotsduFdPAnm52LZyR1UxxJuicIAxm4fC+Eopab80=; 24:N0Jrds7eLGplWeMZuETWaH6X5PHdRQJd/McXx9rFX2hHYA1sv4SmPB40bZke/L4iNrI+ThF6ZaUC8d6FK5LkpJITkMUqjCENb0EAzjYDrKg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 7:/Ejmb0Y68GlnfMHschrgfLNtzoK6sp+gxUbcrpAQy+Nle64QEJ3BV4kLFL6gAQ+f4xq+jgFyAan1OW+r5PyFzYIjtt2fPtDXRwaEPwnr1LqD0mR21CGifxTZixTpQpqgIQcX3908GPoVIMh886Fj8C+h24UTQEXZE4vyVZe18ZUQ4udtp+ir0h40UKuwH2bZntvf43qmV5iGkORQeYgoLANbNl1H4Upr4v9UKrm3gxSF0rYrih7yzQXAQlowhvQb X-MS-Office365-Filtering-Correlation-Id: 2740f11f-1a94-49b4-c7c3-08d5ac394f29 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 12:20:47.8380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2740f11f-1a94-49b4-c7c3-08d5ac394f29 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR07MB0646 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDIsWRmVeSWpSXmKPExsUyM2K7se4S0cdRBnN6ZSxeTW5gtDh6eg+z xZddfYwOzB6LV0xh9Xh28z+jx/NrPSwBzFFcNimpOZllqUX6dglcGZP+rGEvOOVfMa3rCXsD 4wGzLkZODgkBE4mjnf9Yuxi5OIQEjjBKXD66iQnC2cIoMfnfYkYI5xujxJnzx6AyS5gknp9r YgZxWAQ+MUnMWrwPqqyLSWLJxw9ADgcHm4CBxOzdDiBLRAQkJf4t3sIGYjMLlEmsOr8HzBYW CJe40nSUCcRmEVCVmLbrPVicV8BTYu60tUwQB8pJnDw2mRXE5hTwkjjzq4sRxBYCqnn1+QZU vaDEyZlPWCDmS0gcfPGCGaJXQWLjlpksILdJCExnlOg49xiqWV3i76GvLBBFshJHz86BKtrG KDF/1192CGcKu8T67gaoM7Qkzr/5zQ5iMwrESrRsncoEUfSDTeLGomWMEEXZEs8bdkHttpJ4 /es7I0TRUmaJu1efsUEkZCRmbV3HBpG4yCrRuXcG2wRGvVlIHpmF5JEFjEyrGEWLU4uLc9ON jPRSizKTi4vz8/TyUks2MQLTxMEtv612MB587niIUYCDUYmH94jw4ygh1sSy4srcQ4wSHMxK Irw7bj+MEuJNSaysSi3Kjy8qzUktPsQozcGiJM7rlGYRJSSQnliSmp2aWpBaBJNl4uCUamDs 1gx5+i4uKpj/49StIYWevVmnft2YYZ3x5/O39jvrUy1sz19PUVnxhfsEs5Hf3dgZdtpL9YIO t7Od0Txj4aq/XJF3uvZqu4A1dcE71LL5wxe/OzqF0+DoWe/ps/grJQyypnmWXeo//WT2vZ1x 8kZ3eg9oM/OLTS47n1dvkVTU9nCPRcsmsRVKLMUZiYZazEXFiQDawPtXDwMAAA== X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: nitin.katiyar@ericsson.com, ychen103103@163.com Subject: [ovs-dev] [PATCH v3 1/3] userspace datapath: Add OVS_HASH_L4_SYMMETRIC dp_hash algorithm 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org This commit implements a new dp_hash algorithm OVS_HASH_L4_SYMMETRIC in the netdev datapath. It will be used as default hash algorithm for the dp_hash-based select groups in a subsequent commit to maintain compatibility with the symmetry property of the current default hash selection method. A new dpif_backer_support field 'max_hash_alg' is introduced to reflect the highest hash algorithm a datapath supports in the dp_hash action. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar Acked-by: Ben Pfaff --- datapath/linux/compat/include/linux/openvswitch.h | 4 ++ lib/flow.c | 43 +++++++++++++++++++++- lib/flow.h | 1 + lib/odp-execute.c | 23 ++++++++++-- ofproto/ofproto-dpif-xlate.c | 7 +++- ofproto/ofproto-dpif.c | 45 +++++++++++++++++++++++ ofproto/ofproto-dpif.h | 5 ++- 7 files changed, 121 insertions(+), 7 deletions(-) diff --git a/datapath/linux/compat/include/linux/openvswitch.h b/datapath/linux/compat/include/linux/openvswitch.h index 84ebcaf..2bb3cb2 100644 --- a/datapath/linux/compat/include/linux/openvswitch.h +++ b/datapath/linux/compat/include/linux/openvswitch.h @@ -720,6 +720,10 @@ struct ovs_action_push_vlan { */ enum ovs_hash_alg { OVS_HASH_ALG_L4, +#ifndef __KERNEL__ + OVS_HASH_ALG_SYM_L4, +#endif + __OVS_HASH_MAX }; /* diff --git a/lib/flow.c b/lib/flow.c index 09b66b8..c65b288 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -2108,6 +2108,45 @@ flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis) return jhash_bytes(&fields, sizeof fields, basis); } +/* Symmetrically Hashes non-IP 'flow' based on its L2 headers. */ +uint32_t +flow_hash_symmetric_l2(const struct flow *flow, uint32_t basis) +{ + union { + struct { + ovs_be16 eth_type; + ovs_be16 vlan_tci; + struct eth_addr eth_addr; + ovs_be16 pad; + }; + uint32_t word[3]; + } fields; + + uint32_t hash = basis; + int i; + + if (flow->packet_type != htonl(PT_ETH)) { + /* Cannot hash non-Ethernet flows */ + return 0; + } + + for (i = 0; i < ARRAY_SIZE(fields.eth_addr.be16); i++) { + fields.eth_addr.be16[i] = + flow->dl_src.be16[i] ^ flow->dl_dst.be16[i]; + } + fields.vlan_tci = 0; + for (i = 0; i < FLOW_MAX_VLAN_HEADERS; i++) { + fields.vlan_tci ^= flow->vlans[i].tci & htons(VLAN_VID_MASK); + } + fields.eth_type = flow->dl_type; + fields.pad = 0; + + hash = hash_add(hash, fields.word[0]); + hash = hash_add(hash, fields.word[1]); + hash = hash_add(hash, fields.word[2]); + return hash_finish(hash, basis); +} + /* Hashes 'flow' based on its L3 through L4 protocol information */ uint32_t flow_hash_symmetric_l3l4(const struct flow *flow, uint32_t basis, @@ -2128,8 +2167,8 @@ flow_hash_symmetric_l3l4(const struct flow *flow, uint32_t basis, hash = hash_add64(hash, a[i] ^ b[i]); } } else { - /* Cannot hash non-IP flows */ - return 0; + /* Revert to hashing L2 headers */ + return flow_hash_symmetric_l2(flow, basis); } hash = hash_add(hash, flow->nw_proto); diff --git a/lib/flow.h b/lib/flow.h index af82931..900e8f8 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -236,6 +236,7 @@ hash_odp_port(odp_port_t odp_port) uint32_t flow_hash_5tuple(const struct flow *flow, uint32_t basis); uint32_t flow_hash_symmetric_l4(const struct flow *flow, uint32_t basis); +uint32_t flow_hash_symmetric_l2(const struct flow *flow, uint32_t basis); uint32_t flow_hash_symmetric_l3l4(const struct flow *flow, uint32_t basis, bool inc_udp_ports ); diff --git a/lib/odp-execute.c b/lib/odp-execute.c index 1969f02..c716c41 100644 --- a/lib/odp-execute.c +++ b/lib/odp-execute.c @@ -726,14 +726,16 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal, } switch ((enum ovs_action_attr) type) { + case OVS_ACTION_ATTR_HASH: { const struct ovs_action_hash *hash_act = nl_attr_get(a); - /* Calculate a hash value directly. This might not match the + /* Calculate a hash value directly. This might not match the * value computed by the datapath, but it is much less expensive, * and the current use case (bonding) does not require a strict * match to work properly. */ - if (hash_act->hash_alg == OVS_HASH_ALG_L4) { + switch (hash_act->hash_alg) { + case OVS_HASH_ALG_L4: { struct flow flow; uint32_t hash; @@ -749,7 +751,22 @@ odp_execute_actions(void *dp, struct dp_packet_batch *batch, bool steal, } packet->md.dp_hash = hash; } - } else { + break; + } + case OVS_HASH_ALG_SYM_L4: { + struct flow flow; + uint32_t hash; + + DP_PACKET_BATCH_FOR_EACH (i, packet, batch) { + flow_extract(packet, &flow); + hash = flow_hash_symmetric_l3l4(&flow, + hash_act->hash_basis, + false); + packet->md.dp_hash = hash; + } + break; + } + default: /* Assert on unknown hash algorithm. */ OVS_NOT_REACHED(); } diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 94e3ddb..05db090 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -3968,10 +3968,15 @@ compose_output_action__(struct xlate_ctx *ctx, ofp_port_t ofp_port, struct ovs_action_hash *act_hash; /* Hash action. */ + enum ovs_hash_alg hash_alg = xr->hash_alg; + if (hash_alg > ctx->xbridge->support.max_hash_alg) { + /* Algorithm supported by all datapaths. */ + hash_alg = OVS_HASH_ALG_L4; + } act_hash = nl_msg_put_unspec_uninit(ctx->odp_actions, OVS_ACTION_ATTR_HASH, sizeof *act_hash); - act_hash->hash_alg = xr->hash_alg; + act_hash->hash_alg = hash_alg; act_hash->hash_basis = xr->hash_basis; /* Recirc action. */ diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 1ed82d0..7162811 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1291,6 +1291,50 @@ check_ct_clear(struct dpif_backer *backer) return supported; } +/* Probe the highest dp_hash algorithm supported by the datapath. */ +static size_t +check_max_dp_hash_alg(struct dpif_backer *backer) +{ + struct odputil_keybuf keybuf; + struct ofpbuf key; + struct flow flow; + struct ovs_action_hash *hash; + int max_alg = 0; + + struct odp_flow_key_parms odp_parms = { + .flow = &flow, + .probe = true, + }; + + memset(&flow, 0, sizeof flow); + ofpbuf_use_stack(&key, &keybuf, sizeof keybuf); + odp_flow_key_from_flow(&odp_parms, &key); + + /* All datapaths support algortithm 0 (OVS_HASH_ALG_L4). */ + for (int alg = 1; alg < __OVS_HASH_MAX; alg++) { + struct ofpbuf actions; + bool ok; + + ofpbuf_init(&actions, 300); + hash = nl_msg_put_unspec_uninit(&actions, + OVS_ACTION_ATTR_HASH, sizeof *hash); + hash->hash_basis = 0; + hash->hash_alg = alg; + ok = dpif_probe_feature(backer->dpif, "Max dp_hash algorithm", &key, + &actions, NULL); + ofpbuf_uninit(&actions); + if (ok) { + max_alg = alg; + } else { + break; + } + } + + VLOG_INFO("%s: Max dp_hash algorithm probed to be %d", + dpif_name(backer->dpif), max_alg); + return max_alg; +} + #define CHECK_FEATURE__(NAME, SUPPORT, FIELD, VALUE, ETHTYPE) \ static bool \ check_##NAME(struct dpif_backer *backer) \ @@ -1353,6 +1397,7 @@ check_support(struct dpif_backer *backer) backer->rt_support.sample_nesting = check_max_sample_nesting(backer); backer->rt_support.ct_eventmask = check_ct_eventmask(backer); backer->rt_support.ct_clear = check_ct_clear(backer); + backer->rt_support.max_hash_alg = check_max_dp_hash_alg(backer); /* Flow fields. */ backer->rt_support.odp.ct_state = check_ct_state(backer); diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index 47bf7f9..d654947 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -175,7 +175,10 @@ struct group_dpif *group_dpif_lookup(struct ofproto_dpif *, DPIF_SUPPORT_FIELD(bool, ct_eventmask, "Conntrack eventmask") \ \ /* True if the datapath supports OVS_ACTION_ATTR_CT_CLEAR action. */ \ - DPIF_SUPPORT_FIELD(bool, ct_clear, "Conntrack clear") + DPIF_SUPPORT_FIELD(bool, ct_clear, "Conntrack clear") \ + \ + /* Highest supported dp_hash algorithm. */ \ + DPIF_SUPPORT_FIELD(size_t, max_hash_alg, "Max dp_hash algorithm") /* Stores the various features which the corresponding backer supports. */ struct dpif_backer_support { From patchwork Fri Apr 27 12:20:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 905707 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=fail (p=none dis=none) header.from=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="I+L0o31X"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="Qp09DbUp"; 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 40XY2b23Xkz9s02 for ; Fri, 27 Apr 2018 22:21:42 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DDA828DC; Fri, 27 Apr 2018 12:20:56 +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 0054489F for ; Fri, 27 Apr 2018 12:20:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 2BF0CF8 for ; Fri, 27 Apr 2018 12:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1524831651; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=qOuUQGyu1kEUblWhDiP04bAfzTZeoQRsdsqLb6z1MUA=; b=I+L0o31XgtBj9Cc4emqaL5w7R8ox3lsQ/RuN/L4HzZpKW9dd9Slr4QW1swUUbrW/ 1RkD+lbY5BpKm5Sj4v9ASFCj59HSjWwOJyFAXgsjX+XAuZrMCzmBpDvl04Q6BXtY z/v7k/ARaLFJ+BLiORsUtVNvYIFBtmPZe/mHYja+bDk=; X-AuditID: c1b4fb3a-d4dff7000000729c-63-5ae315a34390 Received: from ESESSHC020.ericsson.se (Unknown_Domain [153.88.183.78]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id F6.8D.29340.3A513EA5; Fri, 27 Apr 2018 14:20:51 +0200 (CEST) Received: from ESESSMR501.ericsson.se (153.88.183.108) by ESESSHC020.ericsson.se (153.88.183.78) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 27 Apr 2018 14:20:50 +0200 Received: from ESESBMB501.ericsson.se (153.88.183.168) by ESESSMR501.ericsson.se (153.88.183.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 14:20:50 +0200 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 14:20:50 +0200 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; bh=sq9G6w2hGNbo7zCOeldgmWBTqBuU+lUB0iEllIy8PtA=; b=Qp09DbUp0ZNxTCpAoevTM9tMA1fTRA1ECXXO5hBqYbB5Gco4RDhhC4Qrr2drU8l4L9O3BFn1AzUG1iIikmMdj6YcxNVlnaELJPpprNYrO6siuUu+049M0GgWNWYAaV+CjKqvTIOCJosXTm37pAZN7acFV6QBdhYpaFuNwWbb27c= Received: from ubuntu.eed.ericsson.se (129.192.10.2) by AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.735.5; Fri, 27 Apr 2018 12:20:48 +0000 From: Jan Scheurich To: Date: Fri, 27 Apr 2018 14:20:33 +0200 Message-ID: <1524831634-7955-3-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> References: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: HE1PR02CA0117.eurprd02.prod.outlook.com (2603:10a6:7:29::46) To AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM3PR07MB0646; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 3:/gPfGT2tgAWt/58eSQjeY3zABPzE2/zPUIzWOOQRzLZB95Tc4VjJZqELX2wzY984vH6pV17rqBOrnYrBvz3lP3q7puVQIFuipyTJd75dAk4EGJcy0C3s+/hQa7eMGYQcm3UHfAyVSvWuBihVqQBqX/N1+QltmhCHIERMPCYrTTDLxgt8P1tj/E345uxoAKtUafBSkuuEhIOcVcDWzREJ2jhtZ7CLPE90Ki3PY2/2ZXSjiUFFfFpFFPsPwBKiLNDf; 25:ux42Fv3c9q/r44zsbzfDQNKaiKPgNcJ0V/Jk0tMyjDUUD4J1QORRFOuW0BusPx3RvCMbojvnyDSy7tWfjYfXM2bx8L8Y9ZsLXM/W2LVDVtffzTOSqDQMwuaj1kVCeAFnm6IqBsWOZ9MydJgjZC0HZ9CgfxfGjMedvPTkGP+nPGFZXkSutJ3kkIPuJL4lYigy+qxVpMq1l33QKAt9b+fGJRHtfC8vwtsgPvj+4WNAwizrTtBeGV+wMoG2Mm+nLAhrPD7+P9imKL1d1u/00NUGV2+ylK8MS91iYEdDVmkD6jQXOR0Htz6E6mAUoW2EjE52pQ1EtsA77R4xxR4KkLQd7KYsHfLQdNQ7SW1H6ZJrBiU=; 31:n7qIABsIPaJWVnwiFzc4Wo1tgvgN7sMa0MviDPgGBlwQe9BwS4k5QquFVyFUxMjEE/DO+Y6+YovKosimpDwk0/IVSr3P4jQM2HU1+W1w0IydCAix7hTRpb+Pxksw0QX3LjSXyvtcubjZV3Z8rjY7aiTtOC2VqZzArZ3DvXUWs7TT20IZzrR+OjGV0vyTuwk+xqRAFA89BOevwreJPjJIUQIr+SQ+UFey84PL84zCBuE= X-MS-TrafficTypeDiagnostic: AM3PR07MB0646: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 20:nB5LAy81bDOxcePaJA/YISI95GNRiz7slZkNSMHkVdB2svhbebITuXgGDeMAZO8JKCFzh+Fh0bQ9KeTxMMypH0s0WnFfSqFMxkO5Bjw5a0XWAGMOHJXANpevexAASxaFQPyr6qVA2c/om1CXTodoEaG0gh0m4tARikKhuwJXULsq7K7W2JXtO6Mcvrg0NQsGTZXZ2DdSQtFdXHyPwHOIdc+453f9AiVTa+RjdPrbQyNRww0mx+r0xwBAJid6NHLXh72aM8WMzDmHGdbtKLR+DYoJAx5YIGWARena1tBisxKF38522lQU6y7hrLDFW8H6PpsngYqBkQeKZcd64BUpnyOCZqNmAr6tfK6xcy0ojY5gqBpTkOBoxKaI8zdcDBjgToOFIxXCABlEdAzKvYi6Tjaf9Thtk6VaL4Xt1XoZ6tE8faw5paN3ebUPQdKF6hqiiU16oJnUkIHDKNkbh7toRD64ZMzInLjezWOpPtJxGG3Km48ZQw2bBthBP6s/xTB8; 4:1ZCk1UDf7lJuon6jjc5NmAk0Dva2na7/SoNAbF3B/Fb6jd6CKMd92TiEcMkG6i4EbDtncctIadKFkaUkD+i0O2gf/l/foYHQT21ZOgCk6ATCNxhzjjKY0PmQBcqFASnCWsr7+VMno0i82E7G42xLqY8ucM81a0+I0l5Dz76ON3dXRGEv10QMF9AVsaYmGjnutVIgbQQP9S3H1R2juKQDqQUVLVBN9y1EuUF4sNOJkgmy+wbm0BU36/RuOxXre3NqgPJ/+D4nqfohVRDQNbA7tRKXXrpQarUs29TTYyNK7Jo2F0OSdVdrFmHUxRRjI1OZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(37575265505322); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231232)(944501410)(52105095)(3002001)(93006095)(93001095)(6041310)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM3PR07MB0646; BCL:0; PCL:0; RULEID:; SRVR:AM3PR07MB0646; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(366004)(396003)(39380400002)(199004)(189003)(11346002)(16586007)(486006)(44832011)(2616005)(36756003)(476003)(316002)(51416003)(26005)(52116002)(956004)(446003)(76176011)(50466002)(47776003)(48376002)(16526019)(2906002)(105586002)(186003)(2361001)(66066001)(2351001)(25786009)(106356001)(478600001)(3846002)(86362001)(8936002)(68736007)(81166006)(81156014)(50226002)(305945005)(6116002)(97736004)(8676002)(59450400001)(7736002)(107886003)(6666003)(6916009)(6306002)(386003)(6506007)(4326008)(53936002)(5660300001)(6512007)(6486002)(966005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR07MB0646; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR07MB0646; 23:Q8nZg+6CUXqOtrKoNy3nJYObLDtpMVh1DfgD7eiYj?= KjwiqKHlXiWMkTfyOqVL+ZCmEe/cAlc3G5Dvebwsfna1j5JtASkxuO+kwqa5TuUwsE8DBdi5cMs+vjuvg2iI2vVZUZEWK7KsS8BYfk8mj5Vov61MuRqcliPo0sYATMkWONjTbs62qjYEzPqnlflUfBa3kWQEFXlbgJZC01s8EX8BKrmDR//j50dWVDTQKJH43USuATNPUJ86HMrQGvsLwy/EAfoT/f4Nz9VEBaE7G0P6rXw++XJNpg6IucjgNbYPCjTmQXXdG1BZ4xfDbW/Rb6VunmO5o365899WlHSJIqP50a1r2cwDUXE3wwA6gQ9TTpbiTtOmiyFO/sAUwNBkjLUReM49DnUBY2us6Ce7c20WnMlMoBTA3uEPuwnRYKRMtsHeBRiRm2rRzq3/U/iT/JJXG+9AQ0byyT7Cm/5rM6Hn/B7QbBgqRfs6+abF5nfIZ3OSsKsVFnACeUzhWweetjKDhgZX2cT0grmqUjBUTgO9bGwlTM7Oa24gRqsXd7tRxX4KBIlJSBLoDg5ZAx0T0y0ALe8Yb2lmlNRH5m18YbKnUxiwt9vNzGlABFlFmDPT2ZXJuyTvjHXr5znd5RH/r2DD79Y5d/UpAHXN2cqwiUepgHHH8BgXY4xXl8kjjNlq2sRj9MQulg0mMHoMo/zIjI6ZRQHVfKyGtExYGVpF6HDGMv0I3M3J4WnUkKr0ZHKmco9MDB4P2Jn7aUBazSFwRuciHp1qgI2vFHp4ylzEjk7IJOXNtBYvPsRXOzcMfThjERB4OJyfF4tckvBj2T/Xox5Wmv4+2t4A1F4Y+Q4c/zTKycbfEVZzfeau04FNOxN7ncAA+gKlWW0wYORmNFah7Rfuq3ZTNrsjeXve1v8f7NRwAxlQHLnsm/PJi5OvU17/hzPKC66T4rVPqjylGoXSHpchiW/rjF4TnRJPr/Hk5tRw+lRofxZaP1fSpoKcwHeQBLdszRXdYoVBUx1yLhNv0PwbJetuokasL134jRUyhN2rsd5+9AaceAsfUkniRGBHw2+nJrm5P7E43lp9kH6UES/bX5aiju6AfonvDruYUdbEAhnziairSdkeF7inW3Ea/aSbglMJcLlUbGBiBxjyVyKAw0Be523287l2mSar+ujqL5yfLoTMYa2SBHpfV5reGRVo0FbFBwkyD1vo9gb9FtFhMwaaKpIAZevGmCU/gNUXwkm9YPwBkmqmsB8oHJic9xy9o7e/h5jcxCJ2gapmnLSFf5tD7vKbdqMEmItXsYqqrbiMKPRUPEZ/LbyUynfy0Y= X-Microsoft-Antispam-Message-Info: 4Q6WqyShTN0BETcyBVEeFPeEu2SXTnbPBaPwBhtjHLfWrrrinGuQpw09ki1EZdzHbKleO6vIeiiGeCcgRCHIByQetC+BC338/K433jBrc6yBgrYfDe3f7/GSGjJgwGEpgzsMztjZktTWxCKFw7IrIBufp0/Woyo4K4rs5xSe9Sawgst8mmkO3hgEYkrwgL15 X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 6:l4oXiGAWfx8aFV7Jv9u0IF0Wzub6PrbEDOLR4TQKRktT9iVvulWiYgCkQsf6ZsZakUKT4PJqyAFMJlr3oovUDBJK2jQL+jSI5nVqJhcMyGPm6l+XUbhDil6jTFdaWQADmIxxnIpfg3smL9gkLCf8QhA5VAyzTg+wKpbSewq2AdAUmdigLySSSXAGTpEdnAfFggZ1CoLuw858r3UhvLCPdlO1tps7qFvmBSMwHR10j0XqjucbJlBZLJX9qm5rZb27zFPSqKf42TtMoZIq/Pdz7Oidi7DGKcWGVfDG+jOjKQEaCiGFIQl04n0OM4bK0ywDdvsrpP+dq6jraydoN9XWnxCin5h7o1Gvyy1wRgcPRld22OWd2HgWbFEUZcEPu/A5m7QvRhlnY0F7EGIocvAty9vfXZytex8s2L2IWUt37jI4dBG/ayaN1/aTV3c/h7U2h0MmCWLwxf8znxnVJ9rmAA==; 5:OMebw6J9fek4/YlGsb12JKIGeuXW7/JCMe5vnWkxw47UYDFPT9ej/DgaoEy1/VxXoQL/6pimDzTMytMRq/v9LvO5d/eJImpzQcQ/XrGteGZE59ZjZ63KFixvR/G/kTGPYnHdTG5DWiOxvH4zFGZsyMWccP012kFqu6a51Ulzzgo=; 24:5j5OtwOpXRw+s69cagpiKZH+6Gt/fnOZ7fId8omReRR/sJRKD5GbfrebSOF/am2oO5c93bbRtELgqUepYkNfjX30IDKVElkrg4W1MPWKo/k= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 7:onR3QeFqEYZPWGFja05xF/1xu6EK7fuIM+uhwxmzMgeuuzkhkpllgWFTJe/ZJhUpS76Mlvz9sHT7Cj200DUUBxfif3Cv2Zg1EpOupg65yBWcxdJNffOikxi+ngm4XIGA/qTHCfWBUDzlk8N8aRkz0SZt/9p7n9SB6qvFRGeMm9qYdpg6aXbtCbZvipQxt4hokIhT0iafa7UK9Uxx+3/hVn+hFUVUsTqYhOHkrXA3ExtSdfLjHolKok+HD6QcFLXq X-MS-Office365-Filtering-Correlation-Id: 6255fba6-d2aa-41a3-2d12-08d5ac394fae X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 12:20:48.7287 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6255fba6-d2aa-41a3-2d12-08d5ac394fae X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR07MB0646 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLIsWRmVeSWpSXmKPExsUyM2K7n+5i0cdRBlfmKVi8mtzAaHH09B5m iy+7+hgdmD0Wr5jC6vHs5n9Gj+fXelgCmKO4bFJSczLLUov07RK4Mj587mUtmDSLseL2hrPM DYyPSroYOTkkBEwkPrzbzt7FyMUhJHCEUWLR2b9MEM4WRonr596wQjjfGCU+bLwBVbaESeL5 uSZmEIdF4BOTxIY/e1kgMl1MEhPufAUq4+BgEzCQmL3bAWSJiICkxL/FW9hAbGaBMolV5/eA 2cICERKHN/5nBrFZBFQl2g+fZgWxeQU8JdqP/mCFOFBO4uSxyWA2p4CXxJlfXYwgthBQzavP N9gg6gUlTs58wgIxX0Li4IsXzBC9ChIbt8wEu01CYDqjRMe5x1DN6hJ/D31lgSiSlTh6dg5U 0TZGifm7/rJDOFPYJfZcu8sOUaUlcf7NbzCbUSBWomXrVCaIoh9sEu+XTGGCKMqWeLx/GtRu K4nXv74zQhQtZZa4e/UZG0RCRmLW1nVsEIlHrBL/Tl9ln8CoNwvJI7OQPLKAkWkVo2hxanFx brqRkV5qUWZycXF+nl5easkmRmCiOLjlt9UOxoPPHQ8xCnAwKvHwHhF+HCXEmlhWXJl7iFGC g1lJhHfH7YdRQrwpiZVVqUX58UWlOanFhxilOViUxHmd0iyihATSE0tSs1NTC1KLYLJMHJxS DYySrztDkjRqF2g8uNSW/ZVtwS3BhU+1Z4bxnrgcalp0T93skJKVx/XJ3xUnX5G0DLXPajkQ zbm12lbi27z18qGcDQ0zl3Po6i2zd41hW1e//NX+yFUiVsZf9nvnxy0WtancIKp8x+mV7/c3 ym/nmujOvxJYbP/x99SPf+2e8V66du+2bC7TwbtKLMUZiYZazEXFiQBJ9jx+EAMAAA== X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: nitin.katiyar@ericsson.com, ychen103103@163.com Subject: [ovs-dev] [PATCH v3 2/3] ofproto-dpif: Improve dp_hash selection method for select groups 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The current implementation of the "dp_hash" selection method suffers from two deficiences: 1. The hash mask and hence the number of dp_hash values is just large enough to cover the number of group buckets, but does not consider the case that buckets have different weights. 2. The xlate-time selection of best bucket from the masked dp_hash value often results in bucket load distributions that are quite different from the bucket weights because the number of available masked dp_hash values is too small (2-6 bits compared to 32 bits of a full hash in the default hash selection method). This commit provides a more accurate implementation of the dp_hash select group by applying the well known Webster method for distributing a small number of "seats" fairly over the weighted "parties" (see https://en.wikipedia.org/wiki/Webster/Sainte-Lagu%C3%AB_method). The dp_hash mask is autmatically chosen large enough to provide good enough accuracy even with widely differing weights. This distribution happens at group modification time and the resulting table is stored with the group-dpif struct. At xlation time, we use the masked dp_hash values as index to look up the assigned bucket. If the bucket should not be live, we do a circular search over the mapping table until we find the first live bucket. As the buckets in the table are by construction in pseudo-random order with a frequency according to their weight, this method maintains correct distribution even if one or more buckets are non-live. Xlation is further simplified by storing some derived select group state at group construction in struct group-dpif in a form better suited for xlation purposes. Adapted the unit test case for dp_hash select group accordingly. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar --- include/openvswitch/ofp-group.h | 1 + lib/odp-util.c | 4 +- ofproto/ofproto-dpif-xlate.c | 82 ++++++++++++++-------- ofproto/ofproto-dpif.c | 148 ++++++++++++++++++++++++++++++++++++++++ ofproto/ofproto-dpif.h | 13 ++++ tests/ofproto-dpif.at | 15 ++-- 6 files changed, 227 insertions(+), 36 deletions(-) diff --git a/include/openvswitch/ofp-group.h b/include/openvswitch/ofp-group.h index 8d893a5..af4033d 100644 --- a/include/openvswitch/ofp-group.h +++ b/include/openvswitch/ofp-group.h @@ -47,6 +47,7 @@ struct bucket_counter { /* Bucket for use in groups. */ struct ofputil_bucket { struct ovs_list list_node; + uint16_t aux; /* Padding. Also used for temporary data. */ uint16_t weight; /* Relative weight, for "select" groups. */ ofp_port_t watch_port; /* Port whose state affects whether this bucket * is live. Only required for fast failover diff --git a/lib/odp-util.c b/lib/odp-util.c index 6db241a..2db4e9d 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -595,7 +595,9 @@ format_odp_hash_action(struct ds *ds, const struct ovs_action_hash *hash_act) ds_put_format(ds, "hash("); if (hash_act->hash_alg == OVS_HASH_ALG_L4) { - ds_put_format(ds, "hash_l4(%"PRIu32")", hash_act->hash_basis); + ds_put_format(ds, "l4(%"PRIu32")", hash_act->hash_basis); + } else if (hash_act->hash_alg == OVS_HASH_ALG_SYM_L4) { + ds_put_format(ds, "sym_l4(%"PRIu32")", hash_act->hash_basis); } else { ds_put_format(ds, "Unknown hash algorithm(%"PRIu32")", hash_act->hash_alg); diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index 05db090..e6d97a4 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4380,35 +4380,59 @@ xlate_hash_fields_select_group(struct xlate_ctx *ctx, struct group_dpif *group, } } +static struct ofputil_bucket * +group_dp_hash_best_bucket(struct xlate_ctx *ctx, + const struct group_dpif *group, + uint32_t dp_hash) +{ + struct ofputil_bucket *bucket, *best_bucket = NULL; + uint32_t n_hash = group->hash_mask + 1; + + uint32_t hash = dp_hash &= group->hash_mask; + ctx->wc->masks.dp_hash |= group->hash_mask; + + /* Starting from the original masked dp_hash value iterate over the + * hash mapping table to find the first live bucket. As the buckets + * are quasi-randomly spread over the hash values, this maintains + * a distribution according to bucket weights even when some buckets + * are non-live. */ + for (int i = 0; i < n_hash; i++) { + bucket = group->hash_map[(hash + i) % n_hash]; + if (bucket_is_alive(ctx, bucket, 0)) { + best_bucket = bucket; + break; + } + } + + return best_bucket; +} + static void xlate_dp_hash_select_group(struct xlate_ctx *ctx, struct group_dpif *group, bool is_last_action) { - struct ofputil_bucket *bucket; - /* dp_hash value 0 is special since it means that the dp_hash has not been * computed, as all computed dp_hash values are non-zero. Therefore * compare to zero can be used to decide if the dp_hash value is valid * without masking the dp_hash field. */ if (!ctx->xin->flow.dp_hash) { - uint64_t param = group->up.props.selection_method_param; - - ctx_trigger_recirculate_with_hash(ctx, param >> 32, (uint32_t)param); + enum ovs_hash_alg hash_alg = group->hash_alg; + if (hash_alg > ctx->xbridge->support.max_hash_alg) { + /* Algorithm supported by all datapaths. */ + hash_alg = OVS_HASH_ALG_L4; + } + ctx_trigger_recirculate_with_hash(ctx, hash_alg, group->hash_basis); + if (ctx->xin->xcache) { + ofproto_group_unref(&group->up); + } } else { - uint32_t n_buckets = group->up.n_buckets; - if (n_buckets) { - /* Minimal mask to cover the number of buckets. */ - uint32_t mask = (1 << log_2_ceil(n_buckets)) - 1; - /* Multiplier chosen to make the trivial 1 bit case to - * actually distribute amongst two equal weight buckets. */ - uint32_t basis = 0xc2b73583 * (ctx->xin->flow.dp_hash & mask); - - ctx->wc->masks.dp_hash |= mask; - bucket = group_best_live_bucket(ctx, group, basis); - if (bucket) { - xlate_group_bucket(ctx, bucket, is_last_action); - xlate_group_stats(ctx, group, bucket); - } + struct ofputil_bucket *bucket = + group_dp_hash_best_bucket(ctx, group, ctx->xin->flow.dp_hash); + if (bucket) { + xlate_group_bucket(ctx, bucket, is_last_action); + xlate_group_stats(ctx, group, bucket); + } else if (ctx->xin->xcache) { + ofproto_group_unref(&group->up); } } } @@ -4417,8 +4441,6 @@ static void xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group, bool is_last_action) { - const char *selection_method = group->up.props.selection_method; - /* Select groups may access flow keys beyond L2 in order to * select a bucket. Recirculate as appropriate to make this possible. */ @@ -4426,15 +4448,19 @@ xlate_select_group(struct xlate_ctx *ctx, struct group_dpif *group, ctx_trigger_freeze(ctx); } - if (selection_method[0] == '\0') { + switch (group->selection_method) { + case SEL_METHOD_DEFAULT: xlate_default_select_group(ctx, group, is_last_action); - } else if (!strcasecmp("hash", selection_method)) { + break; + case SEL_METHOD_HASH: xlate_hash_fields_select_group(ctx, group, is_last_action); - } else if (!strcasecmp("dp_hash", selection_method)) { + break; + case SEL_METHOD_DP_HASH: xlate_dp_hash_select_group(ctx, group, is_last_action); - } else { - /* Parsing of groups should ensure this never happens */ + break; + default: OVS_NOT_REACHED(); + break; } } @@ -4713,8 +4739,8 @@ finish_freezing__(struct xlate_ctx *ctx, uint8_t table) act_hash = nl_msg_put_unspec_uninit(ctx->odp_actions, OVS_ACTION_ATTR_HASH, sizeof *act_hash); - act_hash->hash_alg = OVS_HASH_ALG_L4; /* Make configurable. */ - act_hash->hash_basis = 0; /* Make configurable. */ + act_hash->hash_alg = ctx->dp_hash_alg; + act_hash->hash_basis = ctx->dp_hash_basis; } nl_msg_put_u32(ctx->odp_actions, OVS_ACTION_ATTR_RECIRC, recirc_id); } diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 7162811..f5ecd8b 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -32,6 +32,7 @@ #include "lacp.h" #include "learn.h" #include "mac-learning.h" +#include "math.h" #include "mcast-snooping.h" #include "multipath.h" #include "netdev-vport.h" @@ -4762,6 +4763,145 @@ group_dpif_credit_stats(struct group_dpif *group, ovs_mutex_unlock(&group->stats_mutex); } +/* Calculate the dp_hash mask needed to provide the least weighted bucket + * with at least one hash value and construct a mapping table from masked + * dp_hash value to group bucket using the Webster method. + * If the caller specifies a non-zero max_hash value, abort and return false + * if more hash values would be required. The absolute maximum number of + * hash values supported is 256. */ + +#define MAX_SELECT_GROUP_HASH_VALUES 256 + +static bool +group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash) +{ + struct ofputil_bucket *bucket; + uint32_t n_buckets = group->up.n_buckets; + double total_weight = 0.0; + uint16_t min_weight = UINT16_MAX; + uint32_t n_hash; + struct webster { + struct ofputil_bucket *bucket; + uint32_t divisor; + double value; + } *webster; + + if (n_buckets == 0) { + VLOG_DBG(" Don't apply dp_hash method without buckets"); + return false; + } + + webster = xcalloc(n_buckets, sizeof(struct webster)); + int i = 0; + LIST_FOR_EACH (bucket, list_node, &group->up.buckets) { + bucket->aux = 0; + if (bucket->weight > 0 && bucket->weight < min_weight) { + min_weight = bucket->weight; + } + total_weight += bucket->weight; + webster[i].bucket = bucket; + webster[i].divisor = 1; + webster[i].value = bucket->weight; + i++; + } + + if (total_weight == 0) { + VLOG_DBG(" Total weight is zero. No active buckets."); + free(webster); + return false; + } + VLOG_DBG(" Minimum weight: %d, total weight: %.0f", + min_weight, total_weight); + + uint32_t min_slots = ceil(total_weight / min_weight); + n_hash = MAX(16, 1L << log_2_ceil(min_slots)); + + if (n_hash > MAX_SELECT_GROUP_HASH_VALUES || + (max_hash != 0 && n_hash > max_hash)) { + VLOG_DBG(" Too many hash values required: %d", n_hash); + return false; + } + + VLOG_DBG(" Using %d hash values:", n_hash); + group->hash_mask = n_hash - 1; + if (group->hash_map) { + free(group->hash_map); + } + group->hash_map = xcalloc(n_hash, sizeof(struct ofputil_bucket *)); + + /* Use Webster method to distribute hash values over buckets. */ + for (int hash = 0; hash < n_hash; hash++) { + struct webster *winner = &webster[0]; + for (i = 1; i < n_buckets; i++) { + if (webster[i].value > winner->value) { + winner = &webster[i]; + } + } + winner->divisor += 2; + winner->value = (double) winner->bucket->weight / winner->divisor; + group->hash_map[hash] = winner->bucket; + winner->bucket->aux++; + } + + LIST_FOR_EACH (bucket, list_node, &group->up.buckets) { + double target = (n_hash * bucket->weight) / total_weight; + VLOG_DBG(" Bucket %d: weight=%d, target=%.2f hits=%d", + bucket->bucket_id, bucket->weight, + target, bucket->aux); + } + + free(webster); + return true; +} + +static void +group_set_selection_method(struct group_dpif *group) +{ + const struct ofputil_group_props *props = &group->up.props; + const char *selection_method = props->selection_method; + + if (selection_method[0] == '\0') { + VLOG_DBG("No selection method specified."); + group->selection_method = SEL_METHOD_DEFAULT; + } else if (!strcmp(selection_method, "dp_hash")) { + VLOG_DBG("Selection method specified: dp_hash."); + /* Try to use dp_hash if possible at all. */ + if (group_setup_dp_hash_table(group, 0)) { + group->selection_method = SEL_METHOD_DP_HASH; + group->hash_alg = props->selection_method_param >> 32; + if (group->hash_alg >= __OVS_HASH_MAX) { + VLOG_DBG(" Invalid dp_hash algorithm %d. " + "Defaulting to OVS_HASH_ALG_L4", group->hash_alg); + group->hash_alg = OVS_HASH_ALG_L4; + } + group->hash_basis = (uint32_t) props->selection_method_param; + VLOG_DBG("Use dp_hash with %d hash values using algorithm %d.", + group->hash_mask + 1, group->hash_alg); + } else { + /* Fall back to original default hashing in slow path. */ + VLOG_DBG(" Falling back to default hash method."); + group->selection_method = SEL_METHOD_DEFAULT; + } + } else if (!strcmp(selection_method, "hash")) { + VLOG_DBG("Selection method specified: hash."); + if (props->fields.values_size > 0) { + /* Controller has specified hash fields. */ + struct ds s = DS_EMPTY_INITIALIZER; + oxm_format_field_array(&s, &props->fields); + VLOG_DBG(" Hash fields: %s", ds_cstr(&s)); + ds_destroy(&s); + group->selection_method = SEL_METHOD_HASH; + } else { + /* No hash fields. Fall back to original default hashing. */ + VLOG_DBG(" No hash fields. Falling back to default hash method."); + group->selection_method = SEL_METHOD_DEFAULT; + } + } else { + /* Parsing of groups should ensure this never happens */ + OVS_NOT_REACHED(); + } +} + static enum ofperr group_construct(struct ofgroup *group_) { @@ -4770,6 +4910,10 @@ group_construct(struct ofgroup *group_) ovs_mutex_init_adaptive(&group->stats_mutex); ovs_mutex_lock(&group->stats_mutex); group_construct_stats(group); + group->hash_map = NULL; + if (group->up.type == OFPGT11_SELECT) { + group_set_selection_method(group); + } ovs_mutex_unlock(&group->stats_mutex); return 0; } @@ -4779,6 +4923,10 @@ group_destruct(struct ofgroup *group_) { struct group_dpif *group = group_dpif_cast(group_); ovs_mutex_destroy(&group->stats_mutex); + if (group->hash_map) { + free(group->hash_map); + group->hash_map = NULL; + } } static enum ofperr diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index d654947..e95fead 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -119,6 +119,12 @@ rule_dpif_is_internal(const struct rule_dpif *rule) /* Groups. */ +enum group_selection_method { + SEL_METHOD_DEFAULT, + SEL_METHOD_DP_HASH, + SEL_METHOD_HASH, +}; + struct group_dpif { struct ofgroup up; @@ -129,6 +135,12 @@ struct group_dpif { struct ovs_mutex stats_mutex; uint64_t packet_count OVS_GUARDED; /* Number of packets received. */ uint64_t byte_count OVS_GUARDED; /* Number of bytes received. */ + + enum group_selection_method selection_method; + enum ovs_hash_alg hash_alg; /* dp_hash algorithm to be applied. */ + uint32_t hash_basis; /* Basis for dp_hash. */ + uint32_t hash_mask; /* Used to mask dp_hash (2^N - 1).*/ + struct ofputil_bucket **hash_map; /* Map hash values to buckets. */ }; void group_dpif_credit_stats(struct group_dpif *, @@ -137,6 +149,7 @@ void group_dpif_credit_stats(struct group_dpif *, struct group_dpif *group_dpif_lookup(struct ofproto_dpif *, uint32_t group_id, ovs_version_t version, bool take_ref); + /* Backers. * diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 60f28e2..8d6c172 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -500,11 +500,12 @@ for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) done -AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | sed 's/packets.*actions:1/actions:1/' | strip_ufid | strip_used | sort], [0], [dnl +AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:1/actions:1/' | \ + strip_ufid | strip_used | sort | uniq], [0], [dnl flow-dump from non-dpdk interfaces: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(hash_l4(0)),recirc(0x1) -recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:10 -recirc_id(0x1),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:11 +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(l4(0)),recirc(0x1) +recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:10 +recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:11 ]) AT_CHECK([ovs-appctl revalidator/purge], [0]) @@ -516,10 +517,10 @@ for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) done -AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0x1)/dp_hash(0xXXXX\/0x1)/' | sed 's/\(actions:1\)[[01]]/\1X/' | strip_ufid | strip_used | sort], [0], [dnl +AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/\(actions:1\)[[01]]/\1X/' | strip_ufid | strip_used | sort], [0], [dnl flow-dump from non-dpdk interfaces: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(hash_l4(0)),recirc(0x2) -recirc_id(0x2),dp_hash(0xXXXX/0x1),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:1X +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(l4(0)),recirc(0x2) +recirc_id(0x2),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:1X ]) OVS_VSWITCHD_STOP From patchwork Fri Apr 27 12:20:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 905713 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=fail (p=none dis=none) header.from=ericsson.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="FACQtbx9"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="KxhqJq9m"; 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 40XY4b19CRz9s02 for ; Fri, 27 Apr 2018 22:23:27 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 0302C927; Fri, 27 Apr 2018 12:21:02 +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 0F8638CC for ; Fri, 27 Apr 2018 12:20:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C77F7691 for ; Fri, 27 Apr 2018 12:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1524831654; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=TU6btrKhoED9yNSQVI42cqcatzqCzyLSPaEpZNU6QWE=; b=FACQtbx9+V+/NQCUNj9C0ue3dHENIVNhOQeUGF3pTDqDalSU8JiLu0UIFUlHtqq4 1PRmPUFfRgGyyDJwYMQk5fS5UVg/X7KW0izZkMwF+e5P0mEvoGg3vHZ83RtMWlt0 d6FN8L/sRxYsTBRhyATgefUln62DmSeyIITA6Q8jxv0=; X-AuditID: c1b4fb30-4c8039c000007681-6f-5ae315a5b1be Received: from ESESSHC012.ericsson.se (Unknown_Domain [153.88.183.54]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 3A.C0.30337.5A513EA5; Fri, 27 Apr 2018 14:20:54 +0200 (CEST) Received: from ESESBMR501.ericsson.se (153.88.183.129) by ESESSHC012.ericsson.se (153.88.183.54) with Microsoft SMTP Server (TLS) id 14.3.382.0; Fri, 27 Apr 2018 14:20:53 +0200 Received: from ESESSMB505.ericsson.se (153.88.183.166) by ESESBMR501.ericsson.se (153.88.183.129) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 27 Apr 2018 14:20:53 +0200 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB505.ericsson.se (153.88.183.166) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 27 Apr 2018 14:20:52 +0200 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; bh=VzJmU3HPUrLxog5XsIkKXQjA6WYLVR2WD4TV9Sozgc4=; b=KxhqJq9mGFQZsZdGOz+8PkeBkxUevs/PNipbQjZrxPZMDoSaccqKEcYpeXbA8oL7Jz60/HRGhm/mqxhBzDAXWwVD+jfn0S/Pta3CFnkNhiMMyXe1j1yr1AZjJEFd91Iqc1lDdNj5Uu0+n+YCkX7l4RVmCIvlKximWpb/c9S7UQQ= Received: from ubuntu.eed.ericsson.se (129.192.10.2) by AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.735.5; Fri, 27 Apr 2018 12:20:49 +0000 From: Jan Scheurich To: Date: Fri, 27 Apr 2018 14:20:34 +0200 Message-ID: <1524831634-7955-4-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> References: <1524831634-7955-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: HE1PR02CA0117.eurprd02.prod.outlook.com (2603:10a6:7:29::46) To AM3PR07MB0646.eurprd07.prod.outlook.com (2a01:111:e400:8837::20) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM3PR07MB0646; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 3:ukZKMtHYfVngz5X9vLjVzSlR6WE53Yys7ACkCrruL/6oOdD7JmLdzEG/cDbFso8UIbbGCWsZCcQfHtfxnGN2Jp1IKE0yKGgTVBZPVaZ3uFTmYcPKAEeCDI1AeU/s6D5WCMTDz9C77ahJJiBsdhpyXXMwNHhnMnQ0L7TVhDbPOmFDCSJ3vdFR9XEAlFWmNC0t84Se/icZmNG4rYFk7YVuN8sUQj+gbxnGwYVLDLb8pXFGzy67K2TLgGBZUFK/eGKT; 25:m/yoCAjRDkdKE42RdLztq1jLLGG9ghbUItSQH0gZ+0jVZ1aY7uUvFuQYkB2hE/0wTUQZ+x/rjB/2dYWpRI7zFXORgy8KjhvEr4xGRL0G1tbpaP70A4gz8asZOzPFBwKB4mRVCElJvtP3ddQ7mskjiOA9u16urC/irU4siTc8rbkMAzEbDf5q0mhNlEgbHj49HdNunmMgbhHVnmCGQO17DBh4oZxKpeHEsKofy2hM7QbLcvSzKFsPRtSix/3k7gvsjcqouBNwWgJbUS8Tweyu9RN5k/TJ0/zLpf0XKHlmZoWNYjO0NPVcxRgT8bcV9c+jurstOaJigEURfRJtXiREOq3IYhq0AQuBmcun2zMbRac=; 31:yc7x+fmXqMz/TNGiDFP/lI4cJ+H5xc4htEN31NITxyq8PfjjrQ940oj5OQ50A0Mz4UPQz+U0rqLlRoZ6Tt7F2fITnwa8O5dLxSSdm44qz+KOM4J4A5Nbu/bfjsrz8kFu9hGRjR7kEijOg9rmxmj9wHKFFViBdGjFHcXFThVFQglnSBLi5uCry2/VkPQII3BzDrQTuQbFoAwhqCZH/EIePN88RZ0Mvb1ql8t9BTsUxwg= X-MS-TrafficTypeDiagnostic: AM3PR07MB0646: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 20:PN9BwKxl95oM9DNvzgsBmE3M7iCeMTpxviLmFT9/9Bod4sUEVBj+94i1lqoj3tg068XJPvHi6rwxXRJOFEP8pl8vONDyrGVNiG8+Hm4sM4vxVqQfvfuZntNSEYarMXneIMmCXYfCwtLdvGyku54VG/Eqk2s+Fl2vIIQyzthSI75ARjZJ0PcJQOQRx4H+sYZPa3axp6M1LrPUOU8uiWwObbtnSDRJzEgDCtgO/uskX4m5jeNuh4Wd0KGCtsL+gJ48LZZb0S8BNWdA3gdGnjuUMIRfEWYRD5NtXPunwLOc03v+C6MRUbE3XZX4QZMLfzQ/JW/C8zE3/RW1+POEfMS5XUv4ydVWuUvtsAh5s1J2X6mKC6YJwFRMZUhO3X+FYFGfF97vv19xV+N5QDL+kw3mCXQa1agoiLrD1MSFNkCqbDk3i7z5t0aoZ0mbIVoea+3o4J10UAoRoCx4q6bOS+/le/XCbFuXUVy3Y6wvdqvkSUQ03oNYna5i8KKUn6d5xIkH; 4:Bn46Ig8WozNDPITAzqfuQS6xXgV0SNnzDa8uObD7vWJLSrM+waINaUQhydXYQBAz54QxLT0y961ckK59y6XBidWV7zSedpmdntv0sTsyTV4xBKiojestsszZZE/zm0t3kVd0gcuxj5Fdl4WQI8h368xvtE2t7WkEI+Qty4jroVcvD+1zyfAJIMcmKkdgAqZZTQWTq52Jx6z1BkJ/Z1wppQtBPQTa2NZkBMVT5zCXCBVzhawq7jiO2xmjSSMh38DfpkSnEj1KdWCRjWQq7g8+I5NG2hty8B6nGoCHtDZUaVnNDj1NKaL4y1I9s48XR3XP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(37575265505322); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231232)(944501410)(52105095)(3002001)(93006095)(93001095)(6041310)(20161123562045)(20161123558120)(20161123560045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM3PR07MB0646; BCL:0; PCL:0; RULEID:; SRVR:AM3PR07MB0646; X-Forefront-PRVS: 0655F9F006 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(366004)(396003)(39380400002)(199004)(189003)(11346002)(16586007)(486006)(44832011)(2616005)(36756003)(476003)(316002)(51416003)(26005)(52116002)(956004)(446003)(76176011)(50466002)(47776003)(48376002)(16526019)(2906002)(105586002)(186003)(2361001)(66066001)(2351001)(25786009)(106356001)(478600001)(3846002)(86362001)(8936002)(68736007)(81166006)(81156014)(50226002)(305945005)(6116002)(97736004)(8676002)(59450400001)(7736002)(107886003)(6666003)(6916009)(386003)(6506007)(4326008)(53936002)(53946003)(5660300001)(6512007)(6486002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR07MB0646; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR07MB0646; 23:/yPl8kdHUxywKsaqMkbl3eVxJEFq2jCCkPXjK0ove?= 3DzJOU1xUVfpW3eFsEJGvLg7VY1btIhnODwIJ1xcy6SJVXZGDmK3cVcLnGw+QLh7i6Zrwxbd+7gJzPOtp36Z5bUF4bdSGWzkyhAZqPJzLkBBJkKiC9ids+VvM0+wLIZ38H0epCbgTl9MmO+5DxQhsqUPV7cDgcjNptVPS8e+ngAh4bsyVfjYmTtKIKQ3+zVSo5dcNXdMhPeLLvYzlKya48DbhsNs66se4uNbSYEwDFJ+L4OPdwonGn69QRkYyc7PIJA+rh1e3ul4CdEzocJY8xaDM7+20PXDL60MM2b80cbpes64z0uvx0CbngXe2WqZvSO6w1oYuFIGzgJ1sA9sfQBXAELVz59IECeave74OXW5aXBBt/8OCU3eKyDqJPh9U0W7ScrfXUHBm3BDRjFLNHXH4QXILi+WDeGsfPs2WEblXC0nlJ9YFBLPN1CDjpZ6SIDZyb4vXSTBjUT1YwgiAI4mgb33Nurwf9MKFS/8OpsR+qIwYP9V7x4D48n9MFcwZbc1qWi4o0zgfT9wQFc4VI6WRqrQMYqrABBrDAOLGdJKxkJL4vtD0Kn00gDe2V2CBArXa7hYQGS5RK7uCoE4Mvx0pSYPWa8xF8UNzZVbhydk1MTFO4Q7MTDjmDPxbnRQHN+Ap9NtLtO2k8NvbDVdYhnQOhOrlpyHMcMK+4KndCWC94ZqcttGYIwsd7VoopCtDD/GKxymLciC9bObLxkOZAb4Oa+eye3DU58QjQ/O6tNeDVlROz+jd5AQr4Tn9fZRaf0j8i3F8M0zZlLKw6Djcn4I99o8z61w/JaBAk3VCl+6/I5Tv8LbnPbvKWYpUrnzouEEZuHocVLX9htIBZdms3sxpsdWPm6elns3OdR9Y5i31ZEN95+A5IeThKrQOGsy0yj4G4i4pUbEvD9e5M8YBr8gRlCJx5RnUQGFvc8vagXkPd0T6FYH/ShC3cwccQdhfKCOUcuAHaiSntxfiXa7zBTuQ02Z6gzNuxwvqQ+xkf9NYTfxXNix5c3LnzRhQ9qGNWzkGbt6VcFFj9us+LQoUuwknkjKzFrw6zriKh42YqMOHRsNWtsfZLWnXy0fcb3vkLWn8a2Yvm55QK8QEC8NkOd9PRTwO9SY9CD6hbZeiga1MDUf8gQrvjpI4zRe2ATT0PFblhLpqTz9MBTShSIPBsk7HbRqxg4TZXZOpTvQgJ+qHVZK/O+0U8Vd77Q5bK8dIu3IscPdwmi6xCEe18dLOQZ95hickuOwKAXEDFg4Inhv1QqJ+hQN/ledbWNSAfAteY= X-Microsoft-Antispam-Message-Info: PG1XLNBBt0ysezkanzAI8QBNNb2h2UKrblhMYWPKOY3nocNF5t/SZQgVh55rMKE9Bm/ClYfh++OxjB8b4Ujss1ZbIaBoTIUWteTEIFkJaC5Rm8hMuNJF5aiteukcVb0Rj0a1AXjEdFiqt0Dst8DX5bysZjhjlCJa5TE0FO5xFhIJw2luW+osihOQQb2LnNr/ X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 6:/d/irEyZmpXMzoFTLtUL8s4f4m06hlqrxxOq7BoPo87KVnttnQVxm4c9FPuC7AKKPRXbpjuwatniowVcf9hCu8W5hPyB1ZQp/tBfn0lRr0M7UgxQ+/oHfAeuWt4QrgyC+UrkQkH8WX2h6IA+DG7pnsQdO9z8KaNsEmcqLlywjfXeVgWv9eSj3WUpXMK0lLbgVYXMQWvJ0wcjeR/82hmFnkgrfXO+1AKtfz83hhR6fCaRPa2fzS4doKmTFG9C9pc9WlsLbbybgIO5jpyqyHpcVt6dptcmX5uTz1pkLJH6E9EO53r/CBX7G9Kq7Xagx6hhFtDf3FN0CZHiRpFZUkNsI7HrTPU8MI+rKy339DDl6KGEqCCBE86ANQ8gMw44YIgEyFQFDOxwHAa7NuYxMa3B8XBE7nVCMLGYqG5bOmq5rZo3fEyrFgnmKm62XeltwNMNb9Hm+tlabSKwD5rOCCg88w==; 5:g+DSMv/m5gOEjWaekriR0kFdFF8Y1XZtk/a8JtPZmKy5eXOhnPvrIKjBuxHUtSo2FkAFHeaTQmzBLTjXluwM2KZMcJ2/zJJYWPFb0wLE+T4k887VowIGN0zzg4mgymTylzdb1sXoRbqlriFQH7PXvjce2fVqXZIQ+klSWZohnGY=; 24:DlNCidCXdMItw22EFBytoHSzNnzsjsOmHH1HEf/HDPEz1ihbhjxf/K4saEvJAx0xKtS3HuuIbMUPlpa80GUkwRGFpYxLw+bcy7vyoYwOm0w= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB0646; 7:UELPmvEOZInyoV1eTDd8TgX24xfo0raVJOc7kg54Mf3bz7vo2Q3uhC5kpHLSCur+WyEg41S2RYvR64q7PhX7T2+ZJ2+gbXh09kI/6NgfMLEc+bqQxl2AzhzskEQ76GaPtqGluWmelvQuKfpLYQPwqoljtkJ+wIjdmXIdykUDB0HBMP989S1EPCCUPwFyRfTfcIqqzfQUdmGQ54rUzXeekBICYlp4ENNurEwxsMHbE4jpItqFcbG0iH76kJ4HFhhD X-MS-Office365-Filtering-Correlation-Id: 1f9f32c1-bdea-4c68-76bd-08d5ac39502c X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2018 12:20:49.5723 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1f9f32c1-bdea-4c68-76bd-08d5ac39502c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR07MB0646 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0hTcRjG+5/bjqPBaU16XZY5qMBqrRGyIkoj8AJZUIQNJZceVNQp56il H2KhdFlhopZNw6JlitSonLp0H9pMQy0VLPEWGIYzUypnlpdpzrPAb8/L83sf/s/Ln8alHkJO p+qzWU6vS1dQYsIU2xS676n/mFY19AvXTJYakKaty45rZpuLUBgeaa4tIyPHB1dQpKv/NnEa 14qPJLHpqbkst/9ogjjl6uNnVFahBbvsGrAjAypaQkbkRwNzENrevCaMSExLmbcIqkd7SWGw IrDfmsKEYQ5BgbXV5zzBYOldM+7dJ5gZDIadfoJhxKDG0rIaTNMUo4LKljAvI2MCYNlspbwa Z3Khrse+pjczJ2G0xIKEnJ1Q2FmCebWEiYJr9eW48L7t0NFeSnq1HxMN7xeMa7x0lZl0D1AC vwk6TF8JIR/AMTHh290BL62mtW7AlCO40T3mW94NHudvQoC2QduHBz6oEcHDZo9IGMpE8Hzc RglUCPRMLYq8GjHxUNhwFxOgvxS0NP4gBSgNpu3Lvrsehu8Lf5AAVePw+dO4LykQKhoslGAM k9BrqCKLkbJiXZGKdUUeIawO+fMsfzEjWa1WslxqIs9n6pV6NvsVWv0UDuuiyoa+ucKdiKGR YqPkvHRMKyV1uXxehhMBjStkEtvwF61UkqTLy2e5zAtcTjrLO9FWmlBskWhi6rVSJlmXzaax bBbL/Xcx2k9uQNGhQ8mPjdipS3emuwpmOisH7arREcOMOzM4JiqoL9xjLsg5N5vPqZZuuvF7 3dcjrpjvqxuCPHG22rnjTWalNvDEhp/xrXvPHJLFlRlKguclL/bIyRrnykeX1iR3JJRWBY44 3BHFCRF9TPXZPPXEdAbsEsUOBTD9svnEY+2DCoJP0R0IwTle9w8vnnduEAMAAA== X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: nitin.katiyar@ericsson.com, ychen103103@163.com Subject: [ovs-dev] [PATCH v3 3/3] ofproto-dpif: Use dp_hash as default selection method 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The dp_hash selection method for select groups overcomes the scalability problems of the current default selection method which, due to L2-L4 hashing during xlation and un-wildcarding of the hashed fields, basically requires an upcall to the slow path to load-balance every L4 connection. The consequence are an explosion of datapath flows (megaflows degenerate to miniflows) and a limitation of connection setup rate OVS can handle. This commit changes the default selection method to dp_hash, provided the bucket configuration is such that the dp_hash method can accurately represent the bucket weights with up to 64 hash values. Otherwise we stick to original default hash method. We use the new dp_hash algorithm OVS_HASH_L4_SYMMETRIC to maintain the symmetry property of the old default hash method. A controller can explicitly request the old default hash selection method by specifying selection method "hash" with an empty list of fields in the Group properties of the OpenFlow 1.5 Group Mod message. Update the documentation about selection method in the ovs-ovctl man page. Revise and complete the ofproto-dpif unit tests cases for select groups. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar --- NEWS | 2 + lib/ofp-group.c | 15 ++- ofproto/ofproto-dpif.c | 30 +++-- ofproto/ofproto-dpif.h | 1 + ofproto/ofproto-provider.h | 2 +- tests/mpls-xlate.at | 26 ++-- tests/ofproto-dpif.at | 315 +++++++++++++++++++++++++++++++++++---------- tests/ofproto-macros.at | 7 +- utilities/ovs-ofctl.8.in | 47 ++++--- 9 files changed, 334 insertions(+), 111 deletions(-) diff --git a/NEWS b/NEWS index cd4ffbb..fbd987f 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,8 @@ Post-v2.9.0 - ovs-vsctl: New commands "add-bond-iface" and "del-bond-iface". - OpenFlow: * OFPT_ROLE_STATUS is now available in OpenFlow 1.3. + * Default selection method for select groups is now dp_hash with improved + accuracy. - Linux kernel 4.14 * Add support for compiling OVS with the latest Linux 4.14 kernel - ovn: diff --git a/lib/ofp-group.c b/lib/ofp-group.c index 31b0437..c5ddc65 100644 --- a/lib/ofp-group.c +++ b/lib/ofp-group.c @@ -1518,12 +1518,17 @@ parse_group_prop_ntr_selection_method(struct ofpbuf *payload, return OFPERR_OFPBPC_BAD_VALUE; } - error = oxm_pull_field_array(payload->data, fields_len, - &gp->fields); - if (error) { - OFPPROP_LOG(&rl, false, + if (fields_len > 0) { + error = oxm_pull_field_array(payload->data, fields_len, + &gp->fields); + if (error) { + OFPPROP_LOG(&rl, false, "ntr selection method fields are invalid"); - return error; + return error; + } + } else { + /* Selection_method "hash: w/o fields means default hash method. */ + gp->fields.values_size = 0; } return 0; diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index f5ecd8b..52282a8 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -1,5 +1,4 @@ /* - * Copyright (c) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -4787,7 +4786,7 @@ group_setup_dp_hash_table(struct group_dpif *group, size_t max_hash) } *webster; if (n_buckets == 0) { - VLOG_DBG(" Don't apply dp_hash method without buckets"); + VLOG_DBG(" Don't apply dp_hash method without buckets."); return false; } @@ -4860,9 +4859,24 @@ group_set_selection_method(struct group_dpif *group) const struct ofputil_group_props *props = &group->up.props; const char *selection_method = props->selection_method; + VLOG_DBG("Constructing select group %"PRIu32, group->up.group_id); if (selection_method[0] == '\0') { - VLOG_DBG("No selection method specified."); - group->selection_method = SEL_METHOD_DEFAULT; + VLOG_DBG("No selection method specified. Trying dp_hash."); + /* If the controller has not specified a selection method, check if + * the dp_hash selection method with max 64 hash values is appropriate + * for the given bucket configuration. */ + if (group_setup_dp_hash_table(group, 64)) { + /* Use dp_hash selection method with symmetric L4 hash. */ + group->selection_method = SEL_METHOD_DP_HASH; + group->hash_alg = OVS_HASH_ALG_SYM_L4; + group->hash_basis = 0; + VLOG_DBG("Use dp_hash with %d hash values using algorithm %d.", + group->hash_mask + 1, group->hash_alg); + } else { + /* Fall back to original default hashing in slow path. */ + VLOG_DBG("Falling back to default hash method."); + group->selection_method = SEL_METHOD_DEFAULT; + } } else if (!strcmp(selection_method, "dp_hash")) { VLOG_DBG("Selection method specified: dp_hash."); /* Try to use dp_hash if possible at all. */ @@ -4870,7 +4884,7 @@ group_set_selection_method(struct group_dpif *group) group->selection_method = SEL_METHOD_DP_HASH; group->hash_alg = props->selection_method_param >> 32; if (group->hash_alg >= __OVS_HASH_MAX) { - VLOG_DBG(" Invalid dp_hash algorithm %d. " + VLOG_DBG("Invalid dp_hash algorithm %d. " "Defaulting to OVS_HASH_ALG_L4", group->hash_alg); group->hash_alg = OVS_HASH_ALG_L4; } @@ -4879,7 +4893,7 @@ group_set_selection_method(struct group_dpif *group) group->hash_mask + 1, group->hash_alg); } else { /* Fall back to original default hashing in slow path. */ - VLOG_DBG(" Falling back to default hash method."); + VLOG_DBG("Falling back to default hash method."); group->selection_method = SEL_METHOD_DEFAULT; } } else if (!strcmp(selection_method, "hash")) { @@ -4888,12 +4902,12 @@ group_set_selection_method(struct group_dpif *group) /* Controller has specified hash fields. */ struct ds s = DS_EMPTY_INITIALIZER; oxm_format_field_array(&s, &props->fields); - VLOG_DBG(" Hash fields: %s", ds_cstr(&s)); + VLOG_DBG("Hash fields: %s", ds_cstr(&s)); ds_destroy(&s); group->selection_method = SEL_METHOD_HASH; } else { /* No hash fields. Fall back to original default hashing. */ - VLOG_DBG(" No hash fields. Falling back to default hash method."); + VLOG_DBG("No hash fields. Falling back to default hash method."); group->selection_method = SEL_METHOD_DEFAULT; } } else { diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index e95fead..1a404c8 100644 --- a/ofproto/ofproto-dpif.h +++ b/ofproto/ofproto-dpif.h @@ -61,6 +61,7 @@ struct ofproto_async_msg; struct ofproto_dpif; struct uuid; struct xlate_cache; +struct xlate_ctx; /* Number of implemented OpenFlow tables. */ enum { N_TABLES = 255 }; diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h index d636fb3..2b77b89 100644 --- a/ofproto/ofproto-provider.h +++ b/ofproto/ofproto-provider.h @@ -572,7 +572,7 @@ struct ofgroup { const struct ovs_list buckets; /* Contains "struct ofputil_bucket"s. */ const uint32_t n_buckets; - const struct ofputil_group_props props; + struct ofputil_group_props props; struct rule_collection rules OVS_GUARDED; /* Referring rules. */ }; diff --git a/tests/mpls-xlate.at b/tests/mpls-xlate.at index 9bbf22a..34d82a3 100644 --- a/tests/mpls-xlate.at +++ b/tests/mpls-xlate.at @@ -25,7 +25,7 @@ dummy@ovs-dummy: hit:0 missed:0 ]) dnl Setup single MPLS tags. -AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 group_id=1232,type=select,bucket=output:LOCAL]) +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 group_id=1232,type=select,selection_method=hash,bucket=output:LOCAL]) AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 group_id=1233,type=all,bucket=output:LOCAL]) AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 group_id=1234,type=all,bucket=dec_ttl,output:LOCAL]) AT_CHECK([ovs-ofctl -O OpenFlow13 add-flow br0 in_port=local,dl_type=0x0800,action=push_mpls:0x8847,set_field:10-\>mpls_label,output:1]) @@ -71,9 +71,15 @@ AT_CHECK([tail -1 stdout], [0], [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x2) ]) -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(2),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) -AT_CHECK([tail -1 stdout], [0], - [Datapath actions: 100 +for d in 0 1 2 3; do + pkt="in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=22,tc=0,ttl=64,bos=1)" + AT_CHECK([ovs-appctl netdev-dummy/receive p0 $pkt]) +done + +AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/packets.*actions:1/actions:1/' | strip_used | strip_ufid | sort], [0], [dnl +flow-dump from non-dpdk interfaces: +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=22/0xfffff,tc=0/0,ttl=64/0x0,bos=1/1), packets:3, bytes:54, used:0.0s, actions:pop_mpls(eth_type=0x800),recirc(0x3) +recirc_id(0x3),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:100 ]) dnl Test MPLS pop then all group output (bucket actions do not trigger recirculation) @@ -85,10 +91,10 @@ AT_CHECK([tail -1 stdout], [0], dnl Test MPLS pop then all group output (bucket actions trigger recirculation) AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=24,tc=0,ttl=64,bos=1)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], - [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x3) + [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x4) ]) -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(3),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(4),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], [Datapath actions: set(ipv4(ttl=63)),100 ]) @@ -96,10 +102,10 @@ AT_CHECK([tail -1 stdout], [0], dnl Test MPLS pop then all output to patch port AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=25,tc=0,ttl=64,bos=1)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], - [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x4) + [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x5) ]) -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(4),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(5),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], [Datapath actions: 101 ]) @@ -124,10 +130,10 @@ AT_CHECK([tail -1 stdout], [0], dnl Double MPLS pop AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x8847),mpls(label=60,tc=0,ttl=64,bos=0,label=50,tc=0,ttl=64,bos=1)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], - [Datapath actions: pop_mpls(eth_type=0x8847),pop_mpls(eth_type=0x800),recirc(0x5) + [Datapath actions: pop_mpls(eth_type=0x8847),pop_mpls(eth_type=0x800),recirc(0x7) ]) -AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(5),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) +AT_CHECK([ovs-appctl ofproto/trace ovs-dummy 'recirc_id(7),in_port(1),eth(src=f8:bc:12:44:34:b6,dst=f8:bc:12:46:58:e0),eth_type(0x0800),ipv4(src=1.1.2.92,dst=1.1.2.88,proto=47,tos=0,ttl=64,frag=no)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], [Datapath actions: set(ipv4(ttl=10)),100 ]) diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index 8d6c172..a3ce252 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -337,10 +337,18 @@ OVS_VSWITCHD_START add_of_ports br0 1 10 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=set_field:192.168.3.90->ip_src,output:10']) AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=group:1234,output:10']) -AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:05,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout]) -AT_CHECK([tail -1 stdout], [0], - [Datapath actions: set(ipv4(src=192.168.3.90,dst=192.168.0.2)),10,set(ipv4(src=192.168.0.1,dst=192.168.0.2)),10 + +for d in 0 1 2 3; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) +done + +AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:/actions:/' | strip_ufid | strip_used | sort], [0], [dnl +flow-dump from non-dpdk interfaces: +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:hash(sym_l4(0)),recirc(0x1) +recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), actions:set(ipv4(src=192.168.3.90)),10,set(ipv4(src=192.168.0.1)),10 ]) + OVS_VSWITCHD_STOP AT_CLEANUP @@ -397,81 +405,265 @@ AT_CLEANUP AT_SETUP([ofproto-dpif - select group]) + +# Helper function to check the spread of dp_hash flows over buckets in the datapath +check_dpflow_stats () { + min_flows=$1 + min_buckets=$2 + read -d '' dpflows + hash_flow=`echo "$dpflows" | grep "actions:hash"` + n_flows=`echo "$dpflows" | grep -c dp_hash` + n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l` + if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi + if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi + echo $hash_flow + echo "n_flows=$flows n_buckets=$buckets" +} + OVS_VSWITCHD_START add_of_ports br0 1 10 11 + +ovs-appctl vlog/set ofproto_dpif:file:dbg AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11']) +AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1234 +ofproto_dpif|DBG|No selection method specified. Trying dp_hash. +ofproto_dpif|DBG| Minimum weight: 1, total weight: 2 +ofproto_dpif|DBG| Using 16 hash values: +ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8 +ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8 +ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 1. +]) AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)']) # Try a bunch of different flows and make sure that they get distributed -# at least somewhat. -for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout]) - tail -1 stdout >> results +# # at least somewhat. +for d in 0 1 2 3; do + for s in 1 2 3 4 ; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) + done done -sort results | uniq -c -AT_CHECK([sort results | uniq], [0], - [Datapath actions: 10 -Datapath actions: 11 + +AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 5 2], [0], [dnl +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1) +n_flows=ok n_buckets=ok ]) + OVS_VSWITCHD_STOP AT_CLEANUP AT_SETUP([ofproto-dpif - select group with watch port]) + OVS_VSWITCHD_START add_of_ports br0 1 10 11 AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=watch_port:10,output:10,bucket=output:11']) AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)']) -AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout]) -AT_CHECK([tail -1 stdout], [0], - [Datapath actions: 11 + +for d in 0 1 2 3; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) +done + +AT_CHECK([ovs-appctl dpctl/dump-flows | sort| sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | strip_ufid | strip_used], [0], [dnl +flow-dump from non-dpdk interfaces: +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1) +recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:3, bytes:318, used:0.0s, actions:11 ]) + OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto-dpif - select group with weight]) +AT_SETUP([ofproto-dpif - select group with weights]) + +# Helper function to check the spread of dp_hash flows over buckets in the datapath +check_dpflow_stats () { + min_flows=$1 + min_buckets=$2 + read -d '' dpflows + hash_flow=`echo "$dpflows" | grep "actions:hash"` + n_flows=`echo "$dpflows" | grep -c dp_hash` + n_buckets=`echo "$dpflows" | grep dp_hash | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l` + if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi + if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi + echo $hash_flow + echo "n_flows=$flows n_buckets=$buckets" +} + +# Helper function to check the accuracy of distribution of packets over buckets +check_group_stats () { + min=($1 $2 $3 $4) + buckets=`grep -o 'packet_count=[[0-9]]*' | cut -d'=' -f2 | tail -n +2` + i=0 + for bucket in $buckets; do + if [[ $bucket -ge ${min[i]} ]]; then + echo "bucket$i >= ${min[[$i]]}" + else + echo "bucket$i < ${min[[$i]]}" + fi + (( i++ )) + if [[ $i -ge 4 ]]; then break; fi + done +} + OVS_VSWITCHD_START -add_of_ports br0 1 10 11 12 -AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucket=output:10,bucket=output:11,weight=2000,bucket=output:12,weight=0']) +add_of_ports br0 1 10 11 12 13 14 + +ovs-appctl vlog/set ofproto_dpif:file:dbg +AT_CHECK([ovs-ofctl -O OpenFlow13 add-group br0 'group_id=1234,type=select,bucket=weight:5,output:10,bucket=weight:10,output:11,bucket=weight:25,output:12,bucket=weight:60,output:13,bucket=weight:0,output:14']) +AT_CHECK([grep -A9 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1234 +ofproto_dpif|DBG|No selection method specified. Trying dp_hash. +ofproto_dpif|DBG| Minimum weight: 5, total weight: 100 +ofproto_dpif|DBG| Using 32 hash values: +ofproto_dpif|DBG| Bucket 0: weight=5, target=1.60 hits=2 +ofproto_dpif|DBG| Bucket 1: weight=10, target=3.20 hits=3 +ofproto_dpif|DBG| Bucket 2: weight=25, target=8.00 hits=8 +ofproto_dpif|DBG| Bucket 3: weight=60, target=19.20 hits=19 +ofproto_dpif|DBG| Bucket 4: weight=0, target=0.00 hits=0 +ofproto_dpif|DBG|Use dp_hash with 32 hash values using algorithm 1. +]) AT_CHECK([ovs-ofctl -O OpenFlow12 add-flow br0 'ip actions=write_actions(group:1234)']) -AT_CHECK([ovs-appctl ofproto/trace br0 'in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0'], [0], [stdout]) -AT_CHECK([tail -1 stdout], [0], - [Datapath actions: 11 + +# Try 1000 different flows and make sure that they get distributed according to weights +for d1 in 0 1 2 3 4 5 6 7 8 9 ; do + for d2 in 0 1 2 3 4 5 6 7 8 9 ; do + for s in 0 1 2 3 4 5 6 7 8 9 ; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.1.$s,dst=192.168.$d1.$d2,proto=6,tos=0,ttl=128,frag=no),tcp(src=1000$s,dst=1000)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) + done + done +done + +# Check balanced distribution over 32 dp_hash values +AT_CHECK([ovs-appctl dpctl/dump-flows | sort | strip_ufid | strip_used | check_dpflow_stats 32 4 ], [0], [dnl +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:999, bytes:117882, used:0.0s, actions:hash(sym_l4(0)),recirc(0x1) +n_flows=ok n_buckets=ok +]) + +# Check that actual distribution over the buckets is reasonably accurate: + ideal weights dp_hash values +# bucket0: 5%*1000 = 50 2/32*1000 = 63 +# bucket1: 10%*1000 = 100 3/32*1000 = 94 +# bucket2: 25%*1000 = 250 8/32*1000 = 250 +# bucket3: 60%*1000 = 600 19/32*1000 = 594 +# bucket4: 0 0 + +ovs-appctl time/warp 1000 +AT_CHECK([ovs-ofctl -O OpenFlow13 dump-group-stats br0 | sed 's/duration=[[0-9]]\.[[0-9]]*s,//' | check_group_stats 40 80 200 500], +[0], [dnl +bucket0 >= 40 +bucket1 >= 80 +bucket2 >= 200 +bucket3 >= 500 ]) + OVS_VSWITCHD_STOP AT_CLEANUP -AT_SETUP([ofproto-dpif - select group with hash selection method]) +AT_SETUP([ofproto-dpif - select group with explicit dp_hash selection method]) + OVS_VSWITCHD_START add_of_ports br0 1 10 11 -# Check that parse failures after 'fields' parsing work -AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl -ovs-ofctl: unknown keyword bukket + +ovs-appctl vlog/set ofproto_dpif:file:dbg +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11']) +AT_CHECK([grep -A6 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1234 +ofproto_dpif|DBG|Selection method specified: dp_hash. +ofproto_dpif|DBG| Minimum weight: 1, total weight: 2 +ofproto_dpif|DBG| Using 16 hash values: +ofproto_dpif|DBG| Bucket 0: weight=1, target=8.00 hits=8 +ofproto_dpif|DBG| Bucket 1: weight=1, target=8.00 hits=8 +ofproto_dpif|DBG|Use dp_hash with 16 hash values using algorithm 0. +]) + +# Fall back to legacy hash with zero buckets +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selection_method=dp_hash']) +AT_CHECK([grep -A3 "Constructing select group 1235" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1235 +ofproto_dpif|DBG|Selection method specified: dp_hash. +ofproto_dpif|DBG| Don't apply dp_hash method without buckets. +ofproto_dpif|DBG|Falling back to default hash method. +]) + +# Fall back to legacy hash with zero buckets +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1236,type=select,selection_method=dp_hash,bucket=weight=1,output:10,bucket=weight=1000,output:11']) +AT_CHECK([grep -A4 "Constructing select group 1236" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1236 +ofproto_dpif|DBG|Selection method specified: dp_hash. +ofproto_dpif|DBG| Minimum weight: 1, total weight: 1001 +ofproto_dpif|DBG| Too many hash values required: 1024 +ofproto_dpif|DBG|Falling back to default hash method. +]) + +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto-dpif - select group with legacy hash selection method]) + +# Helper function to check the spread of dp_hash flows over buckets in the datapath +check_dpflow_stats () { + min_flows=$1 + min_buckets=$2 + read -d '' dpflows + n_flows=`echo "$dpflows" | wc -l` + n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l` + if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi + if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi + echo "n_flows=$flows n_buckets=$buckets" +} + +OVS_VSWITCHD_START +add_of_ports br0 1 10 11 + +ovs-appctl vlog/set ofproto_dpif:file:dbg +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,bucket=output:10,bucket=output:11']) +AT_CHECK([grep -A2 "Constructing select group 1234" ovs-vswitchd.log | sed 's/^.*ofproto_dpif/ofproto_dpif/'], [0], [dnl +ofproto_dpif|DBG|Constructing select group 1234 +ofproto_dpif|DBG|Selection method specified: hash. +ofproto_dpif|DBG|No hash fields. Falling back to default hash method. ]) -AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11']) + AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)']) -# Try a bunch of different flows and make sure that they get distributed -# at least somewhat. -for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:07,dl_dst=50:54:00:00:00:0$d,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout]) - tail -1 stdout >> results +# Try 16 flows with differing default hash values. +for d in 0 1 2 3; do + for s in 1 2 3 4 ; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:1),eth_type(0x0800),ipv4(src=192.168.0.$s,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" + AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) + done done -sort results | uniq -c -AT_CHECK([sort results | uniq], [0], - [Datapath actions: 10 -Datapath actions: 11 + +# Check that the packets installed 16 data path flows and each of the two +# buckets is hit at least once. +AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl +n_flows=ok n_buckets=ok ]) -> results -# Try a bunch of different flows and make sure that they are not distributed -# as they only vary a field that is not hashed -for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do - AT_CHECK([ovs-appctl ofproto/trace br0 "in_port=1,dl_src=50:54:00:00:00:0$d,dl_dst=50:54:00:00:00:07,dl_type=0x0800,nw_src=192.168.0.1,nw_dst=192.168.0.2,nw_proto=1,nw_tos=0,nw_ttl=128,icmp_type=8,icmp_code=0"], [0], [stdout]) - tail -1 stdout >> results -done -sort results | uniq -c -AT_CHECK([sort results | uniq | sed 's/1[[01]]/1?/'], [0], - [Datapath actions: 1? +OVS_VSWITCHD_STOP +AT_CLEANUP + +AT_SETUP([ofproto-dpif - select group with custom hash selection method]) + +# Helper function to check the spread of dp_hash flows over buckets in the datapath +check_dpflow_stats () { + min_flows=$1 + min_buckets=$2 + read -d '' dpflows + n_flows=`echo "$dpflows" | wc -l` + n_buckets=`echo "$dpflows" | grep -o "actions:[[0-9]]*" | sort | uniq -c | wc -l` + if [[ $n_flows -ge $min_flows ]]; then flows=ok; else flows=nok; fi + if [[ $n_buckets -ge $min_buckets ]]; then buckets=ok; else buckets=nok; fi + echo "n_flows=$flows n_buckets=$buckets" +} + +OVS_VSWITCHD_START +add_of_ports br0 1 10 11 + +# Check that parse failures after 'fields' parsing work +AT_CHECK([ovs-ofctl -O OpenFlow10 add-group br0 'group_id=1,type=select,fields(eth_dst),bukket=output:10'], [1], ,[dnl +ovs-ofctl: unknown keyword bukket ]) # Check that fields are rejected without "selection_method=hash". @@ -484,43 +676,32 @@ AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1235,type=select,selec ovs-ofctl: selection_method_param is only allowed with "selection_method" ]) -OVS_VSWITCHD_STOP -AT_CLEANUP - -AT_SETUP([ofproto-dpif - select group with dp_hash selection method]) -OVS_VSWITCHD_START -add_of_ports br0 1 10 11 -AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=dp_hash,bucket=output:10,bucket=output:11']) -AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip,nw_src=192.168.0.1 actions=group:1234']) +AT_CHECK([ovs-ofctl -O OpenFlow15 add-group br0 'group_id=1234,type=select,selection_method=hash,fields(eth_dst,ip_dst,tcp_dst),bucket=output:10,bucket=output:11']) +AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip actions=write_actions(group:1234)']) -# Try a bunch of different flows and make sure that they get distributed -# at least somewhat. -for d in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do - pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:01),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.$d,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" +# Try 16 flows with differing custom hash and check that they give rise to +# 16 data path flows and each of the two buckets is hit at least once +for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do + pkt="in_port(1),eth(src=50:54:00:00:00:07,dst=50:54:00:00:00:$d),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) done -AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:1/actions:1/' | \ - strip_ufid | strip_used | sort | uniq], [0], [dnl -flow-dump from non-dpdk interfaces: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(l4(0)),recirc(0x1) -recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:10 -recirc_id(0x1),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), actions:11 +AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort | check_dpflow_stats 16 2], [0], [dnl +n_flows=ok n_buckets=ok ]) AT_CHECK([ovs-appctl revalidator/purge], [0]) -# Try a bunch of different flows and make sure that they are not distributed -# as they only vary a field that is not hashed +# Try 16 flows that differ only in fields that are not part of the custom +# hash and check that there is only a single datapath flow for d in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do pkt="in_port(1),eth(src=50:54:00:00:00:$d,dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.0.2,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) done -AT_CHECK([ovs-appctl dpctl/dump-flows | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/\(actions:1\)[[01]]/\1X/' | strip_ufid | strip_used | sort], [0], [dnl +AT_CHECK([ovs-appctl dpctl/dump-flows | strip_ufid | strip_used | sort], [0], [dnl flow-dump from non-dpdk interfaces: -recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(src=192.168.0.1,frag=no), packets:15, bytes:1590, used:0.0s, actions:hash(l4(0)),recirc(0x2) -recirc_id(0x2),dp_hash(0xXXXX/0xf),in_port(1),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:15, bytes:1590, used:0.0s, actions:1X +recirc_id(0),in_port(1),packet_type(ns=0,id=0),eth(dst=50:54:00:00:00:07),eth_type(0x0800),ipv4(dst=192.168.0.2,proto=1,frag=no), packets:15, bytes:1590, used:0.0s, actions:10 ]) OVS_VSWITCHD_STOP diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index c2dbec2..9c57de3 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -300,6 +300,11 @@ strip_used () { sed 's/used:[[0-9]]\.[[0-9]]*/used:0.0/' } +# Removes all 'duration=...' to make output easier to compare. +strip_duration () { + sed 's/duration=[[0-9]]*\.[[0-9]]*s,//' +} + # Strips 'ufid:...' from output, to make it easier to compare. # (ufids are random.) strip_ufid () { @@ -318,7 +323,7 @@ m4_define([_OVS_VSWITCHD_START], [dnl Create database. touch .conf.db.~lock~ AT_CHECK([ovsdb-tool create conf.db $abs_top_srcdir/vswitchd/vswitch.ovsschema]) - +q dnl Start ovsdb-server. AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file --remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr]) on_exit "kill `cat ovsdb-server.pid`" diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 1211829..17fadf4 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -2122,28 +2122,23 @@ The selection method used to select a bucket for a select group. This is a string of 1 to 15 bytes in length known to lower layers. This field is optional for \fBadd\-group\fR, \fBadd\-groups\fR and \fBmod\-group\fR commands on groups of type \fBselect\fR. Prohibited -otherwise. The default value is the empty string. +otherwise. If no selection method is specified, Open vSwitch up to +release 2.9 applies the \fBhash\fR method with default fields. From +2.10 onwards Open vSwitch defaults to the \fBdp_hash\fR method with symmetric +L3/L4 hash algorithm, unless the weighted group buckets cannot be mapped to +a maximum of 64 dp_hash values with sufficient accuracy. +In those rare cases Open vSwitch 2.10 and later fall back to the \fBhash\fR +method with the default set of hash fields. .RS -.IP \fBhash\fR -Use a hash computed over the fields specified with the \fBfields\fR -option, see below. \fBhash\fR uses the \fBselection_method_param\fR -as the hash basis. -.IP -Note that the hashed fields become exact matched by the datapath -flows. For example, if the TCP source port is hashed, the created -datapath flows will match the specific TCP source port value present -in the packet received. Since each TCP connection generally has a -different source port value, a separate datapath flow will be need to -be inserted for each TCP connection thus hashed to a select group -bucket. .IP \fBdp_hash\fR Use a datapath computed hash value. The hash algorithm varies accross different datapath implementations. \fBdp_hash\fR uses the upper 32 bits of the \fBselection_method_param\fR as the datapath hash -algorithm selector, which currently must always be 0, corresponding to -hash computation over the IP 5-tuple (selecting specific fields with -the \fBfields\fR option is not allowed with \fBdp_hash\fR). The lower -32 bits are used as the hash basis. +algorithm selector. The supported values are \fB0\fR (corresponding to +hash computation over the IP 5-tuple) and \fB1\fR (corresponding to a +\fIsymmetric\fR hash computation over the IP 5-tuple). Selecting specific +fields with the \fBfields\fR option is not supported with \fBdp_hash\fR). +The lower 32 bits are used as the hash basis. .IP Using \fBdp_hash\fR has the advantage that it does not require the generated datapath flows to exact match any additional packet header @@ -2157,9 +2152,23 @@ when needed, and a second match is required to match some bits of its value. This double-matching incurs a small additional latency cost for each packet, but this latency is orders of magnitude less than the latency of creating new datapath flows for new TCP connections. +.IP \fBhash\fR +Use a hash computed over the fields specified with the \fBfields\fR +option, see below. If no hash fields are specified, \fBhash\fR defaults +to a symmetric hash over the combination of MAC addresses, VLAN tags, +Ether type, IP addresses and L4 port numbers. \fBhash\fR uses the +\fBselection_method_param\fR as the hash basis. +.IP +Note that the hashed fields become exact matched by the datapath +flows. For example, if the TCP source port is hashed, the created +datapath flows will match the specific TCP source port value present +in the packet received. Since each TCP connection generally has a +different source port value, a separate datapath flow will be need to +be inserted for each TCP connection thus hashed to a select group +bucket. .RE .IP -This option will use a Netronome OpenFlow extension which is only supported +This option uses a Netronome OpenFlow extension which is only supported when using Open vSwitch 2.4 and later with OpenFlow 1.5 and later. .IP \fBselection_method_param\fR=\fIparam\fR @@ -2169,7 +2178,7 @@ lower-layer that implements the \fBselection_method\fR. It is optional if the \fBselection_method\fR field is specified as a non-empty string. Prohibited otherwise. The default value is zero. .IP -This option will use a Netronome OpenFlow extension which is only supported +This option uses a Netronome OpenFlow extension which is only supported when using Open vSwitch 2.4 and later with OpenFlow 1.5 and later. .IP \fBfields\fR=\fIfield\fR