Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions plugins/ocp/ocp-hardware-component-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "nvme-print.h"
#include "ocp-hardware-component-log.h"
#include "ocp-print.h"
#include "ocp-utils.h"

//#define HWCOMP_DUMMY

Expand Down Expand Up @@ -171,21 +172,23 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
int ret = 0;
size_t desc_offset = offsetof(struct hwcomp_log, desc);
struct nvme_get_log_args args = {
.lpo = desc_offset,
.args_size = sizeof(args),
.fd = dev_fd(dev),
.timeout = NVME_DEFAULT_IOCTL_TIMEOUT,
.lid = LID_HWCOMP,
.nsid = NVME_NSID_ALL,
.log = log,
.len = desc_offset,
};

ocp_get_uuid_index(dev, &args.uuidx);

#ifdef HWCOMP_DUMMY
memcpy(log, hwcomp_dummy, desc_offset);
#else /* HWCOMP_DUMMY */
ret = nvme_get_log_simple(dev_fd(dev), LID_HWCOMP, desc_offset, log);
ret = nvme_get_log_page(dev_fd(dev), NVME_LOG_PAGE_PDU_SIZE, &args);
if (ret) {
print_info_error("error: ocp: failed to get log simple (hwcomp: %02X, ret: %d)\n",
LID_HWCOMP, ret);
print_info_error("error: ocp: failed to get hwcomp log size (ret: %d)\n", ret);
return ret;
}
#endif /* HWCOMP_DUMMY */
Expand All @@ -208,6 +211,7 @@ static int get_hwcomp_log_data(struct nvme_dev *dev, struct hwcomp_log *log)
}

args.log = log->desc,
args.lpo = desc_offset,

#ifdef HWCOMP_DUMMY
memcpy(log->desc, &hwcomp_dummy[desc_offset], args.len);
Expand Down