Skip to content

Commit 38a804e

Browse files
ikegami-tigaw
authored andcommitted
ioctl: add nvme_get_log_reachability_associations()
Since added the NVMe 2.1 log page. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent a3417d3 commit 38a804e

2 files changed

Lines changed: 67 additions & 0 deletions

File tree

src/nvme/ioctl.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2238,6 +2238,41 @@ static inline int nvme_get_log_reachability_groups(int fd, __u32 len, bool rgo,
22382238
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
22392239
}
22402240

2241+
/**
2242+
* nvme_get_log_reachability_associations() - Retrieve Reachability Associations Log
2243+
* @fd: File descriptor of nvme device
2244+
* @rao: Return associations only
2245+
* @rae: Retain asynchronous events
2246+
* @len: The allocated length of the log page
2247+
* @log: User address to store the log page
2248+
*
2249+
* Return: The nvme command status if a response was received (see
2250+
* &enum nvme_status_field) or -1 with errno set otherwise
2251+
*/
2252+
static inline int nvme_get_log_reachability_associations(int fd, bool rao, bool rae, __u32 len,
2253+
struct nvme_reachability_associations_log *log)
2254+
{
2255+
struct nvme_get_log_args args = {
2256+
.lpo = 0,
2257+
.result = NULL,
2258+
.log = log,
2259+
.args_size = sizeof(args),
2260+
.fd = fd,
2261+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2262+
.lid = NVME_LOG_LID_REACHABILITY_ASSOCIATIONS,
2263+
.len = len,
2264+
.nsid = NVME_NSID_ALL,
2265+
.csi = NVME_CSI_NVM,
2266+
.lsi = NVME_LOG_LSI_NONE,
2267+
.lsp = rao,
2268+
.uuidx = NVME_LOG_LSP_NONE,
2269+
.rae = rae,
2270+
.ot = false,
2271+
};
2272+
2273+
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
2274+
}
2275+
22412276
/**
22422277
* nvme_get_log_discovery() - Retrieve Discovery log page
22432278
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4986,6 +4986,38 @@ struct nvme_reachability_groups_log {
49864986
struct nvme_reachability_group_desc rgd[];
49874987
};
49884988

4989+
/**
4990+
* struct nvme_reachability_association_desc - Reachability Association Descriptor
4991+
* @rasid: Reachability Association ID
4992+
* @nrid: Number of RGID Values
4993+
* @chngc: Change Count
4994+
* @rac: Reachability Association Characteristics
4995+
* @rsvd17: Reserved
4996+
* @ngid: Reachability Group Identifier List
4997+
*/
4998+
struct nvme_reachability_association_desc {
4999+
__le32 rasid;
5000+
__le32 nrid;
5001+
__le64 chngc;
5002+
__u8 rac;
5003+
__u8 rsvd17[15];
5004+
__le32 ngid[];
5005+
};
5006+
5007+
/**
5008+
* struct nvme_reachability_associations_log - Reachability Associations Log
5009+
* @chngc: Change Count
5010+
* @nrad: Number of Reachability Association Descriptors
5011+
* @rsvd10: Reserved
5012+
* @rad: Reachability Association Descriptor List
5013+
*/
5014+
struct nvme_reachability_associations_log {
5015+
__le64 chngc;
5016+
__le16 nrad;
5017+
__u8 rsvd10[6];
5018+
struct nvme_reachability_association_desc rad[];
5019+
};
5020+
49895021
/**
49905022
* struct nvme_media_unit_stat_desc - Media Unit Status Descriptor
49915023
* @muid: Media Unit Identifier

0 commit comments

Comments
 (0)