From patchwork Mon May 17 13:57:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kumar Amber X-Patchwork-Id: 1479539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FkLbx2QvJz9sWk for ; Tue, 18 May 2021 00:09:33 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 805B360AAF; Mon, 17 May 2021 14:09:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fE0RTFFBOf8c; Mon, 17 May 2021 14:09:27 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id 727B860A65; Mon, 17 May 2021 14:09:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9051BC0030; Mon, 17 May 2021 14:09:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 49D43C000D for ; Mon, 17 May 2021 14:09:21 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3447B404E5 for ; Mon, 17 May 2021 14:08:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 37Vfwx1d_EXS for ; Mon, 17 May 2021 14:08:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by smtp2.osuosl.org (Postfix) with ESMTPS id 61F3E400C0 for ; Mon, 17 May 2021 14:08:21 +0000 (UTC) IronPort-SDR: TCeOlkSpkyZtcJdW0u8DwFkfGAtXjL+dB5VMU0OYW9zli/MzoDvCkd9uoLXoRtk09CZD3N0tMv 6nWik7KWitAA== X-IronPort-AV: E=McAfee;i="6200,9189,9986"; a="221510478" X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="221510478" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2021 07:08:21 -0700 IronPort-SDR: PjRhDJeYiwk33Fuflqy+CxPAK6SBqwHQxb7qg3ZgWmOUSnMyKKfakXMMufIj3jpXVGI+sX0Bbq 67MVG6R8ogcA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,307,1613462400"; d="scan'208";a="438936710" Received: from bmca4bf01706bbf.iind.intel.com (HELO localhost.localdomain) ([10.190.213.111]) by orsmga008.jf.intel.com with ESMTP; 17 May 2021 07:08:19 -0700 From: Kumar Amber To: dev@openvswitch.org Date: Mon, 17 May 2021 19:27:01 +0530 Message-Id: <20210517135708.685517-6-kumar.amber@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210517135708.685517-1-kumar.amber@intel.com> References: <20210428091931.2090062-1-kumar.amber@intel.com> <20210517135708.685517-1-kumar.amber@intel.com> MIME-Version: 1.0 Cc: Kumar Amber , i.maximets@ovn.org Subject: [ovs-dev] [v3 05/12] dpif-netdev: Add configure to enable autovalidator at build time. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This commit adds a new command to allow the user to enable autovalidatior by default at build time thus allowing for runnig unit test by default. $ ./configure --enable-mfex-default-autovalidator Signed-off-by: Kumar Amber Co-authored-by: Harry van Haaren Signed-off-by: Harry van Haaren --- Documentation/topics/dpdk/bridge.rst | 5 +++++ NEWS | 10 ++++++++++ acinclude.m4 | 16 ++++++++++++++++ configure.ac | 1 + lib/dpif-netdev-private-extract.c | 24 ++++++++++++++++++++++++ lib/dpif-netdev-private-extract.h | 10 ++++++++++ lib/dpif-netdev.c | 7 +++++-- 7 files changed, 71 insertions(+), 2 deletions(-) diff --git a/Documentation/topics/dpdk/bridge.rst b/Documentation/topics/dpdk/bridge.rst index e71d47d40..6afe45c83 100644 --- a/Documentation/topics/dpdk/bridge.rst +++ b/Documentation/topics/dpdk/bridge.rst @@ -302,6 +302,11 @@ To set the Miniflow autovalidator, use this command :: $ ovs-appctl dpif-netdev/miniflow-parser-set autovalidator +A compile time option is available in order to test it with the OVS unit +test suite. Use the following configure option :: + + $ ./configure --enable-mfex-default-autovalidator + Unit Test Miniflow Extract ++++++++++++++++++++++++++ diff --git a/NEWS b/NEWS index 69091979a..e0c3f1d4f 100644 --- a/NEWS +++ b/NEWS @@ -29,6 +29,16 @@ Post-v2.15.0 * OVS validated with DPDK 20.11.1. It is recommended to use this version until further releases. * Cache results for CPU ISA checks, reduces overhead on repeated lookups. + * Add command line option to switch between mfex function pointers. + * Add miniflow extract auto-validator function to compare different + miniflow extract implementations against default implementation. + * Add study function to miniflow function table which studies packet + and automatically chooses the best miniflow implementation for that + traffic. + * Add AVX512 based optimized miniflow extract function for traffic type + IP/UDP. + * Add build time configure command to enable auto-validatior as default + miniflow implementation at build time. v2.15.0 - 15 Feb 2021 diff --git a/acinclude.m4 b/acinclude.m4 index 5fbcd9872..e2704cfda 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -14,6 +14,22 @@ # See the License for the specific language governing permissions and # limitations under the License. +dnl Set OVS MFEX Autovalidator as default miniflow extract at compile time? +dnl This enables automatically running all unit tests with all MFEX +dnl implementations. +AC_DEFUN([OVS_CHECK_MFEX_AUTOVALIDATOR], [ + AC_ARG_ENABLE([mfex-default-autovalidator], + [AC_HELP_STRING([--enable-mfex-default-autovalidator], [Enable MFEX autovalidator as default miniflow_extract implementation.])], + [autovalidator=yes],[autovalidator=no]) + AC_MSG_CHECKING([whether MFEX Autovalidator is default implementation]) + if test "$autovalidator" != yes; then + AC_MSG_RESULT([no]) + else + OVS_CFLAGS="$OVS_CFLAGS -DMFEX_AUTOVALIDATOR_DEFAULT" + AC_MSG_RESULT([yes]) + fi +]) + dnl Set OVS DPCLS Autovalidator as default subtable search at compile time? dnl This enables automatically running all unit tests with all DPCLS dnl implementations. diff --git a/configure.ac b/configure.ac index e45685a6c..46c402892 100644 --- a/configure.ac +++ b/configure.ac @@ -186,6 +186,7 @@ OVS_ENABLE_SPARSE OVS_CTAGS_IDENTIFIERS OVS_CHECK_DPCLS_AUTOVALIDATOR OVS_CHECK_DPIF_AVX512_DEFAULT +OVS_CHECK_MFEX_AUTOVALIDATOR OVS_CHECK_BINUTILS_AVX512 AC_ARG_VAR(KARCH, [Kernel Architecture String]) diff --git a/lib/dpif-netdev-private-extract.c b/lib/dpif-netdev-private-extract.c index 81829e6fa..3a480866d 100644 --- a/lib/dpif-netdev-private-extract.c +++ b/lib/dpif-netdev-private-extract.c @@ -230,3 +230,27 @@ dpif_miniflow_extract_autovalidator(struct dp_packet_batch *packets, */ return 0; } + +/* Variable to hold the defaualt mfex implementation. */ +static miniflow_extract_func default_mfex_func = NULL; + +void +dpif_miniflow_extract_set_default(miniflow_extract_func func) +{ + default_mfex_func = func; +} + +miniflow_extract_func +dpif_miniflow_extract_get_default(void) +{ + +#ifdef MFEX_AUTOVALIDATOR_DEFAULT + ovs_assert(mfex_impls[0].extract_func == + dpif_miniflow_extract_autovalidator); + VLOG_INFO("Default miniflow Extract implementation %s \n", + mfex_impls[0].name); + return mfex_impls[0].extract_func; +#else + return default_mfex_func; +#endif +} diff --git a/lib/dpif-netdev-private-extract.h b/lib/dpif-netdev-private-extract.h index 3ada413bb..d8a284db7 100644 --- a/lib/dpif-netdev-private-extract.h +++ b/lib/dpif-netdev-private-extract.h @@ -118,4 +118,14 @@ mfex_study_traffic(struct dp_packet_batch *packets, uint32_t keys_size, odp_port_t in_port, void *pmd_handle); +/* Retrieve the default miniflow extract or auto-validator + * based upon build time configuration choosen by the user. */ +miniflow_extract_func +dpif_miniflow_extract_get_default(void); + +/* Returns the default MFEX which is first ./configure selected, but can be + * overridden at runtime. */ +void +dpif_miniflow_extract_set_default(miniflow_extract_func func); + #endif /* DPIF_NETDEV_AVX512_EXTRACT */ diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 9345fd5c7..ab313326a 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -1179,6 +1179,9 @@ dpif_miniflow_extract_impl_set(struct unixctl_conn *conn, int argc, ovs_mutex_unlock(&dp_netdev_mutex); + /* Set the default implementation for PMD threads created in the future. */ + dpif_miniflow_extract_set_default(*new_func); + /* Reply with success to command. */ struct ds reply = DS_EMPTY_INITIALIZER; ds_put_format(&reply, "Miniflow implementation set to %s.\n", mfex_name); @@ -6253,8 +6256,8 @@ dp_netdev_configure_pmd(struct dp_netdev_pmd_thread *pmd, struct dp_netdev *dp, /* Initialize DPIF function pointer to the default configured version. */ pmd->netdev_input_func = dp_netdev_impl_get_default(); - /*Init default miniflow_extract function */ - pmd->miniflow_extract_opt = NULL; + /* Init default miniflow_extract function */ + pmd->miniflow_extract_opt = dpif_miniflow_extract_get_default(); /* init the 'flow_cache' since there is no * actual thread created for NON_PMD_CORE_ID. */