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 <acon...@redhat.com> --- 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. </column> + <column name="dpdk_initialized"> + True if <ref column="other_config" key="dpdk-init"/> is set to + true and the DPDK library is successfully initialized. + </column> + <group title="Statistics"> <p> The <code>statistics</code> column contains key-value pairs that @@ -649,6 +654,12 @@ </p> </column> + <column name="dpdk_version"> + <p> + The version of the linked DPDK library. + </p> + </column> + </group> <group title="Capabilities"> -- 2.14.3 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev