diff --git a/CHANGELOG.md b/CHANGELOG.md index 2924487f3..f31b0f493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -115,6 +115,9 @@ tag that was logged at least once. Added `transport_tos` to `spdk_nvme_ctrlr_opts` to support setting of the "type of service" value in the IPv4 header. Only RDMA is supported at this time. +Added API spdk_nvme_qpair_get_num_outstanding_reqs to get the number of outstanding reqs of +a specified qpair. + ### bdev_nvme Updated `bdev_nvme_set_options` RPC (and rpc.py) to support the new `transport_tos` parameter. diff --git a/include/spdk/nvme.h b/include/spdk/nvme.h index b36bbc395..3920fa727 100644 --- a/include/spdk/nvme.h +++ b/include/spdk/nvme.h @@ -3791,6 +3791,20 @@ void spdk_nvme_qpair_print_completion(struct spdk_nvme_qpair *qpair, */ uint16_t spdk_nvme_qpair_get_id(struct spdk_nvme_qpair *qpair); +/** + * Gets the number of outstanding requests for the specified qpair. + * + * This number is not decremented until after a request's callback function is completed. + * + * This number is not matched necessarily to the number of NVMe commands submitted by the + * user. For example, nvme driver may split a request due to MDTS limitations, that will + * also allocate a request for the parent, etc. + * + * \param qpair Pointer to the NVMe queue pair. + * \returns number of outstanding requests for the specified qpair. + */ +uint32_t spdk_nvme_qpair_get_num_outstanding_reqs(struct spdk_nvme_qpair *qpair); + /** * \brief Prints (SPDK_NOTICELOG) the contents of an NVMe submission queue entry (command). * diff --git a/lib/nvme/nvme_qpair.c b/lib/nvme/nvme_qpair.c index e79e00b9c..b317b9322 100644 --- a/lib/nvme/nvme_qpair.c +++ b/lib/nvme/nvme_qpair.c @@ -1197,3 +1197,9 @@ spdk_nvme_qpair_get_id(struct spdk_nvme_qpair *qpair) { return qpair->id; } + +uint32_t +spdk_nvme_qpair_get_num_outstanding_reqs(struct spdk_nvme_qpair *qpair) +{ + return qpair->num_outstanding_reqs; +} diff --git a/lib/nvme/spdk_nvme.map b/lib/nvme/spdk_nvme.map index c29ab50e9..8b56b06bc 100644 --- a/lib/nvme/spdk_nvme.map +++ b/lib/nvme/spdk_nvme.map @@ -178,6 +178,7 @@ spdk_nvme_qpair_print_command; spdk_nvme_qpair_print_completion; spdk_nvme_qpair_get_id; + spdk_nvme_qpair_get_num_outstanding_reqs; spdk_nvme_print_command; spdk_nvme_print_completion;