Conversation
include/spdk/bdev.h
Outdated
| struct spdk_bdev_io_memory_key_ctx { | ||
| void *ctx; | ||
| enum spdk_bdev_io_memory_key_ctx_type ctx_type; | ||
| /** Memory key to be filled by the user of \b spdk_bdev_readv_with_md_ext of \b spdk_bdev_writev_with_md_ext |
lib/bdev/bdev.c
Outdated
| return -EINVAL; | ||
| } | ||
|
|
||
| bdev_copy_ext_io_opts(opts, &opts_local, opts->opts_size); |
There was a problem hiding this comment.
We have two copies of opts: here and in bdev_readv_blocks_with_md. Can we optimize somehow and keep just one?
There was a problem hiding this comment.
Will rework to pass user's struct and check if it is NULL or not
lib/bdev/bdev.c
Outdated
| } \ | ||
|
|
||
| SET_FIELD(get_mkey_cb); | ||
| SET_FIELD(get_mkey_cb_arg); |
There was a problem hiding this comment.
Why not just memcpy?
lib/bdev/bdev.c
Outdated
| dst->opts_size = opts_size; | ||
|
|
||
| #define SET_FIELD(field) \ | ||
| if (offsetof(struct spdk_bdev_ext_io_opts, field) + sizeof(src->field) <= opts_size) { \ |
There was a problem hiding this comment.
Can it be that src and dst have different size?
lib/bdev/bdev.c
Outdated
|
|
||
| static void | ||
| bdev_copy_ext_io_opts(const struct spdk_bdev_ext_io_opts *src, struct spdk_bdev_ext_io_opts *dst, | ||
| size_t opts_size) |
There was a problem hiding this comment.
Why do we need opts_size argument? We have one in src.
lib/bdev/bdev.c
Outdated
| } | ||
|
|
||
| memset(&caps_local, 0, sizeof(caps_local)); | ||
| caps_local.size = caps->size; |
There was a problem hiding this comment.
If user was built with newer version, caps->size can be larger than caps_local structure size
include/spdk/bdev.h
Outdated
| enum spdk_bdev_io_memory_key_ctx_type ctx_type; | ||
| /** Memory key to be filled by the user of \b spdk_bdev_readv_with_md_ext of \b spdk_bdev_writev_with_md_ext | ||
| * when bdev module calls \b spdk_bdev_io_get_mkey */ | ||
| uint32_t mkey; |
There was a problem hiding this comment.
Need more description here. It is not very clear that ctx and ctx_typre are input parameters and mkey is out parameter.
include/spdk/bdev.h
Outdated
|
|
||
| enum spdk_bdev_capability_type { | ||
| /** Bdev module doesn't read or modify data buffer passed in IO request */ | ||
| SPDK_BDEV_CAP_DATA_PASSTHRU = 1u << 0u, |
There was a problem hiding this comment.
The description is not correct here. We use it to determine whether bdev supports IOs with mkey extended opt.
And the name should be changed.
Now I don't see any relation between this bdev capability and extended IO opts introduced in the next commits
| 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.
Move apptag_mask, apptag and io_flags to ext_opts structure
The new API spdk_bdev_get_caps returns capabilities specific for bdev module. Change-Id: Ic9f42eff59bdc4c8c6e73deb76b3eecfc04f80a8 Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
New functions accept extedable structure of IO options Change-Id: If6864df151a3c0ad722785cb26d1f5d4309cd733 Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
These functions accept extendable structure with IO request options. The options structure contains a callback to get a memory key per Io request. This callback is used in RDMA transport. Change-Id: I65bfba279904e77539348520c3dfac7aadbe80d9 Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
The new API is used if flags is not zero. Change-Id: I414b5d19bff54114d6708efed89ba19b5955f56a Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
9c31a76 to
130167c
Compare
| * \param caps Capabilities of Block device to be filled by this function | ||
| * \return 0 on success, negated errno on failure. | ||
| */ | ||
| int spdk_bdev_get_caps(struct spdk_bdev *bdev, struct spdk_bdev_capability *caps); |
There was a problem hiding this comment.
rename to
spdk_bdev_get_ext_caps
| /** Bdev supports indirect memory access using Memory Key. | ||
| * That means that the user of ext bdev API can fill spdk_bdev_ext_io_opts_mem_type | ||
| * structure and set SPDK_BDEV_EXT_IO_OPTS_MEM_TYPE flag in spdk_bdev_ext_io_opts structure */ | ||
| SPDK_BDEV_CAP_EXT_MEMORY_TYPE_MKEY = 1u << 0u, |
There was a problem hiding this comment.
/** Bdev supports indirect memory access using Memory Key.
- That means that the user of ext bdev API can fill spdk_bdev_ext_io_opts_mem_type
- structure and set SPDK_BDEV_EXT_IO_OPTS_MEM_TYPE flag in spdk_bdev_ext_io_opts structure
- That also means that bdev can work with regular memory buffers */
| /** Get bdev module context. */ | ||
| void *(*get_module_ctx)(void *ctx); | ||
|
|
||
| /** Get block device capabilities */ |
| struct vbdev_delay *delay_node = (struct vbdev_delay *)ctx; | ||
|
|
||
| if (delay_node->base_bdev->fn_table->get_caps) { | ||
| delay_node->base_bdev->fn_table->get_caps(delay_node->base_bdev, caps); |
There was a problem hiding this comment.
uint64_t local_flags = 0;
if (caps->flags & SPDK_BDEV_CAP_EXT_MEMORY_TYPE_MKEY) {
/* Delay bdev doesn't modify data so it can work with indirect memory if it is supported by underlying bdev */
local_flags |= SPDK_BDEV_CAP_EXT_MEMORY_TYPE_MKEY
}
caps->flags = local_flags;
compress/crypto:
uint64_t local_flags = 0;
|
| */ | ||
| struct spdk_bdev_ext_io_opts { | ||
| /** Combination of bits defined in \b enum spdk_bdev_ext_io_opts_flags */ | ||
| uint64_t flags; |
| * 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 |
There was a problem hiding this comment.
Add comments for other arguments
| * pd is input parameter and should point to a memory domain | ||
| * mkey is an output value | ||
| */ | ||
| typedef int (*spdk_bdev_io_get_mkey)(void *cb_arg, void *address, size_t length, void *pd, |
There was a problem hiding this comment.
Use forward declaration of ibv_pd structure
| * mkey is an output value | ||
| */ | ||
| typedef int (*spdk_bdev_io_get_mkey)(void *cb_arg, void *address, size_t length, void *pd, | ||
| uint32_t *mkey); |
There was a problem hiding this comment.
return 2 keys - local and remote?
Ask if we need 2 keys
| enum spdk_nvme_ns_cmd_ext_io_opts_mem_types type; | ||
| union { | ||
| struct { | ||
| spdk_nvme_ns_cmd_io_get_mkey get_mkey_cb; |
No description provided.