From patchwork Thu Apr 11 12:55:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Van Haaren, Harry" X-Patchwork-Id: 1084032 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=intel.com 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 44g1Gn0bptz9ryj for ; Thu, 11 Apr 2019 22:55:42 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AE2D82582; Thu, 11 Apr 2019 12:55:40 +0000 (UTC) X-Original-To: ovs-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 A5188220B for ; Thu, 11 Apr 2019 12:55:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 322DDF4 for ; Thu, 11 Apr 2019 12:55:06 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Apr 2019 05:55:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,337,1549958400"; d="scan'208";a="141869962" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.34]) by orsmga003.jf.intel.com with ESMTP; 11 Apr 2019 05:55:03 -0700 From: Harry van Haaren To: ovs-dev@openvswitch.org Date: Thu, 11 Apr 2019 13:55:59 +0100 Message-Id: <20190411125604.70050-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: i.maximets@samsung.com Subject: [ovs-dev] [PATCH v7 0/5] dpcls func ptrs & optimizations 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: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org TL;DR: 1) As per v6, the function pointer rework for dpcls 2) Last 2 patches include specialized scalar optimizations Running with Eth/IPv4/UDP traffic should show performance improvements, with EMC/SMC disabled (so just DPCLS traffic), on a simple test case there is a > 15% speedup. Please test this patchset, and report back numbers! Patchset Details; The code is split into 5 patches to make the code traceable during review, as the resulting code is quite different to today's dpcls_lookup. Checkpatch flags two warnings, which I believe to not be sanely fixable due to the way MACROs accept arguments. Running TESTSUITE shows all passing, with ~28 tests being skipped, which is the same as before this patchset. Per patch details: 1) Refactor dpcls_lookup and the subtable for flexibility. In particular, add a function pointer to the subtable structure, which enables "plugging-in" a lookup function at runtime. This enables a number of optimizations in future. 2) and 3) With the function pointer in place, we refactor the existing dpcls_lookup matching code into its own function, and later its own file. To split it to its own file requires making various dpcls data-structures available in the dpif-netdev.h header. 4) Refactor the existing code, to favour compute of flat arrays of miniflows, instead of the MACRO based iteration. This simplifies the code itself, and makes future optimizations possible due to simplified loop structures, and loop trip counts pass in via function arguments. See commit message for more details. 5) This patch implements a select few specialized functions, for handling miniflows with 5-1, 4-1, and 4-0 miniflow unit bit patterns. More of these types of functions can (and should) be added to accelerate other patterns of subtable lookups! See commit message for more details. As always: feedback, suggestions, performance numbers all welcome! Regards -Harry Harry van Haaren (5): dpif-netdev: implement function pointers/subtable dpif-netdev: move dpcls lookup structures to .h dpif-netdev: split out generic lookup function dpif-netdev: refactor generic implementation dpif-netdev: add specialized generic scalar functions lib/automake.mk | 1 + lib/dpif-netdev-lookup-generic.c | 342 +++++++++++++++++++++++++++++++ lib/dpif-netdev.c | 128 +++--------- lib/dpif-netdev.h | 83 ++++++++ 4 files changed, 456 insertions(+), 98 deletions(-) create mode 100644 lib/dpif-netdev-lookup-generic.c