From patchwork Tue Mar 20 18:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 888384 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="V+bGFMQS"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="UF82VdkY"; 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 405Lm52JKhz9ryk for ; Wed, 21 Mar 2018 05:18:45 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A2360F2D; Tue, 20 Mar 2018 18:17:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id C745AF2D for ; Tue, 20 Mar 2018 18:17:49 +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 A57754CC for ; Tue, 20 Mar 2018 18:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1521569867; 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=VUuEEOcIcsAazA9QPyauY43tjVeegmHksO22zbJrnQE=; b=V+bGFMQSiKl6oaETA9kuAcTKDHn8oxjE/nNAM17wKhw4OnxvrJkKqLQ9CkMr5o0X 5TKyCqyE89SfpEZASYU/FvvVOv7Q/8dBBhD8ytIuTL0jlIBn/JGzpt0eG9RXDWB2 sC+IfJBmgcIpgb3O6jFqkq0sDK7uJEIF38/x8HWN0ss=; X-AuditID: c1b4fb3a-a61ff70000003647-16-5ab1504a6c3b Received: from ESESSHC012.ericsson.se (Unknown_Domain [153.88.183.54]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 85.38.13895.A4051BA5; Tue, 20 Mar 2018 19:17:46 +0100 (CET) Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESSHC012.ericsson.se (153.88.183.54) with Microsoft SMTP Server (TLS) id 14.3.382.0; Tue, 20 Mar 2018 19:16:57 +0100 Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Tue, 20 Mar 2018 19:16:57 +0100 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Tue, 20 Mar 2018 19:16:56 +0100 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=CkqQWo5J9fcASPBzXnAaks4PLXEK7GqTqOyWwFRCjwk=; b=UF82VdkYteea+0PAc4vBf6CuQ+QBNtdxu5rDuqPV9T6Oy7E+n6D+rAtLxRj5Hxu8vInBIhu+GAK2U+WncmRUBItkt1RI2eObKp3tdAer7UuNLrmSuhlSv+kS0860CfJETI1zI0SipYcMmYzkkcDcawf2mjjhlJ35VBvP9Sz23+E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; Received: from ubuntu.eed.ericsson.se (129.192.10.2) by DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Tue, 20 Mar 2018 18:16:55 +0000 From: Jan Scheurich To: Date: Tue, 20 Mar 2018 19:16:16 +0100 Message-ID: <1521569778-7283-2-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> References: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: DB6PR1001CA0031.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::17) To DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bfee4186-70a0-495e-92a9-08d58e8ec357 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR07MB0650; X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 3:AptlW8ySmBHZP1Vgfzvir7RtgcoiRFwBBxcaBwhdcZVfe5S6c9g8IajQI87pE5pMfeazR+BIA9VS9tETUdXPbU0PaNm2257sfubBFPLvS5LvvIyHTTEil45RoIVmNotTYyHywmflITJkiuByIqGFpQxhE/Zs8oAk66ksMFe3pmhBHmZ66nrawNzcLbxDzx5mOjZmEzEf2yVKzkUSlGFjE/CAkWBYcdrl+lCxB/RubmlG3An9pQx9hag7aT4Zyblg; 25:gvOU8VaTO0cDMSsI33azCBK/183jrDXY20kYwhXG7KkYGdDS5xQBl8WOd+U8VBzhiD8DbF87nQC/AodsyiAsXgBwOuu7T0XwuXSnyoLIHN+w4Xf4B7X8ZKJm1UVzw7QUmzx0aHvmtgnbek56oR09u0ySRCnhdYFOgvuBMV9bMOHdq1417soSGRYQcCIDQi8bM33TGYtWXsIfL4viczeEDi0/y3llq/6eH2Itja6hymBHOz4noL3eO9TOFRAvSDhzPePBE9CnAnBCnSSDNjcBelNledc+s4qtpzAfGwsGisSQZj1FgCBFKrmDpIrp40PuiawiOuROi8mImhFU5y9B4w==; 31:jghyu+xclMnw2FMMaZ0GDeaCKjTQdP3/HbD0lOIwr6mx2xZrzgmNcn4+xcrFR7g1l+NycUH+8S1oiisecsoZrWUpGbNXE1G1uNdaMvrc6vmURwMhvOB0DxWDNo/I2pHGpRQ212x+2vf4wo50xtCqy/EW9LliFm11hx1PhYXga6zKY2hjLSBOEz5Cg/uPOLePvfkMa8OYXS1UmTWYz5KYqd/a2k/r8scDAojdDce4W+E= X-MS-TrafficTypeDiagnostic: DB3PR07MB0650: X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 20:oLKk0D0Ro8DeO1lLufVWHPrAU1Gktj+Fo2QdIqUC4FKDI/VPnf22ZmCB1he7agAQMv8YwVJhKLudp3I6wme8b76L6JbhM0CEDMctEDPjKMoBREk0t8fMZEl37RFhbj+EEXwwB1FGfUk/UBMZmeg3BppyHdb7hdN/C8+F14hhVI/8w7CntnjW79bYTSmK7hsr/OoX/cnwPiwQVn4GDiu6y0MpPL9tIszRjPldiWsvUwmdZghtyu6V5L4WmbVWOtqSIzIc13q67Ucc7AhCJQm1aEHoy0MRsT/k+6En2TcXKqNhgxgFAXK05wWpysGOfF+MOCWv50xXKGmWyFXuPkae4KkFndqYqfpBqUQx+ceYCulafQsqv2+6p3Q2Mwy+a4/uFcyfnXL6wVWyvSLdBRPJ2g4cICgQKvl1ruX1xrrEYRnGnbWgnegoFfx9pkFKpvrdfi2ziOInQGt8ibcTRgLYd3Gf6vP9NRe3K2KRPXk3JGMLP1OylAt3lFZOQLYr4rzV; 4:QGsTcuzEVqvFc0lLs6LEgd6pc+YJxxnIpT4khHScT74u//0T1TUNNviLeULBY9Ub1YUSRZrKlC5xDhwGsJJtSCM6kb1F9O3heL4AP37csJWsK7EkIaD+OF3d2nARgQamOvSZkQBhpn097shMNfi4LzOx7RhCv0Pvs1K5laTVMlGT47/A7rG6O3f1O6dRfPQBoz3CzzyINH55Ij0qOVghkONDwEinduX3noYKxYNBoBXQf0FJH8ku/9tIPLOZL9hetbYTdRS9GSmJrRKQVzfqpW2I5L3QTp1wWSlATlJBMAk5XqG+BXUIJvue0fLg1Ysx 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)(8121501046)(5005006)(3231221)(944501313)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:DB3PR07MB0650; BCL:0; PCL:0; RULEID:; SRVR:DB3PR07MB0650; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39860400002)(366004)(39380400002)(199004)(189003)(81156014)(7736002)(86362001)(8676002)(36756003)(68736007)(5660300001)(2351001)(51416003)(8936002)(76176011)(305945005)(97736004)(15760500003)(52116002)(3846002)(105586002)(6116002)(81166006)(6916009)(2950100002)(53936002)(386003)(6512007)(6506007)(186003)(106356001)(6486002)(478600001)(50226002)(316002)(16586007)(50466002)(47776003)(48376002)(6666003)(2906002)(26005)(25786009)(4326008)(107886003)(16526019)(66066001)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR07MB0650; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR07MB0650; 23:Szq7gys1onFrO6W0JiFHeThjqb6Y8qAl/tzTOIe0f?= bipYRokoJeJ0gv4WrKGJPzo0CxNqgpbEA5DPKjc0A/wa5ru1ybNeT6/EbmMX3lsDwwfV8JRBhiuv7y9Fl/PVTElNmUi40Unfj0KU/06Fz4Vj/dg9FLsLgcNQWwAhjZBm29TOF1OTV/zJoP5KJiHd7Me7f6L9PhPFPvMi68pc1Ah+NYj5/MYDRVCqb4eRNjf85uDBUeHpvoLTUbzvZMGhp9mYLkp9FbUDOTKhIo6FJZOrGWo8xLciJH0Im4CXIrSEW2ess4Ao9ySRhtj4Dlf32kNnqoGPZwopfsTvffcx+1n9XWD/Y/9sxXnfW+aG4AHPOUZ01mhq7pETc/4pR18k43Q29V4XZsRepgkOP8uuxh+KuFI6aUpCj8ANhMb7KHSPU53E4XS9wFiDbNaA/2n8ESqvvSRy6Gn+N5citl69VYIsupibqWnPaOFXECt/KCZa7a8Ky2SvAX9mf4ze+FbULAizEnXNqF+Me8i4DfeG7eoDQrqGRCaueD3Svj4o1yeU83rby64QcIdxKOzN4Iuu7fQA9UwX8yuuXmj3yk+OSjcFjJF4alFXQC/iM6kmAHRfiC6BpOLUhI/6IFwdf5g+hgbkywtZH9LsBU0+DCIW6pM5YnjOKY650s7PN/KUC9MmivFDsQ/IjxZdUbZVk0DTyzk4ZinVQUxRlJS3Xt9rDk9PQrcoJ27DkhRfgs/UvNVyTWU61j8WzNASOljmM1uKjxs47rIl/fkZqGAiL8r76+6x98e1fJ4aJIzUpVLMiJH8LVEiRODoOhA4aF4niANC1VKmHRfGwi9zQ+DIQxag75YUuWA4lvkCpwDjqsrXNUQdCBBlwgVwBxM0mV4norG2YNs5kcZhIJvTbZEHEZ8GQHjkDofxu8+xqI0kb6In6NjvfrdIBeyPJ7KoE7njggMeLQC8hvfj1GG6CvPn/dZOvqRrlhDIdeYQVB3rww0tG68X6V8gieGgLmmrBCLmeAbSL7PehYzutKDLmwl242H9LjH/9UDMpTLTks5/aFQnRvs5eEK2L8KZpZs7qO28NZHMahfk0xFSwwRIBrG/FZsgM894XdEc4DceFqSHS/6bKCZH346ayU4JOixO74JxPjhvgIFPsyEgQqTucFvAdgSZO6nzHUatheBBMlu0rYBK9o2+A4= X-Microsoft-Antispam-Message-Info: WtPZEjCbNqtxkz1fMmYK1aismYTz5+n/B7vb7PuZuKLmTu5hpipp1p6+EYJCLJe/6/UPWDdRT0nlY4Lipyx9cSQnNd6rK0RWTJl8VbYoTjgn3qXPBNjayJfYVROnRpzucDfHmJlvM1DDngxtQnNla2G/lGxUUSXbQLv5TSr6TG0NxCIy+KE0v9O4iLwgJt9i X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 6:w/iPgkKFwRVRTFlVkbPxwstNq22+CpLYQWpceG1nq3QFRgfxoiRo+UbD3w9cQ7ngVhyxG6CJO9NLZ0oylvzP0AkOFD8auVhR/FLqASNRgP3ixf7n/Q1dCc7GyKsm3mAzpt+u36Urx+cqEa7E4S1d9nAACN1E1xbiCxalDTJuAp/mY38PUi+Vb0pTWPCsgo11brBMZjvzEl/0zazzurkLKoHe9LylAn3nLY3IsrmU8eyY1ebeQclpek2OBdH9YUgZQbFlXvo1r99rtTnWyEaZAv8c6dyEWoRa1BfNdEU+Heovsj0EfOwQJ3eJfHJlzszolbQBiKQwmBprefJSAETbBVRZfu7Rh2rNFpEdnDe5fGz3ND3/ooGgjZ6ARrrSG52kjGrLnuxR5ltcXuNcTuLM6xaHI4E546CVQz+vd5pK9CIIcPdcxbj00XLAZ6otUVWmZ1kb0Gb2NazbyPIFygkvOA==; 5:Fw+anc7mpV1yfC+XSkLkhkd0vUa+e+pbzheyRCGdqeG1XrH7+H924kw2PFIQKpRnCjQjPm2zYaKWKTlVmY0LhVD1nYa/aEhkURgCt9+LaCcgH/4Lo1ylajHrNHyNpChbDoCAoO8HTP0nBpJUr7cupcoT6G7U8dIrT5sFBAtVfdQ=; 24:hTn2ZIxdpyT8F5xxhScVhQEnMrdc7/vqEc+jpKmq3bQP73qf1kqfbAwKf6asx6rkeb68L+e+7L1yYYhPMOibuzFS7L7Jo6JzlG2oJT6IMw4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 7:sn32eANBFO9JhJlOZ5i89lF912L5Z9EQPVzKvgtyplirtJQUajADjYSYvNZCVt5ZirEnNmUBU9OciGefRVTjsrVc/tM+F4noI3lUdtS0TH7Zw12XL7z0GeEaZAnz+4QfcwW5Rzs1eR3mMfuqLQaDuT8LmvlTohz1q7fXzp6sCIdpKwkabpisHLGsBQunYV+jEkwXzgVItz6db3qOkujRU54yjdp1RC+2gdMHnvu8OGgOWTajFDWmJOF/ExVR/V4C X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 18:16:55.3717 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfee4186-70a0-495e-92a9-08d58e8ec357 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR07MB0650 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPIsWRmVeSWpSXmKPExsUyM2K7ma5XwMYog733bCyOnt7DbPFlVx+j A5PH4hVTWD2e3fzPGMAUxWWTkpqTWZZapG+XwJXRtWABW8FB7YrzXTNZGhg75LoYOTkkBEwk /nf9Yu5i5OIQEjjMKNF37yUjhLOFUeLxvM8sIFVCAt+BMs+zIRJLmSR2TXrIBOKwCHxikjh1 6SY7SBWjQKxEy9apTBBVXUwSl/ceAJrFwcEmYCAxe7cDSI2IgKTEv8Vb2EBsZoFUiUkXV4Bt EBYIkej4cJIZxGYRUJWYc+g2WJxXwFOi5/8LNohb5SROHpvMCmJzCnhJbG1eDnWdp8T2vvlQ 9YISJ2c+YYGYLyFx8MULZoheBYmNW2aygNwmITCTUeLR4ensEM3qEn8PfWWBKJKVOHp2DpTt K/G5dzUrRMN+Ronjf05BJRrYJRYtC4SwtSQuT7zHDlH0g03iz41Z7BCJbIm2j9ehVltJvP71 nRGiaCmzxL3jT6GKZCQm/nzNPIFRbxaS02chOX0BI9MqRtHi1OLi3HQjI73Uoszk4uL8PL28 1JJNjMBkcHDLb6sdjAefOx5iFOBgVOLhZbXaGCXEmlhWXJl7iFGCg1lJhDdTASjEm5JYWZVa lB9fVJqTWnyIUZqDRUmc1ynNIkpIID2xJDU7NbUgtQgmy8TBKdXAqHql9PXVov/5/LsE+6pX KzCVGB5b4XmGw6vb2HX/1Hu/Gs++9WF35Q772lq4NI6LSXjzZ/MOXs4d3z6ee5LIHLLQ9fbk ipVT8v7ciGvXyZnQ1dZQW7L4hNv6c8dt9Raf3n4g/ssWj3vrXu9xb3l/I5JZtDriCGNFcvj1 425rM7I2rpEzOipVq8RSnJFoqMVcVJwIAK/6OPACAwAA 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 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. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar --- datapath/linux/compat/include/linux/openvswitch.h | 4 +++ lib/flow.c | 42 +++++++++++++++++++++-- lib/flow.h | 1 + lib/odp-execute.c | 23 +++++++++++-- 4 files changed, 65 insertions(+), 5 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 38ff29c..a57a5da 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -2108,6 +2108,44 @@ 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 != htons(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]; + } + 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 +2166,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 770a07a..e6033ad 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(); } From patchwork Tue Mar 20 18:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 888381 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="G9YEa5Z+"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="SlAcYrXM"; 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 405LkJ3qrPz9ryk for ; Wed, 21 Mar 2018 05:17:10 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 50BDAF25; Tue, 20 Mar 2018 18:17:07 +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 16B02F23 for ; Tue, 20 Mar 2018 18:17:06 +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 68A932F5 for ; Tue, 20 Mar 2018 18:17:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1521569822; 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=4fDnfgpO5ic5/rq4RsbHDdakrHKyk8151CwDUXfHpd0=; b=G9YEa5Z+/Md0PXm0u+fckaczmq/d6AHAoUiqL6GCcjxFeJuZfYEcCTOsLw9aGLVV OmDpwoHpEHihlgg9cCvpqPDQk5aTivGUuaWeLIhptPSW47ZdjDM5GkcncWus4oBg yh6peSNXdWoGd3m3N7xCOcks1reqEIhEyl624zBufLI=; X-AuditID: c1b4fb30-6ebff7000000095a-80-5ab1501e533f Received: from ESESSHC005.ericsson.se (Unknown_Domain [153.88.183.33]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 38.0D.02394.E1051BA5; Tue, 20 Mar 2018 19:17:02 +0100 (CET) Received: from ESESSMR505.ericsson.se (153.88.183.127) by ESESSHC005.ericsson.se (153.88.183.33) with Microsoft SMTP Server (TLS) id 14.3.382.0; Tue, 20 Mar 2018 19:17:02 +0100 Received: from ESESSMB502.ericsson.se (153.88.183.163) by ESESSMR505.ericsson.se (153.88.183.127) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Tue, 20 Mar 2018 19:17:01 +0100 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESSMB502.ericsson.se (153.88.183.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Tue, 20 Mar 2018 19:17:01 +0100 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=TsubB6H9b+a2zA3+8LFiZsBG474BgDG2STx2MVveu+4=; b=SlAcYrXMRFPnZj/DDyA3WxY4OSFCCJqpmSRhStIAzTsBRLI2jPBZ5LaxR3qPGFhldWO5QG45dSotbOrBCUIRHCisEQ5EmiwMZ/JMHjqAbsDuptoDkpe3oNSiyCap5w2QsP+tR2P3z5u9cU5eYzYU90jW2ZHwBbpfrbbrQ0C4XJ8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; Received: from ubuntu.eed.ericsson.se (129.192.10.2) by DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Tue, 20 Mar 2018 18:16:55 +0000 From: Jan Scheurich To: Date: Tue, 20 Mar 2018 19:16:17 +0100 Message-ID: <1521569778-7283-3-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> References: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: DB6PR1001CA0031.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::17) To DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1cb52c47-391c-4853-962e-08d58e8ec3b2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR07MB0650; X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 3:LI05LiPYPnjIUMVZQNPCa1upx+DTb0MBc7ZIdhoSClNj2121j+n/89tu6Zqu2Ymdr7q5Rjz3FeTekzkzP7YKqZoaY4vZzmUwFh8Ym4oy8TwOTQePyUMf8tYpmD1aA0N6SYSgNPdkQgS4DQr56pZseRdwtteLGVGQKbfLzjsSHtyzBhqRnsllrvj4FO5FqHZpyU2TBdGNXrUZWfmPvtBkjYfc/rgHmRGjEudtDx/H+ujmlhLoE8q1LWmf2/NFSJED; 25:nkVApSdlBpGZSTnS9y4OEPON70rOl9i77T5SbihFu9j9GCdabmFqTzvo8O6ugfZAMk29iQn1dfKWgZNVPeM+34fNu4XajS0ArkllBn7TVoCbLZ1muD6qSdcIOojTKDod3JRHPc7UlaE9SAg74mQOdnXPDClzzBDvxarR9ky4HVPtvII2ZGZFiCn5+nJGXHYJ3yuZ3CagWKkO6CLctqwt0EK6rKuH5iNolIuzj7vDv2Tbs7HzSGaGK54wa7dIWCzQdZ6USI6nFaz1On1sZefkgKrgVKXifAaZSHT5pHLA1xc6rBCBlBZHiesR/aloG88tu/kMObEoZtX98vPVTAofDQ==; 31:fX+mIyHQqX2sjfVpX6B844crA0eClbxeJD9uQjkBn6DRoXjuhUuk/vL+EbwjMwcdgN5BHgwIcx3iXbJ42Exhj78E7xkUPPnXvOf+lnTgYvIjDU3bGjlx2KyqHJnV9+j3LzrZnzwFT37oHNFpjT7sro5v+ybGHJoSX/QS6mdqQbx31I4HppVr7J1n99GxXIL01C7DSHStBNSwbyICM6NFLvC8/SXUr/NjF3u6YqqCI44= X-MS-TrafficTypeDiagnostic: DB3PR07MB0650: X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 20:ubRb1eX9PsvkB4+POnjtUK0/nWx6s7XctPxQ1L5D3fu5k3VepK4zjAn7jHXQHFoY3nVdAv5SPktaaZfnbFSWhA88uYesMFJ3/9y+q0hwleQv6Db3RPkkUtiSIKyAQY6yTMJeUuMLqJy8FbQRCyu9kr99b0W4jrvzMbmdQs0jbb8Q5CZLcAOY8eVDRFYEWhcxFG4GJC7RA4v/e6cjFrh3nV9yx9sBKBsHm1H+3yG6ESGzO8GE1nQZD9oTLMW0tDY2WTpoTdRMmEqaWPWfugNDH9/h1jjjmnUdtoR2V+XHvG1djk18J8GqE4E8IqN2qJZJoMW61kPtfxEUY45rDXSPhlwojb6iOuAqEqIcMj39GMegBU1AKG6Q2ClObynNz/GSZjTC1+CNvWD3qad+VKJgpSU/lYzzXC3V6DrZc2iXOKN0d5MW2xxR2RNf0Wwgyd6G1I0eTWeJOtMqZrq+UpROjLxa1iPn4//rioPRHe5hV5+dTVpElR3rqkCABRDpG6E4; 4:MHpg0+raR+BL6Siw62UGFxq08UmgvIAvF/rn4pA0AvEbBDB/qiyKwQXWl8RCBSDz+158+mK6YFqKHYA7+xRoyYQY7s0d7StKrWxPsxPG/ggbh7GT3hS4gvCHKfNyFuOg8JQm4x4GHImfPEvD8D7kRClEflTdEXhBjqsHsR5m5cmzCTV7sXq72pp5i58ARCF57UHN5b1ZkY1EegwghHa1XHN84tuOjXcSJy0N43NJ6hYxwZi/ZFi1b061RkDolLlMCQNhc1F9M68ge7rlxyS1pv0g4aPtooDNUEDd+pqoYfFKgFTOpvVSmkq+DkcmTJLd 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)(8121501046)(5005006)(3231221)(944501313)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:DB3PR07MB0650; BCL:0; PCL:0; RULEID:; SRVR:DB3PR07MB0650; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39860400002)(366004)(39380400002)(199004)(189003)(81156014)(7736002)(86362001)(8676002)(36756003)(68736007)(59450400001)(5660300001)(2351001)(966005)(51416003)(8936002)(76176011)(305945005)(97736004)(52116002)(3846002)(105586002)(6116002)(81166006)(6916009)(2950100002)(53936002)(6306002)(386003)(6512007)(6506007)(186003)(106356001)(6486002)(478600001)(50226002)(316002)(16586007)(50466002)(47776003)(48376002)(6666003)(2906002)(26005)(25786009)(4326008)(107886003)(16526019)(66066001)(2361001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR07MB0650; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR07MB0650; 23:m1zQBDvPk480C0mOKOQtYPcwFjnxLbiBtWIGBCB/+?= 6DojM+OmIsg9sEsQprhgbp7fYHJ3d2VkgwMVNegYEqIY59KXgj8EX39PgY3VxtvtrbBplSrMKoEiyQUiy7CYY+p3nlgZN1EFHfzJSC7MEfcQ893jaupGTGk1bDIwzU43mDLGmLmaWF4MUvf105tXEBE76q5jf330y07aPVScOFP6Prisl2XYUp/EanUkfl3hbEOx1SX6G/KpPqL2WU6EL4vVeTXiuiDbf1Icu8l+sJ52r/2bObnE40Y4HMsDs19g319xkCainCqeQCBe72aPd4llhpMGLhya0CG3JqP3h5axLKIzoe9lUXjKs25CYsQM1oyHBiWyHYEUPb5mDIaAspePBnqEGnFJELU2AaoGWNqccHlcJXhgRHYheei3ep97yZ576SU7vVF2ycVV19tojE9zCyiFogYh8SK70UETCHKL8rXoYiy5ULdSIbgPolZp6uTtzbijZ/AhFlvFDioUWlChOHi0JGaMwWStX2IxkhezHYpcvISeCkl7EP7EzrtcKNC0uQ2NUeWXlZvsY6d6st+ekxRLPZUsfQCi5KBotg62/0lLxNEOW5RwxayNrfi7mNr7jDbgid5pu6lbTtNuovBv4tixGvotGM5akNFPtzDX1xieIkBQi69IWTN+/CrXr7M630ulPOi70Kh9+cDiy4XvsnH9WC4we8VVb2/XftThLBGM7ZtwHkIrdagdwNdaSNHU7WQjL/Xjqp0seJ9x3pQtzcZASmJlGuMv99ex3EoqyYBVKx5JhGx5q3opBNoMgyz3iNMh4ARKQPrkoNRxY/w3PO5zNF25kIa1X8QnsiZ3yhnGTrm8X5izpAF6yQcCB4wFXxe5EBNZz8Xw4yAVvkkODHxv7S0XZ36kU6gjMVbHVmQh3BG0MQoYkZJERrAApOU4EOJ5PIXs+5AtSvwHztjnBKsnEt3++HGb465keGpoBGNUucIYGAHy9ZdQab/9hz4qPADMPuSgP7CoL0gvYlSsNW6HCXjxR56V0pOoVruPEOxEOWnCAPL1rhQcgdFyl3FYzbUVK9w8A+zMFBZ6ZXRpqEv8ye6gtY21hWFoxNZGXwQKeRHTDWwHNlY44OlYAaH1VeToVit8z4dN5mJV39CfIeJKrKm/ImX/P45WEknNlwUvCgRCb7c2f7tDxZDSSXBJcvzQX5aLGSvCslFsdo6n6ZwsnJNP6Tu9wbCshGNEw== X-Microsoft-Antispam-Message-Info: bDjiKGxRAIyyU/YwnefUacZYzkNQojkoUnPSQ3aOux6Cpt6HbzRObIQQwaoOKMDaNHuJ2WCTeE6OVBsn39Tnrp2TBXcA0JFSH0eQ8Alyb/Sgpor2LCs2gVLM0zvtHM5gvLGjaNU4pfdiipW0hwy7yw3Wg3wIZhGnL80YNzMuZUgy/huFL9+GVJk2v3XSvcJw X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 6:EhDDokQGixlq9aNmlkntAWeFf+BFwtA7emk5GYVqG421O47mGvtEanpejrwkpI+WQVpTOvZU5fIUiAEHawga07EkYQN/eX1nTfYX9CfXEmYoQ79GxPGHhMtTMIWng7QYNpL+5eD+OOITPZFp80agtG9iuyuLvssc2FgpEoopYr77BG66VFY84Yppd/z3wyFU2zgYHhJXpxhac7K1MNhTyszvGR01rZuhGMbM7vQ2oDulzk4VtLkSe7WYevPtg3N1J17R7ewdzCLLtitAKXLNdx2tl7e9ZIby5QIqiawq7SCsWIQM8g3donsIGXNnaz1L+AneM09O9jJo4HzUT7k1M7mx1aCI6s9Z+fThKQOyH9HtjurLYYFZdn4tOPzShZilr/rnDOXEDdbwdqhaCoacaWr50fISLpdHPR36Pcnr7Mp9oBDD15dmezjciUTrxumi3++797JePuFmn1PvyqXEyg==; 5:8AKI5POwFb4Kb+UCbnqkVAv5GKYNqP0Ua/eo8ecUGXm0esiweucrbFgoyCJYIXn0b/NVVHAGd+vjOPBb17BVqwjfcmkGkbZFz7a4Hm17T/HSifRUNgZBKtfPNLeOcklhy9aIM9jCY0absfDvLb7e6vwNWEh8NEMtEYpS1hUHlMo=; 24:kw1TrsPvjZeIyXuOwXtdXqD0pvwHSL3y4HFXD1R0dq/hcvO1fkGArFfRPFMHTVcugAe1ccDgBsh5h/OE9vUOye0zKj8d7lApkjweePqTd98= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 7:JffTmRaL0KL24QZf9b6C5CX8/Xz9bj4Jq/ALVd3+AkmkDKILWDm25dycAhGj8jIlyWfgLYf5uX1+y5TiUPLeWHA2tRgLXFhA4ZahHAeDyD06Y9TRhRBZYREdRMvKIiKS1mo+NqZzUQ4/pbZkvyIE3PQbUC0p/fZ4dPQaI5VT/gOyimMx06x6Hujln0SJ6ykHk5IJ0CqIdOsNtHXeMIR/m6sAUbgTeLNR9Pr+3as1WV+IoMgSRic2+Ecak2IAk7U1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 18:16:55.9652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1cb52c47-391c-4853-962e-08d58e8ec3b2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR07MB0650 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsUyM2K7oq5cwMYog1k/NCyOnt7DbPFlVx+j A5PH4hVTWD2e3fzPGMAUxWWTkpqTWZZapG+XwJUx5/VSpoJ3pRUTr69lb2DsDu9i5OSQEDCR mLhgK3sXIxeHkMBhRol3i6YwQzhbGCUat21ihHC+M0q82vgCylnKJLHl3mcWEIdF4BOTxOfL J5lBhjEKxEq0bJ3KBFHVxSRxee8BoBYODjYBA4nZux1AakQEJCX+Ld7CBmIzC6RKTLq4ggWk RFggVOJ9ZwBImEVAVeJATwcTiM0r4CnR9nktM8StchInj01mBbE5BbwktjYvZwGxhYBqtvfN Z4GoF5Q4OfMJC8R4CYmDL15A9SpIbNwyE+xmCYGZjBKPDk9nh2hWl/h76CsLRJGsxNGzc6Bs X4nVdxZANexnlDj+5xSU08AusXD9bjaIKi2JyxPvsUMkfrBJ3H+6DmpftsTXO3uhiqwkXv/6 zghRtJRZ4t7xp+wQCRmJiT9fM09g1JuF5PZZSG5fwMi0ilG0OLU4KTfdyEgvtSgzubg4P08v L7VkEyMwHRzc8ttgB+PL546HGAU4GJV4eD2sN0YJsSaWFVfmHmKU4GBWEuHNVAAK8aYkVlal FuXHF5XmpBYfYpTmYFES5z3pyRslJJCeWJKanZpakFoEk2Xi4JRqYJxlWaJ5/cu6Wfd/XDaO jp+7fXf1biYp9aO59l+tPwk3sMZ7Oq388q/BIzbCQcOwb67xBN+pseeXFDUYP3/LHi5SZlpy S9hr+WSTpdkLRWyUNb6I8FpvF5tbfqm3R/Jm9YHVb499cpYTX6bgtsUvfsHFPRX9c87WNX84 yl+8YvJtz4kPry+4Ol2JpTgj0VCLuag4EQBDubWqAwMAAA== 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 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. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar Signed-off-by: Jan Scheurich --- include/openvswitch/ofp-group.h | 1 + ofproto/ofproto-dpif-xlate.c | 70 ++++++++++++-------- ofproto/ofproto-dpif.c | 142 ++++++++++++++++++++++++++++++++++++++++ ofproto/ofproto-dpif.h | 13 ++++ 4 files changed, 200 insertions(+), 26 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/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index bc6429c..021a4d8 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4232,35 +4232,51 @@ 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); + ctx_trigger_recirculate_with_hash(ctx, group->hash_alg, + group->hash_basis); } 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); } } } @@ -4269,8 +4285,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. */ @@ -4278,15 +4292,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; } } diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index c92c5be..383d04e 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" @@ -4717,6 +4718,139 @@ 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[group->up.n_buckets]; + int i = 0; + + LIST_FOR_EACH (bucket, list_node, &group->up.buckets) { + bucket->aux = 0; + if (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++; + } + + 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_INFO(" Too many hash values required: %d", n_hash); + return false; + } + + VLOG_INFO(" 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++) { + VLOG_DBG(" Hash value: %d", hash); + double max_val = 0.0; + struct webster *winner; + for (i = 0; i < n_buckets; i++) { + VLOG_DBG(" Webster[%d]: divisor=%d value=%.2f", + i, webster[i].divisor, webster[i].value); + if (webster[i].value > max_val) { + max_val = webster[i].value; + winner = &webster[i]; + } + } + VLOG_DBG(" Winner: %d", winner->bucket->bucket_id); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" + /* winner is a reference to a webster[] element initialized above. */ + winner->divisor += 2; + winner->value = (double) winner->bucket->weight / winner->divisor; + group->hash_map[hash] = winner->bucket; + winner->bucket->aux++; +#pragma GCC diagnostic pop + } + + LIST_FOR_EACH (bucket, list_node, &group->up.buckets) { + double target = (n_hash * bucket->weight) / total_weight; + VLOG_INFO(" Bucket %d: weight=%d, target=%f.2 hits=%d", + bucket->bucket_id, bucket->weight, + target, bucket->aux); + } + + return true; +} + +static void +group_set_selection_method(struct group_dpif *group) +{ + struct ofputil_group_props *props = &group->up.props; + char *selection_method = props->selection_method; + + if (selection_method[0] == '\0') { + VLOG_INFO("No selection method specified."); + group->selection_method = SEL_METHOD_DEFAULT; + + } else if (!strcmp(selection_method, "dp_hash")) { + VLOG_INFO("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_INFO(" 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; + } else { + /* Fall back to original default hashing in slow path. */ + VLOG_INFO(" Falling back to default hash method."); + group->selection_method = SEL_METHOD_DEFAULT; + } + } else if (!strcmp(selection_method, "hash")) { + VLOG_INFO("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_INFO(" 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_INFO(" 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_) { @@ -4725,6 +4859,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; } @@ -4734,6 +4872,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 90432fa..6a58b48 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. * From patchwork Tue Mar 20 18:16:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Scheurich X-Patchwork-Id: 888382 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="UGDPUbqV"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ericsson.com header.i=@ericsson.com header.b="RtaHqzBZ"; 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 405Lkq32DPz9ryk for ; Wed, 21 Mar 2018 05:17:39 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 409EEF3D; Tue, 20 Mar 2018 18:17:09 +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 61325F27 for ; Tue, 20 Mar 2018 18:17:08 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from sessmg23.ericsson.net (sessmg23.ericsson.net [193.180.251.45]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8CA7D2F5 for ; Tue, 20 Mar 2018 18:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1521569824; 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=09AfL7o0KyC7UMJl4VvNLWGaC3cd7X7bAbPH2hdOLxQ=; b=UGDPUbqVnCzFqjoCYKkFiW3hSlEn+Jdr41EJLXUHu54oBEoaq1Rwc2HIseD+EY/h TszJCoPYI9vXH68du3oG54YNlrsyH/A7e/hayid7EhZt92Rm30Bs+Em+30YpdKJI jOix23W+CwHKqGOlxmNF6djeAkqbI271Yv4tF9DLW5Y=; X-AuditID: c1b4fb2d-4b1ff70000005540-c4-5ab150204bcd Received: from ESESSHC004.ericsson.se (Unknown_Domain [153.88.183.30]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 1E.EF.21824.02051BA5; Tue, 20 Mar 2018 19:17:04 +0100 (CET) Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESSHC004.ericsson.se (153.88.183.30) with Microsoft SMTP Server (TLS) id 14.3.382.0; Tue, 20 Mar 2018 19:17:04 +0100 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26; Tue, 20 Mar 2018 19:17:04 +0100 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.26 via Frontend Transport; Tue, 20 Mar 2018 19:17:03 +0100 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=h6v5pGW7Acx2MM1XrucQFR8qf+XtJIITlNhPhfu35xk=; b=RtaHqzBZQRZ2eGDOdf8HgCM7m6i+et4PGiKRK4lmoCIMjs3F+oUTDRcv3OlZih83FtKKnRx+G/odmROvepTHYsxKOXv/6jJE7zJh08e+lOUlA2YG55rPdd6fBO4vnUrcEPMxvT3lVFLJn4fQOKgpUer4Ru6uLYqUvg/GBTf7y7o= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jan.scheurich@ericsson.com; Received: from ubuntu.eed.ericsson.se (129.192.10.2) by DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.609.6; Tue, 20 Mar 2018 18:17:00 +0000 From: Jan Scheurich To: Date: Tue, 20 Mar 2018 19:16:18 +0100 Message-ID: <1521569778-7283-4-git-send-email-jan.scheurich@ericsson.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> References: <1521569778-7283-1-git-send-email-jan.scheurich@ericsson.com> MIME-Version: 1.0 X-Originating-IP: [129.192.10.2] X-ClientProxiedBy: DB6PR1001CA0031.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:4:55::17) To DB3PR07MB0650.eurprd07.prod.outlook.com (2a01:111:e400:943d::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a76b9142-1697-44b8-c787-08d58e8ec62c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR07MB0650; X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 3:aFdCY3qjCxmHl1uH/+crqW5Q1jziy7FKd3zCk8NHbMJJvtc5nKpDpJ0rhDWGhUSBnhWPeIaZjqji8otxU9/ojCVede1fIFw8k9I6BcZ+D4gTQ0DwaXYBiCB770H2g4ceCkVyf46yzLsRM/xXFPu1vB3c1dEoAVOyou/F21m4Ho0wEkUkG0KdaGozeSrQDQIdAXi4UrHSHOLQrEwxBkxOCaagOT0fQdYuQuNq2WZ+odWECS4uattPJcVpe1toGz/j; 25:Cn7gtDN5bZUe+NV6okF6jnRtNoop6r9N6+ma/I+yYHr6rsJVQhqWiynjG1a3hc/wCgp8XiLyfXN10XxX1k+S8i0uB9bhJ3kWD7aVX25lRlyDLsrWBcrx4x4hdpYbmG+Fvozi5hqoLrA0qA6rylbZIEnwNpReAyEpQRRxHJlo8k7ALdt4+sC60lz+MPeBC94KDGTXKOweXZJxIan2xNryNhNN9BerK8kHu2f0LJx9t9kag+na4bICYwLbnXGgQokVO1IENjlt2+aUzq6S7oP0jLemcaaUt8e50jgy1L/6cFRG72aUxEVoEqkALP0bPmvSH/KoDfNtHVMRy+n235FZrg==; 31:V26/wbuZxJuO1jziFVKMROnxg3kx3CeiVyAWW7ZzDn0AES0nxoLQP7c/5DlBT/jwv9FhO6pGHjou3CDUJvQi6ITbKrNQz614IcQ9/v/Saax0zm/d5mcGZaTXaxakM8+oBw6MQ45ahZCIVzYXwc2vUgYx5LORQJYpwL2pEiJZpwn2z3Pge0NqGCWVUjGIIOikC88mcJ9CCjHa/T+MpRdQd5+C2XxKewZCLeGKUmUzW0E= X-MS-TrafficTypeDiagnostic: DB3PR07MB0650: X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 20:+w5i1ZhUa/OiuUzvk+6RIPuJ8tKC1vdA/K0o72PTlPKzOHCq+bmolANRCVZ1aZL0dReCmM7YHMnytmEsyVXyhbx1pfJ+HO8G7cg1rKfgsz17JSquCELArfqFe1Xq3aR0p7SgGXTSZkX+NJQmTrJdlbc5mF8L5CXzGK7cxgbm8TwniMS8wBh+iAyoPng0mDIkWGoJ2tmfbaoXFR4pZJWkNsCC0DRTaHascF2YKdQB5cC3EQm7q7udtCI+OOngnFxjDPkjLgVNlZ0wi66To1pfZuoXsJx20HhU79LZo8bl9asMuRrRznm0mxgJH9NXYFC4fNPDngzaGtcYQSL87Tjry5hX6bZe7uSWezeNgXU2qZgPu+Wjrcgl1Ft7LC6hdmnTZm2fIIxW/T9DenmKA4BXk6fRmIglh4hNIv+hfUVXYeIQ2CGv+sK0cCH3nC04DXClFX4SRmBnp51RucZVoMyXOWbt1zrnfbPoHR9rakn1l4P1/tsMvcVWMDQTXGkdfgMu; 4:3ZNopH7mTA14bawFAc7HvjbBEasmolgKK7WOCcW02F4/0Ud9zwyj/6W0tOSggm7PMUMFiFjVvu32pyyqD6CulQ5K/EkAc/xUTQT8+OrrJHm1XZIIaczL2doso9pPKdEJiYX+U4CZpqdWaMJtk5wMvl6VU9833DFi7T6AQzMXfBDdCXoxpmB0QH9a5PPF61japhEc+B+ilqB/cx0CU22SheG9pk1pvZkxHA4vWZD45fj7cQjvQ8xYIq0m+K5+nJxweWbl+ybXD3op/V1P3rOezRCFA3xTI1W/aEObXskL6siTxdUBRZ15JskK7/ruCu5Y 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)(8121501046)(5005006)(3231221)(944501313)(52105095)(93006095)(93001095)(3002001)(10201501046)(6041310)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(6072148)(201708071742011); SRVR:DB3PR07MB0650; BCL:0; PCL:0; RULEID:; SRVR:DB3PR07MB0650; X-Forefront-PRVS: 061725F016 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39860400002)(366004)(39380400002)(199004)(189003)(81156014)(7736002)(86362001)(8676002)(36756003)(68736007)(59450400001)(5660300001)(2351001)(51416003)(8936002)(76176011)(305945005)(97736004)(52116002)(3846002)(105586002)(6116002)(81166006)(6916009)(2950100002)(53936002)(386003)(6512007)(6506007)(186003)(106356001)(6486002)(478600001)(50226002)(316002)(16586007)(50466002)(47776003)(48376002)(6666003)(2906002)(26005)(25786009)(4326008)(107886003)(16526019)(66066001)(2361001)(334744003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR07MB0650; H:ubuntu.eed.ericsson.se; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR07MB0650; 23:SF3syoeMf3N2e78Z6ckEy/Z3YhKISvEWGgdNRlKk7?= qWIPEuiqereeukvZnrfJ8Y3VrPnVMd/CX0is8yMblJ2NGRQ2eub03aAlZ3BBiI2s4k2/g4lSlZzgb6Blrg2lbNLXUdrPZiLAPZu27SxgFCKlPt7IcL+onfFtJzNl9DpghtnAc7PD9p2X/X+IzizZ60kK+UpWBw8Drfptnc9D/hUyMANXZRcpwqFzygIM0gKXIGhXnO+CeRokIZepU1G7wDegE5URfATRZ46rG+E/WajOJy4dTvH/qAXkEWt3ioWvlf0gng6Ogr3xZ78kQEOpUgTq2taetHcQxoIMqlLdOw0ckUn14lBQ4Do0UfFLwhLSaqwEQ6dhs9u32cSa25jNmPiycocN9xPMvma9RAFanmWtYbPpc3pfW1DiE/vaeO1hK6JB35ue5uldO7VvbZ9N/Q+TlfBvfwKtYsA6aeDyRuSK6Ee/6h2bJpCAX0riUXaPZinA/W2ZGhlCRAuVJZTTqakeaoIf52caOaUmUEP0MLY+F8YSdSN50bbB99yeEoXx8LCBMymawsTNqg7YFnr9Eqnq6QlvsqFfMxJKo/eShFsERMWLKXeRqXvRri6aPbWePWM4w3OxNKdcSyPw3r2l6XC+0zn0NQJPGOx1b+qOR4uJnfaNaIm//VxAMKtKOL7dKb4M6QM6yhHzW4H2hbWUvMi3BYA9/7BB1gFG3khnUpHph9NETYJUM3TKapEVXYHwdhVVOM7hUZ6y4OJjgrpSRP+UpC2JRRMM3MnSEhfCUqp7U7T0nY9WCrGLtJruoFeRrKXFPIf3D8WBC/dAasR0hS990n0Bzw98c0nMSBqB9OxigzpnMiO7devLR67OU+GCvOl+6vrcrn/cb7YgzUxf9+FmONqm4NtDXJTZa1wqRCup4Qauv2JKLY90jcn2IjUTCP4eWjfjeKl1BQJDF8jvT8G7BoBj+5Q4P6CsYio6ddDGl9pgek3PAj4tdo081cKhtaAVxW/rx5zHwz9pzoXhgeRFuo0kUczkqDsbPcmNNvWqAh6Qy2JU0n/00B2oH9KmHuBTnFv+SzRObPskyDblcH8TJFPFsKReEaV4mqBJ9PFo3igdGhav973iWeTHPTgu4XWWU4nwzKAwZOxiiZvBcQ/mFf0SlKHI7zjt6XpEKo//RzB4URHaTET7LH573OJy/kshx0u0qMKA5PYv1jWHsWH X-Microsoft-Antispam-Message-Info: dL/sFzek+WOPe77R5v1i7v+PuBmNwdPpWXpoixmlp9nQK2Nz14yBUgVf5VRZmU65SZeFJNzCJrZzOmgBT5qnseJFIdFCqUruGez4F5GdQwrvFjLFaRwsPAkqT8F6zc5ba8dgWlE+dx6L1MWxEVCZ3uY4Y+kAeoEsd9Mqp9XZfsWVSs3qA6GDnxZCaJx3sS5N X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 6:+6zYCPnjIr5ubRLjhJRBEVuvDjiFZeFhCrniMlytlQcPZXndczAyRSj7F0aXXftFvUqeNO6k+iG9IFr5aYB4UaOQYFs9yGA8EmztgXTPLkxR9WC6eXTeZgDP7Iuv9rQjRsQChHU68ZfogP/CAPKfvKknlMGINurBIw5g9mcmIPzeqiVeEEp1xAmdj5Cjk5ial/18v9FKUgPdBT8cc9sxGeB06kV1buW+lWsR0ogSOl9our8egVlYPjLLcVoOlnrlilkuvgN/g9BYjz8r5CvrpJB+leH+vPSw2gyrmcANgCq2Lw9hJgU7x+x5W4fx+CdzX2h+JUYWCIhQUQ4hYhFqdjPkX0NPYv9NPPZ5vLevYtMUb+TB0+gakTi/CTvkhqS8NN18jtDxNpPTMRqG2WcznvKV/HZS4I2LBtbsrezAfTshlzg33wLFwIRfPLXP4z73nKNuTDSasUGte9RhkRB+3Q==; 5:wIHH11n7QmUdzFVfIi7z76tC9K4vOObQh3dI6/f+5qp/JhvnmTMqMRtvZ2TegR/GKPQr1yEmgtIYcGxB08lfZIxQ+r0CQtzcGgk4zDizzeIk/RVFaH5LjekY8C3pkh4tujK9FS5rR67PYrBA9igns0OHaPwj3nkrU7s3mU9trqo=; 24:yRdlh2BzadP0fBZBCUCQFpuo7k8tNu6l28EJTkbRpAIh5WJY2pQXegWWZ8VLxURlCiyeCvuktFh2NOoovN/ZH21bK2fyGb46eBWEt9yc5pY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR07MB0650; 7:gCqBbFSq6nAS8TLVz3TloyxUVQ6hN3XVvJVXCXKfzAWVzt7sOlXYxypz/iADapccmcOSdltQulRytuM+ZeX1GmkGEOV6h1ptMJVoCdmj5D8No2kTTOnUF/qDjkBwQcIfQji7QJmRRtzQViRv1kEDEm/fJFHU6Ra2DzEy6UmeDvuast/RjXSF1G0P9m9MeQ220P/haJ/TYdJ7h5jmpUQKnZC2993oYBKBKPeTp9wrncSCr4NAuNa9oDXXZVPolKJo X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Mar 2018 18:17:00.0884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a76b9142-1697-44b8-c787-08d58e8ec62c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 92e84ceb-fbfd-47ab-be52-080c6b87953f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR07MB0650 X-OriginatorOrg: ericsson.com X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAIsWRmVeSWpSXmKPExsUyM2K7nK5CwMYog10njS2Ont7DbPFlVx+j A5PH4hVTWD2e3fzPGMAUxWWTkpqTWZZapG+XwJVxa8ED1oLzHYwVG672sTcwvi7tYuTkkBAw kfiy8TVTFyMXh5DAYUaJ55vPskE4Wxglfi1vYIdwvjNKPDozjw2kRUhgKZPE2R8VIAkWgU9M EjvOTWYESTAKxEq0bJ0KNauLSeLU+2lADgcHm4CBxOzdDiA1IgKSEv8WbwEbxCyQKjHp4goW EFtYwEuiadUPJhCbRUBV4sP7JcwgNq+Ap8TL5utsELfKSZw8NpkVxOYEqt/avJwF4iBPie19 81kg6gUlTs58wgIxX0Li4IsXzBC9ChIbt8xkAblNQmAm0DeHp7NDNKtL/D30lQWiSFbi6Nk5 ULavxP+zm5khGvYzShz/cwqqu4Fd4tr8Q0wQVVoSlyfeY4ewf7BJzDzpA2FnS3TtugG12kri 9a/vjBDNS5kl7h1/CtUgIzHx52vmCYx6s5CcPgvJ6QsYmVYxihanFhfnphsZ66UWZSYXF+fn 6eWllmxiBKaDg1t+6+5gXP3a8RCjAAejEg+vjfXGKCHWxLLiytxDjBIczEoivJkKQCHelMTK qtSi/Pii0pzU4kOM0hwsSuK8Jz15o4QE0hNLUrNTUwtSi2CyTBycUg2MS8o5vhj5V6dEf+Bw m3LANfsF8zTlfYVexSmPmldO3p0gN/vsvkdmz0sN/wjtWex3Jm9D9TrBKbu5LPvjctbceB+z xdrkQDh7PMcsaaMO0YDP3n6/rgpnBYg8lPvWElX7mIvf65jn8mPxwot0rJa9mH7Bd23DPwfj /52z7fem5iZdFPl0pmWfEktxRqKhFnNRcSIAlQOxpQMDAAA= 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 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. Signed-off-by: Jan Scheurich Signed-off-by: Nitin Katiyar Co-authored-by: Nitin Katiyar --- lib/ofp-group.c | 15 +++++++---- ofproto/ofproto-dpif.c | 18 +++++++++++-- ofproto/ofproto-dpif.h | 1 + ofproto/ofproto-provider.h | 2 +- tests/mpls-xlate.at | 26 +++++++++++------- tests/ofproto-dpif.at | 66 ++++++++++++++++++++++++++++++---------------- 6 files changed, 88 insertions(+), 40 deletions(-) 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 383d04e..1801670 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4812,8 +4812,21 @@ group_set_selection_method(struct group_dpif *group) if (selection_method[0] == '\0') { VLOG_INFO("No selection method specified."); - group->selection_method = SEL_METHOD_DEFAULT; - + /* 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. */ + VLOG_INFO(" Use dp_hash with %d hash values.", + group->hash_mask + 1); + group->selection_method = SEL_METHOD_DP_HASH; + group->hash_alg = OVS_HASH_ALG_SYM_L4; + group->hash_basis = 0xdeadbeef; + } else { + /* Fall back to original default hashing in slow path. */ + VLOG_INFO(" Falling back to default hash method."); + group->selection_method = SEL_METHOD_DEFAULT; + } } else if (!strcmp(selection_method, "dp_hash")) { VLOG_INFO("Selection method specified: dp_hash."); /* Try to use dp_hash if possible at all. */ @@ -4831,6 +4844,7 @@ group_set_selection_method(struct group_dpif *group) VLOG_INFO(" Falling back to default hash method."); group->selection_method = SEL_METHOD_DEFAULT; } + } else if (!strcmp(selection_method, "hash")) { VLOG_INFO("Selection method specified: hash."); if (props->fields.values_size > 0) { diff --git a/ofproto/ofproto-dpif.h b/ofproto/ofproto-dpif.h index 6a58b48..b1972aa 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 92d4622..fd5b249 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..686fa35 100644 --- a/tests/mpls-xlate.at +++ b/tests/mpls-xlate.at @@ -68,12 +68,18 @@ AT_CHECK([tail -1 stdout], [0], dnl Test MPLS pop then select group output (group type triggers 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=22,tc=0,ttl=64,bos=1)'], [0], [stdout]) AT_CHECK([tail -1 stdout], [0], - [Datapath actions: pop_mpls(eth_type=0x800),recirc(0x2) + [Datapath actions: pop_mpls(eth_type=0x800),hash(hash_l4(0)),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/dp_hash(.*\/0xf)/dp_hash(0XXXX\/0xf)/' | 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_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),hash(hash_l4(0)),recirc(0x3) +recirc_id(0x3),dp_hash(0XXXX/0xf),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 d2058ed..e227f71 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(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(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 @@ -403,16 +411,21 @@ AT_CHECK([ovs-ofctl -O OpenFlow12 add-group br0 'group_id=1234,type=select,bucke 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 i in 1 2 ; 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.$i,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 | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:1/actions:1/' | 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), packets:7, bytes:742, used:0.0s, actions:hash(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 ]) + OVS_VSWITCHD_STOP AT_CLEANUP @@ -421,9 +434,16 @@ 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 | sed 's/dp_hash(.*\/0xf)/dp_hash(0xXXXX\/0xf)/' | sed 's/packets.*actions:1/actions:1/' | 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), packets:3, bytes:318, used:0.0s, actions:hash(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:11 ]) OVS_VSWITCHD_STOP AT_CLEANUP @@ -495,16 +515,18 @@ AT_CHECK([ovs-ofctl -O OpenFlow15 add-flow br0 'ip,nw_src=192.168.0.1 actions=gr # 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)" +for d in 0 1 2 3; do + for i in 1 2 ; 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.$i,proto=1,tos=0,ttl=128,frag=no),icmp(type=8,code=0)" AT_CHECK([ovs-appctl netdev-dummy/receive p1 $pkt]) + done 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], [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:7, bytes:742, used:0.0s, actions:hash(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 +538,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(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