diff --git a/CHANGELOG.md b/CHANGELOG.md index f95724caf..32bd56daf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,11 @@ Added `blobfs_set_cache_size` RPC method to set cache size for blobstore filesys `spdk_pipe`, a new utility for buffering data from sockets or files for parsing has been added. The public API is available at `include/spdk/pipe.h`. +### nvme + +`delayed_pcie_doorbell` parameter in `spdk_nvme_io_qpair_opts` was renamed to `delay_cmd_submit` +to allow reuse in other transports. + ## v19.10: ### rpc diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 14cba2a7f..cfe4ab04e 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -313,7 +313,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, } spdk_nvme_ctrlr_get_default_io_qpair_opts(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts)); - qpopts.delay_pcie_doorbell = true; + qpopts.delay_cmd_submit = true; fio_qpair->qpair = spdk_nvme_ctrlr_alloc_io_qpair(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts)); if (!fio_qpair->qpair) { diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 2d4ee623e..037b84e12 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -597,7 +597,7 @@ nvme_init_ns_worker_ctx(struct ns_worker_ctx *ns_ctx) if (opts.io_queue_requests < entry->num_io_requests) { opts.io_queue_requests = entry->num_io_requests; } - opts.delay_pcie_doorbell = true; + opts.delay_cmd_submit = true; for (i = 0; i < ns_ctx->u.nvme.num_qpairs; i++) { ns_ctx->u.nvme.qpair[i] = spdk_nvme_ctrlr_alloc_io_qpair(entry->u.nvme.ctrlr, &opts, diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index 2de252076..968c5a870 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1032,14 +1032,22 @@ struct spdk_nvme_io_qpair_opts { /** * When submitting I/O via spdk_nvme_ns_read/write and similar functions, - * don't immediately write the submission queue doorbell. Instead, write - * to the doorbell as necessary inside spdk_nvme_qpair_process_completions(). + * don't immediately submit it to hardware. Instead, queue up new commands + * and submit them to the hardware inside spdk_nvme_qpair_process_completions(). * - * This results in better batching of I/O submission and consequently fewer - * MMIO writes to the doorbell, which may increase performance. + * This results in better batching of I/O commands. Often, it is more efficient + * to submit batches of commands to the underlying hardware than each command + * individually. * - * This only applies to local PCIe devices. */ - bool delay_pcie_doorbell; + * This only applies to PCIe and RDMA transports. + * + * The flag was originally named delay_pcie_doorbell. To allow backward compatibility + * both names are kept in unnamed union. + */ + union { + bool delay_cmd_submit; + bool delay_pcie_doorbell; + }; /** * These fields allow specifying the memory buffers for the submission and/or diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index 610559742..ddcd9426b 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -253,8 +253,8 @@ spdk_nvme_ctrlr_get_default_io_qpair_opts(struct spdk_nvme_ctrlr *ctrlr, opts->io_queue_requests = ctrlr->opts.io_queue_requests; } - if (FIELD_OK(delay_pcie_doorbell)) { - opts->delay_pcie_doorbell = false; + if (FIELD_OK(delay_cmd_submit)) { + opts->delay_cmd_submit = false; } if (FIELD_OK(sq.vaddr)) { diff --git a/lib/nvme/nvme_pcie.c b/lib/nvme/nvme_pcie.c index cf4aa2b2c..839746678 100644 --- a/lib/nvme/nvme_pcie.c +++ b/lib/nvme/nvme_pcie.c @@ -1,9 +1,9 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * Copyright (c) 2017, IBM Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2017, IBM Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -165,7 +165,7 @@ struct nvme_pcie_qpair { struct { uint8_t phase : 1; - uint8_t delay_pcie_doorbell : 1; + uint8_t delay_cmd_submit : 1; uint8_t has_shadow_doorbell : 1; } flags; @@ -702,7 +702,7 @@ nvme_pcie_ctrlr_construct_admin_qpair(struct spdk_nvme_ctrlr *ctrlr) } pqpair->num_entries = NVME_ADMIN_ENTRIES; - pqpair->flags.delay_pcie_doorbell = 0; + pqpair->flags.delay_cmd_submit = 0; ctrlr->adminq = &pqpair->qpair; @@ -1300,7 +1300,7 @@ nvme_pcie_qpair_submit_tracker(struct spdk_nvme_qpair *qpair, struct nvme_tracke SPDK_ERRLOG("sq_tail is passing sq_head!\n"); } - if (!pqpair->flags.delay_pcie_doorbell) { + if (!pqpair->flags.delay_cmd_submit) { nvme_pcie_qpair_ring_sq_doorbell(qpair); } } @@ -1613,7 +1613,7 @@ nvme_pcie_ctrlr_create_io_qpair(struct spdk_nvme_ctrlr *ctrlr, uint16_t qid, } pqpair->num_entries = opts->io_queue_size; - pqpair->flags.delay_pcie_doorbell = opts->delay_pcie_doorbell; + pqpair->flags.delay_cmd_submit = opts->delay_cmd_submit; qpair = &pqpair->qpair; @@ -2143,7 +2143,7 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_ nvme_pcie_qpair_ring_cq_doorbell(qpair); } - if (pqpair->flags.delay_pcie_doorbell) { + if (pqpair->flags.delay_cmd_submit) { if (pqpair->last_sq_tail != pqpair->sq_tail) { nvme_pcie_qpair_ring_sq_doorbell(qpair); pqpair->last_sq_tail = pqpair->sq_tail; diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 3865f831a..dab3a4732 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -1,8 +1,8 @@ /*- * BSD LICENSE * - * Copyright (c) Intel Corporation. - * All rights reserved. + * Copyright (c) Intel Corporation. All rights reserved. + * Copyright (c) 2019 Mellanox Technologies LTD. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -326,7 +326,7 @@ _bdev_nvme_reset_create_qpair(struct spdk_io_channel_iter *i) struct spdk_nvme_io_qpair_opts opts; spdk_nvme_ctrlr_get_default_io_qpair_opts(nvme_bdev_ctrlr->ctrlr, &opts, sizeof(opts)); - opts.delay_pcie_doorbell = true; + opts.delay_cmd_submit = true; nvme_ch->qpair = spdk_nvme_ctrlr_alloc_io_qpair(nvme_bdev_ctrlr->ctrlr, &opts, sizeof(opts)); if (!nvme_ch->qpair) { @@ -608,7 +608,7 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf) #endif spdk_nvme_ctrlr_get_default_io_qpair_opts(nvme_bdev_ctrlr->ctrlr, &opts, sizeof(opts)); - opts.delay_pcie_doorbell = true; + opts.delay_cmd_submit = true; opts.io_queue_requests = spdk_max(g_opts.io_queue_requests, opts.io_queue_requests); g_opts.io_queue_requests = opts.io_queue_requests;