Skip to content

Commit

Permalink
nvme: add spdk_nvme_ctrlr_get_max_sges
Browse files Browse the repository at this point in the history
Signed-off-by: Jim Harris <[email protected]>
Change-Id: I41ecc9243c8d5b3969e9cc13dde9a538b13d71a3
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21956
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <[email protected]>
Reviewed-by: Shuhei Matsumoto <[email protected]>
Reviewed-by: Konrad Sztyber <[email protected]>
  • Loading branch information
jimharris authored and ksztyber committed Feb 26, 2024
1 parent c522a81 commit 6f3e277
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ SPDK applications can now start with `--wait-for-rpc` and JSON configuration pro
Function `spdk_subsystem_init_from_json_config` is deprecated and will be removed in 24.09 release.
Please use `spdk_subsystem_load_config` instead.

### nvme

Added `spdk_nvme_ctrlr_get_max_sges`.

### bdev_uring

Added `bdev_uring_rescan` RPC to allow rescaning the size of uring bdev.
Expand Down
11 changes: 11 additions & 0 deletions include/spdk/nvme.h
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,17 @@ struct spdk_pci_device *spdk_nvme_ctrlr_get_pci_device(struct spdk_nvme_ctrlr *c
*/
uint32_t spdk_nvme_ctrlr_get_max_xfer_size(const struct spdk_nvme_ctrlr *ctrlr);

/**
* Get the maximum number of SGEs per request for the given NVMe controller.
*
* Controllers that do not support SGL will return UINT16_MAX.
*
* \param ctrlr Opaque handle to NVMe controller.
*
* \return Maximum number of SGEs per request
*/
uint16_t spdk_nvme_ctrlr_get_max_sges(const struct spdk_nvme_ctrlr *ctrlr);

/**
* Check whether the nsid is an active nv for the given NVMe controller.
*
Expand Down
10 changes: 10 additions & 0 deletions lib/nvme/nvme_ctrlr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4571,6 +4571,16 @@ spdk_nvme_ctrlr_get_max_xfer_size(const struct spdk_nvme_ctrlr *ctrlr)
return ctrlr->max_xfer_size;
}

uint16_t
spdk_nvme_ctrlr_get_max_sges(const struct spdk_nvme_ctrlr *ctrlr)
{
if (ctrlr->flags & SPDK_NVME_CTRLR_SGL_SUPPORTED) {
return ctrlr->max_sges;
} else {
return UINT16_MAX;
}
}

void
spdk_nvme_ctrlr_register_aer_callback(struct spdk_nvme_ctrlr *ctrlr,
spdk_nvme_aer_cb aer_cb_fn,
Expand Down
1 change: 1 addition & 0 deletions lib/nvme/spdk_nvme.map
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
spdk_nvme_ctrlr_get_num_ns;
spdk_nvme_ctrlr_get_pci_device;
spdk_nvme_ctrlr_get_max_xfer_size;
spdk_nvme_ctrlr_get_max_sges;
spdk_nvme_ctrlr_is_active_ns;
spdk_nvme_ctrlr_get_first_active_ns;
spdk_nvme_ctrlr_get_next_active_ns;
Expand Down

0 comments on commit 6f3e277

Please sign in to comment.