SPDK NVMe RDMA initiator used the default PD per RDMA device. Default PD may be changed when all QPs for the RDMA device are destroyed and created again. For multipath, the RDMA zero copy feature require the PD per RDMA device to be persistent when all QPs for the RDMA device are destroyed and created again. Maintain such persistent PDs in this patch. Add two APIs, spdk_rdma_get_pd() and spdk_rdma_put_pd(). In each call of two APIs, synchronize RDMA device list with rdma_get_devices(). Context may be deleted anytime by rdma-core. To avoid such deletion, hold the returned array by rdma_get_devices(). RDMA device has PD, context, ref. count, and removed flag. If context is missing in rdma_get_devices(), set the removed flag to true. Then, if the ref count becomes zero, free the PD and the RDMA device. The ref. count of a RDMA device is incremented when spdk_rdma_get_pd() is called and decremented when spdk_rdma_put_pd() is called. To simplify synchronization, sort the returned array by rdma_get_devices(). To avoid resource leakage, add destructor function and free all PDs and related data at termination. Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com> Change-Id: I093cb4ec2c7d8432642edfbffa270797ccf3e715 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13769 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
10 lines
286 B
Makefile
10 lines
286 B
Makefile
# SPDX-License-Identifier: BSD-3-Clause
|
|
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
#
|
|
|
|
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../../../../..)
|
|
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk
|
|
TEST_FILE = common_ut.c
|
|
|
|
include $(SPDK_ROOT_DIR)/mk/spdk.unittest.mk
|