2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

dpdk: reflect status and version in the database

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.

To support this, the other_config:dpdk-init configuration block supports
the 'true' and 'try' keywords now, instead of just 'true'.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
This commit is contained in:
Aaron Conole 2018-05-03 15:08:01 -04:00 committed by Ian Stokes
parent d7e2509e2f
commit 3e52fa5644
9 changed files with 85 additions and 12 deletions

View File

@ -102,9 +102,11 @@ Q: How do I configure a DPDK port as an access port?
A: Firstly, you must have a DPDK-enabled version of Open vSwitch.
If your version is DPDK-enabled it will support the other-config:dpdk-init
configuration in the database and will display lines with "EAL:..." during
startup when other_config:dpdk-init is set to 'true'.
If your version is DPDK-enabled it may support the dpdk_version and
dpdk_initialized keys in the configuration database. Earlier versions
of Open vSwitch only supported the other-config:dpdk-init key in the
configuration in the database. All versions will display lines with
"EAL:..." during startup when other_config:dpdk-init is set to 'true'.
Secondly, when adding a DPDK port, unlike a system port, the type for the
interface and valid dpdk-devargs must be specified. For example::

View File

@ -208,7 +208,8 @@ Open vSwitch should be started as described in :doc:`general` with the
exception of ovs-vswitchd, which requires some special configuration to enable
DPDK functionality. DPDK configuration arguments can be passed to ovs-vswitchd
via the ``other_config`` column of the ``Open_vSwitch`` table. At a minimum,
the ``dpdk-init`` option must be set to ``true``. For example::
the ``dpdk-init`` option must be set to either ``true`` or ``try``.
For example::
$ export PATH=$PATH:/usr/local/share/openvswitch/scripts
$ export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
@ -219,8 +220,12 @@ There are many other configuration options, the most important of which are
listed below. Defaults will be provided for all values not explicitly set.
``dpdk-init``
Specifies whether OVS should initialize and support DPDK ports. This is a
boolean, and defaults to false.
Specifies whether OVS should initialize and support DPDK ports. This field
can either be ``true`` or ``try``.
A value of ``true`` will cause the ovs-vswitchd process to abort on
initialization failure.
A value of ``try`` will imply that the ovs-vswitchd process should
continue running even if the EAL initialization fails.
``dpdk-lcore-mask``
Specifies the CPU cores on which dpdk lcore threads should be spawned and
@ -257,6 +262,22 @@ See the section ``Performance Tuning`` for important DPDK customizations.
Validating
----------
DPDK support can be confirmed by validating the ``dpdk_initialized`` boolean
value from the ovsdb. A value of ``true`` means that the DPDK EAL
initialization succeeded::
$ ovs-vsctl get Open_vSwitch . dpdk_initialized
true
Additionally, the library version linked to ovs-vswitchd can be confirmed
with either the ovs-vswitchd logs, or by running either of the commands::
$ ovs-vswitchd --version
ovs-vswitchd (Open vSwitch) 2.9.0
DPDK 17.11.0
$ ovs-vsctl get Open_vSwitch . dpdk_version
"DPDK 17.11.0"
At this point you can use ovs-vsctl to set up bridges and other Open vSwitch
features. Seeing as we've configured the DPDK datapath, we will use DPDK-type
ports. For example, to create a userspace bridge named ``br0`` and add two

1
NEWS
View File

@ -30,6 +30,7 @@ Post-v2.9.0
* New 'check-dpdk' Makefile target to run a new system testsuite.
See Testing topic for the details.
* Add LSC interrupt support for DPDK physical devices.
* Allow init to fail and record DPDK status/version in OVS database.
- Userspace datapath:
* Commands ovs-appctl dpif-netdev/pmd-*-show can now work on a single PMD
* Detailed PMD performance metrics available with new command

View File

@ -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");
}
}

View File

@ -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,
@ -474,7 +477,11 @@ dpdk_init(const struct smap *ovs_other_config)
return;
}
if (smap_get_bool(ovs_other_config, "dpdk-init", false)) {
const char *dpdk_init_val = smap_get_def(ovs_other_config, "dpdk-init",
"false");
bool try_only = !strcmp(dpdk_init_val, "try");
if (!strcmp(dpdk_init_val, "true") || try_only) {
static struct ovsthread_once once_enable = OVSTHREAD_ONCE_INITIALIZER;
if (ovsthread_once_start(&once_enable)) {
@ -483,7 +490,7 @@ dpdk_init(const struct smap *ovs_other_config)
enabled = dpdk_init__(ovs_other_config);
if (enabled) {
VLOG_INFO("DPDK Enabled - initialized");
} else {
} else if (!try_only) {
ovs_abort(rte_errno, "Cannot init EAL");
}
ovsthread_once_done(&once_enable);
@ -493,6 +500,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 *
@ -520,3 +528,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());
}
}

View File

@ -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 */

View File

@ -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);
@ -2837,10 +2839,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;

View File

@ -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": {

View File

@ -490,6 +490,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
@ -673,6 +678,12 @@
</p>
</column>
<column name="dpdk_version">
<p>
The version of the linked DPDK library.
</p>
</column>
</group>
<group title="Capabilities">