2f6b05f4a7
- nbft: Fix SSNS HFI indexes parsing - cleanup: Explicitly initialize auto-cleanup variables
280 lines
11 KiB
Diff
280 lines
11 KiB
Diff
From 6761c7d71a3fa7c6d5c718fafb3423f9e51ab261 Mon Sep 17 00:00:00 2001
|
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
Date: Fri, 5 Jan 2024 14:42:11 +0100
|
|
Subject: [PATCH 1/5] nbft: Fix (struct nbft_info_subsystem_ns).num_hfis
|
|
off-by-one
|
|
|
|
The num_hfis field only reflected the number of Secondary HFI
|
|
Associations, resulting in the last parsed HFI being ignored
|
|
by users (nvme-cli).
|
|
|
|
According to the NVM Express Boot Specification, Revision 1.0,
|
|
the Primary HFI Descriptor Index in the Subsystem Namespace
|
|
(SSNS) Descriptor contains this note:
|
|
|
|
"If multiple HFIs are associated with this record, subsequent
|
|
interfaces should be populated in the Secondary HFI
|
|
Associations field."
|
|
|
|
As both the primary and secondary HFIs are parsed into a single
|
|
array, it makes sense to reflect the proper number of elements.
|
|
|
|
Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
|
|
---
|
|
src/nvme/nbft.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
|
|
index 2c870880..06632323 100644
|
|
--- a/src/nvme/nbft.c
|
|
+++ b/src/nvme/nbft.c
|
|
@@ -274,6 +274,7 @@ static int read_ssns(struct nbft_info *nbft,
|
|
ret = -EINVAL;
|
|
goto fail;
|
|
}
|
|
+ ssns->num_hfis = 1;
|
|
for (i = 0; i < le16_to_cpu(raw_ssns->secondary_hfi_assoc_obj.length); i++) {
|
|
ssns->hfis[i + 1] = hfi_from_index(nbft, ss_hfi_indexes[i]);
|
|
if (ss_hfi_indexes[i] && !ssns->hfis[i + 1])
|
|
|
|
From fc919080448a3b9cdb1eaa0e65f17d5b45f9e58d Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Thu, 11 Jan 2024 11:02:11 +0100
|
|
Subject: [PATCH 2/5] nbft: avoid duplicate entries in ssns->hfis
|
|
|
|
The NVMe boot specification does not disallow listing the primary
|
|
HFI index again in the secondary HFI list, or listing the same
|
|
index multiple times in the secondary HFI list. But such duplicate
|
|
entries aren't helpful for consumers of this data. In the worst
|
|
case, they might lead to confusion and misconfiguration.
|
|
Suppress them.
|
|
|
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
|
---
|
|
src/nvme/nbft.c | 21 +++++++++++++++++++++
|
|
1 file changed, 21 insertions(+)
|
|
|
|
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
|
|
index 06632323..f2ffc21e 100644
|
|
--- a/src/nvme/nbft.c
|
|
+++ b/src/nvme/nbft.c
|
|
@@ -276,6 +276,27 @@ static int read_ssns(struct nbft_info *nbft,
|
|
}
|
|
ssns->num_hfis = 1;
|
|
for (i = 0; i < le16_to_cpu(raw_ssns->secondary_hfi_assoc_obj.length); i++) {
|
|
+ bool duplicate = false;
|
|
+ int j;
|
|
+
|
|
+ for (j = 0; j < i; j++) {
|
|
+ if (ss_hfi_indexes[i] == ss_hfi_indexes[j]) {
|
|
+ duplicate = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (!duplicate &&
|
|
+ ss_hfi_indexes[i] == raw_ssns->primary_hfi_desc_index)
|
|
+ duplicate = true;
|
|
+
|
|
+ if (duplicate) {
|
|
+ nvme_msg(NULL, LOG_DEBUG,
|
|
+ "file %s: SSNS %d skipping duplicate HFI index %d\n",
|
|
+ nbft->filename, ssns->index, ss_hfi_indexes[i]);
|
|
+ continue;
|
|
+ }
|
|
+
|
|
ssns->hfis[i + 1] = hfi_from_index(nbft, ss_hfi_indexes[i]);
|
|
if (ss_hfi_indexes[i] && !ssns->hfis[i + 1])
|
|
nvme_msg(NULL, LOG_DEBUG,
|
|
|
|
From 68afe6d9055025aa54c351bb131c30e0d66e6976 Mon Sep 17 00:00:00 2001
|
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
Date: Fri, 5 Jan 2024 14:49:15 +0100
|
|
Subject: [PATCH 3/5] tests: Fix diffs output for duplicate HFI entries
|
|
|
|
With commit "nbft: avoid duplicate entries in ssns->hfis" applied,
|
|
nbft-dump will not see any duplicate HFI indices any more.
|
|
Fix the reference output for generating the diffs.
|
|
|
|
Signed-off-by: Martin Wilck <mwilck@suse.com>
|
|
Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
|
|
---
|
|
test/nbft/diffs/NBFT-auto-ipv6 | 1 -
|
|
test/nbft/diffs/NBFT-dhcp-ipv4 | 1 -
|
|
test/nbft/diffs/NBFT-dhcp-ipv6 | 1 -
|
|
test/nbft/diffs/NBFT-rhpoc | 1 -
|
|
test/nbft/diffs/NBFT-static-ipv4 | 1 -
|
|
test/nbft/diffs/NBFT-static-ipv4-discovery | 1 -
|
|
test/nbft/diffs/NBFT-static-ipv6 | 1 -
|
|
7 files changed, 7 deletions(-)
|
|
|
|
diff --git a/test/nbft/diffs/NBFT-auto-ipv6 b/test/nbft/diffs/NBFT-auto-ipv6
|
|
index 32a8b607..83ee6430 100644
|
|
--- a/test/nbft/diffs/NBFT-auto-ipv6
|
|
+++ b/test/nbft/diffs/NBFT-auto-ipv6
|
|
@@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|
subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=fd09:9a46:b5c1:1ff:5054:ff:fefd:9e66
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-dhcp-ipv4 b/test/nbft/diffs/NBFT-dhcp-ipv4
|
|
index cb280d9a..067079d9 100644
|
|
--- a/test/nbft/diffs/NBFT-dhcp-ipv4
|
|
+++ b/test/nbft/diffs/NBFT-dhcp-ipv4
|
|
@@ -28,7 +28,6 @@ subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->discovery->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=192.168.49.10
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-dhcp-ipv6 b/test/nbft/diffs/NBFT-dhcp-ipv6
|
|
index b94cc394..11c974f6 100644
|
|
--- a/test/nbft/diffs/NBFT-dhcp-ipv6
|
|
+++ b/test/nbft/diffs/NBFT-dhcp-ipv6
|
|
@@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=1
|
|
subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=fddf:d:f:49::10
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-rhpoc b/test/nbft/diffs/NBFT-rhpoc
|
|
index d4b4ad84..d849b6e1 100644
|
|
--- a/test/nbft/diffs/NBFT-rhpoc
|
|
+++ b/test/nbft/diffs/NBFT-rhpoc
|
|
@@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|
subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=192.168.101.20
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-static-ipv4 b/test/nbft/diffs/NBFT-static-ipv4
|
|
index 715b30d2..a6f38597 100644
|
|
--- a/test/nbft/diffs/NBFT-static-ipv4
|
|
+++ b/test/nbft/diffs/NBFT-static-ipv4
|
|
@@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|
subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=192.168.49.10
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-static-ipv4-discovery b/test/nbft/diffs/NBFT-static-ipv4-discovery
|
|
index 67881b6c..5bf0e46f 100644
|
|
--- a/test/nbft/diffs/NBFT-static-ipv4-discovery
|
|
+++ b/test/nbft/diffs/NBFT-static-ipv4-discovery
|
|
@@ -28,7 +28,6 @@ subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->discovery->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=192.168.49.10
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
diff --git a/test/nbft/diffs/NBFT-static-ipv6 b/test/nbft/diffs/NBFT-static-ipv6
|
|
index a5b02c1d..c6ad844d 100644
|
|
--- a/test/nbft/diffs/NBFT-static-ipv6
|
|
+++ b/test/nbft/diffs/NBFT-static-ipv6
|
|
@@ -23,7 +23,6 @@ hfi_list[0]->tcp_info.dhcp_override=0
|
|
subsystem_ns_list[0]->index=1
|
|
subsystem_ns_list[0]->num_hfis=1
|
|
subsystem_ns_list[0]->hfis[0]->index=1
|
|
-subsystem_ns_list[0]->hfis[1]->index=1
|
|
subsystem_ns_list[0]->transport=tcp
|
|
subsystem_ns_list[0]->traddr=fd09:9a46:b5c1:1fe::13f
|
|
subsystem_ns_list[0]->trsvcid=4420
|
|
|
|
From 0bc1985b3e78383cd842968e2adc16d019e784f1 Mon Sep 17 00:00:00 2001
|
|
From: Tomas Bzatek <tbzatek@redhat.com>
|
|
Date: Fri, 5 Jan 2024 14:53:28 +0100
|
|
Subject: [PATCH 4/5] tests: Add sample NBFT table from Dell PowerEdge R760
|
|
|
|
Covered by the Python tests already, let's include this
|
|
table in the other NBFT parser tests (which are all
|
|
QEMU dumps).
|
|
|
|
Signed-off-by: Tomas Bzatek <tbzatek@redhat.com>
|
|
---
|
|
test/nbft/diffs/NBFT-Dell.PowerEdge.R760 | 60 +++++++++++++++++++++++
|
|
test/nbft/meson.build | 1 +
|
|
test/nbft/tables/NBFT-Dell.PowerEdge.R760 | 1 +
|
|
3 files changed, 62 insertions(+)
|
|
create mode 100644 test/nbft/diffs/NBFT-Dell.PowerEdge.R760
|
|
create mode 120000 test/nbft/tables/NBFT-Dell.PowerEdge.R760
|
|
|
|
diff --git a/test/nbft/diffs/NBFT-Dell.PowerEdge.R760 b/test/nbft/diffs/NBFT-Dell.PowerEdge.R760
|
|
new file mode 100644
|
|
index 00000000..d7fab3f2
|
|
--- /dev/null
|
|
+++ b/test/nbft/diffs/NBFT-Dell.PowerEdge.R760
|
|
@@ -0,0 +1,60 @@
|
|
+raw_nbft_size=1017
|
|
+host.id=44454c4c34010368038b2c04f313233
|
|
+host.nqn=nqn.1988-11.com.dell:PowerEdge.R760.1234567
|
|
+host.host_id_configured=1
|
|
+host.host_nqn_configured=1
|
|
+host.primary=0
|
|
+hfi_list[0]->index=1
|
|
+hfi_list[0]->transport=tcp
|
|
+hfi_list[0]->tcp_info.pci_sbdf=16384
|
|
+hfi_list[0]->tcp_info.mac_addr=b02628e87ce
|
|
+hfi_list[0]->tcp_info.vlan=0
|
|
+hfi_list[0]->tcp_info.ip_origin=82
|
|
+hfi_list[0]->tcp_info.ipaddr=100.71.245.232
|
|
+hfi_list[0]->tcp_info.subnet_mask_prefix=24
|
|
+hfi_list[0]->tcp_info.gateway_ipaddr=100.71.245.254
|
|
+hfi_list[0]->tcp_info.route_metric=500
|
|
+hfi_list[0]->tcp_info.primary_dns_ipaddr=100.64.0.5
|
|
+hfi_list[0]->tcp_info.secondary_dns_ipaddr=100.64.0.6
|
|
+hfi_list[0]->tcp_info.dhcp_server_ipaddr=100.71.245.254
|
|
+hfi_list[0]->tcp_info.host_name=(null)
|
|
+hfi_list[0]->tcp_info.this_hfi_is_default_route=1
|
|
+hfi_list[0]->tcp_info.dhcp_override=1
|
|
+discovery_list[0]->index=1
|
|
+discovery_list[0]->hfi->index=1
|
|
+discovery_list[0]->uri=nvme+tcp://100.71.103.50:8009/
|
|
+discovery_list[0]->nqn=nqn.2014-08.org.nvmexpress.discovery
|
|
+subsystem_ns_list[0]->index=1
|
|
+subsystem_ns_list[0]->discovery->index=1
|
|
+subsystem_ns_list[0]->num_hfis=1
|
|
+subsystem_ns_list[0]->hfis[0]->index=1
|
|
+subsystem_ns_list[0]->transport=tcp
|
|
+subsystem_ns_list[0]->traddr=100.71.103.48
|
|
+subsystem_ns_list[0]->trsvcid=4420
|
|
+subsystem_ns_list[0]->subsys_port_id=0
|
|
+subsystem_ns_list[0]->nsid=148
|
|
+subsystem_ns_list[0]->nid_type=2
|
|
+subsystem_ns_list[0]->nid=c8244ed9c15f53b8ccf96802efca
|
|
+subsystem_ns_list[0]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:2a64abf1c5b81F6C4549
|
|
+subsystem_ns_list[0]->pdu_header_digest_required=0
|
|
+subsystem_ns_list[0]->data_digest_required=0
|
|
+subsystem_ns_list[0]->controller_id=5
|
|
+subsystem_ns_list[0]->asqsz=0
|
|
+subsystem_ns_list[0]->dhcp_root_path_string=(null)
|
|
+subsystem_ns_list[1]->index=2
|
|
+subsystem_ns_list[1]->discovery->index=1
|
|
+subsystem_ns_list[1]->num_hfis=1
|
|
+subsystem_ns_list[1]->hfis[0]->index=1
|
|
+subsystem_ns_list[1]->transport=tcp
|
|
+subsystem_ns_list[1]->traddr=100.71.103.49
|
|
+subsystem_ns_list[1]->trsvcid=4420
|
|
+subsystem_ns_list[1]->subsys_port_id=0
|
|
+subsystem_ns_list[1]->nsid=148
|
|
+subsystem_ns_list[1]->nid_type=2
|
|
+subsystem_ns_list[1]->nid=c8244ed9c15f53b8ccf96802efca
|
|
+subsystem_ns_list[1]->subsys_nqn=nqn.1988-11.com.dell:powerstore:00:2a64abf1c5b81F6C4549
|
|
+subsystem_ns_list[1]->pdu_header_digest_required=0
|
|
+subsystem_ns_list[1]->data_digest_required=0
|
|
+subsystem_ns_list[1]->controller_id=4166
|
|
+subsystem_ns_list[1]->asqsz=0
|
|
+subsystem_ns_list[1]->dhcp_root_path_string=(null)
|