4 * Copyright (c) Intel Corporation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 * NVMe driver public API
50 #include "spdk/nvme_spec.h"
51 #include "spdk/nvmf_spec.h"
53 #define SPDK_NVME_DEFAULT_RETRY_COUNT (4)
54 extern int32_t spdk_nvme_retry_count
;
58 /** \brief Opaque handle to a controller. Returned by \ref spdk_nvme_probe()'s attach_cb. */
59 struct spdk_nvme_ctrlr
;
62 * \brief NVMe controller initialization options.
64 * A pointer to this structure will be provided for each probe callback from spdk_nvme_probe() to
65 * allow the user to request non-default options, and the actual options enabled on the controller
66 * will be provided during the attach callback.
68 struct spdk_nvme_ctrlr_opts
{
70 * Number of I/O queues to request (used to set Number of Queues feature)
72 uint32_t num_io_queues
;
75 * Enable submission queue in controller memory buffer
80 * Type of arbitration mechanism
82 enum spdk_nvme_cc_ams arb_mechanism
;
85 * Keep alive timeout in milliseconds (0 = disabled).
87 * The NVMe library will set the Keep Alive Timer feature to this value and automatically
88 * send Keep Alive commands as needed. The library user must call
89 * spdk_nvme_ctrlr_process_admin_completions() periodically to ensure Keep Alive commands
92 uint32_t keep_alive_timeout_ms
;
95 * Specify the retry number when there is issue with the transport
97 int transport_retry_count
;
100 * The queue depth of each NVMe I/O queue.
102 uint32_t io_queue_size
;
105 * The host NQN to use when connecting to NVMe over Fabrics controllers.
107 * Unused for local PCIe-attached NVMe devices.
109 char hostnqn
[SPDK_NVMF_NQN_MAX_LEN
+ 1];
112 * The number of requests to allocate for each NVMe I/O queue.
114 * This should be at least as large as io_queue_size.
116 * A single I/O may allocate more than one request, since splitting may be necessary to
117 * conform to the device's maximum transfer size, PRP list compatibility requirements,
118 * or driver-assisted striping.
120 uint32_t io_queue_requests
;
124 * NVMe library transports
126 * NOTE: These are mapped directly to the NVMe over Fabrics TRTYPE values, except for PCIe,
127 * which is a special case since NVMe over Fabrics does not define a TRTYPE for local PCIe.
129 * Currently, this uses 256 for PCIe which is intentionally outside of the 8-bit range of TRTYPE.
130 * If the NVMe-oF specification ever defines a PCIe TRTYPE, this should be updated.
132 enum spdk_nvme_transport_type
{
134 * PCIe Transport (locally attached devices)
136 SPDK_NVME_TRANSPORT_PCIE
= 256,
139 * RDMA Transport (RoCE, iWARP, etc.)
141 SPDK_NVME_TRANSPORT_RDMA
= SPDK_NVMF_TRTYPE_RDMA
,
145 * NVMe transport identifier.
147 * This identifies a unique endpoint on an NVMe fabric.
149 * A string representation of a transport ID may be converted to this type using
150 * spdk_nvme_transport_id_parse().
152 struct spdk_nvme_transport_id
{
154 * NVMe transport type.
156 enum spdk_nvme_transport_type trtype
;
159 * Address family of the transport address.
161 * For PCIe, this value is ignored.
163 enum spdk_nvmf_adrfam adrfam
;
166 * Transport address of the NVMe-oF endpoint. For transports which use IP
167 * addressing (e.g. RDMA), this should be an IP address. For PCIe, this
168 * can either be a zero length string (the whole bus) or a PCI address
169 * in the format DDDD:BB:DD.FF
171 char traddr
[SPDK_NVMF_TRADDR_MAX_LEN
+ 1];
174 * Transport service id of the NVMe-oF endpoint. For transports which use
175 * IP addressing (e.g. RDMA), this field shoud be the port number. For PCIe,
176 * this is always a zero length string.
178 char trsvcid
[SPDK_NVMF_TRSVCID_MAX_LEN
+ 1];
181 * Subsystem NQN of the NVMe over Fabrics endpoint. May be a zero length string.
183 char subnqn
[SPDK_NVMF_NQN_MAX_LEN
+ 1];
187 * Parse the string representation of a transport ID.
189 * \param trid Output transport ID structure (must be allocated and initialized by caller).
190 * \param str Input string representation of a transport ID to parse.
191 * \return 0 if parsing was successful and trid is filled out, or negated errno values on failure.
193 * str must be a zero-terminated C string containing one or more key:value pairs separated by
197 * ------------ | -----
198 * trtype | Transport type (e.g. PCIe, RDMA)
199 * adrfam | Address family (e.g. IPv4, IPv6)
200 * traddr | Transport address (e.g. 0000:04:00.0 for PCIe or 192.168.100.8 for RDMA)
201 * trsvcid | Transport service identifier (e.g. 4420)
202 * subnqn | Subsystem NQN
204 * Unspecified fields of trid are left unmodified, so the caller must initialize trid (for example,
205 * memset() to 0) before calling this function.
207 int spdk_nvme_transport_id_parse(struct spdk_nvme_transport_id
*trid
, const char *str
);
210 * Parse the string representation of a transport ID tranport type.
212 * \param trtype Output transport type (allocated by caller).
213 * \param str Input string representation of transport type (e.g. "PCIe", "RDMA")
214 * \return 0 if parsing was successful and trtype is filled out, or negated errno values on failure.
216 int spdk_nvme_transport_id_parse_trtype(enum spdk_nvme_transport_type
*trtype
, const char *str
);
219 * Parse the string representation of a tranport ID address family.
221 * \param adrfam Output address family (allocated by caller).
222 * \param str Input string representation of address family (e.g. "IPv4", "IPv6")
223 * \return 0 if parsing was successful and adrfam is filled out, or negated errno values on failure.
225 int spdk_nvme_transport_id_parse_adrfam(enum spdk_nvmf_adrfam
*adrfam
, const char *str
);
228 * Compare two transport IDs.
230 * \param trid1 First transport ID to compare.
231 * \param trid2 Second transport ID to compare.
233 * \return 0 if trid1 == trid2, less than 0 if trid1 < trid2, greater than 0 if trid1 > trid2.
235 * The result of this function may be used to sort transport IDs in a consistent order; however,
236 * the comparison result is not guaranteed to be consistent across library versions.
238 * This function uses a case-insensitive comparison for string fields, but it does not otherwise
239 * normalize the transport ID. It is the caller's responsibility to provide the transport IDs in
240 * a consistent format.
242 int spdk_nvme_transport_id_compare(const struct spdk_nvme_transport_id
*trid1
,
243 const struct spdk_nvme_transport_id
*trid2
);
246 * Determine whether the NVMe library can handle a specific NVMe over Fabrics transport type.
248 * \param trtype NVMe over Fabrics transport type to check.
250 * \return true if trtype is supported or false if it is not supported.
252 bool spdk_nvme_transport_available(enum spdk_nvme_transport_type trtype
);
255 * Callback for spdk_nvme_probe() enumeration.
257 * \param opts NVMe controller initialization options. This structure will be populated with the
258 * default values on entry, and the user callback may update any options to request a different
259 * value. The controller may not support all requested parameters, so the final values will be
260 * provided during the attach callback.
261 * \return true to attach to this device.
263 typedef bool (*spdk_nvme_probe_cb
)(void *cb_ctx
, const struct spdk_nvme_transport_id
*trid
,
264 struct spdk_nvme_ctrlr_opts
*opts
);
267 * Callback for spdk_nvme_probe() to report a device that has been attached to the userspace NVMe driver.
269 * \param opts NVMe controller initialization options that were actually used. Options may differ
270 * from the requested options from the probe call depending on what the controller supports.
272 typedef void (*spdk_nvme_attach_cb
)(void *cb_ctx
, const struct spdk_nvme_transport_id
*trid
,
273 struct spdk_nvme_ctrlr
*ctrlr
,
274 const struct spdk_nvme_ctrlr_opts
*opts
);
277 * Callback for spdk_nvme_probe() to report that a device attached to the userspace NVMe driver
278 * has been removed from the system.
280 * The controller will remain in a failed state (any new I/O submitted will fail).
282 * The controller must be detached from the userspace driver by calling spdk_nvme_detach()
283 * once the controller is no longer in use. It is up to the library user to ensure that
284 * no other threads are using the controller before calling spdk_nvme_detach().
286 * \param ctrlr NVMe controller instance that was removed.
288 typedef void (*spdk_nvme_remove_cb
)(void *cb_ctx
, struct spdk_nvme_ctrlr
*ctrlr
);
291 * \brief Enumerate the bus indicated by the transport ID and attach the userspace NVMe driver
292 * to each device found if desired.
294 * \param trid The transport ID indicating which bus to enumerate. If the trtype is PCIe or trid is NULL,
295 * this will scan the local PCIe bus. If the trtype is RDMA, the traddr and trsvcid must point at the
296 * location of an NVMe-oF discovery service.
297 * \param cb_ctx Opaque value which will be passed back in cb_ctx parameter of the callbacks.
298 * \param probe_cb will be called once per NVMe device found in the system.
299 * \param attach_cb will be called for devices for which probe_cb returned true once that NVMe
300 * controller has been attached to the userspace driver.
301 * \param remove_cb will be called for devices that were attached in a previous spdk_nvme_probe()
302 * call but are no longer attached to the system. Optional; specify NULL if removal notices are not
305 * This function is not thread safe and should only be called from one thread at a time while no
306 * other threads are actively using any NVMe devices.
308 * If called from a secondary process, only devices that have been attached to the userspace driver
309 * in the primary process will be probed.
311 * If called more than once, only devices that are not already attached to the SPDK NVMe driver
314 * To stop using the the controller and release its associated resources,
315 * call \ref spdk_nvme_detach with the spdk_nvme_ctrlr instance returned by this function.
317 int spdk_nvme_probe(const struct spdk_nvme_transport_id
*trid
,
319 spdk_nvme_probe_cb probe_cb
,
320 spdk_nvme_attach_cb attach_cb
,
321 spdk_nvme_remove_cb remove_cb
);
324 * \brief Detaches specified device returned by \ref spdk_nvme_probe()'s attach_cb from the NVMe driver.
326 * On success, the spdk_nvme_ctrlr handle is no longer valid.
328 * This function should be called from a single thread while no other threads
329 * are actively using the NVMe device.
332 int spdk_nvme_detach(struct spdk_nvme_ctrlr
*ctrlr
);
335 * \brief Perform a full hardware reset of the NVMe controller.
337 * This function should be called from a single thread while no other threads
338 * are actively using the NVMe device.
340 * Any pointers returned from spdk_nvme_ctrlr_get_ns() and spdk_nvme_ns_get_data() may be invalidated
341 * by calling this function. The number of namespaces as returned by spdk_nvme_ctrlr_get_num_ns() may
344 int spdk_nvme_ctrlr_reset(struct spdk_nvme_ctrlr
*ctrlr
);
347 * \brief Get the identify controller data as defined by the NVMe specification.
349 * This function is thread safe and can be called at any point while the controller is attached to
350 * the SPDK NVMe driver.
353 const struct spdk_nvme_ctrlr_data
*spdk_nvme_ctrlr_get_data(struct spdk_nvme_ctrlr
*ctrlr
);
356 * \brief Get the NVMe controller CSTS (Status) register.
358 union spdk_nvme_csts_register
spdk_nvme_ctrlr_get_regs_csts(struct spdk_nvme_ctrlr
*ctrlr
);
361 * \brief Get the NVMe controller CAP (Capabilities) register.
363 union spdk_nvme_cap_register
spdk_nvme_ctrlr_get_regs_cap(struct spdk_nvme_ctrlr
*ctrlr
);
366 * \brief Get the NVMe controller VS (Version) register.
368 union spdk_nvme_vs_register
spdk_nvme_ctrlr_get_regs_vs(struct spdk_nvme_ctrlr
*ctrlr
);
371 * \brief Get the number of namespaces for the given NVMe controller.
373 * This function is thread safe and can be called at any point while the controller is attached to
374 * the SPDK NVMe driver.
376 * This is equivalent to calling spdk_nvme_ctrlr_get_data() to get the
377 * spdk_nvme_ctrlr_data and then reading the nn field.
380 uint32_t spdk_nvme_ctrlr_get_num_ns(struct spdk_nvme_ctrlr
*ctrlr
);
383 * \brief Determine if a particular log page is supported by the given NVMe controller.
385 * This function is thread safe and can be called at any point while the controller is attached to
386 * the SPDK NVMe driver.
388 * \sa spdk_nvme_ctrlr_cmd_get_log_page()
390 bool spdk_nvme_ctrlr_is_log_page_supported(struct spdk_nvme_ctrlr
*ctrlr
, uint8_t log_page
);
393 * \brief Determine if a particular feature is supported by the given NVMe controller.
395 * This function is thread safe and can be called at any point while the controller is attached to
396 * the SPDK NVMe driver.
398 * \sa spdk_nvme_ctrlr_cmd_get_feature()
400 bool spdk_nvme_ctrlr_is_feature_supported(struct spdk_nvme_ctrlr
*ctrlr
, uint8_t feature_code
);
403 * Signature for callback function invoked when a command is completed.
405 * The spdk_nvme_cpl parameter contains the completion status.
407 typedef void (*spdk_nvme_cmd_cb
)(void *, const struct spdk_nvme_cpl
*);
410 * Signature for callback function invoked when an asynchronous error
411 * request command is completed.
413 * The aer_cb_arg parameter is set to the context specified by
414 * spdk_nvme_register_aer_callback().
415 * The spdk_nvme_cpl parameter contains the completion status of the
416 * asynchronous event request that was completed.
418 typedef void (*spdk_nvme_aer_cb
)(void *aer_cb_arg
,
419 const struct spdk_nvme_cpl
*);
421 void spdk_nvme_ctrlr_register_aer_callback(struct spdk_nvme_ctrlr
*ctrlr
,
422 spdk_nvme_aer_cb aer_cb_fn
,
426 * \brief Opaque handle to a queue pair.
428 * I/O queue pairs may be allocated using spdk_nvme_ctrlr_alloc_io_qpair().
430 struct spdk_nvme_qpair
;
433 * Signature for the callback function invoked when a timeout is
434 * detected on a request.
435 * For timeouts detected on the admin queue pair, the qpair returned
438 typedef void (*spdk_nvme_timeout_cb
)(void *cb_arg
,
439 struct spdk_nvme_ctrlr
*ctrlr
,
440 struct spdk_nvme_qpair
*qpair
,
444 * \brief Register for timeout callback on a controller.
446 * The application can choose to register for timeout callback or not register
447 * for timeout callback.
449 * \param ctrlr NVMe controller on which to monitor for timeout.
450 * \param timeout_sec Timeout value in seconds.
451 * \param cb_fn A function pointer that points to the callback function
452 * \param cb_arg Argument to the callback function.
454 void spdk_nvme_ctrlr_register_timeout_callback(struct spdk_nvme_ctrlr
*ctrlr
,
455 uint32_t timeout_sec
, spdk_nvme_timeout_cb cb_fn
, void *cb_arg
);
458 * \brief Allocate an I/O queue pair (submission and completion queue).
460 * Each queue pair should only be used from a single thread at a time (mutual exclusion must be
461 * enforced by the user).
463 * \param ctrlr NVMe controller for which to allocate the I/O queue pair.
464 * \param qprio Queue priority for weighted round robin arbitration. If a different arbitration
465 * method is in use, pass 0.
467 struct spdk_nvme_qpair
*spdk_nvme_ctrlr_alloc_io_qpair(struct spdk_nvme_ctrlr
*ctrlr
,
468 enum spdk_nvme_qprio qprio
);
471 * \brief Free an I/O queue pair that was allocated by spdk_nvme_ctrlr_alloc_io_qpair().
473 int spdk_nvme_ctrlr_free_io_qpair(struct spdk_nvme_qpair
*qpair
);
476 * \brief Send the given NVM I/O command to the NVMe controller.
478 * This is a low level interface for submitting I/O commands directly. Prefer
479 * the spdk_nvme_ns_cmd_* functions instead. The validity of the command will
482 * When constructing the nvme_command it is not necessary to fill out the PRP
483 * list/SGL or the CID. The driver will handle both of those for you.
485 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
486 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
488 int spdk_nvme_ctrlr_cmd_io_raw(struct spdk_nvme_ctrlr
*ctrlr
,
489 struct spdk_nvme_qpair
*qpair
,
490 struct spdk_nvme_cmd
*cmd
,
491 void *buf
, uint32_t len
,
492 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
495 * \brief Process any outstanding completions for I/O submitted on a queue pair.
497 * This call is non-blocking, i.e. it only
498 * processes completions that are ready at the time of this function call. It does not
499 * wait for outstanding commands to finish.
501 * For each completed command, the request's callback function will
502 * be called if specified as non-NULL when the request was submitted.
504 * \param qpair Queue pair to check for completions.
505 * \param max_completions Limit the number of completions to be processed in one call, or 0
508 * \return Number of completions processed (may be 0) or negative on error.
510 * \sa spdk_nvme_cmd_cb
512 * This function may be called at any point while the controller is attached to
513 * the SPDK NVMe driver.
515 * The caller must ensure that each queue pair is only used from one thread at a time.
517 int32_t spdk_nvme_qpair_process_completions(struct spdk_nvme_qpair
*qpair
,
518 uint32_t max_completions
);
521 * \brief Send the given admin command to the NVMe controller.
523 * This is a low level interface for submitting admin commands directly. Prefer
524 * the spdk_nvme_ctrlr_cmd_* functions instead. The validity of the command will
527 * When constructing the nvme_command it is not necessary to fill out the PRP
528 * list/SGL or the CID. The driver will handle both of those for you.
530 * This function is thread safe and can be called at any point while the controller is attached to
531 * the SPDK NVMe driver.
533 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
534 * of commands submitted through this function.
536 int spdk_nvme_ctrlr_cmd_admin_raw(struct spdk_nvme_ctrlr
*ctrlr
,
537 struct spdk_nvme_cmd
*cmd
,
538 void *buf
, uint32_t len
,
539 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
542 * \brief Process any outstanding completions for admin commands.
544 * This will process completions for admin commands submitted on any thread.
546 * This call is non-blocking, i.e. it only processes completions that are ready
547 * at the time of this function call. It does not wait for outstanding commands to
550 * \return Number of completions processed (may be 0) or negative on error.
552 * This function is thread safe and can be called at any point while the controller is attached to
553 * the SPDK NVMe driver.
555 int32_t spdk_nvme_ctrlr_process_admin_completions(struct spdk_nvme_ctrlr
*ctrlr
);
558 /** \brief Opaque handle to a namespace. Obtained by calling spdk_nvme_ctrlr_get_ns(). */
562 * \brief Get a handle to a namespace for the given controller.
564 * Namespaces are numbered from 1 to the total number of namespaces. There will never
565 * be any gaps in the numbering. The number of namespaces is obtained by calling
566 * spdk_nvme_ctrlr_get_num_ns().
568 * This function is thread safe and can be called at any point while the controller is attached to
569 * the SPDK NVMe driver.
571 struct spdk_nvme_ns
*spdk_nvme_ctrlr_get_ns(struct spdk_nvme_ctrlr
*ctrlr
, uint32_t ns_id
);
574 * \brief Get a specific log page from the NVMe controller.
576 * \param ctrlr NVMe controller to query.
577 * \param log_page The log page identifier.
578 * \param nsid Depending on the log page, this may be 0, a namespace identifier, or SPDK_NVME_GLOBAL_NS_TAG.
579 * \param payload The pointer to the payload buffer.
580 * \param payload_size The size of payload buffer.
581 * \param offset Offset in bytes within the log page to start retrieving log page data.
582 * May only be non-zero if the controller supports extended data for Get Log Page
583 * as reported in the controller data log page attributes.
584 * \param cb_fn Callback function to invoke when the log page has been retrieved.
585 * \param cb_arg Argument to pass to the callback function.
587 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
589 * This function is thread safe and can be called at any point while the controller is attached to
590 * the SPDK NVMe driver.
592 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
593 * of commands submitted through this function.
595 * \sa spdk_nvme_ctrlr_is_log_page_supported()
597 int spdk_nvme_ctrlr_cmd_get_log_page(struct spdk_nvme_ctrlr
*ctrlr
,
598 uint8_t log_page
, uint32_t nsid
,
599 void *payload
, uint32_t payload_size
,
601 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
604 * \brief Abort a specific previously-submitted NVMe command.
606 * \param ctrlr NVMe controller to which the command was submitted.
607 * \param qpair NVMe queue pair to which the command was submitted.
608 * For admin commands, pass NULL for the qpair.
609 * \param cid Command ID of the command to abort.
610 * \param cb_fn Callback function to invoke when the abort has completed.
611 * \param cb_arg Argument to pass to the callback function.\
613 * \return 0 if successfully submitted, negated errno value otherwise.
615 * \sa spdk_nvme_ctrlr_register_timeout_callback()
617 int spdk_nvme_ctrlr_cmd_abort(struct spdk_nvme_ctrlr
*ctrlr
,
618 struct spdk_nvme_qpair
*qpair
,
620 spdk_nvme_cmd_cb cb_fn
,
624 * \brief Set specific feature for the given NVMe controller.
626 * \param ctrlr NVMe controller to manipulate.
627 * \param feature The feature identifier.
628 * \param cdw11 as defined by the specification for this command.
629 * \param cdw12 as defined by the specification for this command.
630 * \param payload The pointer to the payload buffer.
631 * \param payload_size The size of payload buffer.
632 * \param cb_fn Callback function to invoke when the feature has been set.
633 * \param cb_arg Argument to pass to the callback function.
635 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
637 * This function is thread safe and can be called at any point while the controller is attached to
638 * the SPDK NVMe driver.
640 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
641 * of commands submitted through this function.
643 * \sa spdk_nvme_ctrlr_cmd_get_feature()
645 int spdk_nvme_ctrlr_cmd_set_feature(struct spdk_nvme_ctrlr
*ctrlr
,
646 uint8_t feature
, uint32_t cdw11
, uint32_t cdw12
,
647 void *payload
, uint32_t payload_size
,
648 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
651 * \brief Get specific feature from given NVMe controller.
653 * \param ctrlr NVMe controller to query.
654 * \param feature The feature identifier.
655 * \param cdw11 as defined by the specification for this command.
656 * \param payload The pointer to the payload buffer.
657 * \param payload_size The size of payload buffer.
658 * \param cb_fn Callback function to invoke when the feature has been retrieved.
659 * \param cb_arg Argument to pass to the callback function.
661 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
663 * This function is thread safe and can be called at any point while the controller is attached to
664 * the SPDK NVMe driver.
666 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
667 * of commands submitted through this function.
669 * \sa spdk_nvme_ctrlr_cmd_set_feature()
671 int spdk_nvme_ctrlr_cmd_get_feature(struct spdk_nvme_ctrlr
*ctrlr
,
672 uint8_t feature
, uint32_t cdw11
,
673 void *payload
, uint32_t payload_size
,
674 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
677 * \brief Attach the specified namespace to controllers.
679 * \param ctrlr NVMe controller to use for command submission.
680 * \param nsid Namespace identifier for namespace to attach.
681 * \param payload The pointer to the controller list.
683 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
685 * This function is thread safe and can be called at any point after spdk_nvme_attach().
687 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
688 * of commands submitted through this function.
690 int spdk_nvme_ctrlr_attach_ns(struct spdk_nvme_ctrlr
*ctrlr
, uint32_t nsid
,
691 struct spdk_nvme_ctrlr_list
*payload
);
694 * \brief Detach the specified namespace from controllers.
696 * \param ctrlr NVMe controller to use for command submission.
697 * \param nsid Namespace ID to detach.
698 * \param payload The pointer to the controller list.
700 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
702 * This function is thread safe and can be called at any point after spdk_nvme_attach().
704 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
705 * of commands submitted through this function.
707 int spdk_nvme_ctrlr_detach_ns(struct spdk_nvme_ctrlr
*ctrlr
, uint32_t nsid
,
708 struct spdk_nvme_ctrlr_list
*payload
);
711 * \brief Create a namespace.
713 * \param ctrlr NVMe controller to create namespace on.
714 * \param payload The pointer to the NVMe namespace data.
716 * \return Namespace ID (>= 1) if successfully created, or 0 if the request failed.
718 * This function is thread safe and can be called at any point after spdk_nvme_attach().
720 uint32_t spdk_nvme_ctrlr_create_ns(struct spdk_nvme_ctrlr
*ctrlr
,
721 struct spdk_nvme_ns_data
*payload
);
724 * \brief Delete a namespace.
726 * \param ctrlr NVMe controller to delete namespace from.
727 * \param nsid The namespace identifier.
729 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
731 * This function is thread safe and can be called at any point after spdk_nvme_attach().
733 * Call \ref spdk_nvme_ctrlr_process_admin_completions() to poll for completion
734 * of commands submitted through this function.
736 int spdk_nvme_ctrlr_delete_ns(struct spdk_nvme_ctrlr
*ctrlr
, uint32_t nsid
);
741 * This function requests a low-level format of the media.
743 * \param ctrlr NVMe controller to format.
744 * \param nsid The namespace identifier. May be SPDK_NVME_GLOBAL_NS_TAG to format all namespaces.
745 * \param format The format information for the command.
747 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request
749 * This function is thread safe and can be called at any point after spdk_nvme_attach().
751 int spdk_nvme_ctrlr_format(struct spdk_nvme_ctrlr
*ctrlr
, uint32_t nsid
,
752 struct spdk_nvme_format
*format
);
755 * \brief Download a new firmware image.
757 * \param payload The data buffer for the firmware image.
758 * \param size The data size will be downloaded.
759 * \param slot The slot that the firmware image will be committed to.
761 * \return 0 if successfully submitted, ENOMEM if resources could not be allocated for this request,
762 * -1 if the size is not multiple of 4.
764 * This function is thread safe and can be called at any point after spdk_nvme_attach().
766 int spdk_nvme_ctrlr_update_firmware(struct spdk_nvme_ctrlr
*ctrlr
, void *payload
, uint32_t size
,
770 * \brief Get the identify namespace data as defined by the NVMe specification.
772 * This function is thread safe and can be called at any point while the controller is attached to
773 * the SPDK NVMe driver.
775 const struct spdk_nvme_ns_data
*spdk_nvme_ns_get_data(struct spdk_nvme_ns
*ns
);
778 * \brief Get the namespace id (index number) from the given namespace handle.
780 * This function is thread safe and can be called at any point while the controller is attached to
781 * the SPDK NVMe driver.
783 uint32_t spdk_nvme_ns_get_id(struct spdk_nvme_ns
*ns
);
786 * \brief Determine whether a namespace is active.
788 * Inactive namespaces cannot be the target of I/O commands.
790 bool spdk_nvme_ns_is_active(struct spdk_nvme_ns
*ns
);
793 * \brief Get the maximum transfer size, in bytes, for an I/O sent to the given namespace.
795 * This function is thread safe and can be called at any point while the controller is attached to
796 * the SPDK NVMe driver.
798 uint32_t spdk_nvme_ns_get_max_io_xfer_size(struct spdk_nvme_ns
*ns
);
801 * \brief Get the sector size, in bytes, of the given namespace.
803 * This function is thread safe and can be called at any point while the controller is attached to
804 * the SPDK NVMe driver.
806 uint32_t spdk_nvme_ns_get_sector_size(struct spdk_nvme_ns
*ns
);
809 * \brief Get the number of sectors for the given namespace.
811 * This function is thread safe and can be called at any point while the controller is attached to
812 * the SPDK NVMe driver.
814 uint64_t spdk_nvme_ns_get_num_sectors(struct spdk_nvme_ns
*ns
);
817 * \brief Get the size, in bytes, of the given namespace.
819 * This function is thread safe and can be called at any point while the controller is attached to
820 * the SPDK NVMe driver.
822 uint64_t spdk_nvme_ns_get_size(struct spdk_nvme_ns
*ns
);
825 * \brief Get the end-to-end data protection information type of the given namespace.
827 * This function is thread safe and can be called at any point while the controller is attached to
828 * the SPDK NVMe driver.
830 enum spdk_nvme_pi_type
spdk_nvme_ns_get_pi_type(struct spdk_nvme_ns
*ns
);
833 * \brief Get the metadata size, in bytes, of the given namespace.
835 * This function is thread safe and can be called at any point while the controller is attached to
836 * the SPDK NVMe driver.
838 uint32_t spdk_nvme_ns_get_md_size(struct spdk_nvme_ns
*ns
);
841 * \brief True if the namespace can support extended LBA when end-to-end data protection enabled.
843 * This function is thread safe and can be called at any point while the controller is attached to
844 * the SPDK NVMe driver.
846 bool spdk_nvme_ns_supports_extended_lba(struct spdk_nvme_ns
*ns
);
849 * \brief Namespace command support flags.
851 enum spdk_nvme_ns_flags
{
852 SPDK_NVME_NS_DEALLOCATE_SUPPORTED
= 0x1, /**< The deallocate command is supported */
853 SPDK_NVME_NS_FLUSH_SUPPORTED
= 0x2, /**< The flush command is supported */
854 SPDK_NVME_NS_RESERVATION_SUPPORTED
= 0x4, /**< The reservation command is supported */
855 SPDK_NVME_NS_WRITE_ZEROES_SUPPORTED
= 0x8, /**< The write zeroes command is supported */
856 SPDK_NVME_NS_DPS_PI_SUPPORTED
= 0x10, /**< The end-to-end data protection is supported */
857 SPDK_NVME_NS_EXTENDED_LBA_SUPPORTED
= 0x20, /**< The extended lba format is supported,
858 metadata is transferred as a contiguous
859 part of the logical block that it is associated with */
863 * \brief Get the flags for the given namespace.
865 * See spdk_nvme_ns_flags for the possible flags returned.
867 * This function is thread safe and can be called at any point while the controller is attached to
868 * the SPDK NVMe driver.
870 uint32_t spdk_nvme_ns_get_flags(struct spdk_nvme_ns
*ns
);
873 * Restart the SGL walk to the specified offset when the command has scattered payloads.
875 * The cb_arg parameter is the value passed to readv/writev.
877 typedef void (*spdk_nvme_req_reset_sgl_cb
)(void *cb_arg
, uint32_t offset
);
880 * Fill out *address and *length with the current SGL entry and advance to the next
881 * entry for the next time the callback is invoked.
883 * The cb_arg parameter is the value passed to readv/writev.
884 * The address parameter contains the virtual address of this segment.
885 * The length parameter contains the length of this physical segment.
887 typedef int (*spdk_nvme_req_next_sge_cb
)(void *cb_arg
, void **address
, uint32_t *length
);
890 * \brief Submits a write I/O to the specified NVMe namespace.
892 * \param ns NVMe namespace to submit the write I/O
893 * \param qpair I/O queue pair to submit the request
894 * \param payload virtual address pointer to the data payload
895 * \param lba starting LBA to write the data
896 * \param lba_count length (in sectors) for the write operation
897 * \param cb_fn callback function to invoke when the I/O is completed
898 * \param cb_arg argument to pass to the callback function
899 * \param io_flags set flags, defined by the SPDK_NVME_IO_FLAGS_* entries
900 * in spdk/nvme_spec.h, for this I/O.
902 * \return 0 if successfully submitted, ENOMEM if an nvme_request
903 * structure cannot be allocated for the I/O request
905 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
906 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
908 int spdk_nvme_ns_cmd_write(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
, void *payload
,
909 uint64_t lba
, uint32_t lba_count
, spdk_nvme_cmd_cb cb_fn
,
910 void *cb_arg
, uint32_t io_flags
);
913 * \brief Submits a write I/O to the specified NVMe namespace.
915 * \param ns NVMe namespace to submit the write I/O
916 * \param qpair I/O queue pair to submit the request
917 * \param lba starting LBA to write the data
918 * \param lba_count length (in sectors) for the write operation
919 * \param cb_fn callback function to invoke when the I/O is completed
920 * \param cb_arg argument to pass to the callback function
921 * \param io_flags set flags, defined in nvme_spec.h, for this I/O
922 * \param reset_sgl_fn callback function to reset scattered payload
923 * \param next_sge_fn callback function to iterate each scattered
924 * payload memory segment
926 * \return 0 if successfully submitted, ENOMEM if an nvme_request
927 * structure cannot be allocated for the I/O request
929 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
930 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
932 int spdk_nvme_ns_cmd_writev(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
933 uint64_t lba
, uint32_t lba_count
,
934 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
, uint32_t io_flags
,
935 spdk_nvme_req_reset_sgl_cb reset_sgl_fn
,
936 spdk_nvme_req_next_sge_cb next_sge_fn
);
939 * \brief Submits a write I/O to the specified NVMe namespace.
941 * \param ns NVMe namespace to submit the write I/O
942 * \param qpair I/O queue pair to submit the request
943 * \param payload virtual address pointer to the data payload
944 * \param metadata virtual address pointer to the metadata payload, the length
945 * of metadata is specified by spdk_nvme_ns_get_md_size()
946 * \param lba starting LBA to write the data
947 * \param lba_count length (in sectors) for the write operation
948 * \param cb_fn callback function to invoke when the I/O is completed
949 * \param cb_arg argument to pass to the callback function
950 * \param io_flags set flags, defined by the SPDK_NVME_IO_FLAGS_* entries
951 * in spdk/nvme_spec.h, for this I/O.
952 * \param apptag_mask application tag mask.
953 * \param apptag application tag to use end-to-end protection information.
955 * \return 0 if successfully submitted, ENOMEM if an nvme_request
956 * structure cannot be allocated for the I/O request
958 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
959 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
961 int spdk_nvme_ns_cmd_write_with_md(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
962 void *payload
, void *metadata
,
963 uint64_t lba
, uint32_t lba_count
, spdk_nvme_cmd_cb cb_fn
,
964 void *cb_arg
, uint32_t io_flags
,
965 uint16_t apptag_mask
, uint16_t apptag
);
968 * \brief Submits a write zeroes I/O to the specified NVMe namespace.
970 * \param ns NVMe namespace to submit the write zeroes I/O
971 * \param qpair I/O queue pair to submit the request
972 * \param lba starting LBA for this command
973 * \param lba_count length (in sectors) for the write zero operation
974 * \param cb_fn callback function to invoke when the I/O is completed
975 * \param cb_arg argument to pass to the callback function
976 * \param io_flags set flags, defined by the SPDK_NVME_IO_FLAGS_* entries
977 * in spdk/nvme_spec.h, for this I/O.
979 * \return 0 if successfully submitted, ENOMEM if an nvme_request
980 * structure cannot be allocated for the I/O request
982 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
983 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
985 int spdk_nvme_ns_cmd_write_zeroes(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
986 uint64_t lba
, uint32_t lba_count
,
987 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
,
991 * \brief Submits a read I/O to the specified NVMe namespace.
993 * \param ns NVMe namespace to submit the read I/O
994 * \param qpair I/O queue pair to submit the request
995 * \param payload virtual address pointer to the data payload
996 * \param lba starting LBA to read the data
997 * \param lba_count length (in sectors) for the read operation
998 * \param cb_fn callback function to invoke when the I/O is completed
999 * \param cb_arg argument to pass to the callback function
1000 * \param io_flags set flags, defined in nvme_spec.h, for this I/O
1002 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1003 * structure cannot be allocated for the I/O request
1005 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1006 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1008 int spdk_nvme_ns_cmd_read(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
, void *payload
,
1009 uint64_t lba
, uint32_t lba_count
, spdk_nvme_cmd_cb cb_fn
,
1010 void *cb_arg
, uint32_t io_flags
);
1013 * \brief Submits a read I/O to the specified NVMe namespace.
1015 * \param ns NVMe namespace to submit the read I/O
1016 * \param qpair I/O queue pair to submit the request
1017 * \param lba starting LBA to read the data
1018 * \param lba_count length (in sectors) for the read operation
1019 * \param cb_fn callback function to invoke when the I/O is completed
1020 * \param cb_arg argument to pass to the callback function
1021 * \param io_flags set flags, defined in nvme_spec.h, for this I/O
1022 * \param reset_sgl_fn callback function to reset scattered payload
1023 * \param next_sge_fn callback function to iterate each scattered
1024 * payload memory segment
1026 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1027 * structure cannot be allocated for the I/O request
1029 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1030 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1032 int spdk_nvme_ns_cmd_readv(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
1033 uint64_t lba
, uint32_t lba_count
,
1034 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
, uint32_t io_flags
,
1035 spdk_nvme_req_reset_sgl_cb reset_sgl_fn
,
1036 spdk_nvme_req_next_sge_cb next_sge_fn
);
1039 * \brief Submits a read I/O to the specified NVMe namespace.
1041 * \param ns NVMe namespace to submit the read I/O
1042 * \param qpair I/O queue pair to submit the request
1043 * \param payload virtual address pointer to the data payload
1044 * \param metadata virtual address pointer to the metadata payload, the length
1045 * of metadata is specified by spdk_nvme_ns_get_md_size()
1046 * \param lba starting LBA to read the data
1047 * \param lba_count length (in sectors) for the read operation
1048 * \param cb_fn callback function to invoke when the I/O is completed
1049 * \param cb_arg argument to pass to the callback function
1050 * \param io_flags set flags, defined in nvme_spec.h, for this I/O
1051 * \param apptag_mask application tag mask.
1052 * \param apptag application tag to use end-to-end protection information.
1054 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1055 * structure cannot be allocated for the I/O request
1057 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1058 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1060 int spdk_nvme_ns_cmd_read_with_md(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
1061 void *payload
, void *metadata
,
1062 uint64_t lba
, uint32_t lba_count
, spdk_nvme_cmd_cb cb_fn
,
1063 void *cb_arg
, uint32_t io_flags
,
1064 uint16_t apptag_mask
, uint16_t apptag
);
1067 * \brief Submits a data set management request to the specified NVMe namespace. Data set
1068 * management operations are designed to optimize interaction with the block
1069 * translation layer inside the device. The most common type of operation is
1070 * deallocate, which is often referred to as TRIM or UNMAP.
1072 * \param ns NVMe namespace to submit the DSM request
1073 * \param type A bit field constructed from \ref enum spdk_nvme_dsm_attribute.
1074 * \param qpair I/O queue pair to submit the request
1075 * \param ranges An array of \ref spdk_nvme_dsm_range elements describing
1076 the LBAs to operate on.
1077 * \param num_ranges The number of elements in the ranges array.
1078 * \param cb_fn callback function to invoke when the I/O is completed
1079 * \param cb_arg argument to pass to the callback function
1081 * \return 0 if successfully submitted, negated POSIX errno values otherwise.
1083 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1084 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1086 * This is a convenience wrapper that will automatically allocate and construct the correct
1087 * data buffers. Therefore, ranges does not need to be allocated from pinned memory and
1088 * can be placed on the stack. If a higher performance, zero-copy version of DSM is
1089 * required, simply build and submit a raw command using spdk_nvme_ctrlr_cmd_io_raw().
1091 int spdk_nvme_ns_cmd_dataset_management(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
1093 const struct spdk_nvme_dsm_range
*ranges
,
1094 uint16_t num_ranges
,
1095 spdk_nvme_cmd_cb cb_fn
,
1099 * \brief Submits a flush request to the specified NVMe namespace.
1101 * \param ns NVMe namespace to submit the flush request
1102 * \param qpair I/O queue pair to submit the request
1103 * \param cb_fn callback function to invoke when the I/O is completed
1104 * \param cb_arg argument to pass to the callback function
1106 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1107 * structure cannot be allocated for the I/O request
1109 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1110 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1112 int spdk_nvme_ns_cmd_flush(struct spdk_nvme_ns
*ns
, struct spdk_nvme_qpair
*qpair
,
1113 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
1116 * \brief Submits a reservation register to the specified NVMe namespace.
1118 * \param ns NVMe namespace to submit the reservation register request
1119 * \param qpair I/O queue pair to submit the request
1120 * \param payload virtual address pointer to the reservation register data
1121 * \param ignore_key '1' the current reservation key check is disabled
1122 * \param action specifies the registration action
1123 * \param cptpl change the Persist Through Power Loss state
1124 * \param cb_fn callback function to invoke when the I/O is completed
1125 * \param cb_arg argument to pass to the callback function
1127 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1128 * structure cannot be allocated for the I/O request
1130 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1131 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1133 int spdk_nvme_ns_cmd_reservation_register(struct spdk_nvme_ns
*ns
,
1134 struct spdk_nvme_qpair
*qpair
,
1135 struct spdk_nvme_reservation_register_data
*payload
,
1137 enum spdk_nvme_reservation_register_action action
,
1138 enum spdk_nvme_reservation_register_cptpl cptpl
,
1139 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
1142 * \brief Submits a reservation release to the specified NVMe namespace.
1144 * \param ns NVMe namespace to submit the reservation release request
1145 * \param qpair I/O queue pair to submit the request
1146 * \param payload virtual address pointer to current reservation key
1147 * \param ignore_key '1' the current reservation key check is disabled
1148 * \param action specifies the reservation release action
1149 * \param type reservation type for the namespace
1150 * \param cb_fn callback function to invoke when the I/O is completed
1151 * \param cb_arg argument to pass to the callback function
1153 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1154 * structure cannot be allocated for the I/O request
1156 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1157 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1159 int spdk_nvme_ns_cmd_reservation_release(struct spdk_nvme_ns
*ns
,
1160 struct spdk_nvme_qpair
*qpair
,
1161 struct spdk_nvme_reservation_key_data
*payload
,
1163 enum spdk_nvme_reservation_release_action action
,
1164 enum spdk_nvme_reservation_type type
,
1165 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
1168 * \brief Submits a reservation acquire to the specified NVMe namespace.
1170 * \param ns NVMe namespace to submit the reservation acquire request
1171 * \param qpair I/O queue pair to submit the request
1172 * \param payload virtual address pointer to reservation acquire data
1173 * \param ignore_key '1' the current reservation key check is disabled
1174 * \param action specifies the reservation acquire action
1175 * \param type reservation type for the namespace
1176 * \param cb_fn callback function to invoke when the I/O is completed
1177 * \param cb_arg argument to pass to the callback function
1179 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1180 * structure cannot be allocated for the I/O request
1182 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1183 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1185 int spdk_nvme_ns_cmd_reservation_acquire(struct spdk_nvme_ns
*ns
,
1186 struct spdk_nvme_qpair
*qpair
,
1187 struct spdk_nvme_reservation_acquire_data
*payload
,
1189 enum spdk_nvme_reservation_acquire_action action
,
1190 enum spdk_nvme_reservation_type type
,
1191 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);
1194 * \brief Submits a reservation report to the specified NVMe namespace.
1196 * \param ns NVMe namespace to submit the reservation report request
1197 * \param qpair I/O queue pair to submit the request
1198 * \param payload virtual address pointer for reservation status data
1199 * \param len length bytes for reservation status data structure
1200 * \param cb_fn callback function to invoke when the I/O is completed
1201 * \param cb_arg argument to pass to the callback function
1203 * \return 0 if successfully submitted, ENOMEM if an nvme_request
1204 * structure cannot be allocated for the I/O request
1206 * The command is submitted to a qpair allocated by spdk_nvme_ctrlr_alloc_io_qpair().
1207 * The user must ensure that only one thread submits I/O on a given qpair at any given time.
1209 int spdk_nvme_ns_cmd_reservation_report(struct spdk_nvme_ns
*ns
,
1210 struct spdk_nvme_qpair
*qpair
,
1211 void *payload
, uint32_t len
,
1212 spdk_nvme_cmd_cb cb_fn
, void *cb_arg
);