-
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
base: upstream_master
Are you sure you want to change the base?
Bdev ext api #36
Changes from 1 commit
b681709
7e1c1f0
18b6053
130167c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1733,6 +1733,30 @@ void spdk_bdev_histogram_get(struct spdk_bdev *bdev, struct spdk_histogram_data | |
size_t spdk_bdev_get_media_events(struct spdk_bdev_desc *bdev_desc, | ||
struct spdk_bdev_media_event *events, size_t max_events); | ||
|
||
enum spdk_bdev_capability_type { | ||
/** 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, | ||
}; | ||
|
||
/** Describes capabilities of Block device */ | ||
struct spdk_bdev_capability { | ||
/** Size of this structure in bytes, should be set by the user */ | ||
size_t size; | ||
/** bitwise combination of \ref spdk_bdev_capability_type */ | ||
uint64_t flags; | ||
}; | ||
|
||
/** | ||
* Get bdev capabilities | ||
* | ||
* \param bdev Block device | ||
* \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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename to |
||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -222,6 +222,9 @@ struct spdk_bdev_fn_table { | |
|
||
/** Get bdev module context. */ | ||
void *(*get_module_ctx)(void *ctx); | ||
|
||
/** Get block device capabilities */ | ||
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. extended capabilities |
||
void (*get_caps)(void *ctx, struct spdk_bdev_capability *caps); | ||
}; | ||
|
||
/** bdev I/O completion status */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -671,6 +671,16 @@ vbdev_delay_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx | |
/* No config per bdev needed */ | ||
} | ||
|
||
static void | ||
vbdev_delay_get_caps(void *ctx, struct spdk_bdev_capability *caps) | ||
{ | ||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. uint64_t local_flags = 0; if (caps->flags & SPDK_BDEV_CAP_EXT_MEMORY_TYPE_MKEY) { compress/crypto: |
||
} | ||
} | ||
|
||
/* When we register our bdev this is how we specify our entry points. */ | ||
static const struct spdk_bdev_fn_table vbdev_delay_fn_table = { | ||
.destruct = vbdev_delay_destruct, | ||
|
@@ -679,6 +689,7 @@ static const struct spdk_bdev_fn_table vbdev_delay_fn_table = { | |
.get_io_channel = vbdev_delay_get_io_channel, | ||
.dump_info_json = vbdev_delay_dump_info_json, | ||
.write_config_json = vbdev_delay_write_config_json, | ||
.get_caps = vbdev_delay_get_caps, | ||
}; | ||
|
||
static void | ||
|
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.
/** Bdev supports indirect memory access using Memory Key.