Skip to content

Commit a3417d3

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

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

src/nvme/ioctl.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,41 @@ static inline int nvme_get_log_phy_rx_eom(int fd, __u8 lsp, __u16 controller,
22032203
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
22042204
}
22052205

2206+
/**
2207+
* nvme_get_log_reachability_groups() - Retrieve Reachability Groups Log
2208+
* @fd: File descriptor of nvme device
2209+
* @rgo: Return groups only
2210+
* @rae: Retain asynchronous events
2211+
* @len: The allocated length of the log page
2212+
* @log: User address to store the log page
2213+
*
2214+
* Return: The nvme command status if a response was received (see
2215+
* &enum nvme_status_field) or -1 with errno set otherwise
2216+
*/
2217+
static inline int nvme_get_log_reachability_groups(int fd, __u32 len, bool rgo, bool rae,
2218+
struct nvme_reachability_groups_log *log)
2219+
{
2220+
struct nvme_get_log_args args = {
2221+
.lpo = 0,
2222+
.result = NULL,
2223+
.log = log,
2224+
.args_size = sizeof(args),
2225+
.fd = fd,
2226+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2227+
.lid = NVME_LOG_LID_REACHABILITY_GROUPS,
2228+
.len = len,
2229+
.nsid = NVME_NSID_ALL,
2230+
.csi = NVME_CSI_NVM,
2231+
.lsi = NVME_LOG_LSI_NONE,
2232+
.lsp = rgo,
2233+
.uuidx = NVME_LOG_LSP_NONE,
2234+
.rae = rae,
2235+
.ot = false,
2236+
};
2237+
2238+
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
2239+
}
2240+
22062241
/**
22072242
* nvme_get_log_discovery() - Retrieve Discovery log page
22082243
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4956,6 +4956,36 @@ enum nvme_phy_rx_eom_progress {
49564956
NVME_PHY_RX_EOM_COMPLETED = 2,
49574957
};
49584958

4959+
/**
4960+
* struct nvme_reachability_group_desc - Reachability Group Descriptor
4961+
* @rgid: Reachability Group ID
4962+
* @nnid: Number of NSID Values
4963+
* @chngc: Change Count
4964+
* @rsvd16: Reserved
4965+
* @nsid: Namespace Identifier List
4966+
*/
4967+
struct nvme_reachability_group_desc {
4968+
__le32 rgid;
4969+
__le32 nnid;
4970+
__le64 chngc;
4971+
__u8 rsvd16[16];
4972+
__le32 nsid[];
4973+
};
4974+
4975+
/**
4976+
* struct nvme_reachability_groups_log - Reachability Groups Log
4977+
* @chngc: Change Count
4978+
* @nrgd: Number of Reachability Group Descriptors
4979+
* @rsvd10: Reserved
4980+
* @rgd: Reachability Group Descriptor List
4981+
*/
4982+
struct nvme_reachability_groups_log {
4983+
__le64 chngc;
4984+
__le16 nrgd;
4985+
__u8 rsvd10[6];
4986+
struct nvme_reachability_group_desc rgd[];
4987+
};
4988+
49594989
/**
49604990
* struct nvme_media_unit_stat_desc - Media Unit Status Descriptor
49614991
* @muid: Media Unit Identifier

0 commit comments

Comments
 (0)