Skip to content

Commit 1302510

Browse files
ikegami-tigaw
authored andcommitted
ioctl: add temperature threshold TMPSEL and THSEL parameters to get
Those required to get the feature temperature values. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent 8914e64 commit 1302510

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

src/libnvme.map

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# SPDX-License-Identifier: LGPL-2.1-or-later
22
LIBNVME_UNRELEASED {
33
global:
4+
nvme_get_features_temp_thresh2;
45
nvme_set_features_temp_thresh2;
56
nvme_subsystem_get_serial;
67
};

src/nvme/ioctl.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,26 @@ int nvme_get_features_temp_thresh(int fd, enum nvme_get_features_sel sel,
10911091
return __nvme_get_features(fd, NVME_FEAT_FID_TEMP_THRESH, sel, result);
10921092
}
10931093

1094+
int nvme_get_features_temp_thresh2(int fd, enum nvme_get_features_sel sel, __u8 tmpsel,
1095+
enum nvme_feat_tmpthresh_thsel thsel, __u32 *result)
1096+
{
1097+
struct nvme_get_features_args args = {
1098+
.args_size = sizeof(args),
1099+
.fd = fd,
1100+
.fid = NVME_FEAT_FID_TEMP_THRESH,
1101+
.nsid = NVME_NSID_NONE,
1102+
.sel = sel,
1103+
.cdw11 = NVME_SET(tmpsel, FEAT_TT_TMPSEL) | NVME_SET(thsel, FEAT_TT_THSEL),
1104+
.uuidx = NVME_UUID_NONE,
1105+
.data_len = 0,
1106+
.data = NULL,
1107+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
1108+
.result = result,
1109+
};
1110+
1111+
return nvme_get_features(&args);
1112+
}
1113+
10941114
int nvme_get_features_err_recovery(int fd, enum nvme_get_features_sel sel,
10951115
__u32 *result)
10961116
{

src/nvme/ioctl.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3225,6 +3225,20 @@ int nvme_get_features_lba_range2(int fd, enum nvme_get_features_sel sel,
32253225
int nvme_get_features_temp_thresh(int fd, enum nvme_get_features_sel sel,
32263226
__u32 *result);
32273227

3228+
/**
3229+
* nvme_get_features_temp_thresh2() - Get temperature threshold feature
3230+
* @fd: File descriptor of nvme device
3231+
* @sel: Select which type of attribute to return, see &enum nvme_get_features_sel
3232+
* @tmpsel: Threshold Temperature Select
3233+
* @thsel: Threshold Type Select
3234+
* @result: The command completion result from CQE dword0
3235+
*
3236+
* Return: The nvme command status if a response was received (see
3237+
* &enum nvme_status_field) or -1 with errno set otherwise.
3238+
*/
3239+
int nvme_get_features_temp_thresh2(int fd, enum nvme_get_features_sel sel, __u8 tmpsel,
3240+
enum nvme_feat_tmpthresh_thsel thsel, __u32 *result);
3241+
32283242
/**
32293243
* nvme_get_features_err_recovery() - Get error recovery feature
32303244
*

0 commit comments

Comments
 (0)