2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 22:05:19 +00:00

dpdk: Late initialization.

With this commit, we allow the user to set other_config:dpdk-init=true
after the process is started.  This makes it easier to start Open
vSwitch with DPDK using standard init scripts without restarting the
service.

This is still far from ideal, because initializing DPDK might still
abort the process (e.g. if there not enough memory), so the user must
check the status of the process after setting dpdk-init to true.

Nonetheless, I think this is an improvement, because it doesn't require
restarting the whole unit.

CC: Aaron Conole <aconole@redhat.com>
Signed-off-by: Daniele Di Proietto <diproiettod@vmware.com>
Acked-by: Aaron Conole <aconole@redhat.com>
This commit is contained in:
Daniele Di Proietto
2016-10-04 17:58:05 -07:00
parent f4b835bb0f
commit ec2b070143
3 changed files with 26 additions and 15 deletions

View File

@@ -27,13 +27,13 @@ VLOG_DEFINE_THIS_MODULE(dpdk);
void
dpdk_init(const struct smap *ovs_other_config)
{
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
if (smap_get_bool(ovs_other_config, "dpdk-init", false)) {
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
if (ovsthread_once_start(&once)) {
if (smap_get_bool(ovs_other_config, "dpdk-init", false)) {
if (ovsthread_once_start(&once)) {
VLOG_ERR("DPDK not supported in this copy of Open vSwitch.");
ovsthread_once_done(&once);
}
ovsthread_once_done(&once);
}
}