Skip to content

Commit 46b191a

Browse files
committed
ioctl: add get features helper functions
Add get features helper functions that are frequently called in nvme-cli. Signed-off-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
1 parent f12908c commit 46b191a

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/nvme/ioctl.h

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7185,6 +7185,43 @@ nvme_set_features_simple(struct nvme_transport_handle *hdl,
71857185
/**
71867186
* nvme_get_features() - Submit a Get Features command
71877187
* @hdl: Transport handle for the controller.
7188+
* @nsid: Namespace ID, if applicable
7189+
* @fid: Feature identifier, see &enum nvme_features_id
7190+
* @sel: Select which type of attribute to return,
7191+
* see &enum nvme_get_features_sel
7192+
* @cdw11: Feature specific command dword11 field
7193+
* @uidx: UUID Index for differentiating vendor specific encoding
7194+
* @data: User address of feature data, if applicable
7195+
* @len: Length of feature data, if applicable, in bytes
7196+
* @result: The command completion result (CQE dword0) on success.
7197+
*
7198+
* Return: 0 on success, the NVMe command status on error, or a negative
7199+
* errno otherwise.
7200+
*/
7201+
static inline int
7202+
nvme_get_features(struct nvme_transport_handle *hdl, __u32 nsid,
7203+
__u8 fid, enum nvme_get_features_sel sel,
7204+
__u32 cdw11, __u8 uidx, void *data,
7205+
__u32 len, __u32 *result)
7206+
{
7207+
struct nvme_passthru_cmd cmd;
7208+
7209+
nvme_init_get_features(&cmd, fid, sel);
7210+
7211+
cmd.nsid = nsid;
7212+
cmd.cdw11 = cdw11;
7213+
cmd.cdw14 = NVME_FIELD_ENCODE(uidx,
7214+
NVME_GET_FEATURES_CDW14_UUID_SHIFT,
7215+
NVME_GET_FEATURES_CDW14_UUID_MASK);
7216+
cmd.addr = (__u64)(uintptr_t)data;
7217+
cmd.data_len = len;
7218+
7219+
return nvme_submit_admin_passthru(hdl, &cmd, result);
7220+
}
7221+
7222+
/**
7223+
* nvme_get_features_simple() - Submit a simple Get Features command
7224+
* @hdl: Transport handle for the controller.
71887225
* @fid: Feature Identifier (FID) to be retrieved.
71897226
* @sel: Select (SEL), specifying which feature value
71907227
* to return (&struct nvme_get_features_sel).
@@ -7197,7 +7234,7 @@ nvme_set_features_simple(struct nvme_transport_handle *hdl,
71977234
* errno otherwise.
71987235
*/
71997236
static inline int
7200-
nvme_get_features(struct nvme_transport_handle *hdl, __u8 fid,
7237+
nvme_get_features_simple(struct nvme_transport_handle *hdl, __u8 fid,
72017238
enum nvme_get_features_sel sel, __u32 *result)
72027239
{
72037240
struct nvme_passthru_cmd cmd;

0 commit comments

Comments
 (0)