Skip to content

Commit 3a304c2

Browse files
ikegami-tigaw
authored andcommitted
ioctl: add libnvme-mi NVMe 2.1 log page APIs
Since added the NVMe 2.1 log page. Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
1 parent bc207cd commit 3a304c2

File tree

1 file changed

+233
-0
lines changed

1 file changed

+233
-0
lines changed

src/nvme/mi.h

Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1605,6 +1605,47 @@ static inline int nvme_mi_admin_get_nsid_log(nvme_mi_ctrl_t ctrl, bool rae,
16051605
return nvme_mi_admin_get_log(ctrl, &args);
16061606
}
16071607

1608+
/**
1609+
* nvme_mi_admin_get_endgid_log() - Helper for Get Endurance Group ID Log Page functions
1610+
* @ctrl: Controller to query
1611+
* @rae: Retain Asynchronous Events
1612+
* @lid: Log identifier
1613+
* @endgid: Endurance Group ID
1614+
* @len: length of log buffer
1615+
* @log: pointer for resulting log data
1616+
*
1617+
* Performs a Get Log Page Admin command for a specific log ID @lid and
1618+
* endurance group ID @endgid. Log data is expected to be @len bytes, and is stored
1619+
* in @log on success. The @rae flag is passed as-is to the Get Log Page
1620+
* command, and is specific to the Log Page requested.
1621+
*
1622+
* Return: The nvme command status if a response was received (see
1623+
* &enum nvme_status_field) or -1 with errno set otherwise.
1624+
*/
1625+
static inline int nvme_mi_admin_get_endgid_log(nvme_mi_ctrl_t ctrl, bool rae,
1626+
enum nvme_cmd_get_log_lid lid, __u16 endgid,
1627+
__u32 len, void *log)
1628+
{
1629+
struct nvme_get_log_args args = {
1630+
.lpo = 0,
1631+
.result = NULL,
1632+
.log = log,
1633+
.args_size = sizeof(args),
1634+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
1635+
.lid = lid,
1636+
.len = len,
1637+
.nsid = NVME_NSID_NONE,
1638+
.csi = NVME_CSI_NVM,
1639+
.lsi = endgid,
1640+
.lsp = NVME_LOG_LSP_NONE,
1641+
.uuidx = NVME_LOG_LSP_NONE,
1642+
.rae = rae,
1643+
.ot = false,
1644+
};
1645+
1646+
return nvme_mi_admin_get_log(ctrl, &args);
1647+
}
1648+
16081649
/**
16091650
* nvme_mi_admin_get_log_simple() - Helper for Get Log Page functions with no
16101651
* NSID or RAE requirements
@@ -2241,6 +2282,43 @@ static inline int nvme_mi_admin_get_log_boot_partition(nvme_mi_ctrl_t ctrl,
22412282
return nvme_mi_admin_get_log(ctrl, &args);
22422283
}
22432284

2285+
/**
2286+
* nvme_mi_admin_get_log_rotational_media_info() - Retrieve Rotational Media Information Log
2287+
* @ctrl: Controller to query
2288+
* @endgid: Endurance Group Identifier
2289+
* @len: The allocated length of the log page
2290+
* @log: User address to store the log page
2291+
*
2292+
* Return: The nvme command status if a response was received (see
2293+
* &enum nvme_status_field) or -1 with errno set otherwise
2294+
*/
2295+
static inline int nvme_mi_admin_get_log_rotational_media_info(nvme_mi_ctrl_t ctrl, __u16 endgid,
2296+
__u32 len,
2297+
struct nvme_rotational_media_info_log *log)
2298+
{
2299+
return nvme_mi_admin_get_endgid_log(ctrl, false, NVME_LOG_LID_ROTATIONAL_MEDIA_INFO, endgid,
2300+
len, log);
2301+
}
2302+
2303+
/**
2304+
* nvme_mi_admin_get_log_dispersed_ns_participating_nss() - Retrieve Dispersed Namespace
2305+
* Participating NVM Subsystems Log
2306+
* @ctrl: Controller to query
2307+
* @nsid: Namespace Identifier
2308+
* @len: The allocated length of the log page
2309+
* @log: User address to store the log page
2310+
*
2311+
* Return: The nvme command status if a response was received (see
2312+
* &enum nvme_status_field) or -1 with errno set otherwise
2313+
*/
2314+
static inline int nvme_mi_admin_get_log_dispersed_ns_participating_nss(nvme_mi_ctrl_t ctrl,
2315+
__u32 nsid, __u32 len,
2316+
struct nvme_dispersed_ns_participating_nss_log *log)
2317+
{
2318+
return nvme_mi_admin_get_nsid_log(ctrl, false, NVME_LOG_LID_DISPERSED_NS_PARTICIPATING_NSS,
2319+
nsid, len, log);
2320+
}
2321+
22442322
/**
22452323
* nvme_mi_admin_get_log_mgmt_addr_list() - Retrieve Management Address List Log
22462324
* @ctrl: Controller to query
@@ -2291,6 +2369,93 @@ static inline int nvme_mi_admin_get_log_phy_rx_eom(nvme_mi_ctrl_t ctrl,
22912369
return nvme_mi_admin_get_log(ctrl, &args);
22922370
}
22932371

2372+
/**
2373+
* nvme_mi_admin_get_log_reachability_groups() - Retrieve Reachability Groups Log
2374+
* @ctrl: Controller to query
2375+
* @rgo: Return groups only
2376+
* @rae: Retain asynchronous events
2377+
* @len: The allocated length of the log page
2378+
* @log: User address to store the log page
2379+
*
2380+
* Return: The nvme command status if a response was received (see
2381+
* &enum nvme_status_field) or -1 with errno set otherwise
2382+
*/
2383+
static inline int nvme_mi_admin_get_log_reachability_groups(nvme_mi_ctrl_t ctrl, __u32 len,
2384+
bool rgo, bool rae,
2385+
struct nvme_reachability_groups_log *log)
2386+
{
2387+
struct nvme_get_log_args args = {
2388+
.lpo = 0,
2389+
.result = NULL,
2390+
.log = log,
2391+
.args_size = sizeof(args),
2392+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2393+
.lid = NVME_LOG_LID_REACHABILITY_GROUPS,
2394+
.len = len,
2395+
.nsid = NVME_NSID_ALL,
2396+
.csi = NVME_CSI_NVM,
2397+
.lsi = NVME_LOG_LSI_NONE,
2398+
.lsp = rgo,
2399+
.uuidx = NVME_LOG_LSP_NONE,
2400+
.rae = rae,
2401+
.ot = false,
2402+
};
2403+
2404+
return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
2405+
}
2406+
2407+
/**
2408+
* nvme_mi_admin_get_log_reachability_associations() - Retrieve Reachability Associations Log
2409+
* @ctrl: Controller to query
2410+
* @rao: Return associations only
2411+
* @rae: Retain asynchronous events
2412+
* @len: The allocated length of the log page
2413+
* @log: User address to store the log page
2414+
*
2415+
* Return: The nvme command status if a response was received (see
2416+
* &enum nvme_status_field) or -1 with errno set otherwise
2417+
*/
2418+
static inline int nvme_mi_admin_get_log_reachability_associations(nvme_mi_ctrl_t ctrl, bool rao,
2419+
bool rae, __u32 len,
2420+
struct nvme_reachability_associations_log *log)
2421+
{
2422+
struct nvme_get_log_args args = {
2423+
.lpo = 0,
2424+
.result = NULL,
2425+
.log = log,
2426+
.args_size = sizeof(args),
2427+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2428+
.lid = NVME_LOG_LID_REACHABILITY_ASSOCIATIONS,
2429+
.len = len,
2430+
.nsid = NVME_NSID_ALL,
2431+
.csi = NVME_CSI_NVM,
2432+
.lsi = NVME_LOG_LSI_NONE,
2433+
.lsp = rao,
2434+
.uuidx = NVME_LOG_LSP_NONE,
2435+
.rae = rae,
2436+
.ot = false,
2437+
};
2438+
2439+
return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
2440+
}
2441+
2442+
/**
2443+
* nvme_mi_admin_get_log_changed_alloc_ns_list() - Retrieve Changed Allocated Namespace List Log
2444+
* @ctrl: Controller to query
2445+
* @rae: Retain asynchronous events
2446+
* @len: The allocated length of the log page
2447+
* @log: User address to store the log page
2448+
*
2449+
* Return: The nvme command status if a response was received (see
2450+
* &enum nvme_status_field) or -1 with errno set otherwise
2451+
*/
2452+
static inline int nvme_mi_admin_get_log_changed_alloc_ns_list(nvme_mi_ctrl_t ctrl, bool rae,
2453+
__u32 len, struct nvme_ns_list *log)
2454+
{
2455+
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_CHANGED_ALLOC_NS_LIST,
2456+
NVME_NSID_ALL, len, log);
2457+
}
2458+
22942459
/**
22952460
* nvme_mi_admin_get_log_discovery() - Retrieve Discovery log page
22962461
* @ctrl: Controller to query
@@ -2327,6 +2492,74 @@ static inline int nvme_mi_admin_get_log_discovery(nvme_mi_ctrl_t ctrl, bool rae,
23272492
return nvme_mi_admin_get_log(ctrl, &args);
23282493
}
23292494

2495+
/**
2496+
* nvme_mi_admin_get_log_host_discover() - Retrieve Host Discovery Log
2497+
* @ctrl: Controller to query
2498+
* @allhoste: All host entries
2499+
* @rae: Retain asynchronous events
2500+
* @len: The allocated length of the log page
2501+
* @log: User address to store the log page
2502+
*
2503+
* Return: The nvme command status if a response was received (see
2504+
* &enum nvme_status_field) or -1 with errno set otherwise
2505+
*/
2506+
static inline int nvme_mi_admin_get_log_host_discover(nvme_mi_ctrl_t ctrl, bool allhoste, bool rae,
2507+
__u32 len, struct nvme_host_discover_log *log)
2508+
{
2509+
struct nvme_get_log_args args = {
2510+
.lpo = 0,
2511+
.result = NULL,
2512+
.log = log,
2513+
.args_size = sizeof(args),
2514+
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
2515+
.lid = NVME_LOG_LID_HOST_DISCOVER,
2516+
.len = len,
2517+
.nsid = NVME_NSID_ALL,
2518+
.csi = NVME_CSI_NVM,
2519+
.lsi = NVME_LOG_LSI_NONE,
2520+
.lsp = allhoste,
2521+
.uuidx = NVME_LOG_LSP_NONE,
2522+
.rae = rae,
2523+
.ot = false,
2524+
};
2525+
2526+
return nvme_mi_admin_get_log_page(ctrl, NVME_LOG_PAGE_PDU_SIZE, &args);
2527+
}
2528+
2529+
/**
2530+
* nvme_mi_admin_get_log_ave_discover() - Retrieve AVE Discovery Log
2531+
* @ctrl: Controller to query
2532+
* @rae: Retain asynchronous events
2533+
* @len: The allocated length of the log page
2534+
* @log: User address to store the log page
2535+
*
2536+
* Return: The nvme command status if a response was received (see
2537+
* &enum nvme_status_field) or -1 with errno set otherwise
2538+
*/
2539+
static inline int nvme_mi_admin_get_log_ave_discover(nvme_mi_ctrl_t ctrl, bool rae, __u32 len,
2540+
struct nvme_ave_discover_log *log)
2541+
{
2542+
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_AVE_DISCOVER, NVME_NSID_ALL, len,
2543+
log);
2544+
}
2545+
2546+
/**
2547+
* nvme_mi_admin_get_log_pull_model_ddc_req() - Retrieve Pull Model DDC Request Log
2548+
* @ctrl: Controller to query
2549+
* @rae: Retain asynchronous events
2550+
* @len: The allocated length of the log page
2551+
* @log: User address to store the log page
2552+
*
2553+
* Return: The nvme command status if a response was received (see
2554+
* &enum nvme_status_field) or -1 with errno set otherwise
2555+
*/
2556+
static inline int nvme_mi_admin_get_log_pull_model_ddc_req(nvme_mi_ctrl_t ctrl, bool rae, __u32 len,
2557+
struct nvme_pull_model_ddc_req_log *log)
2558+
{
2559+
return nvme_mi_admin_get_nsid_log(ctrl, rae, NVME_LOG_LID_PULL_MODEL_DDC_REQ, NVME_NSID_ALL,
2560+
len, log);
2561+
}
2562+
23302563
/**
23312564
* nvme_mi_admin_get_log_media_unit_stat() - Retrieve Media Unit Status
23322565
* @ctrl: Controller to query

0 commit comments

Comments
 (0)