From patchwork Thu Jul 18 13:03:01 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: 1133725 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 45qDms6pBnz9s4Y for ; Thu, 18 Jul 2019 23:02:05 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id CF861E89; Thu, 18 Jul 2019 13:02:03 +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 E9A2CD91 for ; Thu, 18 Jul 2019 13:01:42 +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 79A918F5 for ; Thu, 18 Jul 2019 13:01:42 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 06:01:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,278,1559545200"; d="scan'208";a="179240246" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.100]) by orsmga002.jf.intel.com with ESMTP; 18 Jul 2019 06:01:39 -0700 From: Harry van Haaren To: dev@openvswitch.org Date: Thu, 18 Jul 2019 14:03:01 +0100 Message-Id: <20190718130306.66970-1-harry.van.haaren@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190717182147.5042-1-harry.van.haaren@intel.com> References: <20190717182147.5042-1-harry.van.haaren@intel.com> 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 v14 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 Hey Folks, Here a v14 of the DPCLS Function Pointer patchset, as has been presented at OVS Conf in Nov '18, and discussed on the ML since then. I'm aware of the soft-freeze for 2.12, I feel this patchset has had enough reviews/versions/testing to be merged in 2.12. Thanks Ilya for input and suggestions on v13. Only change is that the implementation of the blocks array memory allocation is now using DEFINE_PER_THREAD_MALLOCED_DATA() macro, allowing for proper de-allocation of the allocated memory after a thread exits. Regards, -Harry Patchset 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 dpif-netdev-private.h. 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. 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 NEWS | 4 + lib/automake.mk | 2 + lib/dpif-netdev-lookup-generic.c | 315 +++++++++++++++++++++++++++++++ lib/dpif-netdev-private.h | 127 +++++++++++++ lib/dpif-netdev.c | 175 ++++++++--------- 5 files changed, 524 insertions(+), 99 deletions(-) create mode 100644 lib/dpif-netdev-lookup-generic.c create mode 100644 lib/dpif-netdev-private.h