From d25b0e8828ccee21dbd879056619dd9ed7cad9c6 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Fri, 9 Feb 2024 18:11:35 +0100 Subject: [PATCH] nbft: Add SSNS 'unavailable' flag Certain pre-OS driver implementations (i.e. UEFI) may opt to include SSNS records that failed to connect, caused either by a temporary target inaccessibility or an invalid configuration. Such reason is further indicated by TP8029 extended information. This commit adds a flag indicating namespace availability so that clients (nvme-cli) may either decide to skip such record or make another connection attempt. Signed-off-by: Tomas Bzatek --- src/nvme/nbft.c | 4 ++++ src/nvme/nbft.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/nvme/nbft.c b/src/nvme/nbft.c index f2ffc21e9..3bdbeb1ba 100644 --- a/src/nvme/nbft.c +++ b/src/nvme/nbft.c @@ -246,6 +246,10 @@ static int read_ssns(struct nbft_info *nbft, ssns->nid_type = raw_ssns->nidt; ssns->nid = raw_ssns->nid; + /* flags */ + ssns->unavailable = !!(le16_to_cpu(raw_ssns->flags) & + NBFT_SSNS_UNAVAIL_NAMESPACE_UNAVAIL); + /* security profile */ if (raw_ssns->security_desc_index) { ssns->security = security_from_index(nbft, raw_ssns->security_desc_index); diff --git a/src/nvme/nbft.h b/src/nvme/nbft.h index 48aaecf42..e8ddbed0b 100644 --- a/src/nvme/nbft.h +++ b/src/nvme/nbft.h @@ -1180,6 +1180,8 @@ enum nbft_info_nid_type { * Descriptor) or 0 if not supported. * @dhcp_root_path_string: DHCP Root Path Override string (SSNS Extended * Information Descriptor). + * @unavailable: Namespace is unavailable as indicated by + * the pre-OS driver. */ struct nbft_info_subsystem_ns { int index; @@ -1200,6 +1202,7 @@ struct nbft_info_subsystem_ns { int controller_id; int asqsz; char *dhcp_root_path_string; + bool unavailable; }; /**