From patchwork Thu Jun 17 16:18:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ferriter, Cian" X-Patchwork-Id: 1493716 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=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4G5S1P2smfz9sSn for ; Fri, 18 Jun 2021 02:19:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 116D283E6E; Thu, 17 Jun 2021 16:19:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 14o9h_Q8-SoT; Thu, 17 Jun 2021 16:19:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id 81B9B83EB4; Thu, 17 Jun 2021 16:19:12 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C7EAC0028; Thu, 17 Jun 2021 16:19:12 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4D882C0027 for ; Thu, 17 Jun 2021 16:19:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 53526421D6 for ; Thu, 17 Jun 2021 16:19:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9Rk30GdUCldk for ; Thu, 17 Jun 2021 16:19:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9F020421D8 for ; Thu, 17 Jun 2021 16:19:02 +0000 (UTC) IronPort-SDR: K43lmsvFGoXvMN1KNaPEO+Qo9UctSviaRawUZnGcNIcqPYcLxz0SQw1/h73EEAFld8nJZUBadb m4sK4qCyz+dA== X-IronPort-AV: E=McAfee;i="6200,9189,10018"; a="186094068" X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="186094068" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2021 09:19:02 -0700 IronPort-SDR: wIF5NO/fOgMYILFO2Kos7tJKUQJ84Y69PdlbSfat4UT3BBQMi4BmYSK/0trd7gamN+ZgfU4kd6 iwacMxAD1+dg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,280,1616482800"; d="scan'208";a="404985735" Received: from silpixa00399779.ir.intel.com (HELO silpixa00399779.ger.corp.intel.com) ([10.237.222.105]) by orsmga003.jf.intel.com with ESMTP; 17 Jun 2021 09:19:00 -0700 From: Cian Ferriter To: ovs-dev@openvswitch.org Date: Thu, 17 Jun 2021 17:18:19 +0100 Message-Id: <20210617161825.94741-7-cian.ferriter@intel.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210617161825.94741-1-cian.ferriter@intel.com> References: <20210617161825.94741-1-cian.ferriter@intel.com> MIME-Version: 1.0 Cc: i.maximets@ovn.org Subject: [ovs-dev] [v13 06/12] dpif-netdev: Add command to get dpif implementations. 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" From: Harry van Haaren This commit adds a new command to retrieve the list of available DPIF implementations. This can be used by to check what implementations of the DPIF are available in any given OVS binary. Usage: $ ovs-appctl dpif-netdev/dpif-get Signed-off-by: Harry van Haaren --- v13: - Add NEWS item about DPIF get and set commands here rather than in a later commit. - Add documentation items about DPIF set commands here rather than in a later commit. --- Documentation/topics/dpdk/bridge.rst | 8 ++++++++ NEWS | 1 + lib/dpif-netdev-private-dpif.c | 8 ++++++++ lib/dpif-netdev-private-dpif.h | 6 ++++++ lib/dpif-netdev-unixctl.man | 3 +++ lib/dpif-netdev.c | 24 ++++++++++++++++++++++++ 6 files changed, 50 insertions(+) diff --git a/Documentation/topics/dpdk/bridge.rst b/Documentation/topics/dpdk/bridge.rst index fafa8c821..f59e26cbe 100644 --- a/Documentation/topics/dpdk/bridge.rst +++ b/Documentation/topics/dpdk/bridge.rst @@ -226,6 +226,14 @@ stats associated with the datapath. Just like with the SIMD DPCLS feature above, SIMD can be applied to the DPIF to improve performance. +OVS provides multiple implementations of the DPIF. The available +implementations can be listed with the following command :: + + $ ovs-appctl dpif-netdev/dpif-get + Available DPIF implementations: + dpif_scalar + dpif_avx512 + By default, dpif_scalar is used. The DPIF implementation can be selected by name :: diff --git a/NEWS b/NEWS index 6a4a7b76d..c47ab349e 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Post-v2.15.0 * Refactor lib/dpif-netdev.c to multiple header files. * Add avx512 implementation of dpif which can process non recirculated packets. It supports partial HWOL, EMC, SMC and DPCLS lookups. + * Add commands to get and set the dpif implementations. - ovs-ctl: * New option '--no-record-hostname' to disable hostname configuration in ovsdb on startup. diff --git a/lib/dpif-netdev-private-dpif.c b/lib/dpif-netdev-private-dpif.c index d829a7ee5..3649e775d 100644 --- a/lib/dpif-netdev-private-dpif.c +++ b/lib/dpif-netdev-private-dpif.c @@ -73,6 +73,14 @@ dp_netdev_impl_set_default(dp_netdev_input_func func) default_dpif_func = func; } +uint32_t +dp_netdev_impl_get(const struct dpif_netdev_impl_info_t **out_impls) +{ + ovs_assert(out_impls); + *out_impls = dpif_impls; + return ARRAY_SIZE(dpif_impls); +} + /* This function checks all available DPIF implementations, and selects the * returns the function pointer to the one requested by "name". */ diff --git a/lib/dpif-netdev-private-dpif.h b/lib/dpif-netdev-private-dpif.h index a6db3c7f2..717e9e2f9 100644 --- a/lib/dpif-netdev-private-dpif.h +++ b/lib/dpif-netdev-private-dpif.h @@ -48,6 +48,12 @@ struct dpif_netdev_impl_info_t { const char *name; }; +/* This function returns all available implementations to the caller. The + * quantity of implementations is returned by the int return value. + */ +uint32_t +dp_netdev_impl_get(const struct dpif_netdev_impl_info_t **out_impls); + /* This function checks all available DPIF implementations, and selects the * returns the function pointer to the one requested by "name". */ diff --git a/lib/dpif-netdev-unixctl.man b/lib/dpif-netdev-unixctl.man index b348940b0..534823879 100644 --- a/lib/dpif-netdev-unixctl.man +++ b/lib/dpif-netdev-unixctl.man @@ -227,5 +227,8 @@ When this is the case, the above command prints the load-balancing information of the bonds configured in datapath \fIdp\fR showing the interface associated with each bucket (hash). . +.IP "\fBdpif-netdev/dpif-get\fR +Lists the DPIF implementations that are available. +. .IP "\fBdpif-netdev/dpif-set\fR \fIdpif_impl\fR" Sets the DPIF to be used to \fIdpif_impl\fR. By default "dpif_scalar" is used. diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c index 9c234ef3d..59a44a848 100644 --- a/lib/dpif-netdev.c +++ b/lib/dpif-netdev.c @@ -991,6 +991,27 @@ dpif_netdev_subtable_lookup_set(struct unixctl_conn *conn, int argc, ds_destroy(&reply); } +static void +dpif_netdev_impl_get(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) +{ + const struct dpif_netdev_impl_info_t *dpif_impls; + uint32_t count = dp_netdev_impl_get(&dpif_impls); + if (count == 0) { + unixctl_command_reply_error(conn, "error getting dpif names"); + return; + } + + /* Add all dpif functions to reply string. */ + struct ds reply = DS_EMPTY_INITIALIZER; + ds_put_cstr(&reply, "Available DPIF implementations:\n"); + for (uint32_t i = 0; i < count; i++) { + ds_put_format(&reply, " %s\n", dpif_impls[i].name); + } + unixctl_command_reply(conn, ds_cstr(&reply)); + ds_destroy(&reply); +} + static void dpif_netdev_impl_set(struct unixctl_conn *conn, int argc, const char *argv[], void *aux OVS_UNUSED) @@ -1292,6 +1313,9 @@ dpif_netdev_init(void) "dpif_implementation_name [dp]", 1, 2, dpif_netdev_impl_set, NULL); + unixctl_command_register("dpif-netdev/dpif-get", "", + 0, 0, dpif_netdev_impl_get, + NULL); return 0; }