Adding upstream version 2.11.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
6f96c7c854
commit
65508f0a28
533 changed files with 9033 additions and 4835 deletions
|
@ -4,6 +4,7 @@
|
|||
*
|
||||
* Authors: leonardo.da.cunha@solidigm.com
|
||||
* shankaralingegowda.singonahalli@solidigm.com
|
||||
* haro.panosyan@solidigm.com
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
|
@ -136,7 +137,6 @@ struct ilog {
|
|||
int count;
|
||||
struct nvme_id_ctrl id_ctrl;
|
||||
enum nvme_telemetry_da max_da;
|
||||
__u32 max_tx;
|
||||
};
|
||||
|
||||
static void print_nlog_header(__u8 *buffer)
|
||||
|
@ -458,7 +458,6 @@ static int log_save(struct log *log, const char *parent_dir_name, const char *su
|
|||
_cleanup_fd_ int output = -1;
|
||||
char file_path[PATH_MAX] = {0};
|
||||
size_t bytes_remaining = 0;
|
||||
int err = 0;
|
||||
|
||||
ensure_dir(parent_dir_name, subdir_name);
|
||||
|
||||
|
@ -473,19 +472,14 @@ static int log_save(struct log *log, const char *parent_dir_name, const char *su
|
|||
while (bytes_remaining) {
|
||||
ssize_t bytes_written = write(output, buffer, bytes_remaining);
|
||||
|
||||
if (bytes_written < 0) {
|
||||
err = -errno;
|
||||
goto log_save_close_output;
|
||||
}
|
||||
if (bytes_written < 0)
|
||||
return -errno;
|
||||
|
||||
bytes_remaining -= bytes_written;
|
||||
buffer += bytes_written;
|
||||
}
|
||||
printf("Successfully wrote %s to %s\n", log->desc, file_path);
|
||||
|
||||
log_save_close_output:
|
||||
close(output);
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ilog_dump_identify_page(struct ilog *ilog, struct log *cns, __u32 nsid)
|
||||
|
@ -527,11 +521,6 @@ static int ilog_ensure_dump_id_ctrl(struct ilog *ilog)
|
|||
if (ilog->id_ctrl.lpa & 0x40)
|
||||
ilog->max_da = NVME_TELEMETRY_DA_4;
|
||||
|
||||
/* assuming CAP.MPSMIN is zero minimum Memory Page Size is at least 4096 bytes */
|
||||
ilog->max_tx = (1 << ilog->id_ctrl.mdts) * NVME_LOG_PAGE_PDU_SIZE;
|
||||
if (ilog->max_tx > DRIVER_MAX_TX_256K)
|
||||
ilog->max_tx = DRIVER_MAX_TX_256K;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -539,7 +528,7 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
|
|||
{
|
||||
int err = 0;
|
||||
enum nvme_telemetry_da da;
|
||||
size_t max_data_tx;
|
||||
size_t mdts;
|
||||
const char *file_name;
|
||||
struct nvme_feat_host_behavior prev = {0};
|
||||
bool host_behavior_changed = false;
|
||||
|
@ -550,7 +539,7 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
|
|||
return err;
|
||||
|
||||
da = ilog->max_da;
|
||||
max_data_tx = ilog->max_tx;
|
||||
mdts = ilog->id_ctrl.mdts;
|
||||
|
||||
if (da == 4) {
|
||||
__u32 result;
|
||||
|
@ -569,16 +558,16 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
|
|||
case HIT:
|
||||
file_name = "lid_0x07_lsp_0x01_lsi_0x0000.bin";
|
||||
log.desc = "Host Initiated Telemetry";
|
||||
err = nvme_get_telemetry_log(dev_fd(ilog->dev), true, false, false, max_data_tx, da,
|
||||
(struct nvme_telemetry_log **) &log.buffer,
|
||||
&log.buffer_size);
|
||||
err = sldgm_dynamic_telemetry(dev_fd(ilog->dev), true, false, false, mdts,
|
||||
da, (struct nvme_telemetry_log **) &log.buffer,
|
||||
&log.buffer_size);
|
||||
break;
|
||||
case CIT:
|
||||
file_name = "lid_0x08_lsp_0x00_lsi_0x0000.bin";
|
||||
log.desc = "Controller Initiated Telemetry";
|
||||
err = nvme_get_telemetry_log(dev_fd(ilog->dev), false, true, true, max_data_tx, da,
|
||||
(struct nvme_telemetry_log **) &log.buffer,
|
||||
&log.buffer_size);
|
||||
err = sldgm_dynamic_telemetry(dev_fd(ilog->dev), false, true, true, mdts,
|
||||
da, (struct nvme_telemetry_log **) &log.buffer,
|
||||
&log.buffer_size);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
|
@ -597,14 +586,17 @@ static int ilog_dump_telemetry(struct ilog *ilog, enum log_type ttype)
|
|||
|
||||
static int ilog_dump_identify_pages(struct ilog *ilog)
|
||||
{
|
||||
struct nvme_ns_list ns_list;
|
||||
struct nvme_ns_list ns_attached_list;
|
||||
struct nvme_ns_list ns_allocated_list;
|
||||
__u32 j = 0;
|
||||
|
||||
struct log identify_base_list[] = {
|
||||
{NVME_IDENTIFY_CNS_NS_ACTIVE_LIST, "Id Active Namespace ID list",
|
||||
sizeof(ns_list), (__u8 *) &ns_list},
|
||||
sizeof(ns_attached_list), (__u8 *) &ns_attached_list},
|
||||
{NVME_IDENTIFY_CNS_NVMSET_LIST, "Id NVM Set List"},
|
||||
{NVME_IDENTIFY_CNS_CSI_CTRL, "Id I/O Command Set specific"},
|
||||
{NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST, "Id Allocated Namespace ID list"},
|
||||
{NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST, "Id Allocated Namespace ID list",
|
||||
sizeof(ns_allocated_list), (__u8 *) &ns_allocated_list},
|
||||
{NVME_IDENTIFY_CNS_CTRL_LIST, "Id Controller List"}
|
||||
};
|
||||
struct log identify_ns_required_list[] = {
|
||||
|
@ -613,10 +605,12 @@ static int ilog_dump_identify_pages(struct ilog *ilog)
|
|||
{NVME_IDENTIFY_CNS_CSI_NS, "Id Namespace ID I/O Command Set specific"},
|
||||
{NVME_IDENTIFY_CNS_CSI_INDEPENDENT_ID_NS,
|
||||
"I/O Command Set Independent Identify Namespace Data"},
|
||||
{NVME_IDENTIFY_CNS_ALLOCATED_NS, "Id Namespace data "},
|
||||
{NVME_IDENTIFY_CNS_NS_CTRL_LIST, "Id Namespace Id Controller List"},
|
||||
};
|
||||
|
||||
struct log allocated = {NVME_IDENTIFY_CNS_ALLOCATED_NS, "Allocated Namespace Data",
|
||||
NVME_IDENTIFY_DATA_SIZE, NULL};
|
||||
|
||||
ilog_ensure_dump_id_ctrl(ilog);
|
||||
|
||||
for (int i = 0; i < ARRAY_SIZE(identify_base_list); i++) {
|
||||
|
@ -626,10 +620,10 @@ static int ilog_dump_identify_pages(struct ilog *ilog)
|
|||
ilog->count++;
|
||||
}
|
||||
|
||||
while (ns_list.ns[j]) {
|
||||
while (ns_attached_list.ns[j]) {
|
||||
for (int i = 0; i < ARRAY_SIZE(identify_ns_required_list); i++) {
|
||||
int err = ilog_dump_identify_page(ilog, &identify_ns_required_list[i],
|
||||
ns_list.ns[j]);
|
||||
ns_attached_list.ns[j]);
|
||||
|
||||
if (err == 0)
|
||||
ilog->count++;
|
||||
|
@ -637,6 +631,15 @@ static int ilog_dump_identify_pages(struct ilog *ilog)
|
|||
j++;
|
||||
}
|
||||
|
||||
j = 0;
|
||||
while (ns_allocated_list.ns[j]) {
|
||||
int err = ilog_dump_identify_page(ilog, &allocated, ns_allocated_list.ns[j]);
|
||||
|
||||
if (err == 0)
|
||||
ilog->count++;
|
||||
j++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -740,6 +743,7 @@ static int ilog_dump_pel(struct ilog *ilog)
|
|||
void *pevent_log_full;
|
||||
int err;
|
||||
struct nvme_get_log_args args;
|
||||
size_t max_data_tx;
|
||||
|
||||
_cleanup_free_ struct nvme_persistent_event_log *pevent = NULL;
|
||||
|
||||
|
@ -785,7 +789,13 @@ static int ilog_dump_pel(struct ilog *ilog)
|
|||
.rae = false,
|
||||
.ot = false,
|
||||
};
|
||||
err = nvme_get_log_page(dev_fd(ilog->dev), ilog->max_tx, &args);
|
||||
|
||||
max_data_tx = (1 << ilog->id_ctrl.mdts) * NVME_LOG_PAGE_PDU_SIZE;
|
||||
do {
|
||||
err = nvme_get_log_page(dev_fd(ilog->dev), max_data_tx, &args);
|
||||
max_data_tx /= 2;
|
||||
} while (err == -EPERM && max_data_tx >= NVME_LOG_PAGE_PDU_SIZE);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue