Skip to content

Commit 9048fa7

Browse files
ikegami-tigaw
authored andcommitted
ioctl: add nvme_get_log_host_discover()
Since added the NVMe 2.1 log page. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 0a5e083 commit 9048fa7

2 files changed

Lines changed: 87 additions & 0 deletions

File tree

src/nvme/ioctl.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,41 @@ static inline int nvme_get_log_discovery(int fd, bool rae,
23272327
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
23282328
}
23292329

2330+
/**
2331+
* nvme_get_log_host_discover() - Retrieve Host Discovery Log
2332+
* @fd: File descriptor of nvme device
2333+
* @allhoste: All host entries
2334+
* @rae: Retain asynchronous events
2335+
* @len: The allocated length of the log page
2336+
* @log: User address to store the log page
2337+
*
2338+
* Return: The nvme command status if a response was received (see
2339+
* &enum nvme_status_field) or -1 with errno set otherwise
2340+
*/
2341+
static inline int nvme_get_log_host_discover(int fd, bool allhoste, bool rae, __u32 len,
2342+
struct nvme_host_discover_log *log)
2343+
{
2344+
struct nvme_get_log_args args = {
2345+
.lpo = 0,
2346+
.result = NULL,
2347+
.log = log,
2348+
.args_size = sizeof(args),
2349+
.fd = fd,
2350+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2351+
.lid = NVME_LOG_LID_HOST_DISCOVER,
2352+
.len = len,
2353+
.nsid = NVME_NSID_ALL,
2354+
.csi = NVME_CSI_NVM,
2355+
.lsi = NVME_LOG_LSI_NONE,
2356+
.lsp = allhoste,
2357+
.uuidx = NVME_LOG_LSP_NONE,
2358+
.rae = rae,
2359+
.ot = false,
2360+
};
2361+
2362+
return nvme_get_log_page(fd, NVME_LOG_PAGE_PDU_SIZE, &args);
2363+
}
2364+
23302365
/**
23312366
* nvme_get_log_media_unit_stat() - Retrieve Media Unit Status
23322367
* @fd: File descriptor of nvme device

src/nvme/types.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6905,6 +6905,58 @@ struct nvmf_connect_data {
69056905
char rsvd5[256];
69066906
};
69076907

6908+
/**
6909+
* struct nvme_host_ext_discover_log - Host Extended Discovery Log
6910+
* @trtype: Transport Type
6911+
* @adrfam: Address Family
6912+
* @rsvd2: Reserved
6913+
* @eflags: Entry Flags
6914+
* @rsvd12: Reserved
6915+
* @hostnqn: Host NVMe Qualified Name
6916+
* @traddr: Transport Address
6917+
* @tsas: Transport Specific Address Subtype
6918+
* @tel: Total Entry Length
6919+
* @numexat: Number of Extended Attributes
6920+
* @rsvd1030: Reserved
6921+
* @exat: Extended Attributes List
6922+
*/
6923+
struct nvme_host_ext_discover_log {
6924+
__u8 trtype;
6925+
__u8 adrfam;
6926+
__u8 rsvd2[8];
6927+
__le16 eflags;
6928+
__u8 rsvd12[244];
6929+
char hostnqn[NVME_NQN_LENGTH];
6930+
char traddr[NVMF_TRADDR_SIZE];
6931+
union nvmf_tsas tsas;
6932+
__le32 tel;
6933+
__le16 numexat;
6934+
__u8 rsvd1030[2];
6935+
struct nvmf_ext_attr exat[];
6936+
};
6937+
6938+
/**
6939+
* struct nvme_host_discover_log - Host Discovery Log
6940+
* @genctr: Generation Counter
6941+
* @numrec: Number of Records
6942+
* @recfmt: Record Format
6943+
* @hdlpf: Host Discovery Log Page Flags
6944+
* @rsvd19: Reserved
6945+
* @thdlpl: Total Host Discovery Log Page Length
6946+
* @rsvd24: Reserved
6947+
* @hedlpe: Host Extended Discovery Log Page Entry List
6948+
*/
6949+
struct nvme_host_discover_log {
6950+
__le64 genctr;
6951+
__le64 numrec;
6952+
__le16 recfmt;
6953+
__u8 hdlpf;
6954+
__u8 rsvd19;
6955+
__le32 thdlpl;
6956+
__u8 rsvd24[1000];
6957+
struct nvme_host_ext_discover_log hedlpe[];
6958+
};
6959+
69086960
/**
69096961
* struct nvme_mi_read_nvm_ss_info - NVM Subsystem Information Data Structure
69106962
* @nump: Number of Ports

0 commit comments

Comments
 (0)