Seastar
High performance C++ framework for concurrent servers
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
dpdk_rte.hh
1/*
2 * This file is open source software, licensed to you under the terms
3 * of the Apache License, Version 2.0 (the "License"). See the NOTICE file
4 * distributed with this work for additional information regarding copyright
5 * ownership. You may not use this file except in compliance with the License.
6 *
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing,
12 * software distributed under the License is distributed on an
13 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 * KIND, either express or implied. See the License for the
15 * specific language governing permissions and limitations
16 * under the License.
17 */
18#pragma once
19
20#ifdef SEASTAR_HAVE_DPDK
21
22#include <bitset>
23#include <rte_config.h>
24#include <rte_ethdev.h>
25#include <rte_version.h>
26
27/*********************** Compat section ***************************************/
28// We currently support only versions 2.0 and above.
29#if (RTE_VERSION < RTE_VERSION_NUM(2,0,0,0))
30#error "DPDK version above 2.0.0 is required"
31#endif
32
33#if defined(RTE_MBUF_REFCNT_ATOMIC)
34#warning "CONFIG_RTE_MBUF_REFCNT_ATOMIC should be disabled in DPDK's " \
35 "config/common_linuxapp"
36#endif
37/******************************************************************************/
38
39namespace seastar {
40
41namespace dpdk {
42
43// DPDK Environment Abstraction Layer
44class eal {
45public:
46 using cpuset = std::bitset<RTE_MAX_LCORE>;
47
48 static void init(cpuset cpus, const std::string& argv0, const std::optional<std::string>& hugepages_path, bool dpdk_pmd);
55 static size_t mem_size(int num_cpus, bool hugetlbfs_membackend = true);
56 static bool initialized;
57};
58
59} // namespace dpdk
60
61}
62
63#endif // SEASTAR_HAVE_DPDK
Seastar API namespace.
Definition: abort_on_ebadf.hh:26