From patchwork Thu Apr 5 21:22:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Conole X-Patchwork-Id: 895553 X-Patchwork-Delegate: ian.stokes@intel.com 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=redhat.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 40HG6J39fBz9s16 for ; Fri, 6 Apr 2018 07:23:52 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 761E21046; Thu, 5 Apr 2018 21:23:02 +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 9822F1024 for ; Thu, 5 Apr 2018 21:22:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id F3BFB627 for ; Thu, 5 Apr 2018 21:22:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 429BA818AAEB; Thu, 5 Apr 2018 21:22:58 +0000 (UTC) Received: from dhcp-25.97.bos.redhat.com (unknown [10.18.25.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id E6BB5215CDAF; Thu, 5 Apr 2018 21:22:57 +0000 (UTC) From: Aaron Conole To: dev@openvswitch.org Date: Thu, 5 Apr 2018 17:22:54 -0400 Message-Id: <20180405212254.31327-3-aconole@redhat.com> In-Reply-To: <20180405212254.31327-1-aconole@redhat.com> References: <20180405212254.31327-1-aconole@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 05 Apr 2018 21:22:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Thu, 05 Apr 2018 21:22:58 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'aconole@redhat.com' RCPT:'' X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Ilya Maximets Subject: [ovs-dev] [RFC 2/2] dpdk: reflect status and version in the database 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 The normal way of retrieving the running DPDK status involves parsing log files and issuing various incantations of ovs-vsctl and ovs-appctl commands to determine whether the rte_eal_init successfully started. This commit adds two new records to reflect the dpdk version, and the dpdk initialization status. Signed-off-by: Aaron Conole --- lib/dpdk-stub.c | 10 ++++++++++ lib/dpdk.c | 13 +++++++++++++ lib/dpdk.h | 3 ++- vswitchd/bridge.c | 5 +++++ vswitchd/vswitch.ovsschema | 11 ++++++++--- vswitchd/vswitch.xml | 11 +++++++++++ 6 files changed, 49 insertions(+), 4 deletions(-) diff --git a/lib/dpdk-stub.c b/lib/dpdk-stub.c index 041cd0cbb..1df1c5848 100644 --- a/lib/dpdk-stub.c +++ b/lib/dpdk-stub.c @@ -21,6 +21,7 @@ #include "smap.h" #include "ovs-thread.h" #include "openvswitch/vlog.h" +#include "vswitch-idl.h" VLOG_DEFINE_THIS_MODULE(dpdk); @@ -59,3 +60,12 @@ void print_dpdk_version(void) { } + +void +dpdk_status(const struct ovsrec_open_vswitch *cfg) +{ + if (cfg) { + ovsrec_open_vswitch_set_dpdk_initialized(cfg, false); + ovsrec_open_vswitch_set_dpdk_version(cfg, "none"); + } +} diff --git a/lib/dpdk.c b/lib/dpdk.c index 876ba01f1..ac8b61879 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -37,6 +37,7 @@ #include "openvswitch/dynamic-string.h" #include "openvswitch/vlog.h" #include "smap.h" +#include "vswitch-idl.h" VLOG_DEFINE_THIS_MODULE(dpdk); @@ -44,6 +45,8 @@ static FILE *log_stream = NULL; /* Stream for DPDK log redirection */ static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */ static bool vhost_iommu_enabled = false; /* Status of vHost IOMMU support */ +static bool dpdk_initialized = false; /* Indicates successful initialization + * of DPDK. */ static int process_vhost_flags(char *flag, const char *default_val, int size, @@ -490,6 +493,7 @@ dpdk_init(const struct smap *ovs_other_config) } else { VLOG_INFO_ONCE("DPDK Disabled - Use other_config:dpdk-init to enable"); } + dpdk_initialized = enabled; } const char * @@ -517,3 +521,12 @@ print_dpdk_version(void) { puts(rte_version()); } + +void +dpdk_status(const struct ovsrec_open_vswitch *cfg) +{ + if (cfg) { + ovsrec_open_vswitch_set_dpdk_initialized(cfg, dpdk_initialized); + ovsrec_open_vswitch_set_dpdk_version(cfg, rte_version()); + } +} diff --git a/lib/dpdk.h b/lib/dpdk.h index b04153591..efdaa637c 100644 --- a/lib/dpdk.h +++ b/lib/dpdk.h @@ -33,11 +33,12 @@ #endif /* DPDK_NETDEV */ struct smap; +struct ovsrec_open_vswitch; void dpdk_init(const struct smap *ovs_other_config); void dpdk_set_lcore_id(unsigned cpu); const char *dpdk_get_vhost_sock_dir(void); bool dpdk_vhost_iommu_enabled(void); void print_dpdk_version(void); - +void dpdk_status(const struct ovsrec_open_vswitch *); #endif /* dpdk.h */ diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index d90997e3a..ef04b015f 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -407,6 +407,8 @@ bridge_init(const char *remote) ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_db_version); ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_type); ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_version); + ovsdb_idl_omit_alert(idl, &ovsrec_open_vswitch_col_dpdk_version); + ovsdb_idl_omit_alert(idl, &ovsrec_open_vswitch_col_dpdk_initialized); ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_id); ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_version); @@ -2836,10 +2838,13 @@ run_status_update(void) * previous one is not done. */ seq = seq_read(connectivity_seq_get()); if (seq != connectivity_seqno || status_txn_try_again) { + const struct ovsrec_open_vswitch *cfg = + ovsrec_open_vswitch_first(idl); struct bridge *br; connectivity_seqno = seq; status_txn = ovsdb_idl_txn_create(idl); + dpdk_status(cfg); HMAP_FOR_EACH (br, node, &all_bridges) { struct port *port; diff --git a/vswitchd/vswitch.ovsschema b/vswitchd/vswitch.ovsschema index 90e50b626..80f17e89b 100644 --- a/vswitchd/vswitch.ovsschema +++ b/vswitchd/vswitch.ovsschema @@ -1,6 +1,6 @@ {"name": "Open_vSwitch", - "version": "7.15.1", - "cksum": "3682332033 23608", + "version": "7.16.0", + "cksum": "2403910601 23776", "tables": { "Open_vSwitch": { "columns": { @@ -47,7 +47,12 @@ "min": 0, "max": "unlimited"}}, "iface_types": { "type": {"key": {"type": "string"}, - "min": 0, "max": "unlimited"}}}, + "min": 0, "max": "unlimited"}}, + "dpdk_initialized": { + "type": "boolean"}, + "dpdk_version": { + "type": {"key": {"type": "string"}, + "min": 0, "max": 1}}}, "isRoot": true, "maxRows": 1}, "Bridge": { diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index 9c2a8263e..37c7f4f80 100644 --- a/vswitchd/vswitch.xml +++ b/vswitchd/vswitch.xml @@ -466,6 +466,11 @@ configuration changes. + + True if is set to + true and the DPDK library is successfully initialized. + +

The statistics column contains key-value pairs that @@ -649,6 +654,12 @@

+ +

+ The version of the linked DPDK library. +

+
+