env: Move lcore functions into env layer.
They were previously in the event library. Change-Id: I24ffd8f771e895ccf5395c8120423cd114893139 Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
9ee30b87b7
commit
16ae587966
@ -276,7 +276,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
}
|
||||
if (numa_node >= 0) {
|
||||
/* Running subsystem and NVMe device is on the same socket or not */
|
||||
if (rte_lcore_to_socket_id(ctx->app_subsystem->lcore) != (unsigned)numa_node) {
|
||||
if (spdk_env_get_socket_id(ctx->app_subsystem->lcore) != (unsigned)numa_node) {
|
||||
SPDK_WARNLOG("Subsystem %s is configured to run on a CPU core %u belonging "
|
||||
"to a different NUMA node than the associated NVMe device. "
|
||||
"This may result in reduced performance.\n",
|
||||
@ -284,7 +284,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
ctx->app_subsystem->lcore);
|
||||
SPDK_WARNLOG("The NVMe device is on socket %u\n", numa_node);
|
||||
SPDK_WARNLOG("The Subsystem is on socket %u\n",
|
||||
rte_lcore_to_socket_id(ctx->app_subsystem->lcore));
|
||||
spdk_env_get_socket_id(ctx->app_subsystem->lcore));
|
||||
}
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ spdk_nvmf_construct_subsystem(const char *name,
|
||||
/* Parse Listen sections */
|
||||
for (i = 0; i < num_listen_addresses; i++) {
|
||||
int nic_numa_node = spdk_get_ifaddr_numa_node(addresses[i].traddr);
|
||||
unsigned subsys_numa_node = rte_lcore_to_socket_id(app_subsys->lcore);
|
||||
unsigned subsys_numa_node = spdk_env_get_socket_id(app_subsys->lcore);
|
||||
|
||||
if (nic_numa_node >= 0) {
|
||||
if (subsys_numa_node != (unsigned)nic_numa_node) {
|
||||
|
@ -86,7 +86,7 @@ nvmf_tgt_delete_subsystem(struct nvmf_tgt_subsystem *app_subsys)
|
||||
* Unregister the poller - this starts a chain of events that will eventually free
|
||||
* the subsystem's memory.
|
||||
*/
|
||||
event = spdk_event_allocate(spdk_app_get_current_core(), subsystem_delete_event,
|
||||
event = spdk_event_allocate(spdk_env_get_current_core(), subsystem_delete_event,
|
||||
app_subsys, NULL);
|
||||
spdk_poller_unregister(&app_subsys->poller, event);
|
||||
}
|
||||
@ -117,7 +117,7 @@ spdk_nvmf_shutdown_cb(void)
|
||||
fprintf(stdout, " NVMF shutdown signal\n");
|
||||
fprintf(stdout, "=========================\n");
|
||||
|
||||
event = spdk_event_allocate(spdk_app_get_current_core(), acceptor_poller_unregistered_event,
|
||||
event = spdk_event_allocate(spdk_env_get_current_core(), acceptor_poller_unregistered_event,
|
||||
NULL, NULL);
|
||||
spdk_poller_unregister(&g_acceptor_poller, event);
|
||||
}
|
||||
@ -173,7 +173,7 @@ _nvmf_tgt_start_subsystem(void *arg1, void *arg2)
|
||||
{
|
||||
struct nvmf_tgt_subsystem *app_subsys = arg1;
|
||||
struct spdk_nvmf_subsystem *subsystem = app_subsys->subsystem;
|
||||
int lcore = spdk_app_get_current_core();
|
||||
int lcore = spdk_env_get_current_core();
|
||||
|
||||
spdk_nvmf_subsystem_start(subsystem);
|
||||
|
||||
@ -220,7 +220,7 @@ nvmf_tgt_create_subsystem(const char *name, enum spdk_nvmf_subtype subtype,
|
||||
app_subsys->lcore = lcore;
|
||||
|
||||
SPDK_NOTICELOG("allocated subsystem %s on lcore %u on socket %u\n", name, lcore,
|
||||
rte_lcore_to_socket_id(lcore));
|
||||
spdk_env_get_socket_id(lcore));
|
||||
|
||||
TAILQ_INSERT_TAIL(&g_subsystems, app_subsys, tailq);
|
||||
|
||||
@ -295,7 +295,7 @@ spdk_nvmf_startup(void *arg1, void *arg2)
|
||||
g_spdk_nvmf_tgt_conf.acceptor_poll_rate);
|
||||
|
||||
SPDK_NOTICELOG("Acceptor running on core %u on socket %u\n", g_spdk_nvmf_tgt_conf.acceptor_lcore,
|
||||
rte_lcore_to_socket_id(g_spdk_nvmf_tgt_conf.acceptor_lcore));
|
||||
spdk_env_get_socket_id(g_spdk_nvmf_tgt_conf.acceptor_lcore));
|
||||
|
||||
if (getenv("MEMZONE_DUMP") != NULL) {
|
||||
spdk_memzone_dump(stdout);
|
||||
|
@ -156,6 +156,36 @@ void spdk_mempool_put(struct spdk_mempool *mp, void *ele);
|
||||
*/
|
||||
void spdk_mempool_put_bulk(struct spdk_mempool *mp, void *const *ele_arr, size_t count);
|
||||
|
||||
/**
|
||||
* \brief Return the number of dedicated CPU cores utilized by
|
||||
* this env abstraction
|
||||
*/
|
||||
uint32_t spdk_env_get_core_count(void);
|
||||
|
||||
/**
|
||||
* \brief Return the CPU core index of the current thread. This
|
||||
* will only function when called from threads set up by
|
||||
* this environment abstraction.
|
||||
*/
|
||||
uint32_t spdk_env_get_current_core(void);
|
||||
|
||||
/**
|
||||
* \brief Return the index of the first dedicated CPU core for
|
||||
* this application.
|
||||
*/
|
||||
uint32_t spdk_env_get_first_core(void);
|
||||
|
||||
/**
|
||||
* \brief Return the index of the next dedicated CPU core for
|
||||
* this application.
|
||||
* If there is no next core, return UINT32_MAX.
|
||||
*/
|
||||
uint32_t spdk_env_get_next_core(uint32_t prev_core);
|
||||
|
||||
/**
|
||||
* \brief Return the socket ID for the given core.
|
||||
*/
|
||||
uint32_t spdk_env_get_socket_id(uint32_t core);
|
||||
|
||||
/**
|
||||
* Return true if the calling process is primary process
|
||||
|
@ -151,12 +151,12 @@ uint64_t spdk_app_get_core_mask(void);
|
||||
/**
|
||||
* \brief Return the number of CPU cores utilized by this application
|
||||
*/
|
||||
int spdk_app_get_core_count(void);
|
||||
int spdk_app_get_core_count(void) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
* \brief Return the lcore of the current thread.
|
||||
*/
|
||||
uint32_t spdk_app_get_current_core(void);
|
||||
uint32_t spdk_app_get_current_core(void) __attribute__((deprecated));
|
||||
|
||||
/**
|
||||
* \brief Allocate an event to be passed to \ref spdk_event_call
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "spdk/bdev.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/fd.h"
|
||||
#include "spdk/io_channel.h"
|
||||
|
||||
@ -304,7 +305,7 @@ blockdev_aio_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *
|
||||
}
|
||||
|
||||
spdk_poller_register(&ch->poller, blockdev_aio_poll, ch,
|
||||
spdk_app_get_current_core(), 0);
|
||||
spdk_env_get_current_core(), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include <rte_mempool.h>
|
||||
#include <rte_version.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/queue.h"
|
||||
#include "spdk/nvme_spec.h"
|
||||
|
||||
@ -162,7 +163,7 @@ static int spdk_initialize_rbuf_pool(void)
|
||||
* using spdk_event_get_active_core_count() to determine how many local caches we need
|
||||
* to account for.
|
||||
*/
|
||||
cache_size = RBUF_SMALL_POOL_SIZE / (2 * spdk_app_get_core_count());
|
||||
cache_size = RBUF_SMALL_POOL_SIZE / (2 * spdk_env_get_core_count());
|
||||
if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE)
|
||||
cache_size = RTE_MEMPOOL_CACHE_MAX_SIZE;
|
||||
g_rbuf_small_pool = rte_mempool_create("rbuf_small_pool",
|
||||
@ -175,7 +176,7 @@ static int spdk_initialize_rbuf_pool(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
cache_size = RBUF_LARGE_POOL_SIZE / (2 * spdk_app_get_core_count());
|
||||
cache_size = RBUF_LARGE_POOL_SIZE / (2 * spdk_env_get_core_count());
|
||||
if (cache_size > RTE_MEMPOOL_CACHE_MAX_SIZE)
|
||||
cache_size = RTE_MEMPOOL_CACHE_MAX_SIZE;
|
||||
g_rbuf_large_pool = rte_mempool_create("rbuf_large_pool",
|
||||
@ -844,7 +845,7 @@ spdk_bdev_io_complete(struct spdk_bdev_io *bdev_io, enum spdk_bdev_io_status sta
|
||||
* Defer completion via an event to avoid potential infinite recursion if the
|
||||
* user's completion callback issues a new I/O.
|
||||
*/
|
||||
spdk_event_call(spdk_event_allocate(spdk_app_get_current_core(),
|
||||
spdk_event_call(spdk_event_allocate(spdk_env_get_current_core(),
|
||||
bdev_io_deferred_completion,
|
||||
bdev_io,
|
||||
(void *)status));
|
||||
|
@ -355,7 +355,7 @@ bdev_nvme_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *uni
|
||||
}
|
||||
|
||||
spdk_poller_register(&ch->poller, bdev_nvme_poll, ch->qpair,
|
||||
spdk_app_get_current_core(), 0);
|
||||
spdk_env_get_current_core(), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
|
||||
nvme_ctrlr_create_bdevs(nvme_ctrlr);
|
||||
|
||||
spdk_poller_register(&nvme_ctrlr->adminq_timer_poller, bdev_nvme_poll_adminq, ctrlr,
|
||||
spdk_app_get_current_core(), g_nvme_adminq_poll_timeout_us);
|
||||
spdk_env_get_current_core(), g_nvme_adminq_poll_timeout_us);
|
||||
|
||||
spdk_io_device_register(ctrlr, bdev_nvme_create_cb, bdev_nvme_destroy_cb,
|
||||
sizeof(struct nvme_io_channel));
|
||||
@ -784,7 +784,7 @@ bdev_nvme_library_init(void)
|
||||
|
||||
g_nvme_hotplug_poll_core = spdk_conf_section_get_intval(sp, "HotplugPollCore");
|
||||
if (g_nvme_hotplug_poll_core <= 0) {
|
||||
g_nvme_hotplug_poll_core = spdk_app_get_current_core();
|
||||
g_nvme_hotplug_poll_core = spdk_env_get_current_core();
|
||||
}
|
||||
|
||||
if (spdk_nvme_probe(NULL, &probe_ctx, probe_cb, attach_cb, NULL)) {
|
||||
|
@ -449,7 +449,7 @@ blockdev_rbd_create_cb(void *io_device, uint32_t priority,
|
||||
}
|
||||
|
||||
spdk_poller_register(&ch->poller, blockdev_rbd_io_poll, ch,
|
||||
spdk_app_get_current_core(), 0);
|
||||
spdk_env_get_current_core(), 0);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -207,7 +207,7 @@ ioat_create_cb(void *io_device, uint32_t priority, void *ctx_buf, void *unique_c
|
||||
ch->ioat_dev = ioat_dev;
|
||||
ch->ioat_ch = ioat_dev->ioat;
|
||||
spdk_poller_register(&ch->poller, ioat_poll, ch->ioat_ch,
|
||||
spdk_app_get_current_core(), 0);
|
||||
spdk_env_get_current_core(), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
|
||||
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
||||
|
||||
CFLAGS += $(ENV_CFLAGS)
|
||||
C_SRCS = env.c pci.c vtophys.c init.c
|
||||
C_SRCS = env.c pci.c vtophys.c init.c threads.c
|
||||
C_SRCS += pci_nvme.c pci_ioat.c
|
||||
LIBNAME = env_dpdk
|
||||
|
||||
|
@ -160,34 +160,9 @@ spdk_push_arg(char *args[], int *argcount, char *arg)
|
||||
return tmp;
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
spdk_get_coremask(const char *coremask)
|
||||
{
|
||||
unsigned long long core_mask, max_coremask = 0;
|
||||
int num_cores_online;
|
||||
|
||||
num_cores_online = sysconf(_SC_NPROCESSORS_ONLN);
|
||||
if (num_cores_online > 0) {
|
||||
if (num_cores_online > RTE_MAX_LCORE) {
|
||||
num_cores_online = RTE_MAX_LCORE;
|
||||
}
|
||||
if (num_cores_online >= 64) {
|
||||
max_coremask = ~0ULL;
|
||||
} else {
|
||||
max_coremask = (1ULL << num_cores_online) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
core_mask = strtoull(coremask, NULL, 16);
|
||||
core_mask &= max_coremask;
|
||||
|
||||
return core_mask;
|
||||
}
|
||||
|
||||
static int
|
||||
spdk_build_eal_cmdline(const struct spdk_env_opts *opts, char **out[])
|
||||
{
|
||||
unsigned long long core_mask;
|
||||
int argcount = 0;
|
||||
char **args;
|
||||
|
||||
@ -205,12 +180,7 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts, char **out[])
|
||||
}
|
||||
|
||||
/* set the coremask */
|
||||
core_mask = spdk_get_coremask(opts->core_mask);
|
||||
if (core_mask == 0) {
|
||||
spdk_free_args(args, argcount);
|
||||
return -1;
|
||||
}
|
||||
args = spdk_push_arg(args, &argcount, _sprintf_alloc("-c %llx", core_mask));
|
||||
args = spdk_push_arg(args, &argcount, _sprintf_alloc("-c %s", opts->core_mask));
|
||||
if (args == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
73
lib/env_dpdk/threads.c
Normal file
73
lib/env_dpdk/threads.c
Normal file
@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* BSD LICENSE
|
||||
*
|
||||
* Copyright (c) Intel Corporation.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "spdk/env.h"
|
||||
|
||||
#include <rte_config.h>
|
||||
#include <rte_lcore.h>
|
||||
|
||||
uint32_t
|
||||
spdk_env_get_core_count(void)
|
||||
{
|
||||
return rte_lcore_count();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_env_get_current_core(void)
|
||||
{
|
||||
return rte_lcore_id();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_env_get_first_core(void)
|
||||
{
|
||||
return rte_get_next_lcore(-1, 0, 0);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_env_get_next_core(uint32_t prev_core)
|
||||
{
|
||||
unsigned lcore;
|
||||
|
||||
lcore = rte_get_next_lcore(prev_core, 0, 0);
|
||||
if (lcore == RTE_MAX_LCORE) {
|
||||
return UINT32_MAX;
|
||||
}
|
||||
return lcore;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_env_get_socket_id(uint32_t core)
|
||||
{
|
||||
return rte_lcore_to_socket_id(core);
|
||||
}
|
@ -124,7 +124,6 @@ struct spdk_reactor {
|
||||
|
||||
static struct spdk_reactor g_reactors[RTE_MAX_LCORE];
|
||||
static uint64_t g_reactor_mask = 0;
|
||||
static int g_reactor_count = 0;
|
||||
|
||||
static enum spdk_reactor_state g_reactor_state = SPDK_REACTOR_STATE_INVALID;
|
||||
|
||||
@ -412,7 +411,7 @@ spdk_reactor_construct(struct spdk_reactor *reactor, uint32_t lcore, uint64_t ma
|
||||
char ring_name[64];
|
||||
|
||||
reactor->lcore = lcore;
|
||||
reactor->socket_id = rte_lcore_to_socket_id(lcore);
|
||||
reactor->socket_id = spdk_env_get_socket_id(lcore);
|
||||
assert(reactor->socket_id < SPDK_MAX_SOCKET);
|
||||
reactor->max_delay_us = max_delay_us;
|
||||
|
||||
@ -450,13 +449,13 @@ spdk_reactor_start(struct spdk_reactor *reactor)
|
||||
int
|
||||
spdk_app_get_core_count(void)
|
||||
{
|
||||
return g_reactor_count;
|
||||
return spdk_env_get_core_count();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_app_get_current_core(void)
|
||||
{
|
||||
return rte_lcore_id();
|
||||
return spdk_env_get_current_core();
|
||||
}
|
||||
|
||||
int
|
||||
@ -535,7 +534,7 @@ spdk_reactor_get_socket_mask(void)
|
||||
|
||||
RTE_LCORE_FOREACH(i) {
|
||||
if (((1ULL << i) & g_reactor_mask)) {
|
||||
socket_id = rte_lcore_to_socket_id(i);
|
||||
socket_id = spdk_env_get_socket_id(i);
|
||||
socket_info |= (1ULL << socket_id);
|
||||
}
|
||||
}
|
||||
@ -643,7 +642,6 @@ spdk_reactors_init(const char *mask, unsigned int max_delay_us)
|
||||
if (((1ULL << i) & spdk_app_get_core_mask())) {
|
||||
reactor = spdk_reactor_get(i);
|
||||
spdk_reactor_construct(reactor, i, max_delay_us);
|
||||
g_reactor_count++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -735,7 +733,7 @@ spdk_poller_register(struct spdk_poller **ppoller, spdk_poller_fn fn, void *arg,
|
||||
*ppoller = poller;
|
||||
reactor = spdk_reactor_get(lcore);
|
||||
|
||||
if (lcore == spdk_app_get_current_core()) {
|
||||
if (lcore == spdk_env_get_current_core()) {
|
||||
/*
|
||||
* The poller is registered to run on the current core, so call the add function
|
||||
* directly.
|
||||
@ -755,7 +753,7 @@ _spdk_poller_unregister(struct spdk_reactor *reactor, struct spdk_poller *poller
|
||||
struct spdk_event *next)
|
||||
{
|
||||
assert(poller->lcore == reactor->lcore);
|
||||
assert(poller->lcore == spdk_app_get_current_core());
|
||||
assert(poller->lcore == spdk_env_get_current_core());
|
||||
|
||||
poller->unregister_complete_event = next;
|
||||
|
||||
@ -807,7 +805,7 @@ spdk_poller_unregister(struct spdk_poller **ppoller,
|
||||
|
||||
lcore = poller->lcore;
|
||||
|
||||
if (lcore == spdk_app_get_current_core()) {
|
||||
if (lcore == spdk_env_get_current_core()) {
|
||||
/*
|
||||
* The poller is registered on the current core, so call the remove function
|
||||
* directly.
|
||||
|
@ -38,6 +38,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/log.h"
|
||||
#include "spdk/net.h"
|
||||
@ -94,7 +95,7 @@ spdk_acceptor(void *arg)
|
||||
void
|
||||
spdk_iscsi_acceptor_start(void)
|
||||
{
|
||||
spdk_poller_register(&g_acceptor_poller, spdk_acceptor, &g_spdk_iscsi, spdk_app_get_current_core(),
|
||||
spdk_poller_register(&g_acceptor_poller, spdk_acceptor, &g_spdk_iscsi, spdk_env_get_current_core(),
|
||||
ACCEPT_TIMEOUT_US);
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ error_return:
|
||||
* core, suspend the connection here. This ensures any necessary libuns
|
||||
* housekeeping for TCP socket to lcore associations gets cleared.
|
||||
*/
|
||||
conn->lcore = spdk_app_get_current_core();
|
||||
conn->lcore = spdk_env_get_current_core();
|
||||
spdk_net_framework_clear_socket_association(conn->sock);
|
||||
__sync_fetch_and_add(&g_num_connections[conn->lcore], 1);
|
||||
spdk_poller_register(&conn->poller, spdk_iscsi_conn_login_do_work, conn,
|
||||
@ -572,7 +572,7 @@ _spdk_iscsi_conn_free(void *arg1, void *arg2)
|
||||
spdk_iscsi_remove_conn(conn);
|
||||
pthread_mutex_unlock(&g_conns_mutex);
|
||||
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_app_get_current_core()], 1);
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_env_get_current_core()], 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -588,7 +588,7 @@ _spdk_iscsi_conn_check_shutdown(void *arg)
|
||||
|
||||
spdk_poller_unregister(&conn->shutdown_timer, NULL);
|
||||
|
||||
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_app_get_current_core());
|
||||
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_env_get_current_core());
|
||||
}
|
||||
|
||||
void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
|
||||
@ -613,9 +613,9 @@ void spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn)
|
||||
if (rc < 0) {
|
||||
/* The connection cannot be freed yet. Check back later. */
|
||||
spdk_poller_register(&conn->shutdown_timer, _spdk_iscsi_conn_check_shutdown, conn,
|
||||
spdk_app_get_current_core(), 1000);
|
||||
spdk_env_get_current_core(), 1000);
|
||||
} else {
|
||||
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_app_get_current_core());
|
||||
spdk_iscsi_conn_stop_poller(conn, _spdk_iscsi_conn_free, spdk_env_get_current_core());
|
||||
}
|
||||
}
|
||||
|
||||
@ -713,7 +713,7 @@ spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after
|
||||
assert(conn->dev != NULL);
|
||||
spdk_scsi_dev_free_io_channels(conn->dev);
|
||||
}
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_app_get_current_core()], 1);
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_env_get_current_core()], 1);
|
||||
spdk_net_framework_clear_socket_association(conn->sock);
|
||||
event = spdk_event_allocate(lcore, fn_after_stop, conn, NULL);
|
||||
spdk_poller_unregister(&conn->poller, event);
|
||||
@ -1301,7 +1301,7 @@ spdk_iscsi_conn_full_feature_migrate(void *arg1, void *arg2)
|
||||
}
|
||||
|
||||
/* The poller has been unregistered, so now we can re-register it on the new core. */
|
||||
conn->lcore = spdk_app_get_current_core();
|
||||
conn->lcore = spdk_env_get_current_core();
|
||||
spdk_poller_register(&conn->poller, spdk_iscsi_conn_full_feature_do_work, conn,
|
||||
conn->lcore, 0);
|
||||
}
|
||||
@ -1324,7 +1324,7 @@ spdk_iscsi_conn_login_do_work(void *arg)
|
||||
*/
|
||||
if (conn->login_phase == ISCSI_FULL_FEATURE_PHASE) {
|
||||
event = spdk_iscsi_conn_get_migrate_event(conn, &lcore);
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_app_get_current_core()], 1);
|
||||
__sync_fetch_and_sub(&g_num_connections[spdk_env_get_current_core()], 1);
|
||||
__sync_fetch_and_add(&g_num_connections[lcore], 1);
|
||||
spdk_net_framework_clear_socket_association(conn->sock);
|
||||
spdk_poller_unregister(&conn->poller, event);
|
||||
@ -1521,7 +1521,7 @@ void
|
||||
spdk_iscsi_conn_logout(struct spdk_iscsi_conn *conn)
|
||||
{
|
||||
conn->state = ISCSI_CONN_STATE_LOGGED_OUT;
|
||||
spdk_poller_register(&conn->logout_timer, logout_timeout, conn, spdk_app_get_current_core(),
|
||||
spdk_poller_register(&conn->logout_timer, logout_timeout, conn, spdk_env_get_current_core(),
|
||||
ISCSI_LOGOUT_TIMEOUT * 1000000);
|
||||
}
|
||||
|
||||
|
@ -2835,7 +2835,7 @@ spdk_iscsi_compare_pdu_bhs_within_existed_r2t_tasks(struct spdk_iscsi_conn *conn
|
||||
static void spdk_iscsi_queue_task(struct spdk_iscsi_conn *conn,
|
||||
struct spdk_iscsi_task *task)
|
||||
{
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_app_get_current_core(), process_task_completion,
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_env_get_current_core(), process_task_completion,
|
||||
conn, task);
|
||||
spdk_trace_record(TRACE_ISCSI_TASK_QUEUE, conn->id, task->scsi.length,
|
||||
(uintptr_t)task, (uintptr_t)task->pdu);
|
||||
@ -2845,7 +2845,7 @@ static void spdk_iscsi_queue_task(struct spdk_iscsi_conn *conn,
|
||||
static void spdk_iscsi_queue_mgmt_task(struct spdk_iscsi_conn *conn,
|
||||
struct spdk_iscsi_task *task)
|
||||
{
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_app_get_current_core(), process_task_mgmt_completion,
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_env_get_current_core(), process_task_mgmt_completion,
|
||||
conn, task);
|
||||
spdk_scsi_dev_queue_mgmt_task(conn->dev, &task->scsi);
|
||||
}
|
||||
|
@ -977,7 +977,7 @@ spdk_iscsi_subsystem_init(void)
|
||||
/*
|
||||
* Defer creation of listening sockets until the reactor has started.
|
||||
*/
|
||||
spdk_event_call(spdk_event_allocate(spdk_app_get_current_core(), spdk_iscsi_setup, NULL, NULL));
|
||||
spdk_event_call(spdk_event_allocate(spdk_env_get_current_core(), spdk_iscsi_setup, NULL, NULL));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -54,6 +54,7 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/event.h"
|
||||
#include "spdk/conf.h"
|
||||
#include "spdk/net.h"
|
||||
@ -1086,7 +1087,7 @@ spdk_iscsi_tgt_node_cleanup_luns(struct spdk_iscsi_conn *conn,
|
||||
task->scsi.lun = target->dev->lun[i];
|
||||
task->scsi.function = SPDK_SCSI_TASK_FUNC_LUN_RESET;
|
||||
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_app_get_current_core(),
|
||||
task->scsi.cb_event = spdk_event_allocate(spdk_env_get_current_core(),
|
||||
process_task_mgmt_completion, conn, task);
|
||||
spdk_scsi_dev_queue_mgmt_task(target->dev, &task->scsi);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ nvmf_direct_ctrlr_poll_for_completions(struct spdk_nvmf_subsystem *subsystem)
|
||||
}
|
||||
|
||||
if (subsystem->dev.direct.admin_poller == NULL) {
|
||||
int lcore = spdk_app_get_current_core();
|
||||
int lcore = spdk_env_get_current_core();
|
||||
|
||||
spdk_poller_register(&subsystem->dev.direct.admin_poller,
|
||||
nvmf_direct_ctrlr_poll_for_admin_completions,
|
||||
|
@ -234,7 +234,7 @@ spdk_rpc_setup(void *arg)
|
||||
}
|
||||
|
||||
/* Register the periodic rpc_server_do_work */
|
||||
spdk_poller_register(&g_rpc_poller, spdk_rpc_server_do_work, NULL, spdk_app_get_current_core(),
|
||||
spdk_poller_register(&g_rpc_poller, spdk_rpc_server_do_work, NULL, spdk_env_get_current_core(),
|
||||
RPC_SELECT_INTERVAL);
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ spdk_rpc_initialize(void)
|
||||
* when the SPDK application has finished initialization and ready for logins
|
||||
* or RPC commands.
|
||||
*/
|
||||
spdk_poller_register(&g_rpc_poller, spdk_rpc_setup, NULL, spdk_app_get_current_core(), 0);
|
||||
spdk_poller_register(&g_rpc_poller, spdk_rpc_setup, NULL, spdk_env_get_current_core(), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "scsi_internal.h"
|
||||
#include "spdk/endian.h"
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/io_channel.h"
|
||||
#include "spdk/event.h"
|
||||
|
||||
@ -411,7 +412,7 @@ int spdk_scsi_lun_allocate_io_channel(struct spdk_scsi_lun *lun)
|
||||
return -1;
|
||||
}
|
||||
|
||||
lun->lcore = spdk_app_get_current_core();
|
||||
lun->lcore = spdk_env_get_current_core();
|
||||
|
||||
lun->io_channel = spdk_bdev_get_io_channel(lun->bdev, SPDK_IO_PRIORITY_DEFAULT);
|
||||
if (lun->io_channel == NULL) {
|
||||
|
@ -141,7 +141,7 @@ bdevperf_construct_targets(void)
|
||||
}
|
||||
target->bdev = bdev;
|
||||
/* Mapping each target to lcore */
|
||||
index = g_target_count % spdk_app_get_core_count();
|
||||
index = g_target_count % spdk_env_get_core_count();
|
||||
target->next = head[index];
|
||||
target->lcore = index;
|
||||
target->io_completed = 0;
|
||||
@ -432,7 +432,7 @@ static void usage(char *program_name)
|
||||
static void
|
||||
performance_dump(int io_time)
|
||||
{
|
||||
int index;
|
||||
uint32_t index;
|
||||
unsigned lcore_id;
|
||||
float io_per_second, mb_per_second;
|
||||
float total_io_per_second, total_mb_per_second;
|
||||
@ -440,7 +440,7 @@ performance_dump(int io_time)
|
||||
|
||||
total_io_per_second = 0;
|
||||
total_mb_per_second = 0;
|
||||
for (index = 0; index < spdk_app_get_core_count(); index++) {
|
||||
for (index = 0; index < spdk_env_get_core_count(); index++) {
|
||||
target = head[index];
|
||||
if (target != NULL) {
|
||||
lcore_id = target->lcore;
|
||||
@ -486,7 +486,7 @@ bdevperf_run(void *arg1, void *arg2)
|
||||
/* Start a timer to dump performance numbers */
|
||||
if (g_show_performance_real_time) {
|
||||
spdk_poller_register(&g_perf_timer, performance_statistics_thread, NULL,
|
||||
spdk_app_get_current_core(), 1000000);
|
||||
spdk_env_get_current_core(), 1000000);
|
||||
}
|
||||
|
||||
/* Send events to start all I/O */
|
||||
@ -672,7 +672,7 @@ main(int argc, char **argv)
|
||||
|
||||
bdevperf_construct_targets();
|
||||
|
||||
task_pool = rte_mempool_create("task_pool", 4096 * spdk_app_get_core_count(),
|
||||
task_pool = rte_mempool_create("task_pool", 4096 * spdk_env_get_core_count(),
|
||||
sizeof(struct bdevperf_task),
|
||||
64, 0, NULL, NULL, task_ctor, NULL,
|
||||
SOCKET_ID_ANY, 0);
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/event.h"
|
||||
|
||||
static int g_time_in_sec;
|
||||
@ -57,7 +58,7 @@ __submit_next(void *arg1, void *arg2)
|
||||
|
||||
g_call_count++;
|
||||
|
||||
event = spdk_event_allocate(spdk_app_get_current_core(),
|
||||
event = spdk_event_allocate(spdk_env_get_current_core(),
|
||||
__submit_next, NULL, NULL);
|
||||
spdk_event_call(event);
|
||||
}
|
||||
@ -71,7 +72,7 @@ test_start(void *arg1, void *arg2)
|
||||
|
||||
/* Register a poller that will stop the test after the time has elapsed. */
|
||||
spdk_poller_register(&test_end_poller, __test_end, NULL,
|
||||
spdk_app_get_current_core(),
|
||||
spdk_env_get_current_core(),
|
||||
g_time_in_sec * 1000000ULL);
|
||||
|
||||
for (i = 0; i < g_queue_depth; i++) {
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include "iscsi/iscsi.h"
|
||||
#include "iscsi/conn.h"
|
||||
|
||||
#include "spdk/env.h"
|
||||
#include "spdk/event.h"
|
||||
|
||||
#include "spdk_internal/log.h"
|
||||
@ -90,7 +91,7 @@ spdk_scsi_dev_queue_mgmt_task(struct spdk_scsi_dev *dev,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_app_get_current_core(void)
|
||||
spdk_env_get_current_core(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
SPDK_LOG_REGISTER_TRACE_FLAG("nvmf", SPDK_TRACE_NVMF)
|
||||
|
||||
uint32_t
|
||||
spdk_app_get_current_core(void)
|
||||
spdk_env_get_current_core(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ spdk_poller_unregister(struct spdk_poller **ppoller,
|
||||
}
|
||||
|
||||
uint32_t
|
||||
spdk_app_get_current_core(void)
|
||||
spdk_env_get_current_core(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user