diff --git a/src/nvme/ioctl.h b/src/nvme/ioctl.h index 725d9cf6..fef7f52b 100644 --- a/src/nvme/ioctl.h +++ b/src/nvme/ioctl.h @@ -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 diff --git a/src/nvme/types.h b/src/nvme/types.h index 084b8bf6..7376437c 100644 --- a/src/nvme/types.h +++ b/src/nvme/types.h @@ -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