Skip to content

Commit 7ea5ab7

Browse files
dwsuseigaw
authored andcommitted
mi: Add nvme_mi_admin_get_log_page
The non MI API has an nvme_get_log_page() function which accepts the transfer length. In order to be able to use the nvme_get_log_page() function ins nvme-cli, the MI API needs to provide the same API so that the transport abstraction wrappers work. Signed-off-by: Daniel Wagner <[email protected]>
1 parent cda5eac commit 7ea5ab7

3 files changed

Lines changed: 35 additions & 2 deletions

File tree

src/libnvme-mi.map

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
LIBNVME_MI_1_4 {
2+
global:
3+
nvme_mi_admin_get_log_page;
4+
};
5+
16
LIBNVME_MI_1_3 {
27
global:
38
nvme_mi_admin_admin_passthru;

src/nvme/mi.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,9 +841,10 @@ static int __nvme_mi_admin_get_log(nvme_mi_ctrl_t ctrl,
841841
return rc;
842842
}
843843

844-
int nvme_mi_admin_get_log(nvme_mi_ctrl_t ctrl, struct nvme_get_log_args *args)
844+
int nvme_mi_admin_get_log_page(nvme_mi_ctrl_t ctrl, __u32 xfer_size,
845+
struct nvme_get_log_args *args)
845846
{
846-
const size_t max_xfer_size = 4096;
847+
const size_t max_xfer_size = xfer_size;
847848
off_t xfer_offset;
848849
int rc = 0;
849850

@@ -887,6 +888,11 @@ int nvme_mi_admin_get_log(nvme_mi_ctrl_t ctrl, struct nvme_get_log_args *args)
887888
return rc;
888889
}
889890

891+
int nvme_mi_admin_get_log(nvme_mi_ctrl_t ctrl, struct nvme_get_log_args *args)
892+
{
893+
return nvme_mi_admin_get_log_page(ctrl, 4096, args);
894+
}
895+
890896
int nvme_mi_admin_security_send(nvme_mi_ctrl_t ctrl,
891897
struct nvme_security_send_args *args)
892898
{

src/nvme/mi.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,28 @@ static inline int nvme_mi_admin_identify_secondary_ctrl_list(nvme_mi_ctrl_t ctrl
14171417
return nvme_mi_admin_identify(ctrl, &args);
14181418
}
14191419

1420+
/**
1421+
* nvme_mi_admin_get_log_page() - Retrieve log page data from controller
1422+
* @ctrl: Controller to query
1423+
* @xfer_len: The chunk size of the read
1424+
* @args: Get Log Page command arguments
1425+
*
1426+
* Performs a Get Log Page Admin command as specified by @args. Response data
1427+
* is stored in @args->data, which should be a buffer of @args->data_len bytes.
1428+
* Resulting data length is stored in @args->data_len on successful
1429+
* command completion.
1430+
*
1431+
* This request may be implemented as multiple log page commands, in order
1432+
* to fit within MI message-size limits.
1433+
*
1434+
* Return: The nvme command status if a response was received (see
1435+
* &enum nvme_status_field) or -1 with errno set otherwise.
1436+
*
1437+
* See: &struct nvme_get_log_args
1438+
*/
1439+
int nvme_mi_admin_get_log_page(nvme_mi_ctrl_t ctrl, __u32 xfer_len,
1440+
struct nvme_get_log_args *args);
1441+
14201442
/**
14211443
* nvme_mi_admin_get_log() - Retrieve log page data from controller
14221444
* @ctrl: Controller to query

0 commit comments

Comments
 (0)