2016-10-04 17:58:05 -07:00
|
|
|
/*
|
2016-10-04 17:58:05 -07:00
|
|
|
* Copyright (c) 2014, 2015, 2016 Nicira, Inc.
|
2016-10-04 17:58:05 -07:00
|
|
|
* Copyright (c) 2016 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2016-04-29 13:44:01 -04:00
|
|
|
#include <config.h>
|
2016-10-04 17:58:05 -07:00
|
|
|
#include "dpdk.h"
|
|
|
|
|
2016-04-29 13:44:01 -04:00
|
|
|
#include "smap.h"
|
|
|
|
#include "ovs-thread.h"
|
|
|
|
#include "openvswitch/vlog.h"
|
2018-05-03 15:08:01 -04:00
|
|
|
#include "vswitch-idl.h"
|
2016-04-29 13:44:01 -04:00
|
|
|
|
|
|
|
VLOG_DEFINE_THIS_MODULE(dpdk);
|
|
|
|
|
|
|
|
void
|
|
|
|
dpdk_init(const struct smap *ovs_other_config)
|
|
|
|
{
|
2016-10-04 17:58:05 -07:00
|
|
|
if (smap_get_bool(ovs_other_config, "dpdk-init", false)) {
|
|
|
|
static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER;
|
2016-04-29 13:44:01 -04:00
|
|
|
|
2016-10-04 17:58:05 -07:00
|
|
|
if (ovsthread_once_start(&once)) {
|
2016-04-29 13:44:01 -04:00
|
|
|
VLOG_ERR("DPDK not supported in this copy of Open vSwitch.");
|
2016-10-04 17:58:05 -07:00
|
|
|
ovsthread_once_done(&once);
|
2016-04-29 13:44:01 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-10-04 17:58:05 -07:00
|
|
|
|
dpdk: Support running PMD threads on any core.
Previously in OVS, a PMD thread running on cpu X used lcore X.
This assumption limited OVS to run PMD threads on physical cpu <
RTE_MAX_LCORE.
DPDK 20.08 introduced a new API that associates a non-EAL thread to a free
lcore. This new API does not change the thread characteristics (like CPU
affinity) and let OVS run its PMD threads on any cpu regardless of
RTE_MAX_LCORE.
The DPDK multiprocess feature is not compatible with this new API and is
disabled.
DPDK still limits the number of lcores to RTE_MAX_LCORE (128 on x86_64)
which should be enough for OVS pmd threads (hopefully).
DPDK lcore/OVS pmd threads mapping are logged at threads when trying to
attach a OVS PMD thread, and when detaching.
A new command is added to help get DPDK point of view of the DPDK lcores
at any time:
$ ovs-appctl dpdk/lcore-list
lcore 0, socket 0, role RTE, cpuset 0
lcore 1, socket 0, role NON_EAL, cpuset 1
lcore 2, socket 0, role NON_EAL, cpuset 15
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-10 17:53:41 +01:00
|
|
|
bool
|
|
|
|
dpdk_attach_thread(unsigned cpu OVS_UNUSED)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-10-04 17:58:05 -07:00
|
|
|
void
|
dpdk: Support running PMD threads on any core.
Previously in OVS, a PMD thread running on cpu X used lcore X.
This assumption limited OVS to run PMD threads on physical cpu <
RTE_MAX_LCORE.
DPDK 20.08 introduced a new API that associates a non-EAL thread to a free
lcore. This new API does not change the thread characteristics (like CPU
affinity) and let OVS run its PMD threads on any cpu regardless of
RTE_MAX_LCORE.
The DPDK multiprocess feature is not compatible with this new API and is
disabled.
DPDK still limits the number of lcores to RTE_MAX_LCORE (128 on x86_64)
which should be enough for OVS pmd threads (hopefully).
DPDK lcore/OVS pmd threads mapping are logged at threads when trying to
attach a OVS PMD thread, and when detaching.
A new command is added to help get DPDK point of view of the DPDK lcores
at any time:
$ ovs-appctl dpdk/lcore-list
lcore 0, socket 0, role RTE, cpuset 0
lcore 1, socket 0, role NON_EAL, cpuset 1
lcore 2, socket 0, role NON_EAL, cpuset 15
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2021-11-10 17:53:41 +01:00
|
|
|
dpdk_detach_thread(void)
|
2016-10-04 17:58:05 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-07-05 08:43:15 -04:00
|
|
|
bool
|
|
|
|
dpdk_available(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-01-15 19:21:12 +01:00
|
|
|
void
|
|
|
|
print_dpdk_version(void)
|
|
|
|
{
|
|
|
|
}
|
2018-05-03 15:08:01 -04:00
|
|
|
|
|
|
|
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");
|
|
|
|
}
|
|
|
|
}
|