Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NBFT parser SSNS flags #781

Merged
merged 6 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/api.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ functions.
.. include:: rst/filters.rst
.. include:: rst/util.rst
.. include:: rst/log.rst
.. include:: rst/nbft.rst
6 changes: 6 additions & 0 deletions src/nvme/nbft.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,12 @@ 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);
ssns->discovered = !!(le16_to_cpu(raw_ssns->flags) &
NBFT_SSNS_DISCOVERED_NAMESPACE);

/* security profile */
if (raw_ssns->security_desc_index) {
ssns->security = security_from_index(nbft, raw_ssns->security_desc_index);
Expand Down
110 changes: 62 additions & 48 deletions src/nvme/nbft.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
#include <sys/types.h>
#include "util.h"

/**
* DOC: nbft.h
*
* NVM Express Boot Specification, Revision 1.0
*
* Note: this API is currently unstable, subject to further additions.
*/

/*
* ACPI NBFT table structures (TP8012 Boot Specification rev. 1.0)
*/
Expand Down Expand Up @@ -994,17 +1002,17 @@ enum nbft_discovery_flags {
/**
* enum nbft_info_primary_admin_host_flag - Primary Administrative Host Descriptor Flags
* @NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_NOT_INDICATED: Not Indicated by Driver: The driver
* that created this NBFT provided no
* administrative priority hint for
* this NBFT.
* that created this NBFT provided no
* administrative priority hint for
* this NBFT.
* @NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_UNSELECTED: Unselected: The driver that created
* this NBFT explicitly indicated that
* this NBFT should not be prioritized
* over any other NBFT.
* this NBFT explicitly indicated that
* this NBFT should not be prioritized
* over any other NBFT.
* @NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_SELECTED: Selected: The driver that created
* this NBFT explicitly indicated that
* this NBFT should be prioritized over
* any other NBFT.
* this NBFT explicitly indicated that
* this NBFT should be prioritized over
* any other NBFT.
* @NBFT_INFO_PRIMARY_ADMIN_HOST_FLAG_RESERVED: Reserved.
*/
enum nbft_info_primary_admin_host_flag {
Expand All @@ -1019,13 +1027,13 @@ enum nbft_info_primary_admin_host_flag {
* @id: Host ID (raw UUID, length = 16 bytes).
* @nqn: Host NQN.
* @host_id_configured: HostID Configured Flag: value of True indicates that @id
* contains administratively-configured value, or driver
* default value if False.
* contains administratively-configured value, or driver
* default value if False.
* @host_nqn_configured: Host NQN Configured Flag: value of True indicates that
* @nqn contains administratively-configured value,
* or driver default value if False.
* @nqn contains administratively-configured value,
* or driver default value if False.
* @primary: Primary Administrative Host Descriptor, see
* &enum nbft_info_primary_admin_host_flag.
* &enum nbft_info_primary_admin_host_flag.
*/
struct nbft_info_host {
unsigned char *id;
Expand All @@ -1039,34 +1047,34 @@ struct nbft_info_host {
* struct nbft_info_hfi_info_tcp - HFI Transport Info Descriptor - NVMe/TCP
* @pci_sbdf: PCI Express Routing ID for the HFI Transport Function.
* @mac_addr: MAC Address: The MAC address of this HFI,
* in EUI-48TM format.
* in EUI-48TM format.
* @vlan: The VLAN identifier if the VLAN is associated with
* this HFI, as defined in IEEE 802.1q-2018 or zeroes
* if no VLAN is associated with this HFI.
* this HFI, as defined in IEEE 802.1q-2018 or zeroes
* if no VLAN is associated with this HFI.
* @ip_origin: The source of Ethernet L3 configuration information
* used by the driver or 0 if not used.
* used by the driver or 0 if not used.
* @ipaddr: The IPv4 or IPv6 address of this HFI.
* @subnet_mask_prefix: The IPv4 or IPv6 subnet mask in CIDR routing prefix
* notation.
* notation.
* @gateway_ipaddr: The IPv4 or IPv6 address of the IP gateway for this
* HFI or zeroes if no IP gateway is specified.
* HFI or zeroes if no IP gateway is specified.
* @route_metric: The cost value for the route indicated by this HFI.
* @primary_dns_ipaddr: The IPv4 or IPv6 address of the Primary DNS server
* for this HFI.
* for this HFI.
* @secondary_dns_ipaddr: The IPv4 or IPv6 address of the Secondary DNS server
* for this HFI.
* for this HFI.
* @dhcp_server_ipaddr: The IPv4 or IPv6 address of the DHCP server used
* to assign this HFI address.
* to assign this HFI address.
* @host_name: The Host Name string.
* @this_hfi_is_default_route: If True, then the BIOS utilized this interface
* described by HFI to be the default route with highest
* priority. If False, then routes are local to their
* own scope.
* described by HFI to be the default route with highest
* priority. If False, then routes are local to their
* own scope.
* @dhcp_override: If True, then HFI information was populated
* by consuming the DHCP on this interface. If False,
* then the HFI information was set administratively
* by a configuration interface to the driver and
* pre-OS envrionment.
* by consuming the DHCP on this interface. If False,
* then the HFI information was set administratively
* by a configuration interface to the driver and
* pre-OS envrionment.
*/
struct nbft_info_hfi_info_tcp {
__u32 pci_sbdf;
Expand All @@ -1088,7 +1096,7 @@ struct nbft_info_hfi_info_tcp {
/**
* struct nbft_info_hfi - Host Fabric Interface (HFI) Descriptor
* @index: HFI Descriptor Index: indicates the number of this HFI Descriptor
* in the Host Fabric Interface Descriptor List.
* in the Host Fabric Interface Descriptor List.
* @transport: Transport Type string (e.g. 'tcp').
* @tcp_info: The HFI Transport Info Descriptor, see &struct nbft_info_hfi_info_tcp.
*/
Expand All @@ -1101,12 +1109,12 @@ struct nbft_info_hfi {
/**
* struct nbft_info_discovery - Discovery Descriptor
* @index: The number of this Discovery Descriptor in the Discovery
* Descriptor List.
* Descriptor List.
* @security: The Security Profile Descriptor, see &struct nbft_info_security.
* @hfi: The HFI Descriptor associated with this Discovery Descriptor.
* See &struct nbft_info_hfi.
* See &struct nbft_info_hfi.
* @uri: A URI which indicates an NVMe Discovery controller associated
* with this Discovery Descriptor.
* with this Discovery Descriptor.
* @nqn: An NVMe Discovery controller NQN.
*/
struct nbft_info_discovery {
Expand All @@ -1120,7 +1128,7 @@ struct nbft_info_discovery {
/**
* struct nbft_info_security - Security Profile Descriptor
* @index: The number of this Security Profile Descriptor in the Security
* Profile Descriptor List.
* Profile Descriptor List.
*/
struct nbft_info_security {
int index;
Expand All @@ -1143,35 +1151,39 @@ enum nbft_info_nid_type {

/**
* struct nbft_info_subsystem_ns - Subsystem Namespace (SSNS) info
* @index: SSNS Descriptor Index in the descriptor list.
* @index: SSNS Descriptor Index in the descriptor list.
* @discovery: Primary Discovery Controller associated with
* this SSNS Descriptor.
* this SSNS Descriptor.
* @security: Security Profile Descriptor associated with
* this namespace.
* this namespace.
* @num_hfis: Number of HFIs.
* @hfis: List of HFIs associated with this namespace.
* Includes the primary HFI at the first position
* and all secondary HFIs. This array is null-terminated.
* Includes the primary HFI at the first position
* and all secondary HFIs. This array is null-terminated.
* @transport: Transport Type string (e.g. 'tcp').
* @traddr: Subsystem Transport Address.
* @trsvcid: Subsystem Transport Service Identifier.
* @subsys_port_id: The Subsystem Port ID.
* @nsid: The Namespace ID of this descriptor or when @nid
* should be used instead.
* should be used instead.
* @nid_type: Namespace Identifier Type, see &enum nbft_info_nid_type.
* @nid: The Namespace Identifier value.
* @subsys_nqn: Subsystem and Namespace NQN.
* @pdu_header_digest_required: PDU Header Digest (HDGST) Flag: the use of NVM Header
* Digest Enabled is required.
* @data_digest_required: Data Digest (DDGST) Flag: the use of NVM Data Digest
* Enabled is required.
* Digest Enabled is required.
* @data_digest_required: Data Digest (DDGST) Flag: the use of NVM Data Digest
* Enabled is required.
* @controller_id: Controller ID (SSNS Extended Information Descriptor):
* The controller ID associated with the Admin Queue
* or 0 if not supported.
* The controller ID associated with the Admin Queue
* or 0 if not supported.
* @asqsz: Admin Submission Queue Size (SSNS Extended Information
* Descriptor) or 0 if not supported.
* Descriptor) or 0 if not supported.
* @dhcp_root_path_string: DHCP Root Path Override string (SSNS Extended
* Information Descriptor).
* Information Descriptor).
* @discovered: Indicates that this namespace was acquired
* through discovery.
* @unavailable: Namespace is unavailable as indicated by
* the pre-OS driver.
*/
struct nbft_info_subsystem_ns {
int index;
Expand All @@ -1192,6 +1204,8 @@ struct nbft_info_subsystem_ns {
int controller_id;
int asqsz;
char *dhcp_root_path_string;
bool discovered;
bool unavailable;
};

/**
Expand Down
Loading