Commit b30c1383 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

bdev/crypto: Report encrypt op memory domain



That allows to propagate accel module memory domain
to the application

Signed-off-by: default avatarAlexey Marchuk <alexeymar@nvidia.com>
Change-Id: Ic90695ad388e85f05e7f6cac69e901f5556256e3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23098


Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 431b22cd
Loading
Loading
Loading
Loading
+17 −7
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (C) 2018 Intel Corporation.
 *   All rights reserved.
 *   Copyright (c) 2022, 2023 NVIDIA CORPORATION & AFFILIATES.
 *   Copyright (c) 2022-2024 NVIDIA CORPORATION & AFFILIATES.
 *   All rights reserved.
 */

@@ -691,16 +691,26 @@ vbdev_crypto_base_bdev_event_cb(enum spdk_bdev_event_type type, struct spdk_bdev
static int
vbdev_crypto_get_memory_domains(void *ctx, struct spdk_memory_domain **domains, int array_size)
{
	struct vbdev_crypto *crypto_bdev = ctx;
	int num_domains;
	struct spdk_memory_domain **accel_domains = NULL;
	int num_domains = 0, accel_rc, accel_array_size = 0;

	/* Report base bdev's memory domains plus accel memory domain */
	num_domains = spdk_bdev_get_memory_domains(crypto_bdev->base_bdev, domains, array_size);
	if (domains != NULL && num_domains < array_size) {
	/* Report generic accel and encryption module's memory domains */
	if (domains && num_domains < array_size) {
		domains[num_domains] = spdk_accel_get_memory_domain();
	}

	return num_domains + 1;
	num_domains++;
	if (domains && num_domains < array_size) {
		accel_domains = domains + num_domains;
		accel_array_size = array_size - num_domains;
	}
	accel_rc = spdk_accel_get_opc_memory_domains(SPDK_ACCEL_OPC_ENCRYPT, accel_domains,
			accel_array_size);
	if (accel_rc > 0) {
		num_domains += accel_rc;
	}

	return num_domains;
}

static bool
+4 −1
Original line number Diff line number Diff line
/*   SPDX-License-Identifier: BSD-3-Clause
 *   Copyright (C) 2018 Intel Corporation.
 *   Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.
 *   Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES.
 *   All rights reserved.
 */

@@ -77,6 +77,9 @@ DEFINE_STUB(spdk_bdev_get_memory_domains, int,
DEFINE_STUB(spdk_accel_get_memory_domain, struct spdk_memory_domain *, (void), (void *)0xdeadbeef);
DEFINE_STUB(spdk_accel_get_buf_align, uint8_t,
	    (enum spdk_accel_opcode opcode, const struct spdk_accel_operation_exec_ctx *ctx), 0);
DEFINE_STUB(spdk_accel_get_opc_memory_domains, int, (enum spdk_accel_opcode opcode,
		struct spdk_memory_domain **domains,
		int array_size), 0);

/* global vars and setup/cleanup functions used for all test functions */
struct spdk_bdev_io *g_base_io;