Skip to content

Commit

Permalink
ioctl: add nvme_get_log_host_discover()
Browse files Browse the repository at this point in the history
Since added the NVMe 2.1 log page.

Signed-off-by: Tokunori Ikegami <[email protected]>
ikegami-t authored and igaw committed Jan 8, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 0a5e083 commit 9048fa7
Showing 2 changed files with 87 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/nvme/ioctl.h
Original file line number Diff line number Diff line change
@@ -2327,6 +2327,41 @@ static inline int nvme_get_log_discovery(int fd, bool rae,
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_get_log_host_discover() - Retrieve Host Discovery Log
* @fd: File descriptor of nvme device
* @allhoste: All host entries
* @rae: Retain asynchronous events
* @len: The allocated length of 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_host_discover(int fd, bool allhoste, bool rae, __u32 len,
struct nvme_host_discover_log *log)
{
struct nvme_get_log_args args = {
.lpo = 0,
.result = NULL,
.log = log,
.args_size = sizeof(args),
.fd = fd,
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = NVME_LOG_LID_HOST_DISCOVER,
.len = len,
.nsid = NVME_NSID_ALL,
.csi = NVME_CSI_NVM,
.lsi = NVME_LOG_LSI_NONE,
.lsp = allhoste,
.uuidx = NVME_LOG_LSP_NONE,
.rae = rae,
.ot = false,
};

return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
}

/**
* nvme_get_log_media_unit_stat() - Retrieve Media Unit Status
* @fd: File descriptor of nvme device
52 changes: 52 additions & 0 deletions src/nvme/types.h
Original file line number Diff line number Diff line change
@@ -6905,6 +6905,58 @@ struct nvmf_connect_data {
char rsvd5[256];
};

/**
* struct nvme_host_ext_discover_log - Host Extended Discovery Log
* @trtype: Transport Type
* @adrfam: Address Family
* @rsvd2: Reserved
* @eflags: Entry Flags
* @rsvd12: Reserved
* @hostnqn: Host NVMe Qualified Name
* @traddr: Transport Address
* @tsas: Transport Specific Address Subtype
* @tel: Total Entry Length
* @numexat: Number of Extended Attributes
* @rsvd1030: Reserved
* @exat: Extended Attributes List
*/
struct nvme_host_ext_discover_log {
__u8 trtype;
__u8 adrfam;
__u8 rsvd2[8];
__le16 eflags;
__u8 rsvd12[244];
char hostnqn[NVME_NQN_LENGTH];
char traddr[NVMF_TRADDR_SIZE];
union nvmf_tsas tsas;
__le32 tel;
__le16 numexat;
__u8 rsvd1030[2];
struct nvmf_ext_attr exat[];
};

/**
* struct nvme_host_discover_log - Host Discovery Log
* @genctr: Generation Counter
* @numrec: Number of Records
* @recfmt: Record Format
* @hdlpf: Host Discovery Log Page Flags
* @rsvd19: Reserved
* @thdlpl: Total Host Discovery Log Page Length
* @rsvd24: Reserved
* @hedlpe: Host Extended Discovery Log Page Entry List
*/
struct nvme_host_discover_log {
__le64 genctr;
__le64 numrec;
__le16 recfmt;
__u8 hdlpf;
__u8 rsvd19;
__le32 thdlpl;
__u8 rsvd24[1000];
struct nvme_host_ext_discover_log hedlpe[];
};

/**
* struct nvme_mi_read_nvm_ss_info - NVM Subsystem Information Data Structure
* @nump: Number of Ports

0 comments on commit 9048fa7

Please sign in to comment.