* Thu Apr 20 2023 Tomas Bzatek <tbzatek@redhat.com> - 1.4-2

- Backport the NBFT parser from git master
This commit is contained in:
Tomas Bzatek 2023-04-20 15:58:48 +02:00
parent fb706687df
commit aa9c0e2d02
7 changed files with 2282 additions and 1 deletions

View File

@ -0,0 +1,25 @@
From 1617d1a3f42a25a2e99073811174609abcffc34d Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 13 Apr 2023 18:27:39 +0200
Subject: [PATCH 12/18] nbft: Parse the {HOSTID,HOSTNQN}_CONFIGURED flags
---
src/nvme/nbft.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
index 940dd8e..c0af2b3 100644
--- a/src/nvme/nbft.c
+++ b/src/nvme/nbft.c
@@ -560,6 +560,8 @@ static int parse_raw_nbft(struct nbft_info *nbft)
nbft->host.id = (unsigned char *) &(host->host_id);
if (get_heap_obj(host, host_nqn_obj, 1, &nbft->host.nqn) != 0)
return -EINVAL;
+ nbft->host.host_id_configured = host->flags & NBFT_HOST_HOSTID_CONFIGURED;
+ nbft->host.host_nqn_configured = host->flags & NBFT_HOST_HOSTNQN_CONFIGURED;
/*
* HFI
--
2.39.2

View File

@ -0,0 +1,27 @@
From 00b48dd3c217a9271c1888e8dbeb4aa9d307e5bf Mon Sep 17 00:00:00 2001
From: Martin Belanger <martin.belanger@dell.com>
Date: Thu, 13 Apr 2023 09:27:04 -0400
Subject: [PATCH 13/18] nbft: Doc typo - Use nvme_nbft_free() instead of
nbft_free()
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
---
src/nvme/nbft.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
index c0af2b3..a085768 100644
--- a/src/nvme/nbft.c
+++ b/src/nvme/nbft.c
@@ -663,7 +663,7 @@ void nvme_nbft_free(struct nbft_info *nbft)
* @filename: Filename of the raw NBFT table to read.
*
* Read and parse the specified NBFT file into a struct nbft_info.
- * Free with nbft_free().
+ * Free with nvme_nbft_free().
*
* Return: 0 on success, errno otherwise.
*/
--
2.39.2

View File

@ -0,0 +1,64 @@
From 961606f0d0547c3eebd47b79c363ab28c95a94ea Mon Sep 17 00:00:00 2001
From: Martin Belanger <martin.belanger@dell.com>
Date: Fri, 14 Apr 2023 11:19:23 -0400
Subject: [PATCH 15/18] NBFT: Remove documentation from nbft.c since it's also
in nbft.h
Also, replace nbft_free() by nvme_nbft_free() in documentation
found in nbft.h.
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
---
src/nvme/nbft.c | 15 ---------------
src/nvme/nbft.h | 2 +-
2 files changed, 1 insertion(+), 16 deletions(-)
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
index a085768..a1e17cd 100644
--- a/src/nvme/nbft.c
+++ b/src/nvme/nbft.c
@@ -626,10 +626,6 @@ static int parse_raw_nbft(struct nbft_info *nbft)
return 0;
}
-/**
- * nvme_nbft_free() - Free the struct nbft_info and its contents
- * @nbft: Parsed NBFT table data.
- */
void nvme_nbft_free(struct nbft_info *nbft)
{
struct nbft_info_hfi **hfi;
@@ -656,17 +652,6 @@ void nvme_nbft_free(struct nbft_info *nbft)
free(nbft);
}
-/**
- * nvme_nbft_read() - Read and parse contents of an ACPI NBFT table
- *
- * @nbft: Parsed NBFT table data.
- * @filename: Filename of the raw NBFT table to read.
- *
- * Read and parse the specified NBFT file into a struct nbft_info.
- * Free with nvme_nbft_free().
- *
- * Return: 0 on success, errno otherwise.
- */
int nvme_nbft_read(struct nbft_info **nbft, const char *filename)
{
__u8 *raw_nbft = NULL;
diff --git a/src/nvme/nbft.h b/src/nvme/nbft.h
index c3caa85..6012e16 100644
--- a/src/nvme/nbft.h
+++ b/src/nvme/nbft.h
@@ -1223,7 +1223,7 @@ struct nbft_info {
* @filename: Filename of the raw NBFT table to read.
*
* Read and parse the specified NBFT file into a struct nbft_info.
- * Free with nbft_free().
+ * Free with nvme_nbft_free().
*
* Return: 0 on success, errno otherwise.
*/
--
2.39.2

View File

@ -0,0 +1,36 @@
From 26e4343c2ba2db7a3c5696bbf61bb87942ac02bb Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 13 Apr 2023 17:28:42 +0200
Subject: [PATCH 11/18] nbft: Fix nbft_ssns_flags endianness test
Missing flags endianness conversion leading to ssns_ext_info
not being parsed on s390x and armhf.
---
src/nvme/nbft.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c
index f91d21b..940dd8e 100644
--- a/src/nvme/nbft.c
+++ b/src/nvme/nbft.c
@@ -169,7 +169,7 @@ static int read_ssns_exended_info(struct nbft_info *nbft,
"invalid ID in SSNS extended info descriptor");
verify(raw_ssns_ei->version == 1,
"invalid version in SSNS extended info descriptor");
- verify(le16_to_cpu(raw_ssns_ei->ssns_index) == le16_to_cpu(ssns->index),
+ verify(le16_to_cpu(raw_ssns_ei->ssns_index) == ssns->index,
"SSNS index doesn't match extended info descriptor index");
if (!(le32_to_cpu(raw_ssns_ei->flags) & NBFT_SSNS_EXT_INFO_VALID))
@@ -292,7 +292,7 @@ static int read_ssns(struct nbft_info *nbft,
goto fail;
/* SSNS extended info */
- if (raw_ssns->flags & NBFT_SSNS_EXTENDED_INFO_IN_USE) {
+ if (le16_to_cpu(raw_ssns->flags) & NBFT_SSNS_EXTENDED_INFO_IN_USE) {
struct nbft_ssns_ext_info *ssns_extended_info;
if (!get_heap_obj(raw_ssns, ssns_extended_info_desc_obj, 0,
--
2.39.2

View File

@ -0,0 +1,37 @@
From 670ec98ebc986e62267145abb059b66ac5e51380 Mon Sep 17 00:00:00 2001
From: Tomas Bzatek <tbzatek@redhat.com>
Date: Thu, 13 Apr 2023 15:39:28 +0200
Subject: [PATCH 05/18] nbft: Move added symbols to LIBNVME_1_5
---
src/libnvme.map | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libnvme.map b/src/libnvme.map
index 6aa9fd0..28de595 100644
--- a/src/libnvme.map
+++ b/src/libnvme.map
@@ -1,5 +1,11 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
+LIBNVME_1_5 {
+ global:
+ nvme_nbft_read;
+ nvme_nbft_free;
+};
+
LIBNVME_1_4 {
global:
nvme_lookup_keyring;
@@ -7,8 +13,6 @@ LIBNVME_1_4 {
nvme_lookup_key;
nvme_set_keyring;
nvme_insert_tls_key;
- nvme_nbft_read;
- nvme_nbft_free;
};
LIBNVME_1_3 {
--
2.39.2

2082
libnvme-1.5-nbft.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,18 @@
Name: libnvme
Summary: Linux-native nvme device management library
Version: 1.4
Release: 1%{?dist}
Release: 2%{?dist}
License: LGPLv2+
URL: https://github.com/linux-nvme/libnvme
Source0: %{url}/archive/v%{version_no_tilde}/%{name}-%{version_no_tilde}.tar.gz
Patch100: libnvme-1.5-nbft.patch
Patch101: libnvme-1.5-nbft-symbols.patch
Patch102: libnvme-1.5-nbft-endianness.patch
Patch103: libnvme-1.5-nbft-HOSTID-HOSTNQN-_CONFIGURED.patch
Patch104: libnvme-1.5-nbft-doc1.patch
Patch105: libnvme-1.5-nbft-doc2.patch
BuildRequires: gcc gcc-c++
BuildRequires: swig
BuildRequires: python3-devel
@ -97,6 +104,9 @@ mv %{buildroot}/usr/*.rst %{buildroot}%{_pkgdocdir}/
%{python3_sitearch}/libnvme/*
%changelog
* Thu Apr 20 2023 Tomas Bzatek <tbzatek@redhat.com> - 1.4-2
- Backport the NBFT parser from git master
* Mon Apr 03 2023 Tomas Bzatek <tbzatek@redhat.com> - 1.4-1
- Upstream v1.4 release