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 <optional>
24#include <rte_config.h>
25#include <rte_ethdev.h>
26#include <rte_version.h>
27
28/*********************** Compat section ***************************************/
29// We currently support only versions 2.0 and above.
30#if (RTE_VERSION < RTE_VERSION_NUM(2,0,0,0))
31#error "DPDK version above 2.0.0 is required"
32#endif
33
34#if defined(RTE_MBUF_REFCNT_ATOMIC)
35#warning "CONFIG_RTE_MBUF_REFCNT_ATOMIC should be disabled in DPDK's " \
36 "config/common_linuxapp"
37#endif
38/******************************************************************************/
39
40namespace seastar {
41
42namespace dpdk {
43
44// DPDK Environment Abstraction Layer
45class eal {
46public:
47 using cpuset = std::bitset<RTE_MAX_LCORE>;
48
49 static void init(cpuset cpus, const std::string& argv0, const std::optional<std::string>& hugepages_path, bool dpdk_pmd);
56 static size_t mem_size(int num_cpus, bool hugetlbfs_membackend = true);
57 static bool initialized;
58};
59
60} // namespace dpdk
61
62}
63
64#endif // SEASTAR_HAVE_DPDK
Seastar API namespace.
Definition: abort_on_ebadf.hh:26