Commit 9e6aa50f authored by Ankit Kumar's avatar Ankit Kumar Committed by Tomasz Zawadzki
Browse files

bdev: add support for controller attributes



Introduce bdev_nvme_ctratt, which by convention is similar to the one
defined by NVMe spec, with only fdp bit enabled for now. This adds extra
clarity on which bits are currently relevant to the bdev layer.

Add this field to bdev, which can be used to indicate nvmf about
controller attributes such as FDP supported by the bdev.

Set the controller attributes field for nvme bdev.

Change-Id: Ib44fdc7afd6465cc97d33f062c8ad5dabcc75b44
Signed-off-by: default avatarAnkit Kumar <ankit.kumar@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22789


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent b4d406b7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -2,6 +2,10 @@

## v24.05: (Upcoming Release)

### bdev

Added `spdk_bdev_get_nvme_ctratt()` API to get controller attributes of bdev.

### event

SPDK applications can now start with `--wait-for-rpc` and JSON configuration provided at the same time.
+24 −0
Original line number Diff line number Diff line
@@ -207,6 +207,22 @@ struct spdk_bdev_opts {
} __attribute__((packed));
SPDK_STATIC_ASSERT(sizeof(struct spdk_bdev_opts) == 32, "Incorrect size");

/**
 * Union for controller attributes field, to list whether bdev supports fdp etc.
 * By convention we match the NVMe definition, allowing other bdevs to use this feature
 */
union spdk_bdev_nvme_ctratt {
	uint32_t raw;

	struct {
		uint32_t reserved	: 19;
		/* Supports flexible data placement */
		uint32_t fdps		: 1;
		uint32_t reserved2	: 12;
	} bits;
};
SPDK_STATIC_ASSERT(sizeof(union spdk_bdev_nvme_ctratt) == 4, "Incorrect size");

/**
 * Structure with optional IO request parameters
 */
@@ -2147,6 +2163,14 @@ void spdk_bdev_for_each_channel_continue(struct spdk_bdev_channel_iter *i, int s
void spdk_bdev_for_each_channel(struct spdk_bdev *bdev, spdk_bdev_for_each_channel_msg fn,
				void *ctx, spdk_bdev_for_each_channel_done cpl);

/**
 * Get controller attributes for the bdev.
 *
 * \param bdev Block device to query.
 * \return controller attributes for the bdev.
 */
union spdk_bdev_nvme_ctratt spdk_bdev_get_nvme_ctratt(struct spdk_bdev *bdev);

#ifdef __cplusplus
}
#endif
+5 −0
Original line number Diff line number Diff line
@@ -598,6 +598,11 @@ struct spdk_bdev {
	 */
	bool media_events;

	/**
	 * Specifies the bdev nvme controller attributes.
	 */
	union spdk_bdev_nvme_ctratt ctratt;

	/* Upon receiving a reset request, this is the amount of time in seconds
	 * to wait for all I/O to complete before moving forward with the reset.
	 * If all I/O completes prior to this time out, the reset will be skipped.
+5 −0
Original line number Diff line number Diff line
@@ -4894,6 +4894,11 @@ spdk_bdev_get_io_time(const struct spdk_bdev *bdev)
	return bdev->internal.io_time;
}

union spdk_bdev_nvme_ctratt spdk_bdev_get_nvme_ctratt(struct spdk_bdev *bdev)
{
	return bdev->ctratt;
}

static void bdev_update_qd_sampling_period(void *ctx);

static void
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@
	spdk_bdev_for_each_channel_continue;
	spdk_bdev_get_max_copy;
	spdk_bdev_copy_blocks;
	spdk_bdev_get_nvme_ctratt;

	# Public functions in bdev_module.h
	spdk_bdev_register;
Loading