From acf73199fa227b97217238334236af367c8ab2d7 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 26 Jul 2022 07:25:24 +0200 Subject: Adding upstream version 1.1~rc0. Signed-off-by: Daniel Baumann --- src/nvme/ioctl.h | 1312 ++++++++++++------------------------------------------ 1 file changed, 286 insertions(+), 1026 deletions(-) (limited to 'src/nvme/ioctl.h') diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index ab3797d..379c43a 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -4,7 +4,7 @@ * Copyright (c) 2020 Western Digital Corporation or its affiliates. * * Authors: Keith Busch - * Chaitanya Kulkarni + * Chaitanya Kulkarni */ #ifndef _LIBNVME_IOCTL_H @@ -13,6 +13,7 @@ #include #include #include "types.h" +#include "api-types.h" /* * We can not always count on the kernel UAPI being installed. Use the same @@ -94,29 +95,71 @@ struct nvme_passthru_cmd { * @cdw14: Command Dword 14 (command specific) * @cdw15: Command Dword 15 (command specific) * @timeout_ms: If non-zero, overrides system default timeout in milliseconds - * @rsvd2: Reserved for future use (and fills an impicit struct pad + * @rsvd2: Reserved for future use (and fills an implicit struct pad * @result: Set on completion to the command's CQE DWORD 0-1 controller response */ struct nvme_passthru_cmd64 { - __u8 opcode; - __u8 flags; - __u16 rsvd1; - __u32 nsid; - __u32 cdw2; - __u32 cdw3; - __u64 metadata; - __u64 addr; - __u32 metadata_len; - __u32 data_len; - __u32 cdw10; - __u32 cdw11; - __u32 cdw12; - __u32 cdw13; - __u32 cdw14; - __u32 cdw15; - __u32 timeout_ms; - __u32 rsvd2; - __u64 result; + __u8 opcode; + __u8 flags; + __u16 rsvd1; + __u32 nsid; + __u32 cdw2; + __u32 cdw3; + __u64 metadata; + __u64 addr; + __u32 metadata_len; + __u32 data_len; + __u32 cdw10; + __u32 cdw11; + __u32 cdw12; + __u32 cdw13; + __u32 cdw14; + __u32 cdw15; + __u32 timeout_ms; + __u32 rsvd2; + __u64 result; +}; + +/** + * struct nvme_uring_cmd - nvme uring command structure + * @opcode: Operation code, see &enum nvme_io_opcodes and &enum nvme_admin_opcodes + * @flags: Not supported: intended for command flags (eg: SGL, FUSE) + * @rsvd1: Reserved for future use + * @nsid: Namespace Identifier, or Fabrics type + * @cdw2: Command Dword 2 (no spec defined use) + * @cdw3: Command Dword 3 (no spec defined use) + * @metadata: User space address to metadata buffer (NULL if not used) + * @addr: User space address to data buffer (NULL if not used) + * @metadata_len: Metadata buffer transfer length + * @data_len: Data buffer transfer length + * @cdw10: Command Dword 10 (command specific) + * @cdw11: Command Dword 11 (command specific) + * @cdw12: Command Dword 12 (command specific) + * @cdw13: Command Dword 13 (command specific) + * @cdw14: Command Dword 14 (command specific) + * @cdw15: Command Dword 15 (command specific) + * @timeout_ms: If non-zero, overrides system default timeout in milliseconds + * @rsvd2: Reserved for future use (and fills an implicit struct pad + */ +struct nvme_uring_cmd { + __u8 opcode; + __u8 flags; + __u16 rsvd1; + __u32 nsid; + __u32 cdw2; + __u32 cdw3; + __u64 metadata; + __u64 addr; + __u32 metadata_len; + __u32 data_len; + __u32 cdw10; + __u32 cdw11; + __u32 cdw12; + __u32 cdw13; + __u32 cdw14; + __u32 cdw15; + __u32 timeout_ms; + __u32 rsvd2; }; #define NVME_IOCTL_ID _IO('N', 0x40) @@ -128,13 +171,31 @@ struct nvme_passthru_cmd64 { #define NVME_IOCTL_ADMIN64_CMD _IOWR('N', 0x47, struct nvme_passthru_cmd64) #define NVME_IOCTL_IO64_CMD _IOWR('N', 0x48, struct nvme_passthru_cmd64) +/* io_uring async commands: */ +#define NVME_URING_CMD_IO _IOWR('N', 0x80, struct nvme_uring_cmd) +#define NVME_URING_CMD_IO_VEC _IOWR('N', 0x81, struct nvme_uring_cmd) + #endif /* _UAPI_LINUX_NVME_IOCTL_H */ #endif /* _LINUX_NVME_IOCTL_H */ +/** + * sizeof_args - Helper function used to determine structure sizes + * @type: Argument structure type + * @member: Member inside the type + * @align: Alignment information + */ +#define sizeof_args(type, member, align) \ +({ \ + type s; \ + size_t t = offsetof(type, member) + sizeof(s.member); \ + size_t p = (sizeof(align) - (t % sizeof(align))) % sizeof(align); \ + t + p; \ +}) + /** * nvme_submit_admin_passthru64() - Submit a 64-bit nvme passthrough admin - * command + * command * @fd: File descriptor of nvme device * @cmd: The nvme admin command to send * @result: Optional field to return the result from the CQE DW0-1 @@ -152,7 +213,7 @@ int nvme_submit_admin_passthru64(int fd, struct nvme_passthru_cmd64 *cmd, * @fd: File descriptor of nvme device * @opcode: The nvme io command to send * @flags: NVMe command flags (not used) - * @rsvd: Reserevd for future use + * @rsvd: Reserved for future use * @nsid: Namespace identifier * @cdw2: Command dword 2 * @cdw3: Command dword 3 @@ -162,9 +223,9 @@ int nvme_submit_admin_passthru64(int fd, struct nvme_passthru_cmd64 *cmd, * @cdw13: Command dword 13 * @cdw14: Command dword 14 * @cdw15: Command dword 15 - * @data_len: Length of the data transfered in this command in bytes + * @data_len: Length of the data transferred in this command in bytes * @data: Pointer to user address of the data buffer - * @metadata_len:Length of metadata transfered in this command + * @metadata_len:Length of metadata transferred in this command * @metadata: Pointer to user address of the metadata buffer * @timeout_ms: How long the kernel waits for the command to complete * @result: Optional field to return the result from the CQE dword 0 @@ -202,7 +263,7 @@ int nvme_submit_admin_passthru(int fd, struct nvme_passthru_cmd *cmd, * @fd: File descriptor of nvme device * @opcode: The nvme io command to send * @flags: NVMe command flags (not used) - * @rsvd: Reserevd for future use + * @rsvd: Reserved for future use * @nsid: Namespace identifier * @cdw2: Command dword 2 * @cdw3: Command dword 3 @@ -212,9 +273,9 @@ int nvme_submit_admin_passthru(int fd, struct nvme_passthru_cmd *cmd, * @cdw13: Command dword 13 * @cdw14: Command dword 14 * @cdw15: Command dword 15 - * @data_len: Length of the data transfered in this command in bytes + * @data_len: Length of the data transferred in this command in bytes * @data: Pointer to user address of the data buffer - * @metadata_len:Length of metadata transfered in this command + * @metadata_len:Length of metadata transferred in this command * @metadata: Pointer to user address of the metadata buffer * @timeout_ms: How long the kernel waits for the command to complete * @result: Optional field to return the result from the CQE dword 0 @@ -252,7 +313,7 @@ int nvme_submit_io_passthru64(int fd, struct nvme_passthru_cmd64 *cmd, * @fd: File descriptor of nvme device * @opcode: The nvme io command to send * @flags: NVMe command flags (not used) - * @rsvd: Reserevd for future use + * @rsvd: Reserved for future use * @nsid: Namespace identifier * @cdw2: Command dword 2 * @cdw3: Command dword 3 @@ -262,9 +323,9 @@ int nvme_submit_io_passthru64(int fd, struct nvme_passthru_cmd64 *cmd, * @cdw13: Command dword 13 * @cdw14: Command dword 14 * @cdw15: Command dword 15 - * @data_len: Length of the data transfered in this command in bytes + * @data_len: Length of the data transferred in this command in bytes * @data: Pointer to user address of the data buffer - * @metadata_len:Length of metadata transfered in this command + * @metadata_len:Length of metadata transferred in this command * @metadata: Pointer to user address of the metadata buffer * @timeout_ms: How long the kernel waits for the command to complete * @result: Optional field to return the result from the CQE dword 0 @@ -303,7 +364,7 @@ int nvme_submit_io_passthru(int fd, struct nvme_passthru_cmd *cmd, * @fd: File descriptor of nvme device * @opcode: The nvme io command to send * @flags: NVMe command flags (not used) - * @rsvd: Reserevd for future use + * @rsvd: Reserved for future use * @nsid: Namespace identifier * @cdw2: Command dword 2 * @cdw3: Command dword 3 @@ -313,9 +374,9 @@ int nvme_submit_io_passthru(int fd, struct nvme_passthru_cmd *cmd, * @cdw13: Command dword 13 * @cdw14: Command dword 14 * @cdw15: Command dword 15 - * @data_len: Length of the data transfered in this command in bytes + * @data_len: Length of the data transferred in this command in bytes * @data: Pointer to user address of the data buffer - * @metadata_len:Length of metadata transfered in this command + * @metadata_len:Length of metadata transferred in this command * @metadata: Pointer to user address of the metadata buffer * @timeout_ms: How long the kernel waits for the command to complete * @result: Optional field to return the result from the CQE dword 0 @@ -379,34 +440,6 @@ int nvme_ns_rescan(int fd); */ int nvme_get_nsid(int fd, __u32 *nsid); -/** - * struct nvme_identify_args - Arguments for the NVMe Identify command - * @result: The command completion result from CQE dword0 - * @data: User space destination address to transfer the data - * @args_size: Size of &struct nvme_identify_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms (0 for default timeout) - * @cns: The Controller or Namespace structure, see @enum nvme_identify_cns - * @csi: Command Set Identifier - * @nsid: Namespace identifier, if applicable - * @cntid: The Controller Identifier, if applicable - * @cns_specific_id: Identifier that is required for a particular CNS value - * @uuidx: UUID Index if controller supports this id selection method - */ -struct nvme_identify_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - enum nvme_identify_cns cns; - enum nvme_csi csi; - __u32 nsid; - __u16 cntid; - __u16 cns_specific_id; - __u8 uuidx; -}; - /** * nvme_identify() - Send the NVMe Identify command * @args: &struct nvme_identify_args argument structure @@ -419,8 +452,8 @@ struct nvme_identify_args { */ int nvme_identify(struct nvme_identify_args *args); -static int nvme_identify_cns_nsid(int fd, enum nvme_identify_cns cns, - __u32 nsid, void *data) +static inline int nvme_identify_cns_nsid(int fd, enum nvme_identify_cns cns, + __u32 nsid, void *data) { struct nvme_identify_args args = { .result = NULL, @@ -484,7 +517,7 @@ static inline int nvme_identify_ns(int fd, __u32 nsid, struct nvme_id_ns *ns) /** * nvme_identify_allocated_ns() - Same as nvme_identify_ns, but only for - * allocated namespaces + * allocated namespaces * @fd: File descriptor of nvme device * @nsid: Namespace to identify * @ns: User space destination address to transfer the data @@ -502,7 +535,7 @@ static inline int nvme_identify_allocated_ns(int fd, __u32 nsid, /** * nvme_identify_active_ns_list() - Retrieves active namespaces id list * @fd: File descriptor of nvme device - * @nsid: Return namespaces greater than this identifer + * @nsid: Return namespaces greater than this identifier * @list: User space destination address to transfer the data * * A list of 1024 namespace IDs is returned to the host containing NSIDs in @@ -524,7 +557,7 @@ static inline int nvme_identify_active_ns_list(int fd, __u32 nsid, /** * nvme_identify_allocated_ns_list() - Retrieves allocated namespace id list * @fd: File descriptor of nvme device - * @nsid: Return namespaces greater than this identifer + * @nsid: Return namespaces greater than this identifier * @list: User space destination address to transfer the data * * A list of 1024 namespace IDs is returned to the host containing NSIDs in @@ -617,14 +650,14 @@ static inline int nvme_identify_nsid_ctrl_list(int fd, __u32 nsid, __u16 cntid, /** * nvme_identify_ns_descs() - Retrieves namespace descriptor list * @fd: File descriptor of nvme device - * @nsid: The namespace id to retrieve destriptors + * @nsid: The namespace id to retrieve descriptors * @descs: User space destination address to transfer the data * * A list of Namespace Identification Descriptor structures is returned to the * host for the namespace specified in the Namespace Identifier (NSID) field if * it is an active NSID. * - * The data returned is in the form of an arrray of 'struct nvme_ns_id_desc'. + * The data returned is in the form of an array of 'struct nvme_ns_id_desc'. * * See &struct nvme_ns_id_desc for the definition of the returned structure. * @@ -649,7 +682,7 @@ static inline int nvme_identify_ns_descs(int fd, __u32 nsid, * Identifier supported by the NVM subsystem that is equal to or greater than * the NVM Set Identifier. * - * See &struct nvme_id_nvmset_list for the defintion of the returned structure. + * See &struct nvme_id_nvmset_list for the definition of the returned structure. * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. @@ -676,12 +709,12 @@ static inline int nvme_identify_nvmset_list(int fd, __u16 nvmsetid, /** * nvme_identify_primary_ctrl() - Retrieve NVMe Primary Controller - * identification + * identification * @fd: File descriptor of nvme device * @cntid: Return controllers starting at this identifier * @cap: User space destination buffer address to transfer the data * - * See &struct nvme_primary_ctrl_cap for the defintion of the returned structure, @cap. + * See &struct nvme_primary_ctrl_cap for the definition of the returned structure, @cap. * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. @@ -718,7 +751,7 @@ static inline int nvme_identify_primary_ctrl(int fd, __u16 cntid, * The list contains entries for controller identifiers greater than or equal * to the value specified in the Controller Identifier (cntid). * - * See &struct nvme_secondary_ctrls_list for a defintion of the returned + * See &struct nvme_secondary_ctrls_list for a definition of the returned * structure. * * Return: The nvme command status if a response was received (see @@ -746,7 +779,7 @@ static inline int nvme_identify_secondary_ctrl_list(int fd, __u32 nsid, /** * nvme_identify_ns_granularity() - Retrieves namespace granularity - * identification + * identification * @fd: File descriptor of nvme device * @gr_list: User space destination address to transfer the data * @@ -794,7 +827,7 @@ static inline int nvme_identify_uuid(int fd, struct nvme_id_uuid_list *uuid_list * @csi: Command Set Identifier * @data: User space destination address to transfer the data * - * An I/O Command Set specific Identify Namespace data structre is returned + * An I/O Command Set specific Identify Namespace data structure is returned * for the namespace specified in @nsid. * * Return: The nvme command status if a response was received (see @@ -853,7 +886,7 @@ static inline int nvme_identify_ctrl_csi(int fd, enum nvme_csi csi, void *data) } /** - * nvme_identify_active_ns_list_csi() - Active namespace ID list associated with a specified I/O command set + * nvme_identify_active_ns_list_csi() - Active namespace ID list associated with a specified I/O command set * @fd: File descriptor of nvme device * @nsid: Return namespaces greater than this identifier * @csi: Command Set Identifier @@ -960,11 +993,12 @@ static inline int nvme_identify_independent_identify_ns(int fd, __u32 nsid, } /** - * nvme_identify_ns_csi_user_data_format() - + * nvme_identify_ns_csi_user_data_format() - Identify namespace user data format * @fd: File descriptor of nvme device * @user_data_format: Return namespaces capability of identifier * @uuidx: UUID selection, if supported * @csi: Command Set Identifier + * @data: User space destination address to transfer the data * * Identify Namespace data structure for the specified User Data Format * index containing the namespace capabilities for the NVM Command Set. @@ -994,11 +1028,12 @@ static inline int nvme_identify_ns_csi_user_data_format(int fd, } /** - * nvme_identify_iocs_ns_csi_user_data_format() - + * nvme_identify_iocs_ns_csi_user_data_format() - Identify I/O command set namespace data structure * @fd: File descriptor of nvme device * @user_data_format: Return namespaces capability of identifier * @uuidx: UUID selection, if supported * @csi: Command Set Identifier + * @data: User space destination address to transfer the data * * I/O Command Set specific Identify Namespace data structure for * the specified User Data Format index containing the namespace @@ -1048,7 +1083,7 @@ static inline int nvme_nvm_identify_ctrl(int fd, struct nvme_id_ctrl_nvm *id) * nvme_identify_domain_list() - Domain list data * @fd: File descriptor of nvme device * @domid: Domain ID - * @list: User space destiantion address to transfer data + * @list: User space destination address to transfer data * * A list of 31 domain IDs is returned to the host containing domain * attributes in increasing order that are greater than the value @@ -1182,45 +1217,6 @@ static inline int nvme_zns_identify_ctrl(int fd, struct nvme_zns_id_ctrl *id) return nvme_identify_ctrl_csi(fd, NVME_CSI_ZNS, id); } -/** - * struct nvme_get_log_args - Arguments for the NVMe Admin Get Log command - * @lpo: Log page offset for partial log transfers - * @result: The command completion result from CQE dword0 - * @log: User space destination address to transfer the data - * @args_size: Length of the structure - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @lid: Log page identifier, see &enum nvme_cmd_get_log_lid for known - * values - * @len: Length of provided user buffer to hold the log data in bytes - * @nsid: Namespace identifier, if applicable - * @csi: Command set identifier, see &enum nvme_csi for known values - * @lsi: Log Specific Identifier - * @lsp: Log specific field - * @uuidx: UUID selection, if supported - * @rae: Retain asynchronous events - * @ot: Offset Type; if set @lpo specifies the index into the list - * of data structures, otherwise @lpo specifies the byte offset - * into the log page. - */ -struct nvme_get_log_args { - __u64 lpo; - __u32 *result; - void *log; - int args_size; - int fd; - __u32 timeout; - enum nvme_cmd_get_log_lid lid; - __u32 len; - __u32 nsid; - enum nvme_csi csi; - __u16 lsi; - __u8 lsp; - __u8 uuidx; - bool rae; - bool ot; -}; - /** * nvme_get_log() - NVMe Admin Get Log command * @args: &struct nvme_get_log_args argument structure @@ -1291,8 +1287,8 @@ static inline int nvme_get_log_supported_log_pages(int fd, bool rae, * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. */ -static inline int nvme_get_log_error(int fd, unsigned nr_entries, bool rae, - struct nvme_error_log_page *err_log) +static inline int nvme_get_log_error(int fd, unsigned int nr_entries, bool rae, + struct nvme_error_log_page *err_log) { return nvme_get_nsid_log(fd, rae, NVME_LOG_LID_ERROR, NVME_NSID_ALL, sizeof(*err_log) * nr_entries, @@ -1421,6 +1417,9 @@ static inline int nvme_get_log_device_self_test(int fd, * nvme_get_log_create_telemetry_host() - Create host telemetry log * @fd: File descriptor of nvme device * @log: Userspace address of the log payload + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_create_telemetry_host(int fd, struct nvme_telemetry_log *log) @@ -1446,13 +1445,13 @@ static inline int nvme_get_log_create_telemetry_host(int fd, } /** - * nvme_get_log_telemetry_host() - + * nvme_get_log_telemetry_host() - Get Telemetry Host-Initiated log page * @fd: File descriptor of nvme device * @offset: Offset into the telemetry data * @len: Length of provided user buffer to hold the log data in bytes * @log: User address for log page data * - * Retreives the Telemetry Host-Initiated log page at the requested offset + * Retrieves the Telemetry Host-Initiated log page at the requested offset * using the previously existing capture. * * Return: The nvme command status if a response was received (see @@ -1482,12 +1481,18 @@ static inline int nvme_get_log_telemetry_host(int fd, __u64 offset, } /** - * nvme_get_log_telemetry_ctrl() - + * nvme_get_log_telemetry_ctrl() - Get Telemetry Controller-Initiated log page * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @offset: Offset into the telemetry data * @len: Length of provided user buffer to hold the log data in bytes * @log: User address for log page data + * + * Retrieves the Telemetry Controller-Initiated log page at the requested offset + * using the previously existing capture. + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_telemetry_ctrl(int fd, bool rae, __u64 offset, __u32 len, void *log) @@ -1513,7 +1518,7 @@ static inline int nvme_get_log_telemetry_ctrl(int fd, bool rae, } /** - * nvme_get_log_endurance_group() - + * nvme_get_log_endurance_group() - Get Endurance Group log * @fd: File descriptor of nvme device * @endgid: Starting group identifier to return in the list * @log: User address to store the endurance log @@ -1552,7 +1557,7 @@ static inline int nvme_get_log_endurance_group(int fd, __u16 endgid, } /** - * nvme_get_log_predictable_lat_nvmset() - + * nvme_get_log_predictable_lat_nvmset() - Predictable Latency Per NVM Set * @fd: File descriptor of nvme device * @nvmsetid: NVM set id * @log: User address to store the predictable latency log @@ -1584,12 +1589,15 @@ static inline int nvme_get_log_predictable_lat_nvmset(int fd, __u16 nvmsetid, } /** - * nvme_get_log_predictable_lat_event() - + * nvme_get_log_predictable_lat_event() - Retrieve Predictable Latency Event Aggregate Log Page * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @offset: Offset into the predictable latency event * @len: Length of provided user buffer to hold the log data in bytes * @log: User address for log page data + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_predictable_lat_event(int fd, bool rae, __u32 offset, __u32 len, void *log) @@ -1615,25 +1623,25 @@ static inline int nvme_get_log_predictable_lat_event(int fd, bool rae, } /** - * nvme_get_log_ana() - + * nvme_get_log_ana() - Retrieve Asymmetric Namespace Access log page * @fd: File descriptor of nvme device * @lsp: Log specific, see &enum nvme_get_log_ana_lsp * @rae: Retain asynchronous events * @offset: Offset to the start of the log page * @len: The allocated length of the log page - * @log: User address to store the ana log + * @log: User address to store the ana log * * This log consists of a header describing the log and descriptors containing * the asymmetric namespace access information for ANA Groups that contain * namespaces that are attached to the controller processing the command. * - * See &struct nvme_ana_rsp_hdr for the defintion of the returned structure. + * See &struct nvme_ana_rsp_hdr for the definition of the returned structure. * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. */ -static int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae, - __u64 offset, __u32 len, void *log) +static inline int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae, + __u64 offset, __u32 len, void *log) { struct nvme_get_log_args args = { .lpo = offset, @@ -1647,7 +1655,7 @@ static int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae, .nsid = NVME_NSID_NONE, .csi = NVME_CSI_NVM, .lsi = NVME_LOG_LSI_NONE, - .lsp = lsp, + .lsp = (__u8)lsp, .uuidx = NVME_UUID_NONE, .rae = false, .ot = false, @@ -1656,13 +1664,16 @@ static int nvme_get_log_ana(int fd, enum nvme_log_ana_lsp lsp, bool rae, } /** - * nvme_get_log_ana_groups() - + * nvme_get_log_ana_groups() - Retrieve Asymmetric Namespace Access groups only log page * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @len: The allocated length of the log page - * @log: User address to store the ana group log + * @log: User address to store the ana group log + * + * See &struct nvme_ana_group_desc for the definition of the returned structure. * - * See &struct nvme_ana_group_desc for the defintion of the returned structure. + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_ana_groups(int fd, bool rae, __u32 len, struct nvme_ana_group_desc *log) @@ -1672,12 +1683,15 @@ static inline int nvme_get_log_ana_groups(int fd, bool rae, __u32 len, } /** - * nvme_get_log_lba_status() - + * nvme_get_log_lba_status() - Retrieve LBA Status * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @offset: Offset to the start of the log page * @len: The allocated length of the log page - * @log: User address to store the log page + * @log: User address to store the log page + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_lba_status(int fd, bool rae, __u64 offset, __u32 len, void *log) @@ -1703,12 +1717,15 @@ static inline int nvme_get_log_lba_status(int fd, bool rae, } /** - * nvme_get_log_endurance_grp_evt() - + * nvme_get_log_endurance_grp_evt() - Retrieve Rotational Media Information * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @offset: Offset to the start of the log page * @len: The allocated length of the log page - * @log: User address to store the log page + * @log: User address to store the log page + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_endurance_grp_evt(int fd, bool rae, __u32 offset, __u32 len, void *log) @@ -1734,7 +1751,7 @@ static inline int nvme_get_log_endurance_grp_evt(int fd, bool rae, } /** - * nvme_get_log_fid_supported_effects() - + * nvme_get_log_fid_supported_effects() - Retrieve Feature Identifiers Supported and Effects * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @log: FID Supported and Effects data structure @@ -1750,7 +1767,7 @@ static inline int nvme_get_log_fid_supported_effects(int fd, bool rae, } /** - * nvme_get_log_mi_cmd_supported_effects() - displays the MI Commands Supported byt the controller + * nvme_get_log_mi_cmd_supported_effects() - displays the MI Commands Supported by the controller * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @log: MI Command Supported and Effects data structure @@ -1766,13 +1783,13 @@ static inline int nvme_get_log_mi_cmd_supported_effects(int fd, bool rae, } /** - * nvme_get_log_boot_partition() - + * nvme_get_log_boot_partition() - Retrieve Boot Partition * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @lsp: The log specified field of LID * @len: The allocated size, minimum * struct nvme_boot_partition - * @part: User address to store the log page + * @part: User address to store the log page * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise @@ -1801,7 +1818,7 @@ static inline int nvme_get_log_boot_partition(int fd, bool rae, } /** - * nvme_get_log_discovery() - + * nvme_get_log_discovery() - Retrieve Discovery log page * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @offset: Offset of this log to retrieve @@ -1838,7 +1855,7 @@ static inline int nvme_get_log_discovery(int fd, bool rae, } /** - * nvme_get_log_media_unit_stat() - + * nvme_get_log_media_unit_stat() - Retrieve Media Unit Status * @fd: File descriptor of nvme device * @domid: Domain Identifier selection, if supported * @mus: User address to store the Media Unit statistics log @@ -1870,9 +1887,10 @@ static inline int nvme_get_log_media_unit_stat(int fd, __u16 domid, } /** - * nvme_get_log_support_cap_config_list() - + * nvme_get_log_support_cap_config_list() - Retrieve Supported Capacity Configuration List * @fd: File descriptor of nvme device * @domid: Domain Identifier selection, if supported + * @cap: User address to store supported capabilities config list * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise @@ -1901,10 +1919,13 @@ static inline int nvme_get_log_support_cap_config_list(int fd, __u16 domid, } /** - * nvme_get_log_reservation() - + * nvme_get_log_reservation() - Retrieve Reservation Notification * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @log: User address to store the reservation log + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise */ static inline int nvme_get_log_reservation(int fd, bool rae, struct nvme_resv_notification_log *log) @@ -1914,7 +1935,7 @@ static inline int nvme_get_log_reservation(int fd, bool rae, } /** - * nvme_get_log_sanitize() - + * nvme_get_log_sanitize() - Retrieve Sanitize Status * @fd: File descriptor of nvme device * @rae: Retain asynchronous events * @log: User address to store the sanitize log @@ -1933,7 +1954,7 @@ static inline int nvme_get_log_sanitize(int fd, bool rae, } /** - * nvme_get_log_zns_changed_zones() - + * nvme_get_log_zns_changed_zones() - Retrieve list of zones that have changed * @fd: File descriptor of nvme device * @nsid: Namespace ID * @rae: Retain asynchronous events @@ -1968,11 +1989,14 @@ static inline int nvme_get_log_zns_changed_zones(int fd, __u32 nsid, bool rae, } /** - * nvme_get_log_persistent_event() - + * nvme_get_log_persistent_event() - Retrieve Persistent Event Log * @fd: File descriptor of nvme device * @action: Action the controller should take during processing this command * @size: Size of @pevent_log * @pevent_log: User address to store the persistent event log + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_log_persistent_event(int fd, enum nvme_pevent_log_action action, @@ -1990,7 +2014,7 @@ static inline int nvme_get_log_persistent_event(int fd, .nsid = NVME_NSID_ALL, .csi = NVME_CSI_NVM, .lsi = NVME_LOG_LSI_NONE, - .lsp = action, + .lsp = (__u8)action, .uuidx = NVME_UUID_NONE, .rae = false, .ot = false, @@ -1998,39 +2022,6 @@ static inline int nvme_get_log_persistent_event(int fd, return nvme_get_log(&args); } -/** - * struct nvme_set_features_args - Arguments for the NVMe Admin Set Feature command - * @result: The command completion result from CQE dword0 - * @data: User address of feature data, if applicable - * @args_size: Size of &struct nvme_set_features_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID, if applicable - * @cdw11: Value to set the feature to - * @cdw12: Feature specific command dword12 field - * @cdw15: Feature specific command dword15 field - * @data_len: Length of feature data, if applicable, in bytes - * @save: Save value across power states - * @uuidx: UUID Index for differentiating vendor specific encoding - * @fid: Feature identifier - */ -struct nvme_set_features_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 cdw11; - __u32 cdw12; - __u32 cdw13; - __u32 cdw15; - __u32 data_len; - bool save; - __u8 uuidx; - __u8 fid; -}; - /** * nvme_set_features() - Set a feature attribute * @args: &struct nvme_set_features_args argument structure @@ -2050,6 +2041,9 @@ int nvme_set_features(struct nvme_set_features_args *args); * @data_len: Length of feature data, if applicable, in bytes * @data: User address of feature data, if applicable * @result: The command completion result from CQE dword0 + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_set_features_data(int fd, __u8 fid, __u32 nsid, __u32 cdw11, bool save, __u32 data_len, void *data, @@ -2075,13 +2069,16 @@ static inline int nvme_set_features_data(int fd, __u8 fid, __u32 nsid, } /** - * nvme_set_features_simple() - Helper functionn for @nvme_set_features() + * nvme_set_features_simple() - Helper function for @nvme_set_features() * @fd: File descriptor of nvme device * @fid: Feature identifier * @nsid: Namespace ID, if applicable * @cdw11: Value to set the feature to * @save: Save value across power states * @result: The command completion result from CQE dword0 + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_set_features_simple(int fd, __u8 fid, __u32 nsid, __u32 cdw11, bool save, __u32 *result) @@ -2091,7 +2088,7 @@ static inline int nvme_set_features_simple(int fd, __u8 fid, __u32 nsid, } /** - * nvme_set_features_arbitration() - + * nvme_set_features_arbitration() - Set arbitration features * @fd: File descriptor of nvme device * @ab: Arbitration Burst * @lpw: Low Priority Weight @@ -2107,7 +2104,7 @@ int nvme_set_features_arbitration(int fd, __u8 ab, __u8 lpw, __u8 mpw, __u8 hpw, bool save, __u32 *result); /** - * nvme_set_features_power_mgmt() - + * nvme_set_features_power_mgmt() - Set power management feature * @fd: File descriptor of nvme device * @ps: Power State * @wh: Workload Hint @@ -2121,7 +2118,7 @@ int nvme_set_features_power_mgmt(int fd, __u8 ps, __u8 wh, bool save, __u32 *result); /** - * nvme_set_features_lba_range() - + * nvme_set_features_lba_range() - Set LBA range feature * @fd: File descriptor of nvme device * @nsid: Namespace ID * @nr_ranges: Number of ranges in @data @@ -2136,7 +2133,7 @@ int nvme_set_features_lba_range(int fd, __u32 nsid, __u32 nr_ranges, bool save, struct nvme_lba_range_type *data, __u32 *result); /** - * nvme_set_features_temp_thresh() - + * nvme_set_features_temp_thresh() - Set temperature threshold feature * @fd: File descriptor of nvme device * @tmpth: Temperature Threshold * @tmpsel: Threshold Temperature Select @@ -2152,7 +2149,7 @@ int nvme_set_features_temp_thresh(int fd, __u16 tmpth, __u8 tmpsel, bool save, __u32 *result); /** - * nvme_set_features_err_recovery() - + * nvme_set_features_err_recovery() - Set error recovery feature * @fd: File descriptor of nvme device * @nsid: Namespace ID * @tler: Time-limited error recovery value @@ -2167,7 +2164,7 @@ int nvme_set_features_err_recovery(int fd, __u32 nsid, __u16 tler, bool dulbe, bool save, __u32 *result); /** - * nvme_set_features_volatile_wc() - + * nvme_set_features_volatile_wc() - Set volatile write cache feature * @fd: File descriptor of nvme device * @wce: Write cache enable * @save: Save value across power states @@ -2180,7 +2177,7 @@ int nvme_set_features_volatile_wc(int fd, bool wce, bool save, __u32 *result); /** - * nvme_set_features_irq_coalesce() - + * nvme_set_features_irq_coalesce() - Set IRQ coalesce feature * @fd: File descriptor of nvme device * @thr: Aggregation Threshold * @time: Aggregation Time @@ -2194,7 +2191,7 @@ int nvme_set_features_irq_coalesce(int fd, __u8 thr, __u8 time, bool save, __u32 *result); /** - * nvme_set_features_irq_config() - + * nvme_set_features_irq_config() - Set IRQ config feature * @fd: File descriptor of nvme device * @iv: Interrupt Vector * @cd: Coalescing Disable @@ -2208,7 +2205,7 @@ int nvme_set_features_irq_config(int fd, __u16 iv, bool cd, bool save, __u32 *result); /** - * nvme_set_features_write_atomic() - + * nvme_set_features_write_atomic() - Set write atomic feature * @fd: File descriptor of nvme device * @dn: Disable Normal * @save: Save value across power states @@ -2221,7 +2218,7 @@ int nvme_set_features_write_atomic(int fd, bool dn, bool save, __u32 *result); /** - * nvme_set_features_async_event() - + * nvme_set_features_async_event() - Set asynchronous event feature * @fd: File descriptor of nvme device * @events: Events to enable * @save: Save value across power states @@ -2234,7 +2231,7 @@ int nvme_set_features_async_event(int fd, __u32 events, bool save, __u32 *result); /** - * nvme_set_features_auto_pst() - + * nvme_set_features_auto_pst() - Set autonomous power state feature * @fd: File descriptor of nvme device * @apste: Autonomous Power State Transition Enable * @apst: Autonomous Power State Transition @@ -2249,10 +2246,10 @@ int nvme_set_features_auto_pst(int fd, bool apste, bool save, __u32 *result); /** - * nvme_set_features_timestamp() - + * nvme_set_features_timestamp() - Set timestamp feature * @fd: File descriptor of nvme device * @save: Save value across power states - * @timestamp: The current timestamp value to assign to this this feature + * @timestamp: The current timestamp value to assign to this feature * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. @@ -2260,7 +2257,7 @@ int nvme_set_features_auto_pst(int fd, bool apste, bool save, int nvme_set_features_timestamp(int fd, bool save, __u64 timestamp); /** - * nvme_set_features_hctm() - + * nvme_set_features_hctm() - Set thermal management feature * @fd: File descriptor of nvme device * @tmt2: Thermal Management Temperature 2 * @tmt1: Thermal Management Temperature 1 @@ -2274,7 +2271,7 @@ int nvme_set_features_hctm(int fd, __u16 tmt2, __u16 tmt1, bool save, __u32 *result); /** - * nvme_set_features_nopsc() - + * nvme_set_features_nopsc() - Set non-operational power state feature * @fd: File descriptor of nvme device * @noppme: Non-Operational Power State Permissive Mode Enable * @save: Save value across power states @@ -2286,7 +2283,7 @@ int nvme_set_features_hctm(int fd, __u16 tmt2, __u16 tmt1, bool save, int nvme_set_features_nopsc(int fd, bool noppme, bool save, __u32 *result); /** - * nvme_set_features_rrl() - + * nvme_set_features_rrl() - Set read recovery level feature * @fd: File descriptor of nvme device * @rrl: Read recovery level setting * @nvmsetid: NVM set id @@ -2300,7 +2297,7 @@ int nvme_set_features_rrl(int fd, __u8 rrl, __u16 nvmsetid, bool save, __u32 *result); /** - * nvme_set_features_plm_config() - + * nvme_set_features_plm_config() - Set predictable latency feature * @fd: File descriptor of nvme device * @enable: Predictable Latency Enable * @nvmsetid: NVM Set Identifier @@ -2313,10 +2310,10 @@ int nvme_set_features_rrl(int fd, __u8 rrl, __u16 nvmsetid, bool save, */ int nvme_set_features_plm_config(int fd, bool enable, __u16 nvmsetid, bool save, struct nvme_plm_config *data, - __u32*result); + __u32 *result); /** - * nvme_set_features_plm_window() - + * nvme_set_features_plm_window() - Set window select feature * @fd: File descriptor of nvme device * @sel: Window Select * @nvmsetid: NVM Set Identifier @@ -2330,7 +2327,7 @@ int nvme_set_features_plm_window(int fd, enum nvme_feat_plm_window_select sel, __u16 nvmsetid, bool save, __u32 *result); /** - * nvme_set_features_lba_sts_interval() - + * nvme_set_features_lba_sts_interval() - Set LBA status information feature * @fd: File descriptor of nvme device * @save: Save value across power states * @lsiri: LBA Status Information Report Interval @@ -2344,7 +2341,7 @@ int nvme_set_features_lba_sts_interval(int fd, __u16 lsiri, __u16 lsipi, bool save, __u32 *result); /** - * nvme_set_features_host_behavior() - + * nvme_set_features_host_behavior() - Set host behavior feature * @fd: File descriptor of nvme device * @save: Save value across power states * @data: Pointer to structure nvme_feat_host_behavior @@ -2356,7 +2353,7 @@ int nvme_set_features_host_behavior(int fd, bool save, struct nvme_feat_host_behavior *data); /** - * nvme_set_features_sanitize() - + * nvme_set_features_sanitize() - Set sanitize feature * @fd: File descriptor of nvme device * @nodrm: No-Deallocate Response Mode * @save: Save value across power states @@ -2368,7 +2365,7 @@ int nvme_set_features_host_behavior(int fd, bool save, int nvme_set_features_sanitize(int fd, bool nodrm, bool save, __u32 *result); /** - * nvme_set_features_endurance_evt_cfg() - + * nvme_set_features_endurance_evt_cfg() - Set endurance event config feature * @fd: File descriptor of nvme device * @endgid: Endurance Group Identifier * @egwarn: Flags to enable warning, see &enum nvme_eg_critical_warning_flags @@ -2382,7 +2379,7 @@ int nvme_set_features_endurance_evt_cfg(int fd, __u16 endgid, __u8 egwarn, bool save, __u32 *result); /** - * nvme_set_features_sw_progress() - + * nvme_set_features_sw_progress() - Set pre-boot software load count feature * @fd: File descriptor of nvme device * @pbslc: Pre-boot Software Load Count * @save: Save value across power states @@ -2395,7 +2392,7 @@ int nvme_set_features_sw_progress(int fd, __u8 pbslc, bool save, __u32 *result); /** - * nvme_set_features_host_id() - + * nvme_set_features_host_id() - Set enable extended host identifers feature * @fd: File descriptor of nvme device * @exhid: Enable Extended Host Identifier * @save: Save value across power states @@ -2407,7 +2404,7 @@ int nvme_set_features_sw_progress(int fd, __u8 pbslc, bool save, int nvme_set_features_host_id(int fd, bool exhid, bool save, __u8 *hostid); /** - * nvme_set_features_resv_mask() - + * nvme_set_features_resv_mask() - Set reservation notification mask feature * @fd: File descriptor of nvme device * @mask: Reservation Notification Mask Field * @save: Save value across power states @@ -2419,7 +2416,7 @@ int nvme_set_features_host_id(int fd, bool exhid, bool save, __u8 *hostid); int nvme_set_features_resv_mask(int fd, __u32 mask, bool save, __u32 *result); /** - * nvme_set_features_resv_persist() - + * nvme_set_features_resv_persist() - Set persist through power loss feature * @fd: File descriptor of nvme device * @ptpl: Persist Through Power Loss * @save: Save value across power states @@ -2431,7 +2428,7 @@ int nvme_set_features_resv_mask(int fd, __u32 mask, bool save, __u32 *result); int nvme_set_features_resv_persist(int fd, bool ptpl, bool save, __u32 *result); /** - * nvme_set_features_write_protect() - + * nvme_set_features_write_protect() - Set write protect feature * @fd: File descriptor of nvme device * @state: Write Protection State * @save: Save value across power states @@ -2442,34 +2439,6 @@ int nvme_set_features_resv_persist(int fd, bool ptpl, bool save, __u32 *result); */ int nvme_set_features_write_protect(int fd, enum nvme_feat_nswpcfg_state state, bool save, __u32 *result); -/** - * struct nvme_get_features_args - Arguments for the NVMe Admin Get Feature command - * @args_size: Size of &struct nvme_get_features_args - * @fd: File descriptor of nvme device - * @result: The command completion result from CQE dword0 - * @timeout: Timeout in ms - * @nsid: Namespace ID, if applicable - * @sel: Select which type of attribute to return, - * see &enum nvme_get_features_sel - * @cdw11: Feature specific command dword11 field - * @data_len: Length of feature data, if applicable, in bytes - * @data: User address of feature data, if applicable - * @fid: Feature identifier, see &enum nvme_features_id - * @uuidx: UUID Index for differentiating vendor specific encoding - */ -struct nvme_get_features_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_get_features_sel sel; - __u32 cdw11; - __u32 data_len; - __u8 fid; - __u8 uuidx; -}; /** * nvme_get_features() - Retrieve a feature attribute @@ -2488,6 +2457,9 @@ int nvme_get_features(struct nvme_get_features_args *args); * @data_len: Length of feature data, if applicable, in bytes * @data: User address of feature data, if applicable * @result: The command completion result from CQE dword0 + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_features_data(int fd, enum nvme_features_id fid, __u32 nsid, __u32 data_len, void *data, __u32 *result) @@ -2502,7 +2474,7 @@ static inline int nvme_get_features_data(int fd, enum nvme_features_id fid, .sel = NVME_GET_FEATURES_SEL_CURRENT, .cdw11 = 0, .data_len = data_len, - .fid = fid, + .fid = (__u8)fid, .uuidx = NVME_UUID_NONE, }; @@ -2515,6 +2487,9 @@ static inline int nvme_get_features_data(int fd, enum nvme_features_id fid, * @fid: Feature identifier * @nsid: Namespace ID, if applicable * @result: The command completion result from CQE dword0 + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_get_features_simple(int fd, enum nvme_features_id fid, __u32 nsid, __u32 *result) @@ -2523,7 +2498,7 @@ static inline int nvme_get_features_simple(int fd, enum nvme_features_id fid, } /** - * nvme_get_features_arbitration() - + * nvme_get_features_arbitration() - Get arbitration feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2535,7 +2510,7 @@ int nvme_get_features_arbitration(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_power_mgmt() - + * nvme_get_features_power_mgmt() - Get power management feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2547,7 +2522,7 @@ int nvme_get_features_power_mgmt(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_lba_range() - + * nvme_get_features_lba_range() - Get LBA range feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @data: User address of feature data, if applicable @@ -2561,7 +2536,7 @@ int nvme_get_features_lba_range(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_temp_thresh() - + * nvme_get_features_temp_thresh() - Get temperature threshold feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2573,7 +2548,7 @@ int nvme_get_features_temp_thresh(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_err_recovery() - + * nvme_get_features_err_recovery() - Get error recovery feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2585,7 +2560,7 @@ int nvme_get_features_err_recovery(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_volatile_wc() - + * nvme_get_features_volatile_wc() - Get volatile write cache feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2597,7 +2572,7 @@ int nvme_get_features_volatile_wc(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_num_queues() - + * nvme_get_features_num_queues() - Get number of queues feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2609,7 +2584,7 @@ int nvme_get_features_num_queues(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_irq_coalesce() - + * nvme_get_features_irq_coalesce() - Get IRQ coalesce feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2621,7 +2596,7 @@ int nvme_get_features_irq_coalesce(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_irq_config() - + * nvme_get_features_irq_config() - Get IRQ config feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @iv: @@ -2634,7 +2609,7 @@ int nvme_get_features_irq_config(int fd, enum nvme_get_features_sel sel, __u16 iv, __u32 *result); /** - * nvme_get_features_write_atomic() - + * nvme_get_features_write_atomic() - Get write atomic feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2646,7 +2621,7 @@ int nvme_get_features_write_atomic(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_async_event() - + * nvme_get_features_async_event() - Get asynchronous event feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2658,7 +2633,7 @@ int nvme_get_features_async_event(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_auto_pst() - + * nvme_get_features_auto_pst() - Get autonomous power state feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @apst: @@ -2671,7 +2646,7 @@ int nvme_get_features_auto_pst(int fd, enum nvme_get_features_sel sel, struct nvme_feat_auto_pst *apst, __u32 *result); /** - * nvme_get_features_host_mem_buf() - + * nvme_get_features_host_mem_buf() - Get host memory buffer feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2683,7 +2658,7 @@ int nvme_get_features_host_mem_buf(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_timestamp() - + * nvme_get_features_timestamp() - Get timestamp feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @ts: Current timestamp @@ -2695,7 +2670,7 @@ int nvme_get_features_timestamp(int fd, enum nvme_get_features_sel sel, struct nvme_timestamp *ts); /** - * nvme_get_features_kato() - + * nvme_get_features_kato() - Get keep alive timeout feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2706,7 +2681,7 @@ int nvme_get_features_timestamp(int fd, enum nvme_get_features_sel sel, int nvme_get_features_kato(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_hctm() - + * nvme_get_features_hctm() - Get thermal management feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2717,7 +2692,7 @@ int nvme_get_features_kato(int fd, enum nvme_get_features_sel sel, __u32 *result int nvme_get_features_hctm(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_nopsc() - + * nvme_get_features_nopsc() - Get non-operational power state feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2728,7 +2703,7 @@ int nvme_get_features_hctm(int fd, enum nvme_get_features_sel sel, __u32 *result int nvme_get_features_nopsc(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_rrl() - + * nvme_get_features_rrl() - Get read recovery level feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2739,7 +2714,7 @@ int nvme_get_features_nopsc(int fd, enum nvme_get_features_sel sel, __u32 *resul int nvme_get_features_rrl(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_plm_config() - + * nvme_get_features_plm_config() - Get predictable latency feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @nvmsetid: NVM set id @@ -2754,7 +2729,7 @@ int nvme_get_features_plm_config(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_plm_window() - + * nvme_get_features_plm_window() - Get window select feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @nvmsetid: NVM set id @@ -2767,7 +2742,7 @@ int nvme_get_features_plm_window(int fd, enum nvme_get_features_sel sel, __u16 nvmsetid, __u32 *result); /** - * nvme_get_features_lba_sts_interval() - + * nvme_get_features_lba_sts_interval() - Get LBA status information feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2779,10 +2754,10 @@ int nvme_get_features_lba_sts_interval(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_host_behavior() - + * nvme_get_features_host_behavior() - Get host behavior feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel - * @data: Poniter to structure nvme_feat_host_behavior + * @data: Pointer to structure nvme_feat_host_behavior * @result: The command completion result from CQE dword0 * * Return: The nvme command status if a response was received (see @@ -2793,7 +2768,7 @@ int nvme_get_features_host_behavior(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_sanitize() - + * nvme_get_features_sanitize() - Get sanitize feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2805,7 +2780,7 @@ int nvme_get_features_sanitize(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_endurance_event_cfg() - + * nvme_get_features_endurance_event_cfg() - Get endurance event config feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @endgid: Endurance Group Identifier @@ -2818,7 +2793,7 @@ int nvme_get_features_endurance_event_cfg(int fd, enum nvme_get_features_sel sel __u16 endgid, __u32 *result); /** - * nvme_get_features_sw_progress() - + * nvme_get_features_sw_progress() - Get software progress feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2830,7 +2805,7 @@ int nvme_get_features_sw_progress(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_host_id() - + * nvme_get_features_host_id() - Get host id feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @exhid: Enable Extended Host Identifier @@ -2844,7 +2819,7 @@ int nvme_get_features_host_id(int fd, enum nvme_get_features_sel sel, bool exhid, __u32 len, __u8 *hostid); /** - * nvme_get_features_resv_mask() - + * nvme_get_features_resv_mask() - Get reservation mask feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2856,7 +2831,7 @@ int nvme_get_features_resv_mask(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_resv_persist() - + * nvme_get_features_resv_persist() - Get reservation persist feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2868,7 +2843,7 @@ int nvme_get_features_resv_persist(int fd, enum nvme_get_features_sel sel, __u32 *result); /** - * nvme_get_features_write_protect() - + * nvme_get_features_write_protect() - Get write protect feature * @fd: File descriptor of nvme device * @nsid: Namespace ID * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel @@ -2882,7 +2857,7 @@ int nvme_get_features_write_protect(int fd, __u32 nsid, __u32 *result); /** - * nvme_get_features_iocs_profile() - + * nvme_get_features_iocs_profile() - Get IOCS profile feature * @fd: File descriptor of nvme device * @sel: Select which type of attribute to return, see &enum nvme_get_features_sel * @result: The command completion result from CQE dword0 @@ -2893,33 +2868,6 @@ int nvme_get_features_write_protect(int fd, __u32 nsid, int nvme_get_features_iocs_profile(int fd, enum nvme_get_features_sel sel, __u32 *result); -/** - * struct nvme_format_nvm_args - Arguments for the Format Nvme Namespace command - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_format_nvm_args - * @fd: File descriptor of nvme device - * @timeout: Set to override default timeout to this value in milliseconds; - * useful for long running formats. 0 will use system default. - * @nsid: Namespace ID to format - * @mset: Metadata settings (extended or separated), true if extended - * @pi: Protection information type - * @pil: Protection information location (beginning or end), true if end - * @ses: Secure erase settings - * @lbaf: Logical block address format - */ -struct nvme_format_nvm_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_cmd_format_mset mset; - enum nvme_cmd_format_pi pi; - enum nvme_cmd_format_pil pil; - enum nvme_cmd_format_ses ses; - __u8 lbaf; -}; - /** * nvme_format_nvm() - Format nvme namespace(s) * @args: &struct nvme_format_nvme_args argument structure @@ -2934,41 +2882,22 @@ struct nvme_format_nvm_args { */ int nvme_format_nvm(struct nvme_format_nvm_args *args); -/** - * struct nvme_ns_mgmt_args - Arguments for NVMe Namespace Management command - * @result: NVMe command result - * @ns: Namespace identication descriptors - * @args_size: Size of &struct nvme_ns_mgmt_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @sel: Type of management operation to perform - * @csi: Command Set Identifier - */ -struct nvme_ns_mgmt_args { - __u32 *result; - struct nvme_id_ns *ns; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_ns_mgmt_sel sel; - __u8 csi; -}; - /** * nvme_ns_mgmt() - Issue a Namespace management command * @args: &struct nvme_ns_mgmt_args Argument structure + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ int nvme_ns_mgmt(struct nvme_ns_mgmt_args *args); /** - * nvme_ns_mgmt_create() - + * nvme_ns_mgmt_create() - Create a non attached namespace * @fd: File descriptor of nvme device * @ns: Namespace identification that defines ns creation parameters * @nsid: On success, set to the namespace id that was created - * @timeout: Overide the default timeout to this value in milliseconds; - * set to 0 to use the system default. + * @timeout: Override the default timeout to this value in milliseconds; + * set to 0 to use the system default. * @csi: Command Set Identifier * * On successful creation, the namespace exists in the subsystem, but is not @@ -2996,7 +2925,7 @@ static inline int nvme_ns_mgmt_create(int fd, struct nvme_id_ns *ns, } /** - * nvme_ns_mgmt_delete() - + * nvme_ns_mgmt_delete() - Delete a non attached namespace * @fd: File descriptor of nvme device * @nsid: Namespace identifier to delete * @@ -3023,37 +2952,23 @@ static inline int nvme_ns_mgmt_delete(int fd, __u32 nsid) return nvme_ns_mgmt(&args); } -/** - * struct nvme_ns_attach_args - Arguments for Nvme Namespace Management command - * @result: NVMe command result - * @ctrlist: Controller list to modify attachment state of nsid - * @args_size: Size of &struct nvme_ns_attach_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID to execute attach selection - * @sel: Attachment selection, see &enum nvme_ns_attach_sel - */ -struct nvme_ns_attach_args { - __u32 *result; - struct nvme_ctrl_list *ctrlist; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_ns_attach_sel sel; -}; - /** * nvme_ns_attach() - Attach or detach namespace to controller(s) * @args: &struct nvme_ns_attach_args Argument structure + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ int nvme_ns_attach(struct nvme_ns_attach_args *args); /** - * nvme_ns_attach_ctrls() - + * nvme_ns_attach_ctrls() - Attach namespace to controllers * @fd: File descriptor of nvme device * @nsid: Namespace ID to attach * @ctrlist: Controller list to modify attachment state of nsid + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_ns_attach_ctrls(int fd, __u32 nsid, struct nvme_ctrl_list *ctrlist) @@ -3072,10 +2987,13 @@ static inline int nvme_ns_attach_ctrls(int fd, __u32 nsid, } /** - * nvme_ns_detach_ctrls() - + * nvme_ns_detach_ctrls() - Detach namespace from controllers * @fd: File descriptor of nvme device * @nsid: Namespace ID to detach * @ctrlist: Controller list to modify attachment state of nsid + * + * Return: The nvme command status if a response was received (see + * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_ns_detach_ctrls(int fd, __u32 nsid, struct nvme_ctrl_list *ctrlist) @@ -3093,29 +3011,9 @@ static inline int nvme_ns_detach_ctrls(int fd, __u32 nsid, return nvme_ns_attach(&args); } -/** - * struct nvme_fw_download_args - Arguments for the NVMe Firmware Download command - * @args_size: Size of &struct nvme_fw_download_args - * @fd: File descriptor of nvme device - * @result: The command completion result from CQE dword0 - * @timeout: Timeout in ms - * @offset: Offset in the firmware data - * @data: Userspace address of the firmware data - * @data_len: Length of data in this command in bytes - */ -struct nvme_fw_download_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 offset; - __u32 data_len; -}; - /** * nvme_fw_download() - Download part or all of a firmware image to the - * controller + * controller * @args: &struct nvme_fw_download_args argument structure * * The Firmware Image Download command downloads all or a portion of an image @@ -3136,26 +3034,6 @@ struct nvme_fw_download_args { */ int nvme_fw_download(struct nvme_fw_download_args *args); -/** - * struct nvme_fw_commit_args - Arguments for the NVMe Firmware Commit command - * @args_size: Size of &struct nvme_fw_commit_args - * @fd: File descriptor of nvme device - * @action: Action to use for the firmware image, see &enum nvme_fw_commit_ca - * @timeout: Timeout in ms - * @result: The command completion result from CQE dword0 - * @slot: Firmware slot to commit the downloaded image - * @bpid: Set to true to select the boot partition id - */ -struct nvme_fw_commit_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - enum nvme_fw_commit_ca action; - __u8 slot; - bool bpid; -}; - /** * nvme_fw_commit() - Commit firmware using the specified action * @args: &struct nvme_fw_commit_args argument structure @@ -3170,37 +3048,7 @@ struct nvme_fw_commit_args { int nvme_fw_commit(struct nvme_fw_commit_args *args); /** - * struct nvme_security_send_args - Arguments for the NVMe Security Send command - * @result: The command completion result from CQE dword0 - * @data: Security data payload to send - * @args_size: Size of &struct nvme_security_send_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID to issue security command on - * @tl: Protocol specific transfer length - * @data_len: Data length of the payload in bytes - * @nssf: NVMe Security Specific field - * @spsp0: Security Protocol Specific field - * @spsp1: Security Protocol Specific field - * @secp: Security Protocol - */ -struct nvme_security_send_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 tl; - __u32 data_len; - __u8 nssf; - __u8 spsp0; - __u8 spsp1; - __u8 secp; -}; - -/** - * nvme_security_send() - + * nvme_security_send() - Security Send command * @args: &struct nvme_security_send argument structure * * The Security Send command transfers security protocol data to the @@ -3218,71 +3066,14 @@ struct nvme_security_send_args { int nvme_security_send(struct nvme_security_send_args *args); /** - * struct nvme_security_receive_args - Arguments for the NVMe Security Receive command - * @result: The command completion result from CQE dword0 - * @data: Security data payload to send - * @args_size: Size of &struct nvme_security_receive_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID to issue security command on - * @al: Protocol specific allocation length - * @data_len: Data length of the payload in bytes - * @nssf: NVMe Security Specific field - * @spsp0: Security Protocol Specific field - * @spsp1: Security Protocol Specific field - * @secp: Security Protocol - */ -struct nvme_security_receive_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 al; - __u32 data_len; - __u8 nssf; - __u8 spsp0; - __u8 spsp1; - __u8 secp; -}; - -/** - * nvme_security_receive() - - * @args: &struct nvme_security_recevice argument structure + * nvme_security_receive() - Security Receive command + * @args: &struct nvme_security_receive argument structure * * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. */ int nvme_security_receive(struct nvme_security_receive_args *args); -/** - * struct nvme_get_lba_status_args - Arguments for the NVMe Get LBA Status command - * @lbas: Data payload to return status descriptors - * @result: The command completion result from CQE dword0 - * @slba: Starting logical block address to check statuses - * @args_size: Size of &struct nvme_get_lba_status_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID to retrieve LBA status - * @mndw: Maximum number of dwords to return - * @atype: Action type mechanism to determine LBA status desctriptors to - * return, see &enum nvme_lba_status_atype - * @rl: Range length from slba to perform the action - */ -struct nvme_get_lba_status_args { - __u64 slba; - __u32 *result; - struct nvme_lba_status *lbas; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 mndw; - enum nvme_lba_status_atype atype; - __u16 rl; -}; - /** * nvme_get_lba_status() - Retrieve information on possibly unrecoverable LBAs * @args: &struct nvme_get_lba_status_args argument structure @@ -3295,34 +3086,6 @@ struct nvme_get_lba_status_args { */ int nvme_get_lba_status(struct nvme_get_lba_status_args *args); -/** - * struct nvme_directive_send_args - Arguments for the NVMe Directive Send command - * @result: If successful, the CQE dword0 value - * @data: Data payload to to be send - * @args_size: Size of &struct nvme_directive_send_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID, if applicable - * @doper: Directive send operation, see &enum nvme_directive_send_doper - * @dtype: Directive type, see &enum nvme_directive_dtype - * @cdw12: Directive specific command dword12 - * @data_len: Length of data payload in bytes - * @dspec: Directive specific field - */ -struct nvme_directive_send_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_directive_send_doper doper; - enum nvme_directive_dtype dtype; - __u32 cdw12; - __u32 data_len; - __u16 dspec; -}; - /** * nvme_directive_send() - Send directive command * @args: &struct nvme_directive_send_args argument structure @@ -3339,7 +3102,7 @@ struct nvme_directive_send_args { int nvme_directive_send(struct nvme_directive_send_args *args); /** - * nvme_directive_send_id_endir() - + * nvme_directive_send_id_endir() - Directive Send Enable Directive * @fd: File descriptor of nvme device * @nsid: Namespace Identifier * @endir: Enable Directive @@ -3354,7 +3117,7 @@ int nvme_directive_send_id_endir(int fd, __u32 nsid, bool endir, struct nvme_id_directives *id); /** - * nvme_directive_send_stream_release_identifier() - + * nvme_directive_send_stream_release_identifier() - Directive Send Stream release * @fd: File descriptor of nvme device * @nsid: Namespace ID * @stream_id: Stream identifier @@ -3383,7 +3146,7 @@ static inline int nvme_directive_send_stream_release_identifier(int fd, } /** - * nvme_directive_send_stream_release_resource() - + * nvme_directive_send_stream_release_resource() - Directive Send Stream release resources * @fd: File descriptor of nvme device * @nsid: Namespace ID * @@ -3409,34 +3172,6 @@ static inline int nvme_directive_send_stream_release_resource(int fd, __u32 nsid return nvme_directive_send(&args); } -/** - * struct nvme_directive_recv_args - Arguments for the NVMe Directive Receive command - * @result: If successful, the CQE dword0 value - * @data: Usespace address of data payload - * @args_size: Size of &struct nvme_directive_recv_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID, if applicable - * @doper: Directive send operation, see &enum nvme_directive_send_doper - * @dtype: Directive type, see &enum nvme_directive_dtype - * @cdw12: Directive specific command dword12 - * @data_len: Length of data payload in bytes - * @dspec: Directive specific field - */ -struct nvme_directive_recv_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_directive_receive_doper doper; - enum nvme_directive_dtype dtype; - __u32 cdw12; - __u32 data_len; - __u16 dspec; -}; - /** * nvme_directive_recv() - Receive directive specific data * @args: &struct nvme_directive_recv_args argument structure @@ -3447,7 +3182,7 @@ struct nvme_directive_recv_args { int nvme_directive_recv(struct nvme_directive_recv_args *args); /** - * nvme_directive_recv_identify_parameters() - + * nvme_directive_recv_identify_parameters() - Directive receive identifier parameters * @fd: File descriptor of nvme device * @nsid: Namespace ID * @id: Identify parameters buffer @@ -3476,7 +3211,7 @@ static inline int nvme_directive_recv_identify_parameters(int fd, __u32 nsid, } /** - * nvme_directive_recv_stream_parameters() - + * nvme_directive_recv_stream_parameters() - Directive receive stream parameters * @fd: File descriptor of nvme device * @nsid: Namespace ID * @parms: Streams directive parameters buffer @@ -3505,7 +3240,7 @@ static inline int nvme_directive_recv_stream_parameters(int fd, __u32 nsid, } /** - * nvme_directive_recv_stream_status() - + * nvme_directive_recv_stream_status() - Directive receive stream status * @fd: File descriptor of nvme device * @nsid: Namespace ID * @nr_entries: Number of streams to receive @@ -3515,7 +3250,7 @@ static inline int nvme_directive_recv_stream_parameters(int fd, __u32 nsid, * &enum nvme_status_field) or -1 with errno set otherwise. */ static inline int nvme_directive_recv_stream_status(int fd, __u32 nsid, - unsigned nr_entries, + unsigned int nr_entries, struct nvme_streams_directive_status *id) { struct nvme_directive_recv_args args = { @@ -3536,7 +3271,7 @@ static inline int nvme_directive_recv_stream_status(int fd, __u32 nsid, } /** - * nvme_directive_recv_stream_allocate() - + * nvme_directive_recv_stream_allocate() - Directive receive stream allocate * @fd: File descriptor of nvme device * @nsid: Namespace ID * @nsr: Namespace Streams Requested @@ -3566,31 +3301,7 @@ static inline int nvme_directive_recv_stream_allocate(int fd, __u32 nsid, } /** - * struct nvme_capacity_mgmt_args - Arguments for the NVMe Capacity Management command - * @result: If successful, the CQE dword0 value - * @args_size: Size of &struct nvme_capacity_mgmt_args - * @fd: File descriptor of nvme device - * @cdw11: Least significant 32 bits of the capacity in bytes of the - * Endurance Group or NVM Set to be created - * @cdw12: Most significant 32 bits of the capacity in bytes of the - * Endurance Group or NVM Set to be created - * @timeout: Timeout in ms - * @element_id: Value specific to the value of the Operation field - * @op: Operation to be performed by the controller - */ -struct nvme_capacity_mgmt_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 cdw11; - __u32 cdw12; - __u16 element_id; - __u8 op; -}; - -/** - * nvme_capacity_mgmt() - + * nvme_capacity_mgmt() - Capacity management command * @args: &struct nvme_capacity_mgmt_args argument structure * * Return: The nvme command status if a response was received (see @@ -3598,30 +3309,6 @@ struct nvme_capacity_mgmt_args { */ int nvme_capacity_mgmt(struct nvme_capacity_mgmt_args *args); -/** - * struct nvme_lockdown_args - Arguments for the NVME Lockdown command - * @args_size: Size of &struct nvme_lockdown_args - * @fd: File descriptor of nvme device - * @result: The command completion result from CQE dword0 - * @timeout: Timeout in ms (0 for default timeout) - * @scp: Scope of the command - * @prhbt: Prohibit or allow the command opcode or Set Features command - * @ifc: Affected interface - * @ofi: Opcode or Feature Identifier - * @uuidx: UUID Index if controller supports this id selection method - */ -struct nvme_lockdown_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u8 scp; - __u8 prhbt; - __u8 ifc; - __u8 ofi; - __u8 uuidx; -}; - /** * nvme_lockdown() - Issue lockdown command * @args: &struct nvme_lockdown_args argument structure @@ -3631,24 +3318,6 @@ struct nvme_lockdown_args { */ int nvme_lockdown(struct nvme_lockdown_args *args); -/** - * struct nvme_set_property_args - Arguments for NVMe Set Property command - * @args_size: Size of &struct nvme_set_property_args - * @fd: File descriptor of nvme device - * @result: The command completion result from CQE dword0 - * @timeout: Timeout in ms - * @offset: Property offset from the base to set - * @value: The value to set the property - */ -struct nvme_set_property_args { - __u64 value; - __u32 *result; - int args_size; - int fd; - __u32 timeout; - int offset; -}; - /** * nvme_set_property() - Set controller property * @args: &struct nvme_set_property_args argument structure @@ -3661,22 +3330,6 @@ struct nvme_set_property_args { */ int nvme_set_property(struct nvme_set_property_args *args); -/** - * struct nvme_get_property_args - Arguments for NVMe Get Property command - * @value: Where the property's value will be stored on success - * @args_size: Size of &struct nvme_get_property_args - * @fd: File descriptor of nvme device - * @offset: Property offset from the base to retrieve - * @timeout: Timeout in ms - */ -struct nvme_get_property_args { - __u64 *value; - int args_size; - int fd; - __u32 timeout; - int offset; -}; - /** * nvme_get_property() - Get a controller property * @args: &struct nvme_get_propert_args argument structure @@ -3689,32 +3342,6 @@ struct nvme_get_property_args { */ int nvme_get_property(struct nvme_get_property_args *args); -/** - * struct nvme_sanitize_nvm_args - Arguments for the NVMe Sanitize NVM command - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_sanitize_nvm_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @ovrpat: Overwrite pattern - * @sanact: Sanitize action, see &enum nvme_sanitize_sanact - * @ause: Set to allow unrestriced sanitize exit - * @owpass: Overwrite pass count - * @oipbp: Set to overwrite invert pattern between passes - * @nodas: Set to not deallocate blocks after sanitizing - */ -struct nvme_sanitize_nvm_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - enum nvme_sanitize_sanact sanact; - __u32 ovrpat; - bool ause; - __u8 owpass; - bool oipbp; - bool nodas; -}; - /** * nvme_sanitize_nvm() - Start a sanitize operation * @args: &struct nvme_sanitize_nvm_args argument structure @@ -3734,24 +3361,6 @@ struct nvme_sanitize_nvm_args { */ int nvme_sanitize_nvm(struct nvme_sanitize_nvm_args *args); -/** - * struct nvme_dev_self_test_args - Arguments for the NVMe Device Self Test command - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_dev_self_test_args - * @fd: File descriptor of nvme device - * @nsid: Namespace ID to test - * @stc: Self test code, see &enum nvme_dst_stc - * @timeout: Timeout in ms - */ -struct nvme_dev_self_test_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_dst_stc stc; -}; - /** * nvme_dev_self_test() - Start or abort a self test * @args: &struct nvme_dev_self_test argument structure @@ -3772,29 +3381,6 @@ struct nvme_dev_self_test_args { */ int nvme_dev_self_test(struct nvme_dev_self_test_args *args); -/** - * struct nvme_virtual_mgmt_args - Arguments for the NVMe Virtualization - * resource management command - * @args_size: Size of &struct nvme_virtual_mgmt_args - * @fd: File descriptor of nvme device - * @result: If successful, the CQE dword0 - * @timeout: Timeout in ms - * @act: Virtual resource action, see &enum nvme_virt_mgmt_act - * @rt: Resource type to modify, see &enum nvme_virt_mgmt_rt - * @cntlid: Controller id for which resources are bing modified - * @nr: Number of resources being allocated or assigned - */ -struct nvme_virtual_mgmt_args { - __u32 *result; - int args_size; - int fd; - __u32 timeout; - enum nvme_virt_mgmt_act act; - enum nvme_virt_mgmt_rt rt; - __u16 cntlid; - __u16 nr; -}; - /** * nvme_virtual_mgmt() - Virtualization resource management * @args: &struct nvme_virtual_mgmt_args argument structure @@ -3823,7 +3409,8 @@ int nvme_virtual_mgmt(struct nvme_virtual_mgmt_args *args); * Return: The nvme command status if a response was received (see * &enum nvme_status_field) or -1 with errno set otherwise. */ -static inline int nvme_flush(int fd, __u32 nsid) { +static inline int nvme_flush(int fd, __u32 nsid) +{ struct nvme_passthru_cmd cmd = {}; cmd.opcode = nvme_cmd_flush; @@ -3832,56 +3419,6 @@ static inline int nvme_flush(int fd, __u32 nsid) { return nvme_submit_io_passthru(fd, &cmd, NULL); } -/** - * struct nvme_io_args - Arguments for NVMe I/O commands - * @slba: Starting logical block - * @storage_tag: This filed specifies Variable Sized Expected Logical Block - * Storage Tag (ELBST) and Expected Logical Block Reference - * Tag (ELBRT) - * @result: The command completion result from CQE dword0 - * @data: Pointer to user address of the data buffer - * @metadata: Pointer to user address of the metadata buffer - * @args_size: Size of &struct nvme_io_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID - * @data_len: Length of user buffer, @data, in bytes - * @metadata_len:Length of user buffer, @metadata, in bytes - * @nlb: Number of logical blocks to send (0's based value) - * @control: Command control flags, see &enum nvme_io_control_flags. - * @apptag: This field specifies the Application Tag Mask expected value. - * Used only if the namespace is formatted to use end-to-end - * protection information. - * @appmask: This field specifies the Application Tag expected value. Used - * only if the namespace is formatted to use end-to-end protection - * information. - * @reftag: This field specifies the Initial Logical Block Reference Tag - * expected value. Used only if the namespace is formatted to use - * end-to-end protection information. - * @dspec: Directive specific value - * @dsm: Data set management attributes, see &enum nvme_io_dsm_flags - */ -struct nvme_io_args { - __u64 slba; - __u64 storage_tag; - __u32 *result; - void *data; - void *metadata; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 reftag; - __u32 data_len; - __u32 metadata_len; - __u16 nlb; - __u16 control; - __u16 apptag; - __u16 appmask; - __u16 dspec; - __u8 dsm; -}; - /** * nvme_io() - Submit an nvme user I/O command * @args: &struct nvme_io_args argument structure @@ -3978,28 +3515,6 @@ static inline int nvme_verify(struct nvme_io_args *args) return nvme_io(args, nvme_cmd_verify); } -/** - * struct nvme_dsm_args - Arguments for the NVMe Dataset Management command - * @result: The command completion result from CQE dword0 - * @dsm: The data set management attributes - * @args_size: Size of &struct nvme_dsm_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @attrs: DSM attributes, see &enum nvme_dsm_attributes - * @nr_ranges: Number of block ranges in the data set management attributes - */ -struct nvme_dsm_args { - __u32 *result; - struct nvme_dsm_range *dsm; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 attrs; - __u16 nr_ranges; -}; - /** * nvme_dsm() - Send an nvme data set management command * @args: &struct nvme_dsm_args argument structure @@ -4016,49 +3531,7 @@ struct nvme_dsm_args { int nvme_dsm(struct nvme_dsm_args *args); /** - * struct nvme_copy_args - Arguments for the NVMe Copy command - * @sdlba: Start destination LBA - * @result: The command completion result from CQE dword0 - * @copy: Range descriptior - * @args_size: Size of &struct nvme_copy_args - * @fd: File descriptor of the nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @ilbrt: Initial logical block reference tag - * @lr: Limited retry - * @fua: Force unit access - * @nr: Number of ranges - * @dspec: Directive specific value - * @lbatm: Logical block application tag mask - * @lbat: Logical block application tag - * @prinfor: Protection information field for read - * @prinfow: Protection information field for write - * @dtype: Directive type - * @format: Descriptor format - */ -struct nvme_copy_args { - __u64 sdlba; - __u32 *result; - struct nvme_copy_range *copy; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 ilbrt; - int lr; - int fua; - __u16 nr; - __u16 dspec; - __u16 lbatm; - __u16 lbat; - __u8 prinfor; - __u8 prinfow; - __u8 dtype; - __u8 format; -}; - -/** - * nvme_copy() - + * nvme_copy() - Copy command * * @args: &struct nvme_copy_args argument structure * @@ -4067,33 +3540,6 @@ struct nvme_copy_args { */ int nvme_copy(struct nvme_copy_args *args); -/** - * struct nvme_resv_acquire_args - Arguments for the NVMe Reservation Acquire Comand - * @nrkey: The reservation key to be unregistered from the namespace if - * the action is preempt - * @iekey: Set to ignore the existing key - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_resv_acquire_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @rtype: The type of reservation to be create, see &enum nvme_resv_rtype - * @racqa: The action that is performed by the command, see &enum nvme_resv_racqa - * @crkey: The current reservation key associated with the host - */ -struct nvme_resv_acquire_args { - __u64 crkey; - __u64 nrkey; - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_resv_rtype rtype; - enum nvme_resv_racqa racqa; - bool iekey; -}; - /** * nvme_resv_acquire() - Send an nvme reservation acquire * @args: &struct nvme_resv_acquire argument structure @@ -4107,33 +3553,6 @@ struct nvme_resv_acquire_args { */ int nvme_resv_acquire(struct nvme_resv_acquire_args *args); -/** - * struct nvme_resv_register_args - Arguments for the NVMe Reservation Register command - * @crkey: The current reservation key associated with the host - * @nrkey: The new reservation key to be register if action is register or - * replace - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_resv_register_args - * @fd: File descriptor of nvme device - * @nsid: Namespace identifier - * @rrega: The registration action, see &enum nvme_resv_rrega - * @cptpl: Change persist through power loss, see &enum nvme_resv_cptpl - * @iekey: Set to ignore the existing key - * @timeout: Timeout in ms - */ -struct nvme_resv_register_args { - __u64 crkey; - __u64 nrkey; - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_resv_rrega rrega; - enum nvme_resv_cptpl cptpl; - bool iekey; -}; - /** * nvme_resv_register() - Send an nvme reservation register * @args: &struct nvme_resv_register_args argument structure @@ -4146,30 +3565,6 @@ struct nvme_resv_register_args { */ int nvme_resv_register(struct nvme_resv_register_args *args); -/** - * struct nvme_resv_release_args - Arguments for the NVMe Reservation Release Command - * @crkey: The current reservation key to release - * @result: The command completion result from CQE dword0 - * @args_size: Size of &struct nvme_resv_release_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @rtype: The type of reservation to be create, see &enum nvme_resv_rtype - * @rrela: Reservation releast action, see &enum nvme_resv_rrela - * @iekey: Set to ignore the existing key - */ -struct nvme_resv_release_args { - __u64 crkey; - __u32 *result; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_resv_rtype rtype; - enum nvme_resv_rrela rrela; - bool iekey; -}; - /** * nvme_resv_release() - Send an nvme reservation release * @args: &struct nvme_resv_release_args argument structure @@ -4179,35 +3574,12 @@ struct nvme_resv_release_args { */ int nvme_resv_release(struct nvme_resv_release_args *args); -/** - * struct nvme_resv_report_args - Arguments for the NVMe Reservation Report command - * @result: The command completion result from CQE dword0 - * @report: The user space destination address to store the reservation - * report - * @args_size: Size of &struct nvme_resv_report_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace identifier - * @len: Number of bytes to request transfered with this command - * @eds: Request extended Data Structure - */ -struct nvme_resv_report_args { - __u32 *result; - struct nvme_resv_status *report; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 len; - bool eds; -}; - /** * nvme_resv_report() - Send an nvme reservation report * @args: struct nvme_resv_report_args argument structure * * Returns a Reservation Status data structure to memory that describes the - * registration and reservation status of a namespace. See the defintion for + * registration and reservation status of a namespace. See the definition for * the returned structure, &struct nvme_reservation_status, for more details. * * Return: The nvme command status if a response was received (see @@ -4216,35 +3588,7 @@ struct nvme_resv_report_args { int nvme_resv_report(struct nvme_resv_report_args *args); /** - * struct nvme_zns_mgmt_send_args - Arguments for the NVMe ZNS Management Send command - * @slba: Starting logical block address - * @result: The command completion result from CQE dword0 - * @data: Userspace address of the data - * @args_size: Size of &struct nvme_zns_mgmt_send_args - * @fd: File descriptor of nvme device - * @timeout: timeout in ms - * @nsid: Namespace ID - * @zsa: Zone send action - * @data_len: Length of @data - * @select_all: Select all flag - * @zsaso: Zone Send Action Specific Option - */ -struct nvme_zns_mgmt_send_args { - __u64 slba; - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_zns_send_action zsa; - __u32 data_len; - bool select_all; - __u8 zsaso; -}; - -/** - * nvme_zns_mgmt_send() - + * nvme_zns_mgmt_send() - ZNS management send command * @args: &struct nvme_zns_mgmt_send_args argument structure * * Return: The nvme command status if a response was received (see @@ -4254,35 +3598,7 @@ int nvme_zns_mgmt_send(struct nvme_zns_mgmt_send_args *args); /** - * struct nvme_zns_mgmt_recv_args - Arguments for the NVMe ZNS Management Receive command - * @slba: Starting logical block address - * @result: The command completion result from CQE dword0 - * @data: Userspace address of the data - * @args_size: Size of &struct nvme_zns_mgmt_recv_args - * @fd: File descriptor of nvme device - * @timeout: timeout in ms - * @nsid: Namespace ID - * @zra: zone receive action - * @data_len: Length of @data - * @zrasf: Zone receive action specific field - * @zras_feat: Zone receive action specific features - */ -struct nvme_zns_mgmt_recv_args { - __u64 slba; - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - enum nvme_zns_recv_action zra; - __u32 data_len; - __u16 zrasf; - bool zras_feat; -}; - -/** - * nvme_zns_mgmt_recv() - + * nvme_zns_mgmt_recv() - ZNS management receive command * @args: &struct nvme_zns_mgmt_recv_args argument structure * * Return: The nvme command status if a response was received (see @@ -4323,49 +3639,13 @@ static inline int nvme_zns_report_zones(int fd, __u32 nsid, __u64 slba, .zra = extended ? NVME_ZNS_ZRA_EXTENDED_REPORT_ZONES : NVME_ZNS_ZRA_REPORT_ZONES, .data_len = data_len, - .zrasf = opts, + .zrasf = (__u16)opts, .zras_feat = partial, }; return nvme_zns_mgmt_recv(&args); } -/** - * struct nvme_zns_append_args - Arguments for the NVMe ZNS Append command - * @zslba: Zone start logical block address - * @result: The command completion result from CQE dword0 - * @data: Userspace address of the data - * @metadata: Userspace address of the metadata - * @args_size: Size of &struct nvme_zns_append_args - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @nsid: Namespace ID - * @ilbrt: Initial logical block reference tag - * @data_len: Length of @data - * @metadata_len: Length of @metadata - * @nlb: Number of logical blocks - * @control: - * @lbat: Logical block application tag - * @lbatm: Logical block application tag mask - */ -struct nvme_zns_append_args { - __u64 zslba; - __u64 *result; - void *data; - void *metadata; - int args_size; - int fd; - __u32 timeout; - __u32 nsid; - __u32 ilbrt; - __u32 data_len; - __u32 metadata_len; - __u16 nlb; - __u16 control; - __u16 lbat; - __u16 lbatm; -}; - /** * nvme_zns_append() - Append data to a zone * @args: &struct nvme_zns_append_args argument structure @@ -4375,26 +3655,6 @@ struct nvme_zns_append_args { */ int nvme_zns_append(struct nvme_zns_append_args *args); -/** - * struct nvme_dim_args - Arguments for the Discovery Information Management (DIM) command - * @result: Set on completion to the command's CQE DWORD 0 controller response. - * @data: Pointer to the DIM data - * @args_size: Length of the structure - * @fd: File descriptor of nvme device - * @timeout: Timeout in ms - * @data_len: Length of @data - * @tas: Task field of the Command Dword 10 (cdw10) - */ -struct nvme_dim_args { - __u32 *result; - void *data; - int args_size; - int fd; - __u32 timeout; - __u32 data_len; - __u8 tas; -}; - /** * nvme_dim_send - Send a Discovery Information Management (DIM) command * @args: &struct nvme_dim_args argument structure -- cgit v1.2.3