mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
use new kernel namespace
This commit is contained in:
parent
13c117fe2c
commit
53bb93a967
6 changed files with 20 additions and 10 deletions
|
@ -34,13 +34,15 @@
|
|||
#include <villas/kernel/tc.h>
|
||||
#include <villas/kernel/nl.h>
|
||||
|
||||
using namespace villas;
|
||||
|
||||
int tc_prio(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hdl_t parent, int bands)
|
||||
{
|
||||
int ret;
|
||||
struct nl_sock *sock = nl_init();
|
||||
struct rtnl_qdisc *q = rtnl_qdisc_alloc();
|
||||
|
||||
ret = kernel_module_load("sch_prio");
|
||||
ret = kernel::module_load("sch_prio");
|
||||
if (ret)
|
||||
error("Failed to load kernel module: sch_prio (%d)", ret);
|
||||
|
||||
|
@ -73,7 +75,7 @@ int tc_mark(struct interface *i, struct rtnl_cls **cls, tc_hdl_t flowid, uint32_
|
|||
struct nl_sock *sock = nl_init();
|
||||
struct rtnl_cls *c = rtnl_cls_alloc();
|
||||
|
||||
ret = kernel_module_load("cls_fw");
|
||||
ret = kernel::module_load("cls_fw");
|
||||
if (ret)
|
||||
error("Failed to load kernel module: cls_fw");
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <villas/kernel/kernel.hpp>
|
||||
#include <villas/utils.hpp>
|
||||
|
||||
using namespace villas;
|
||||
using namespace villas::utils;
|
||||
|
||||
static const double max_percent_value = 0xffffffff;
|
||||
|
@ -216,7 +217,7 @@ int tc_netem(struct interface *i, struct rtnl_qdisc **qd, tc_hdl_t handle, tc_hd
|
|||
struct nl_sock *sock = nl_init();
|
||||
struct rtnl_qdisc *q = *qd;
|
||||
|
||||
ret = kernel_module_load("sch_netem");
|
||||
ret = kernel::module_load("sch_netem");
|
||||
if (ret)
|
||||
error("Failed to load kernel module: sch_netem (%d)", ret);
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/kernel/kernel.hpp>
|
||||
|
||||
using namespace villas;
|
||||
|
||||
static std::unordered_map<void *, struct memory_allocation *> allocations;
|
||||
|
||||
int memory_init(int hugepages)
|
||||
|
@ -48,7 +50,7 @@ int memory_init(int hugepages)
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
size_t lock = kernel_get_hugepage_size() * hugepages;
|
||||
size_t lock = kernel::get_hugepage_size() * hugepages;
|
||||
|
||||
ret = memory_lock(lock);
|
||||
if (ret)
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <villas/utils.hpp>
|
||||
#include <villas/kernel/kernel.hpp>
|
||||
|
||||
using namespace villas;
|
||||
using namespace villas::utils;
|
||||
|
||||
static size_t pgsz = -1;
|
||||
|
@ -47,12 +48,12 @@ static size_t hugepgsz = -1;
|
|||
|
||||
int memory_mmap_init(int hugepages)
|
||||
{
|
||||
pgsz = kernel_get_page_size();
|
||||
pgsz = kernel::get_page_size();
|
||||
if (pgsz < 0)
|
||||
return -1;
|
||||
|
||||
if (hugepages > 0) {
|
||||
hugepgsz = kernel_get_hugepage_size();
|
||||
hugepgsz = kernel::get_hugepage_size();
|
||||
if (hugepgsz < 0) {
|
||||
warning("Failed to determine hugepage size.");
|
||||
|
||||
|
@ -63,10 +64,10 @@ int memory_mmap_init(int hugepages)
|
|||
#if defined(__linux__) && defined(__x86_64__)
|
||||
int ret, pagecnt;
|
||||
|
||||
pagecnt = kernel_get_nr_hugepages();
|
||||
pagecnt = kernel::get_nr_hugepages();
|
||||
if (pagecnt < hugepages) {
|
||||
if (getuid() == 0) {
|
||||
ret = kernel_set_nr_hugepages(hugepages);
|
||||
ret = kernel::set_nr_hugepages(hugepages);
|
||||
if (ret) {
|
||||
warning("Failed to increase number of reserved hugepages");
|
||||
memory_default = &memory_mmap;
|
||||
|
|
|
@ -25,12 +25,14 @@
|
|||
#include <villas/memory.h>
|
||||
#include <villas/kernel/kernel.hpp>
|
||||
|
||||
using namespace villas;
|
||||
|
||||
int pool_init(struct pool *p, size_t cnt, size_t blocksz, struct memory_type *m)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Make sure that we use a block size that is aligned to the size of a cache line */
|
||||
p->alignment = kernel_get_cacheline_size();
|
||||
p->alignment = kernel::get_cacheline_size();
|
||||
p->blocksz = p->alignment * CEIL(blocksz, p->alignment);
|
||||
p->len = cnt * p->blocksz;
|
||||
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <villas/sample.h>
|
||||
#include <villas/shmem.h>
|
||||
|
||||
using namespace villas;
|
||||
|
||||
size_t shmem_total_size(int queuelen, int samplelen)
|
||||
{
|
||||
/* We have the constant const of the memory_type header */
|
||||
|
@ -42,7 +44,7 @@ size_t shmem_total_size(int queuelen, int samplelen)
|
|||
/* the size of the actual queue and the queue for the pool */
|
||||
+ queuelen * (2 * sizeof(struct queue_cell))
|
||||
/* the size of the pool */
|
||||
+ queuelen * kernel_get_cacheline_size() * CEIL(SAMPLE_LENGTH(samplelen), kernel_get_cacheline_size())
|
||||
+ queuelen * kernel::get_cacheline_size() * CEIL(SAMPLE_LENGTH(samplelen), kernel::get_cacheline_size())
|
||||
/* a memblock for each allocation (1 shmem_shared, 2 queues, 1 pool) */
|
||||
+ 4 * sizeof(struct memory_block)
|
||||
/* and some extra buffer for alignment */
|
||||
|
|
Loading…
Add table
Reference in a new issue