-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bdev ext api #36
Open
AlekseyMarchuk
wants to merge
4
commits into
upstream_master
Choose a base branch
from
bdev_ext_api
base: upstream_master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Bdev ext api #36
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b681709
[RFC] bdev: Add API to get bdev capabilities
AlekseyMarchuk 7e1c1f0
[RFC] bdev: Add extended versions of readv/writev_with_md
AlekseyMarchuk 18b6053
[RFC] nvme: Add function spdk_nvme_ns_cmd_readv/writev_with_md_ext
AlekseyMarchuk 130167c
[RFC] bdev_nvme: Use new extended API
AlekseyMarchuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2545,6 +2545,90 @@ int spdk_nvme_ns_cmd_writev_with_md(struct spdk_nvme_ns *ns, struct spdk_nvme_qp | |
spdk_nvme_req_next_sge_cb next_sge_fn, void *metadata, | ||
uint16_t apptag_mask, uint16_t apptag); | ||
|
||
/** | ||
* Callback used to get a Memory Key per IO request | ||
* | ||
* pd is input parameter and should point to a memory domain | ||
* mkey is an output value | ||
*/ | ||
typedef int (*spdk_nvme_ns_cmd_io_get_mkey)(void *cb_arg, void *address, size_t length, void *pd, | ||
uint32_t *mkey); | ||
|
||
enum spdk_nvme_ns_cmd_ext_io_opts_mem_types { | ||
/** Memory in IO request belongs to another memory domain and it is described by Memory Key. | ||
* If this value is set then \b mkey structure in spdk_nvme_ns_cmd_ext_io_opts_mem_type contains | ||
* a callback and its argument that can be used to get a Memory Key */ | ||
SPDK_NVME_NS_CMD_EXT_IO_OPTS_MEM_TYPE_MEMORY_KEY = 0, | ||
}; | ||
|
||
struct spdk_nvme_ns_cmd_ext_io_opts_mem_type { | ||
/** This value determines which part of union should be used. Provides extensibility for this structure */ | ||
enum spdk_nvme_ns_cmd_ext_io_opts_mem_types type; | ||
union { | ||
struct { | ||
spdk_nvme_ns_cmd_io_get_mkey get_mkey_cb; | ||
} mkey; | ||
} u; | ||
}; | ||
|
||
enum spdk_nvme_ns_cmd_ext_io_opts_flags { | ||
/** This flag determines the type of memory passed in IO request. | ||
* Refer to \ref spdk_nvme_ns_cmd_ext_io_opts_mem_types for more information. | ||
* If this flag is set in spdk_nvme_ns_cmd_ext_io_opts then \b mem_type member of | ||
* \b spdk_nvme_ns_cmd_ext_io_opts should point to a structure that describes memory buffer */ | ||
SPDK_NVME_NS_CMD_EXT_IO_OPTS_MEM_TYPE = 1u << 0, | ||
}; | ||
|
||
/** | ||
* Structure with optional IO request parameters | ||
*/ | ||
struct spdk_nvme_ns_cmd_ext_io_opts { | ||
/** Combination of bits defined in \b enum spdk_nvme_ns_cmd_ext_io_opts_flags */ | ||
uint64_t flags; | ||
/** Describes type of the memory used in IO request | ||
* This structure must be filled by the user if \b SPDK_NVME_NS_CMD_EXT_IO_OPTS_MEM_TYPE bit is set | ||
* in \b flags member. Used by RDMA transport, other transports ignore this extension */ | ||
struct spdk_nvme_ns_cmd_ext_io_opts_mem_type *mem_type; | ||
}; | ||
|
||
/** | ||
* Submit a write I/O to the specified NVMe namespace. | ||
* | ||
* The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). | ||
* The user must ensure that only one thread submits I/O on a given qpair at any | ||
* given time. | ||
* | ||
* \param ns NVMe namespace to submit the write I/O | ||
* \param qpair I/O queue pair to submit the request | ||
* \param lba starting LBA to write the data | ||
* \param lba_count length (in sectors) for the write operation | ||
* \param cb_fn callback function to invoke when the I/O is completed | ||
* \param cb_arg argument to pass to the callback function | ||
* \param io_flags set flags, defined in nvme_spec.h, for this I/O | ||
* \param reset_sgl_fn callback function to reset scattered payload | ||
* \param next_sge_fn callback function to iterate each scattered | ||
* payload memory segment | ||
* \param metadata virtual address pointer to the metadata payload, the length | ||
* of metadata is specified by spdk_nvme_ns_get_md_size() | ||
* \param apptag_mask application tag mask. | ||
* \param apptag application tag to use end-to-end protection information. | ||
* \param opts Optional structure with extended IO request options. | ||
* | ||
* \return 0 if successfully submitted, negated errnos on the following error conditions: | ||
* -EINVAL: The request is malformed. | ||
* -ENOMEM: The request cannot be allocated. | ||
* -ENXIO: The qpair is failed at the transport level. | ||
* -EFAULT: Invalid address was specified as part of payload. cb_fn is also called | ||
* with error status including dnr=1 in this case. | ||
*/ | ||
int spdk_nvme_ns_cmd_writev_with_md_ext(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, | ||
uint64_t lba, uint32_t lba_count, | ||
spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint32_t io_flags, | ||
spdk_nvme_req_reset_sgl_cb reset_sgl_fn, | ||
spdk_nvme_req_next_sge_cb next_sge_fn, void *metadata, | ||
uint16_t apptag_mask, uint16_t apptag, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move apptag_mask, apptag and io_flags to ext_opts structure |
||
struct spdk_nvme_ns_cmd_ext_io_opts *opts); | ||
|
||
/** | ||
* Submit a write I/O to the specified NVMe namespace. | ||
* | ||
|
@@ -2725,6 +2809,43 @@ int spdk_nvme_ns_cmd_readv_with_md(struct spdk_nvme_ns *ns, struct spdk_nvme_qpa | |
spdk_nvme_req_next_sge_cb next_sge_fn, void *metadata, | ||
uint16_t apptag_mask, uint16_t apptag); | ||
|
||
/** | ||
* Submit a read I/O to the specified NVMe namespace. | ||
* | ||
* The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair(). | ||
* The user must ensure that only one thread submits I/O on a given qpair at any given time. | ||
* | ||
* \param ns NVMe namespace to submit the read I/O | ||
* \param qpair I/O queue pair to submit the request | ||
* \param lba starting LBA to read the data | ||
* \param lba_count length (in sectors) for the read operation | ||
* \param cb_fn callback function to invoke when the I/O is completed | ||
* \param cb_arg argument to pass to the callback function | ||
* \param io_flags set flags, defined in nvme_spec.h, for this I/O | ||
* \param reset_sgl_fn callback function to reset scattered payload | ||
* \param next_sge_fn callback function to iterate each scattered | ||
* payload memory segment | ||
* \param metadata virtual address pointer to the metadata payload, the length | ||
* of metadata is specified by spdk_nvme_ns_get_md_size() | ||
* \param apptag_mask application tag mask. | ||
* \param apptag application tag to use end-to-end protection information. | ||
* \param opts Optional structure with extended IO request options. | ||
* | ||
* \return 0 if successfully submitted, negated errnos on the following error conditions: | ||
* -EINVAL: The request is malformed. | ||
* -ENOMEM: The request cannot be allocated. | ||
* -ENXIO: The qpair is failed at the transport level. | ||
* -EFAULT: Invalid address was specified as part of payload. cb_fn is also called | ||
* with error status including dnr=1 in this case. | ||
*/ | ||
int spdk_nvme_ns_cmd_readv_with_md_ext(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, | ||
uint64_t lba, uint32_t lba_count, | ||
spdk_nvme_cmd_cb cb_fn, void *cb_arg, uint32_t io_flags, | ||
spdk_nvme_req_reset_sgl_cb reset_sgl_fn, | ||
spdk_nvme_req_next_sge_cb next_sge_fn, void *metadata, | ||
uint16_t apptag_mask, uint16_t apptag, | ||
struct spdk_nvme_ns_cmd_ext_io_opts *opts); | ||
|
||
/** | ||
* Submits a read I/O to the specified NVMe namespace. | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add
void *cb_arg