2015-09-21 15:52:41 +00:00
|
|
|
/*-
|
|
|
|
* BSD LICENSE
|
|
|
|
*
|
2016-01-26 17:47:22 +00:00
|
|
|
* Copyright (c) Intel Corporation.
|
2017-04-11 04:36:05 +00:00
|
|
|
* Copyright (c) NetApp, Inc.
|
2015-09-21 15:52:41 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
* * Neither the name of Intel Corporation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2016-04-29 18:04:33 +00:00
|
|
|
/** \file
|
2016-08-10 17:21:45 +00:00
|
|
|
* Encapsulated third-party dependencies
|
2016-04-29 18:04:33 +00:00
|
|
|
*/
|
|
|
|
|
2016-08-10 17:21:45 +00:00
|
|
|
#ifndef SPDK_ENV_H
|
|
|
|
#define SPDK_ENV_H
|
2015-09-21 15:52:41 +00:00
|
|
|
|
2017-05-01 20:22:48 +00:00
|
|
|
#include "spdk/stdinc.h"
|
2018-12-01 16:49:52 +00:00
|
|
|
#include "spdk/queue.h"
|
2017-05-01 20:22:48 +00:00
|
|
|
|
2015-09-21 15:52:41 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-01-27 17:04:08 +00:00
|
|
|
#define SPDK_ENV_SOCKET_ID_ANY (-1)
|
2017-10-10 16:30:57 +00:00
|
|
|
#define SPDK_ENV_LCORE_ID_ANY (UINT32_MAX)
|
2017-01-27 17:04:08 +00:00
|
|
|
|
2018-02-23 06:43:28 +00:00
|
|
|
/**
|
|
|
|
* Memory is dma-safe.
|
|
|
|
*/
|
|
|
|
#define SPDK_MALLOC_DMA 0x01
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Memory is sharable across process boundries.
|
|
|
|
*/
|
|
|
|
#define SPDK_MALLOC_SHARE 0x02
|
|
|
|
|
2018-06-27 07:31:22 +00:00
|
|
|
#define SPDK_MAX_MEMZONE_NAME_LEN 32
|
|
|
|
#define SPDK_MAX_MEMPOOL_NAME_LEN 29
|
|
|
|
|
2018-06-27 08:29:22 +00:00
|
|
|
/**
|
|
|
|
* Memzone flags
|
|
|
|
*/
|
|
|
|
#define SPDK_MEMZONE_NO_IOVA_CONTIG 0x00100000 /**< no iova contiguity */
|
|
|
|
|
2017-01-12 18:25:17 +00:00
|
|
|
/**
|
|
|
|
* \brief Environment initialization options
|
|
|
|
*/
|
|
|
|
struct spdk_env_opts {
|
2018-03-02 19:49:36 +00:00
|
|
|
const char *name;
|
|
|
|
const char *core_mask;
|
|
|
|
int shm_id;
|
|
|
|
int mem_channel;
|
|
|
|
int master_core;
|
2017-06-16 08:41:13 +00:00
|
|
|
int mem_size;
|
2017-06-14 07:31:55 +00:00
|
|
|
bool no_pci;
|
2018-02-23 08:19:09 +00:00
|
|
|
bool hugepage_single_segments;
|
2018-07-12 07:58:59 +00:00
|
|
|
bool unlink_hugepage;
|
2018-03-30 17:39:37 +00:00
|
|
|
size_t num_pci_addr;
|
2018-11-06 06:10:11 +00:00
|
|
|
const char *hugedir;
|
2018-03-30 17:39:37 +00:00
|
|
|
struct spdk_pci_addr *pci_blacklist;
|
|
|
|
struct spdk_pci_addr *pci_whitelist;
|
2017-10-10 20:35:44 +00:00
|
|
|
|
|
|
|
/** Opaque context for use of the env implementation. */
|
|
|
|
void *env_context;
|
2017-01-12 18:25:17 +00:00
|
|
|
};
|
|
|
|
|
2018-02-23 06:43:28 +00:00
|
|
|
/**
|
2018-10-29 07:02:30 +00:00
|
|
|
* Allocate dma/sharable memory based on a given dma_flg. It is a memory buffer
|
|
|
|
* with the given size, alignment and socket id.
|
2018-02-23 06:43:28 +00:00
|
|
|
*
|
|
|
|
* \param size Size in bytes.
|
2019-07-03 12:23:10 +00:00
|
|
|
* \param align If non-zero, the allocated buffer is aligned to a multiple of
|
|
|
|
* align. In this case, it must be a power of two. The returned buffer is always
|
|
|
|
* aligned to at least cache line size.
|
2019-03-15 13:13:46 +00:00
|
|
|
* \param phys_addr **Deprecated**. Please use spdk_vtophys() for retrieving physical
|
|
|
|
* addresses. A pointer to the variable to hold the physical address of
|
2018-02-23 06:43:28 +00:00
|
|
|
* the allocated buffer is passed. If NULL, the physical address is not returned.
|
|
|
|
* \param socket_id Socket ID to allocate memory on, or SPDK_ENV_SOCKET_ID_ANY
|
|
|
|
* for any socket.
|
|
|
|
* \param flags Combination of SPDK_MALLOC flags (\ref SPDK_MALLOC_DMA, \ref SPDK_MALLOC_SHARE).
|
|