mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 14:55:18 +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:
@@ -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.
|
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
|
If your version is DPDK-enabled it may support the dpdk_version and
|
||||||
configuration in the database and will display lines with "EAL:..." during
|
dpdk_initialized keys in the configuration database. Earlier versions
|
||||||
startup when other_config:dpdk-init is set to 'true'.
|
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
|
Secondly, when adding a DPDK port, unlike a system port, the type for the
|
||||||
interface and valid dpdk-devargs must be specified. For example::
|
interface and valid dpdk-devargs must be specified. For example::
|
||||||
|
@@ -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
|
exception of ovs-vswitchd, which requires some special configuration to enable
|
||||||
DPDK functionality. DPDK configuration arguments can be passed to ovs-vswitchd
|
DPDK functionality. DPDK configuration arguments can be passed to ovs-vswitchd
|
||||||
via the ``other_config`` column of the ``Open_vSwitch`` table. At a minimum,
|
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 PATH=$PATH:/usr/local/share/openvswitch/scripts
|
||||||
$ export DB_SOCK=/usr/local/var/run/openvswitch/db.sock
|
$ 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.
|
listed below. Defaults will be provided for all values not explicitly set.
|
||||||
|
|
||||||
``dpdk-init``
|
``dpdk-init``
|
||||||
Specifies whether OVS should initialize and support DPDK ports. This is a
|
Specifies whether OVS should initialize and support DPDK ports. This field
|
||||||
boolean, and defaults to false.
|
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``
|
``dpdk-lcore-mask``
|
||||||
Specifies the CPU cores on which dpdk lcore threads should be spawned and
|
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
|
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
|
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
|
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
|
ports. For example, to create a userspace bridge named ``br0`` and add two
|
||||||
|
1
NEWS
1
NEWS
@@ -30,6 +30,7 @@ Post-v2.9.0
|
|||||||
* New 'check-dpdk' Makefile target to run a new system testsuite.
|
* New 'check-dpdk' Makefile target to run a new system testsuite.
|
||||||
See Testing topic for the details.
|
See Testing topic for the details.
|
||||||
* Add LSC interrupt support for DPDK physical devices.
|
* Add LSC interrupt support for DPDK physical devices.
|
||||||
|
* Allow init to fail and record DPDK status/version in OVS database.
|
||||||
- Userspace datapath:
|
- Userspace datapath:
|
||||||
* Commands ovs-appctl dpif-netdev/pmd-*-show can now work on a single PMD
|
* Commands ovs-appctl dpif-netdev/pmd-*-show can now work on a single PMD
|
||||||
* Detailed PMD performance metrics available with new command
|
* Detailed PMD performance metrics available with new command
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
#include "smap.h"
|
#include "smap.h"
|
||||||
#include "ovs-thread.h"
|
#include "ovs-thread.h"
|
||||||
#include "openvswitch/vlog.h"
|
#include "openvswitch/vlog.h"
|
||||||
|
#include "vswitch-idl.h"
|
||||||
|
|
||||||
VLOG_DEFINE_THIS_MODULE(dpdk);
|
VLOG_DEFINE_THIS_MODULE(dpdk);
|
||||||
|
|
||||||
@@ -59,3 +60,12 @@ void
|
|||||||
print_dpdk_version(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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
21
lib/dpdk.c
21
lib/dpdk.c
@@ -37,6 +37,7 @@
|
|||||||
#include "openvswitch/dynamic-string.h"
|
#include "openvswitch/dynamic-string.h"
|
||||||
#include "openvswitch/vlog.h"
|
#include "openvswitch/vlog.h"
|
||||||
#include "smap.h"
|
#include "smap.h"
|
||||||
|
#include "vswitch-idl.h"
|
||||||
|
|
||||||
VLOG_DEFINE_THIS_MODULE(dpdk);
|
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 char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */
|
||||||
static bool vhost_iommu_enabled = false; /* Status of vHost IOMMU support */
|
static bool vhost_iommu_enabled = false; /* Status of vHost IOMMU support */
|
||||||
|
static bool dpdk_initialized = false; /* Indicates successful initialization
|
||||||
|
* of DPDK. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
process_vhost_flags(char *flag, const char *default_val, int size,
|
process_vhost_flags(char *flag, const char *default_val, int size,
|
||||||
@@ -474,7 +477,11 @@ dpdk_init(const struct smap *ovs_other_config)
|
|||||||
return;
|
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;
|
static struct ovsthread_once once_enable = OVSTHREAD_ONCE_INITIALIZER;
|
||||||
|
|
||||||
if (ovsthread_once_start(&once_enable)) {
|
if (ovsthread_once_start(&once_enable)) {
|
||||||
@@ -483,7 +490,7 @@ dpdk_init(const struct smap *ovs_other_config)
|
|||||||
enabled = dpdk_init__(ovs_other_config);
|
enabled = dpdk_init__(ovs_other_config);
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
VLOG_INFO("DPDK Enabled - initialized");
|
VLOG_INFO("DPDK Enabled - initialized");
|
||||||
} else {
|
} else if (!try_only) {
|
||||||
ovs_abort(rte_errno, "Cannot init EAL");
|
ovs_abort(rte_errno, "Cannot init EAL");
|
||||||
}
|
}
|
||||||
ovsthread_once_done(&once_enable);
|
ovsthread_once_done(&once_enable);
|
||||||
@@ -493,6 +500,7 @@ dpdk_init(const struct smap *ovs_other_config)
|
|||||||
} else {
|
} else {
|
||||||
VLOG_INFO_ONCE("DPDK Disabled - Use other_config:dpdk-init to enable");
|
VLOG_INFO_ONCE("DPDK Disabled - Use other_config:dpdk-init to enable");
|
||||||
}
|
}
|
||||||
|
dpdk_initialized = enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -520,3 +528,12 @@ print_dpdk_version(void)
|
|||||||
{
|
{
|
||||||
puts(rte_version());
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -33,11 +33,12 @@
|
|||||||
#endif /* DPDK_NETDEV */
|
#endif /* DPDK_NETDEV */
|
||||||
|
|
||||||
struct smap;
|
struct smap;
|
||||||
|
struct ovsrec_open_vswitch;
|
||||||
|
|
||||||
void dpdk_init(const struct smap *ovs_other_config);
|
void dpdk_init(const struct smap *ovs_other_config);
|
||||||
void dpdk_set_lcore_id(unsigned cpu);
|
void dpdk_set_lcore_id(unsigned cpu);
|
||||||
const char *dpdk_get_vhost_sock_dir(void);
|
const char *dpdk_get_vhost_sock_dir(void);
|
||||||
bool dpdk_vhost_iommu_enabled(void);
|
bool dpdk_vhost_iommu_enabled(void);
|
||||||
void print_dpdk_version(void);
|
void print_dpdk_version(void);
|
||||||
|
void dpdk_status(const struct ovsrec_open_vswitch *);
|
||||||
#endif /* dpdk.h */
|
#endif /* dpdk.h */
|
||||||
|
@@ -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_db_version);
|
||||||
ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_type);
|
ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_type);
|
||||||
ovsdb_idl_omit(idl, &ovsrec_open_vswitch_col_system_version);
|
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_id);
|
||||||
ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_version);
|
ovsdb_idl_omit_alert(idl, &ovsrec_bridge_col_datapath_version);
|
||||||
@@ -2837,10 +2839,13 @@ run_status_update(void)
|
|||||||
* previous one is not done. */
|
* previous one is not done. */
|
||||||
seq = seq_read(connectivity_seq_get());
|
seq = seq_read(connectivity_seq_get());
|
||||||
if (seq != connectivity_seqno || status_txn_try_again) {
|
if (seq != connectivity_seqno || status_txn_try_again) {
|
||||||
|
const struct ovsrec_open_vswitch *cfg =
|
||||||
|
ovsrec_open_vswitch_first(idl);
|
||||||
struct bridge *br;
|
struct bridge *br;
|
||||||
|
|
||||||
connectivity_seqno = seq;
|
connectivity_seqno = seq;
|
||||||
status_txn = ovsdb_idl_txn_create(idl);
|
status_txn = ovsdb_idl_txn_create(idl);
|
||||||
|
dpdk_status(cfg);
|
||||||
HMAP_FOR_EACH (br, node, &all_bridges) {
|
HMAP_FOR_EACH (br, node, &all_bridges) {
|
||||||
struct port *port;
|
struct port *port;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{"name": "Open_vSwitch",
|
{"name": "Open_vSwitch",
|
||||||
"version": "7.15.1",
|
"version": "7.16.0",
|
||||||
"cksum": "3682332033 23608",
|
"cksum": "2403910601 23776",
|
||||||
"tables": {
|
"tables": {
|
||||||
"Open_vSwitch": {
|
"Open_vSwitch": {
|
||||||
"columns": {
|
"columns": {
|
||||||
@@ -47,7 +47,12 @@
|
|||||||
"min": 0, "max": "unlimited"}},
|
"min": 0, "max": "unlimited"}},
|
||||||
"iface_types": {
|
"iface_types": {
|
||||||
"type": {"key": {"type": "string"},
|
"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,
|
"isRoot": true,
|
||||||
"maxRows": 1},
|
"maxRows": 1},
|
||||||
"Bridge": {
|
"Bridge": {
|
||||||
|
@@ -490,6 +490,11 @@
|
|||||||
configuration changes.
|
configuration changes.
|
||||||
</column>
|
</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">
|
<group title="Statistics">
|
||||||
<p>
|
<p>
|
||||||
The <code>statistics</code> column contains key-value pairs that
|
The <code>statistics</code> column contains key-value pairs that
|
||||||
@@ -673,6 +678,12 @@
|
|||||||
</p>
|
</p>
|
||||||
</column>
|
</column>
|
||||||
|
|
||||||
|
<column name="dpdk_version">
|
||||||
|
<p>
|
||||||
|
The version of the linked DPDK library.
|
||||||
|
</p>
|
||||||
|
</column>
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
<group title="Capabilities">
|
<group title="Capabilities">
|
||||||
|
Reference in New Issue
Block a user