dpdk/lib/librte_eal/common/eal_common_config.c
<<
>>
Prefs
   1/* SPDX-License-Identifier: BSD-3-Clause
   2 * Copyright(c) 2020 Mellanox Technologies, Ltd
   3 */
   4#include <string.h>
   5
   6#include <rte_os.h>
   7#include <rte_string_fns.h>
   8
   9#include "eal_private.h"
  10#include "eal_memcfg.h"
  11
  12/* early configuration structure, when memory config is not mmapped */
  13static struct rte_mem_config early_mem_config;
  14
  15/* Address of global and public configuration */
  16static struct rte_config rte_config = {
  17        .mem_config = &early_mem_config,
  18};
  19
  20/* platform-specific runtime dir */
  21static char runtime_dir[PATH_MAX];
  22
  23/* internal configuration */
  24static struct internal_config internal_config;
  25
  26const char *
  27rte_eal_get_runtime_dir(void)
  28{
  29        return runtime_dir;
  30}
  31
  32int
  33eal_set_runtime_dir(char *run_dir, size_t size)
  34{
  35        size_t str_size;
  36
  37        str_size = strlcpy(runtime_dir, run_dir, size);
  38        if (str_size >= size) {
  39                RTE_LOG(ERR, EAL, "Runtime directory string too long\n");
  40                return -1;
  41        }
  42
  43        return 0;
  44}
  45
  46/* Return a pointer to the configuration structure */
  47struct rte_config *
  48rte_eal_get_configuration(void)
  49{
  50        return &rte_config;
  51}
  52
  53/* Return a pointer to the internal configuration structure */
  54struct internal_config *
  55eal_get_internal_configuration(void)
  56{
  57        return &internal_config;
  58}
  59
  60enum rte_iova_mode
  61rte_eal_iova_mode(void)
  62{
  63        return rte_eal_get_configuration()->iova_mode;
  64}
  65
  66enum rte_proc_type_t
  67rte_eal_process_type(void)
  68{
  69        return rte_config.process_type;
  70}
  71
  72/* Return user provided mbuf pool ops name */
  73const char *
  74rte_eal_mbuf_user_pool_ops(void)
  75{
  76        return internal_config.user_mbuf_pool_ops_name;
  77}
  78
  79/* return non-zero if hugepages are enabled. */
  80int
  81rte_eal_has_hugepages(void)
  82{
  83        return !internal_config.no_hugetlbfs;
  84}
  85
  86int
  87rte_eal_has_pci(void)
  88{
  89        return !internal_config.no_pci;
  90}
  91