Commit 38b1eaa4 authored by Jim Harris's avatar Jim Harris Committed by Konrad Sztyber
Browse files

env: add spdk_env_get_numa_id()



This will effectively replace spdk_env_get_socket_id(), which is
marked obsolete as part of this patch.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: I5d39e5e1b98e07f709b14c86382e59ea76584def
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24608


Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 186b109d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -74,3 +74,10 @@ a bdev of the correct size.

These functions are deprecated and will be removed in 24.09 release. Please use
`spdk_rpc_server_listen`, `spdk_rpc_server_accept` and `spdk_rpc_server_close` instead.

### env

#### `spdk_env_get_socket_id`

This function is deprecated and will be removed in 25.05 release. Please use
`spdk_env_get_numa_id` instead.
+13 −2
Original line number Diff line number Diff line
@@ -507,11 +507,22 @@ uint32_t spdk_env_get_next_core(uint32_t prev_core);
	     i = spdk_env_get_next_core(i))

/**
 * Get the NUMA socket ID for the given core.
 * Get the NUMA node ID for the given core.
 *
 * \param core CPU core to query.
 *
 * \return the NUMA socket ID for the given core.
 * \return the NUMA node ID for the given core.
 */
int32_t spdk_env_get_numa_id(uint32_t core);

/**
 * Get the NUMA node ID for the given core.
 *
 * Deprecated, use \ref spdk_env_get_numa_id() instead.
 *
 * \param core CPU core to query.
 *
 * \return the NUMA node ID for the given core.
 */
uint32_t spdk_env_get_socket_id(uint32_t core);

+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@
	spdk_env_get_last_core;
	spdk_env_get_next_core;
	spdk_env_get_socket_id;
	spdk_env_get_numa_id;
	spdk_env_get_cpuset;
	spdk_env_core_get_smt_cpuset;
	spdk_env_thread_launch_pinned;
+11 −2
Original line number Diff line number Diff line
@@ -66,8 +66,8 @@ spdk_env_get_next_core(uint32_t prev_core)
	return lcore;
}

uint32_t
spdk_env_get_socket_id(uint32_t core)
int32_t
spdk_env_get_numa_id(uint32_t core)
{
	if (core >= RTE_MAX_LCORE) {
		return SPDK_ENV_NUMA_ID_ANY;
@@ -76,6 +76,15 @@ spdk_env_get_socket_id(uint32_t core)
	return rte_lcore_to_socket_id(core);
}

SPDK_LOG_DEPRECATION_REGISTER(env_socket_id, "spdk_env_get_socket_id", "v25.05", 0);

uint32_t
spdk_env_get_socket_id(uint32_t core)
{
	SPDK_LOG_DEPRECATED(env_socket_id);
	return spdk_env_get_numa_id(core);
}

void
spdk_env_get_cpuset(struct spdk_cpuset *cpuset)
{
+1 −3
Original line number Diff line number Diff line
@@ -543,8 +543,6 @@ nvme_driver_init(void)
{
	static pthread_mutex_t g_init_mutex = PTHREAD_MUTEX_INITIALIZER;
	int ret = 0;
	/* Any socket ID */
	int socket_id = -1;

	/* Use a special process-private mutex to ensure the global
	 * nvme driver object (g_spdk_nvme_driver) gets initialized by
@@ -570,7 +568,7 @@ nvme_driver_init(void)
			return 0;
		} else {
			g_spdk_nvme_driver = spdk_memzone_reserve(SPDK_NVME_DRIVER_NAME,
					     sizeof(struct nvme_driver), socket_id,
					     sizeof(struct nvme_driver), SPDK_ENV_NUMA_ID_ANY,
					     SPDK_MEMZONE_NO_IOVA_CONTIG);
		}

Loading