hello_world: If supported, use CMB WDS buffer
If the NVMe controller to be tested supports a CMB with the WDS feature then we use that for the write phase of hello_world. Change-Id: Ide6ee1005a892ca977bd32a974cd644256e95c8a Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Signed-off-by: Stephen Bates <sbates@raithlin.com> Reviewed-on: https://review.gerrithub.io/397039 Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
3839639759
commit
8f3d0a6413
@ -93,6 +93,7 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
|
|||||||
struct hello_world_sequence {
|
struct hello_world_sequence {
|
||||||
struct ns_entry *ns_entry;
|
struct ns_entry *ns_entry;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
unsigned using_cmb_io;
|
||||||
int is_completed;
|
int is_completed;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -124,7 +125,11 @@ write_complete(void *arg, const struct spdk_nvme_cpl *completion)
|
|||||||
* the write I/O and allocate a new zeroed buffer for reading
|
* the write I/O and allocate a new zeroed buffer for reading
|
||||||
* the data back from the NVMe namespace.
|
* the data back from the NVMe namespace.
|
||||||
*/
|
*/
|
||||||
spdk_dma_free(sequence->buf);
|
if (sequence->using_cmb_io) {
|
||||||
|
spdk_nvme_ctrlr_free_cmb_io_buffer(ns_entry->ctrlr, sequence->buf, 0x1000);
|
||||||
|
} else {
|
||||||
|
spdk_dma_free(sequence->buf);
|
||||||
|
}
|
||||||
sequence->buf = spdk_dma_zmalloc(0x1000, 0x1000, NULL);
|
sequence->buf = spdk_dma_zmalloc(0x1000, 0x1000, NULL);
|
||||||
|
|
||||||
rc = spdk_nvme_ns_cmd_read(ns_entry->ns, ns_entry->qpair, sequence->buf,
|
rc = spdk_nvme_ns_cmd_read(ns_entry->ns, ns_entry->qpair, sequence->buf,
|
||||||
@ -169,7 +174,21 @@ hello_world(void)
|
|||||||
* will be pinned, which is required for data buffers used for SPDK NVMe
|
* will be pinned, which is required for data buffers used for SPDK NVMe
|
||||||
* I/O operations.
|
* I/O operations.
|
||||||
*/
|
*/
|
||||||
sequence.buf = spdk_dma_zmalloc(0x1000, 0x1000, NULL);
|
sequence.using_cmb_io = 1;
|
||||||
|
sequence.buf = spdk_nvme_ctrlr_alloc_cmb_io_buffer(ns_entry->ctrlr, 0x1000);
|
||||||
|
if (sequence.buf == NULL) {
|
||||||
|
sequence.using_cmb_io = 0;
|
||||||
|
sequence.buf = spdk_dma_zmalloc(0x1000, 0x1000, NULL);
|
||||||
|
}
|
||||||
|
if (sequence.buf == NULL) {
|
||||||
|
printf("ERROR: write buffer allocation failed\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (sequence.using_cmb_io) {
|
||||||
|
printf("INFO: using controller memory buffer for IO\n");
|
||||||
|
} else {
|
||||||
|
printf("INFO: using host memory buffer for IO\n");
|
||||||
|
}
|
||||||
sequence.is_completed = 0;
|
sequence.is_completed = 0;
|
||||||
sequence.ns_entry = ns_entry;
|
sequence.ns_entry = ns_entry;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user